/* ============================================================
   Fred Okonjo — letterpress & hand binding
   Composition: warm earth editorial · receipt/listing layout
   ============================================================ */

:root {
  --bg: #f5efe4;
  --ink: #2b1e14;
  --accent: #c25a37;
  --secondary: #6a7a4a;
  --rule: rgba(43, 30, 20, 0.35);
  --muted: rgba(43, 30, 20, 0.62);
  --panel: rgba(43, 30, 20, 0.035);
  --measure: 40ch;
  --pad: clamp(1.25rem, 5vw, 3rem);
}

html[data-theme="dark"] {
  --bg: #1a1512;
  --ink: #ece2d2;
  --accent: #e0764f;
  --secondary: #9aad72;
  --rule: rgba(236, 226, 210, 0.32);
  --muted: rgba(236, 226, 210, 0.62);
  --panel: rgba(236, 226, 210, 0.05);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(0.9rem, 0.85rem + 0.25vw, 1rem);
  line-height: 1.65;
  font-variation-settings: "wght" 380;
  transition: background-color 0.45s ease, color 0.45s ease;
  overflow-x: hidden;
}

img, video { max-width: 100%; height: auto; display: block; }

/* ---------- skip link ---------- */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--bg);
  padding: 0.6rem 1rem;
  z-index: 100;
}
.skip:focus { left: 0; }

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

/* ---------- layout ---------- */
.wrap {
  width: 100%;
  max-width: calc(var(--measure) + (var(--pad) * 2));
  margin-inline: auto;
  padding-inline: var(--pad);
}

.section {
  padding-block: clamp(3.5rem, 9vw, 7rem);
  border-top: 1px dotted var(--rule);
  scroll-margin-top: 5rem;
}
.section:first-of-type { border-top: 0; }

/* ---------- masthead ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px dotted var(--rule);
}
.masthead .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding-block: 0.7rem;
}
.stamp {
  margin: 0;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  flex: 1 1 100%;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  flex: 1 1 auto;
}
.nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  padding: 0.55rem 0.15rem;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.theme-toggle {
  font: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px dotted var(--rule);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  min-height: 44px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- hero ---------- */
.hero { padding-top: clamp(2.5rem, 7vw, 5rem); }

.kicker {
  margin: 0 0 1.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--secondary);
}

.hero-h1 {
  position: relative;
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.6rem, 11vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  font-variation-settings: "wght" 240, "opsz" 120;
  transition: font-variation-settings 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  cursor: default;
  min-height: 1.1em;
}
.hero-h1:hover,
.hero-h1:focus-visible {
  font-variation-settings: "wght" 900, "opsz" 120;
}

.hero-h1 .default,
.hero-h1 .alt {
  display: block;
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.hero-h1 .alt {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(0.35em);
  color: var(--accent);
  font-style: italic;
  font-size: 0.62em;
  line-height: 1.05;
  padding-top: 0.18em;
  pointer-events: none;
}
.hero-h1:hover .default,
.hero-h1:focus-visible .default { opacity: 0; transform: translateY(-0.3em); }
.hero-h1:hover .alt,
.hero-h1:focus-visible .alt { opacity: 1; transform: translateY(0); }

.hero-sub {
  margin: 1.75rem 0 0;
  max-width: 34ch;
  font-size: 1rem;
  color: var(--ink);
}

.hero-note {
  margin: 1.25rem 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ---------- rules ---------- */
.rule {
  border: 0;
  border-top: 1px dotted var(--rule);
  margin: 2.25rem 0;
}

/* ---------- receipt / definition list ---------- */
.receipt {
  margin: 0;
  display: grid;
  gap: 0.35rem;
}
.receipt .row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.receipt dt {
  flex: 0 0 auto;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.receipt .row::after {
  content: "";
  flex: 1 1 auto;
  order: 1;
  border-bottom: 1px dotted var(--rule);
  transform: translateY(-0.28em);
}
.receipt dd {
  order: 2;
  flex: 0 0 auto;
  margin: 0;
  text-align: right;
  max-width: 62%;
  font-size: 0.85rem;
}
.receipt dd.ok { color: var(--secondary); }
.receipt dd.closed { color: var(--accent); }

/* ---------- section headings ---------- */
.sec-h {
  margin: 0 0 0.75rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  font-variation-settings: "wght" 400, "opsz" 90;
  transition: font-variation-settings 0.4s ease;
}
.sec-h:hover { font-variation-settings: "wght" 800, "opsz" 90; }

.lede {
  margin: 0;
  max-width: 38ch;
  color: var(--muted);
  font-size: 0.9rem;
}

.sub-h {
  margin: 0 0 0.6rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.15rem, 3.5vw, 1.5rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-variation-settings: "wght" 500, "opsz" 60;
  transition: font-variation-settings 0.35s ease;
}
.sub-h:hover { font-variation-settings: "wght" 800, "opsz" 60; }

/* ---------- listings ---------- */
.listing {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2rem;
}

.item { padding-bottom: 1.75rem; border-bottom: 1px dotted var(--rule); }
.item:last-child { border-bottom: 0; padding-bottom: 0; }

.item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-bottom: 0.5rem;
}
.item-head h3 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.12rem;
  font-variation-settings: "wght" 500, "opsz" 40;
  letter-spacing: -0.005em;
  transition: font-variation-settings 0.35s ease, color 0.25s ease;
}
.item:hover .item-head h3 {
  font-variation-settings: "wght" 800, "opsz" 40;
  color: var(--accent);
}
.item-head .meta {
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}
.item p {
  margin: 0 0 0.6rem;
  font-size: 0.88rem;
  max-width: 42ch;
}
.item p:last-child { margin-bottom: 0; }

.tags {
  font-size: 0.7rem !important;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--secondary);
}

