/* v9 - The Waveform. Everforest, dark-first. */

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #272e33;
  --raised: #2e383c;
  --fg: #d3c6aa;
  --head: #d3c6aa;
  --muted: #8f9c93; /* half-step up from Everforest #859289: 4.82:1 on bg */
  --hair: #4f5b58;
  --green: #a7c080;
  --aqua: #83c092;
  --sand: #dbbc7f;
  --wave-bar: #a7c080;
  --wave-bar-alpha: 0.85;
  --wave-line: #83c092;
  --wave-ghost: #4f5b58;
  --wave-ghost-alpha: 0.24;
  --wave-tick: #dbbc7f;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fdf6e3;
  --raised: #f4f0d9;
  --fg: #5c6a72;
  --head: #4a555b;
  --muted: #64726a; /* darkened for AA: 4.68:1 on bg */
  --hair: #ddd8c0;
  --green: #8da101;
  --aqua: #35a77c;
  --sand: #dfa000;
  --wave-bar: #8da101;
  --wave-bar-alpha: 0.7;
  --wave-line: #35a77c;
  --wave-ghost: #cfc6a4;
  --wave-ghost-alpha: 0.3;
  --wave-tick: #dfa000;
}

/* no-JS visitors: honor the OS preference without the theme script */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #fdf6e3;
    --raised: #f4f0d9;
    --fg: #5c6a72;
    --head: #4a555b;
    --muted: #64726a;
    --hair: #ddd8c0;
    --green: #8da101;
    --aqua: #35a77c;
    --sand: #dfa000;
    --wave-bar: #8da101;
    --wave-bar-alpha: 0.7;
    --wave-line: #35a77c;
    --wave-ghost: #cfc6a4;
    --wave-ghost-alpha: 0.3;
    --wave-tick: #dfa000;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "iA Writer Quattro", -apple-system, "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  padding: 0 1.25rem 2rem;
  -webkit-font-smoothing: antialiased;
  transition: background-color 160ms ease, color 160ms ease;
}

::selection { background: var(--green); color: var(--bg); }

.wide { max-width: 58rem; margin-left: auto; margin-right: auto; }
.col  { max-width: 40rem; margin-left: auto; margin-right: auto; }

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

/* ---------- mono spec voice ---------- */

.wordmark, #theme-toggle, .eyebrow, h2, .mural-meta, figcaption,
.link-handle, footer {
  font-family: "iA Writer Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ---------- header ---------- */

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

header.row { padding: 1.4rem 0 0; }

#theme-toggle {
  background: none;
  border: 1px solid var(--hair);
  border-radius: 999px;
  padding: 0.32rem 0.85rem;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  color: var(--muted);
  transition: color 140ms ease, border-color 140ms ease;
}
#theme-toggle:hover { color: var(--green); border-color: var(--green); }
html:not(.js) #theme-toggle { display: none; }

/* ---------- hero ---------- */

.hero { margin-top: 5rem; }

.eyebrow { margin-bottom: 0.9rem; }

h1 {
  font-family: "iA Writer Quattro Var", "iA Writer Quattro", sans-serif;
  font-weight: 600;
  font-size: clamp(2.1rem, 5vw, 2.9rem);
  line-height: 1.15;
  color: var(--head);
  letter-spacing: -0.01em;
}

.lede {
  margin-top: 1.1rem;
  font-size: 1.2rem;
  color: var(--muted);
}

/* ---------- mural ---------- */

.mural { margin-top: 3.5rem; }

.mural-meta {
  display: flex;
  gap: 1.5rem;
  padding: 0 0.15rem 0.6rem;
}
.mural-meta .seed { margin-left: auto; }
html:not(.js) .mural-meta .seed { visibility: hidden; }

.mural-frame {
  background: var(--raised);
  border: 1px solid var(--hair);
  border-radius: 8px;
  padding: 1rem 0.9rem;
  height: 250px;
  transition: background-color 160ms ease, border-color 160ms ease;
}

#mural-canvas {
  display: none;
  width: 100%;
  height: 100%;
}
html.js #mural-canvas { display: block; }

.mural-fallback {
  height: 100%;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 11px,
    var(--wave-ghost) 11px,
    var(--wave-ghost) 12px
  );
  opacity: 0.55;
}
html.js .mural-fallback { display: none; }

figcaption {
  padding: 0.7rem 0.15rem 0;
  font-style: normal;
}

/* no hover, no invitation: don't promise the pointer trick on touch */
@media (hover: none) {
  .if-hover { display: none; }
}

/* ---------- sections ---------- */

section.col { margin-top: 4.5rem; }

h2 {
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: 0.14em;
  border-top: 1px solid var(--hair);
  padding-top: 1.4rem;
  margin-bottom: 1.4rem;
}

section.col p + p { margin-top: 1.1rem; }

p[data-wave] {
  border-left: 2px solid transparent;
  padding-left: 0.85rem;
  margin-left: -0.98rem;
  transition: border-color 140ms ease, color 140ms ease;
}
p[data-wave]:hover {
  border-left-color: var(--green);
  color: var(--head);
}
:root[data-theme="dark"] p[data-wave]:hover { color: #e6dcc0; }

.quiet { color: var(--muted); }

/* ---------- links ---------- */

.links { list-style: none; }

.links li { border-top: 1px solid var(--hair); }
.links li:last-child { border-bottom: 1px solid var(--hair); }

.links a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.15rem;
  text-decoration: none;
  color: var(--fg);
  transition: color 140ms ease;
}
.links .link-handle { transition: color 140ms ease; }
.links a:hover { color: var(--green); }
.links a:hover .link-handle { color: var(--green); }

.link-name {
  font-family: "iA Writer Quattro Var", "iA Writer Quattro", sans-serif;
  font-weight: 600;
}

/* ---------- footer ---------- */

footer.row {
  margin-top: 5rem;
  border-top: 1px solid var(--hair);
  padding-top: 1.2rem;
}

footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--hair);
  transition: color 140ms ease;
}
footer a:hover { color: var(--green); }

/* ---------- mobile ---------- */

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .hero { margin-top: 3rem; }
  .mural { margin-top: 2.5rem; }
  .mural-frame { height: 170px; padding: 0.8rem 0.6rem; }
  .mural-meta { flex-wrap: wrap; gap: 0.4rem 1.2rem; }
  section.col { margin-top: 3.25rem; }
  p[data-wave] { padding-left: 0.7rem; margin-left: -0.83rem; }
  footer.row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    margin-top: 3.5rem;
  }
}
