/* ============================================================
   Civil Legend Manager — warm earth editorial
   ============================================================ */

:root {
  --bg: #f5efe4;
  --bg-soft: #efe6d4;
  --ink: #2b1e14;
  --ink-soft: #5a4a38;
  --accent: #c25a37;
  --accent-deep: #a3482a;
  --secondary: #6a7a4a;
  --line: rgba(43, 30, 20, 0.14);
  --card: rgba(255, 252, 245, 0.6);
  --shadow: 0 1px 0 rgba(43, 30, 20, 0.06), 0 12px 32px -18px rgba(43, 30, 20, 0.35);
  --serif: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
  --sans: 'DM Sans', 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1610;
    --bg-soft: #241c13;
    --ink: #ece3d4;
    --ink-soft: #b7a88f;
    --accent: #d97a52;
    --accent-deep: #e08a63;
    --secondary: #93a56b;
    --line: rgba(236, 227, 212, 0.14);
    --card: rgba(38, 30, 20, 0.6);
    --shadow: 0 1px 0 rgba(236, 227, 212, 0.06), 0 12px 32px -18px rgba(0, 0, 0, 0.6);
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* animated noise field */
.noise {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
}
@media (prefers-color-scheme: dark) {
  .noise { mix-blend-mode: screen; opacity: 0.06; }
}

main { position: relative; z-index: 1; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); }
code { font-family: var(--mono); font-size: 0.9em; background: var(--bg-soft); padding: 0.1em 0.35em; border-radius: 4px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- header ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem clamp(1.25rem, 5vw, 3.5rem);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.brand span { color: var(--accent); }
nav { display: flex; gap: 1.4rem; }
nav a { color: var(--ink-soft); font-size: 0.95rem; }
nav a:hover { color: var(--accent); }
.theme-toggle {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.2s, color 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- hero ---------- */
.hero {
  max-width: 68ch;
  margin: 0 auto;
  padding: clamp(4rem, 11vw, 8rem) clamp(1.25rem, 5vw, 3.5rem) clamp(3rem, 7vw, 5rem);
}
.eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 1.2rem;
}
.hero-title {
  font-size: clamp(3rem, 9vw, 6rem);
  font-weight: 200;
  font-variation-settings: 'wght' 200;
  letter-spacing: -0.03em;
  margin-bottom: 0.25em;
  animation: weigh linear both;
  animation-timeline: scroll(root);
  animation-range: 0 30vh;
}
@keyframes weigh {
  from { font-variation-settings: 'wght' 200; }
  to   { font-variation-settings: 'wght' 900; }
}
.hero-lede {
  font-size: clamp(1.15rem, 2.4vw, 1.4rem);
  color: var(--ink-soft);
  max-width: 56ch;
}
.hero-meta {
  margin-top: 2rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.hero-meta .dot { color: var(--accent); }

/* ---------- bento ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1.25rem;
  padding: clamp(1.25rem, 5vw, 3.5rem);
  max-width: 1200px;
  margin: 0 auto;
}
.cell {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.6rem;
  box-shadow: var(--shadow);
}
.cell h2 { font-size: 1.7rem; }
.cell h3 { font-size: 1.25rem; }
.cell-a { grid-column: 1 / 4; }
.cell-b { grid-column: 4 / 7; }
.cell-c { grid-column: 2 / 5; }
.cell-d { grid-column: 5 / 7; }
.cell-e { grid-column: 1 / 3; }
/* cell-f (grid-column 3/4) intentionally left empty — the broken bento breathes */

.tick-list { list-style: none; padding: 0; margin: 0; }
.tick-list li {
  padding-left: 1.4em;
  position: relative;
  margin-bottom: 0.6em;
}
.tick-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--secondary);
  font-weight: 700;
}
.cell blockquote { margin: 0; }
.cell blockquote p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.3rem;
  line-height: 1.4;
  color: var(--ink);
}
.cell blockquote cite {
  font-style: normal;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- sections ---------- */
.section-title {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 500;
  letter-spacing: -0.02em;
}
.section-sub {
  color: var(--ink-soft);
  max-width: 52ch;
  margin-bottom: 2rem;
}
.routines, .notes, .contact {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 5rem) clamp(1.25rem, 5vw, 3.5rem);
}

/* ---------- routines ---------- */
.routine-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.routine {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.routine h3 { font-size: 1.15rem; margin: 0; }
.routine h3 code {
  font-family: var(--mono);
  font-size: 0.95rem;
  background: none;
  padding: 0;
  color: var(--accent);
}
.routine p { color: var(--ink-soft); font-size: 0.98rem; margin: 0; flex: 1; }
.tag {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
  border: 1px solid var(--line);
  padding: 0.2em 0.7em;
  border-radius: 999px;
}

/* ---------- drag band ---------- */
.band-section {
  padding: clamp(3rem, 7vw, 5rem) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.band-section .section-title,
.band-section .section-sub {
  padding-left: clamp(1.25rem, 5vw, 3.5rem);
  padding-right: clamp(1.25rem, 5vw, 3.5rem);
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
.band {
  overflow: hidden;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  padding: 0.5rem 0 1.5rem;
}
.band.dragging { cursor: grabbing; }
.band-inner {
  display: flex;
  gap: 1.25rem;
  padding: 0 clamp(1.25rem, 5vw, 3.5rem);
  width: max-content;
  will-change: transform;
}
.band-card {
  width: clamp(260px, 30vw, 340px);
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.band-card h3 { font-size: 1.3rem; }
.band-card p { color: var(--ink-soft); font-size: 0.98rem; }
.band-meta {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--secondary);
  letter-spacing: 0.04em;
}

/* ---------- notes ---------- */
.note-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.note {
  border-left: 2px solid var(--accent);
  padding-left: 1.25rem;
}
.note time {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.note h3 { font-size: 1.2rem; margin: 0.4em 0 0.5em; }
.note p { color: var(--ink-soft); font-size: 0.98rem; }

/* ---------- contact ---------- */
.contact { border-top: 1px solid var(--line); }
.contact-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  max-width: 720px;
}
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: 0.9rem; color: var(--ink-soft); }
.field input, .field textarea {
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  transition: border-color 0.2s;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.btn {
  grid-column: 1 / -1;
  justify-self: start;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.8rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn:hover { background: var(--accent-deep); }
.btn:active { transform: translateY(1px); }
.form-status { grid-column: 1 / -1; font-size: 0.95rem; margin: 0; }
.form-status.ok { color: var(--secondary); }
.form-status.err { color: var(--accent); }

/* ---------- footer ---------- */
.site-foot {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  padding: 2rem clamp(1.25rem, 5vw, 3.5rem);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.site-foot p { margin: 0; }
.attribution a { color: var(--ink-soft); }
.attribution a:hover { color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .routine-grid, .note-list { grid-template-columns: 1fr 1fr; }
  .cell-a { grid-column: 1 / 7; }
  .cell-b { grid-column: 1 / 7; }
  .cell-c { grid-column: 1 / 7; }
  .cell-d { grid-column: 1 / 7; }
  .cell-e { grid-column: 1 / 7; }
}
@media (max-width: 640px) {
  nav { gap: 0.9rem; }
  nav a { font-size: 0.85rem; }
  .routine-grid, .note-list { grid-template-columns: 1fr; }
  .contact-form { grid-template-columns: 1fr; }
  .field-wide { grid-column: 1; }
  .btn { grid-column: 1; }
  .bento { gap: 1rem; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-title {
    animation: none;
    font-variation-settings: 'wght' 700;
  }
  .noise { display: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