.price-list .item-head h3 { font-size: 1rem; }
.price-list .item-head .meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
  color: var(--accent);
  font-variation-settings: "wght" 600;
}

.note {
  margin: 2rem 0 0;
  padding: 1rem 1.15rem;
  background: var(--panel);
  border-left: 2px solid var(--secondary);
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 44ch;
}

/* ---------- prose ---------- */
.prose { display: grid; gap: 1.15rem; max-width: 44ch; }
.prose p { margin: 0; font-size: 0.9rem; }
.prose em { font-style: italic; color: var(--accent); }

/* ---------- form ---------- */
.form { display: grid; gap: 1.25rem; margin-top: 1.75rem; max-width: 34rem; }

.field { display: grid; gap: 0.4rem; }
.field label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input,
.field select,
.field textarea {
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px dotted var(--rule);
  border-radius: 2px;
  padding: 0.7rem 0.8rem;
  min-height: 44px;
  width: 100%;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.field textarea { resize: vertical; min-height: 7rem; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  border-style: solid;
  outline: none;
}
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 0.85rem 1.4rem;
  min-height: 44px;
  cursor: pointer;
  justify-self: start;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn[disabled] { opacity: 0.55; cursor: progress; }

.form-status {
  margin: 0;
  font-size: 0.8rem;
  color: var(--secondary);
}
.form-status.is-error { color: var(--accent); }

.colophon {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.9;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* ---------- attribution (free tier) ---------- */
.attribution {
  position: static;
  text-align: center;
  padding: 1.5rem var(--pad) 2.5rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  opacity: 0.55;
  font-family: "JetBrains Mono", monospace;
  border-top: 1px dotted var(--rule);
}
.attribution a { color: inherit; }

/* ---------- view transitions ---------- */
@view-transition { navigation: auto; }

::view-transition-old(root) {
  animation: vt-out 0.32s cubic-bezier(0.4, 0, 1, 1) both;
}
::view-transition-new(root) {
  animation: vt-in 0.42s cubic-bezier(0, 0, 0.2, 1) both;
}
@keyframes vt-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-1.2rem); }
}
@keyframes vt-in {
  from { opacity: 0; transform: translateY(1.2rem); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- section reveal ---------- */
.section .wrap {
  animation: rise linear both;
  animation-timeline: view();
  animation-range: entry 5% cover 26%;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(1.5rem); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .section .wrap { animation: none; opacity: 1; transform: none; }
  .hero-h1 .alt { position: static; opacity: 1; transform: none; font-size: 0.62em; }
  .hero-h1 .default { display: none; }
  .hero-h1:hover .default { opacity: 1; }
}

/* ---------- wider screens ---------- */
@media (min-width: 46rem) {
  :root { --measure: 46ch; }
  .stamp { flex: 0 0 auto; }
  .nav { justify-content: flex-end; }
  .receipt dd { max-width: 70%; }
}
