/* ── RESET & BASE ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f7f6f2;
  --bg2: #efede8;
  --bg3: #e8e5de;
  --border: rgba(0, 0, 0, 0.08);
  --border2: rgba(0, 0, 0, 0.14);
  --text: #111;
  --text2: #555;
  --text3: #999;
  --accent: #4a9e5c;
  --accent-dim: #d6ead9;
  --card-bg: rgba(255, 255, 255, 0.7);
  --mono: "IBM Plex Mono", monospace;
  --sans: "IBM Plex Sans", sans-serif;

  --built-bg: #e4f0e7;
  --built-text: #2d6e3a;
  --built-dot: #4a9e5c;
  --learned-bg: #deeaf8;
  --learned-text: #1a5291;
  --learned-dot: #378add;
  --fixed-bg: #fce8e2;
  --fixed-text: #8c3520;
  --fixed-dot: #d85a30;
  --figured-bg: #fdf0dc;
  --figured-text: #7a4a0a;
  --figured-dot: #ba7517;
  --reflection-bg: #fbe7ff;
  --reflection-text: #7a1f91;
  --reflection-dot: #f05cff;
  --keep-bg: #ececfb;
  --keep-text: #3d3a9e;
  --keep-dot: #6c63d4;
  --wins-bg: #fde8f4;
  --wins-text: #8c1f5e;
  --wins-dot: #c4407a;
}

[data-theme="dark"] {
  --bg: #0e0e0c;
  --bg2: #161614;
  --bg3: #1e1e1b;
  --border: rgba(255, 255, 255, 0.07);
  --border2: rgba(255, 255, 255, 0.12);
  --text: #e8e6df;
  --text2: #9a9890;
  --text3: #555;
  --card-bg: rgba(22, 22, 20, 0.85);
  --built-bg: #1a2e1e;
  --built-text: #7ec98e;
  --learned-bg: #142033;
  --learned-text: #7ab4e8;
  --fixed-bg: #2a1510;
  --fixed-text: #e89070;
  --figured-bg: #261a08;
  --figured-text: #e0aa60;
  --reflection-bg: #2b0e36;
  --reflection-text: #e498f5;
  --reflection-dot: #f05cff;
  --keep-bg: #1c1a3a;
  --keep-text: #a9a4f0;
  --keep-dot: #6c63d4;
  --wins-bg: #2a1020;
  --wins-text: #e87ab8;
  --wins-dot: #c4407a;
}

html {
  font-size: 15px;
}
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  transition:
    background 0.3s,
    color 0.3s;
  position: relative;
  overflow-x: hidden;
}

/* ── GRID BG ── */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.5;
}

/* ── LAYOUT ── */
header,
main,
footer {
  position: relative;
  z-index: 1;
}

header {
  max-width: 700px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 0;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.25rem;
}

.logo {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
}
.logo span:first-child {
  color: var(--accent);
}
.cursor {
  color: var(--accent);
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.meta-text {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text3);
}

.theme-btn {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text2);
  font-size: 0.9rem;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.theme-btn:hover {
  background: var(--bg3);
  color: var(--text);
}

.header-sub {
  font-size: 0.8rem;
  color: var(--text3);
  font-family: var(--mono);
  margin-bottom: 2rem;
}

main {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

/* ── CONTROLS ── */
.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
  gap: 12px;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.filter-btn {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover {
  background: var(--bg3);
  color: var(--text);
}
.filter-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.search-wrap {
  position: relative;
}
.search-input {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: var(--card-bg);
  color: var(--text);
  width: 180px;
  outline: none;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
}
.search-input:focus {
  border-color: var(--accent);
  width: 220px;
}
.search-input::placeholder {
  color: var(--text3);
}

/* ── TIMELINE ── */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* month group */
.month-group {
  margin-bottom: 1.75rem;
}
.month-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.month-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* entry card */
.entry {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0 1rem;
  margin-bottom: 0.5rem;
  animation: fadeUp 0.35s ease both;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.entry-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0.9rem;
  gap: 0;
}

.entry-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: transform 0.2s;
}
.entry:hover .entry-dot {
  transform: scale(1.4);
}

.entry-line {
  width: 1px;
  flex: 1;
  background: var(--border);
  margin-top: 4px;
  min-height: 20px;
}

.entry-day {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--text3);
  margin-top: 4px;
  line-height: 1;
}

.entry-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  backdrop-filter: blur(8px);
  transition:
    border-color 0.2s,
    transform 0.2s;
  cursor: default;
}
.entry-card:hover {
  border-color: var(--border2);
  transform: translateX(3px);
}

.tag {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.tag-built {
  background: var(--built-bg);
  color: var(--built-text);
}
.tag-learned {
  background: var(--learned-bg);
  color: var(--learned-text);
}
.tag-fixed {
  background: var(--fixed-bg);
  color: var(--fixed-text);
}
.tag-figured {
  background: var(--figured-bg);
  color: var(--figured-text);
}
.tag-reflection {
  background: var(--reflection-bg);
  color: var(--reflection-text);
}
.tag-keep {
  background: var(--keep-bg);
  color: var(--keep-text);
}
.tag-wins {
  background: var(--wins-bg);
  color: var(--wins-text);
}
.entry-desc {
  font-size: 0.8rem;
  color: var(--text2);
  line-height: 1.6;
  margin-top: 0.25rem;
}

.entry-stack {
  display: flex;
  gap: 4px;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.stack-tag {
  font-family: var(--mono);
  font-size: 0.62rem;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--bg3);
  color: var(--text3);
  border: 1px solid var(--border);
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 3rem 0;
  color: var(--text3);
  font-size: 0.8rem;
}
.mono {
  font-family: var(--mono);
}

/* ── FOOTER ── */
footer {
  max-width: 700px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text3);
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
}
footer a {
  color: var(--accent);
  text-decoration: none;
}
footer a:hover {
  text-decoration: underline;
}

/* ── RESPONSIVE ── */
@media (max-width: 500px) {
  .controls {
    flex-direction: column;
    align-items: flex-start;
  }
  .search-input {
    width: 100%;
  }
  .search-input:focus {
    width: 100%;
  }
  .entry {
    grid-template-columns: 36px 1fr;
  }
  header {
    padding: 1.5rem 1rem 0;
  }
  main {
    padding: 0 1rem 4rem;
  }
}
.entry-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.entry-title {
  flex: 1;
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}

.entry-link {
  display: block;
  text-align: left;
  margin-top: 0.4rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.entry-link:hover {
  text-decoration: underline;
}
