/* Loom spec — editorial paper, copper thread */
:root {
  --paper: #f4efe6;
  --paper-2: #ebe4d6;
  --ink: #1b1713;
  --ink-soft: #5e554c;
  --line: rgba(27, 23, 19, 0.1);
  --thread: #c45c26;
  --thread-deep: #9a3f16;
  --warp: #2f4a3c;
  --keep: #2f4a3c;
  --later: #8a6230;
  --skip: #8f3d32;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --serif: "Fraunces", "Times New Roman", serif;
  --sans: "Figtree", ui-sans-serif, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --nav: 17.5rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.65;
  letter-spacing: -0.011em;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.weave {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, transparent 0 47px, rgba(196,92,38,.045) 47px 48px),
    repeating-linear-gradient(0deg, transparent 0 47px, rgba(47,74,60,.04) 47px 48px);
}

a { color: var(--thread-deep); text-underline-offset: 0.18em; }
a:hover { color: var(--thread); }
code, .mono { font-family: var(--mono); font-size: 0.86em; }

.island {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  width: calc(var(--nav) - 1.5rem);
  z-index: 30;
  padding: 0.35rem;
  border-radius: 1.75rem;
  background: rgba(27, 23, 19, 0.04);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.island-inner {
  background: rgba(244, 239, 230, 0.88);
  border-radius: 1.5rem;
  padding: 1.15rem 1rem 1.25rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
  max-height: calc(100dvh - 2.4rem);
  overflow: auto;
}
.mark {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.15rem 0.4rem 0.85rem;
  text-decoration: none;
  color: var(--ink);
}
.mark b {
  font-family: var(--serif);
  font-weight: 560;
  font-size: 1.55rem;
  font-optical-sizing: auto;
  letter-spacing: -0.03em;
}
.mark span {
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.nav a {
  display: block;
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.55s var(--ease), color 0.55s var(--ease), transform 0.55s var(--ease);
}
.nav a:hover, .nav a.active {
  background: var(--ink);
  color: var(--paper);
}
.nav-label {
  margin: 0.85rem 0.7rem 0.3rem;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.menu-btn {
  display: none;
  position: fixed;
  top: 1.1rem;
  right: 1.1rem;
  z-index: 35;
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
}
.menu-btn i, .menu-btn i::after {
  display: block;
  width: 1.05rem;
  height: 1.5px;
  margin: 0 auto;
  background: currentColor;
  transition: transform 0.55s var(--ease);
}
.menu-btn i::after {
  content: "";
  margin-top: 6px;
}
body.nav-open .menu-btn i { transform: rotate(45deg) translateY(4px); }
body.nav-open .menu-btn i::after { transform: rotate(-90deg) translateX(-4px); }

.wrap {
  position: relative;
  z-index: 1;
  margin-left: var(--nav);
  padding: 4.5rem 4.5rem 8rem 2.5rem;
  max-width: 78rem;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: rgba(196, 92, 38, 0.1);
  color: var(--thread-deep);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 600;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 460;
  font-size: clamp(3.1rem, 7vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
  margin: 1rem 0 1.1rem;
  font-optical-sizing: auto;
}
.lede {
  font-size: 1.22rem;
  color: var(--ink-soft);
  max-width: 38rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.8rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.15rem 0.15rem 0.15rem 1.15rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-weight: 560;
  transition: transform 0.55s var(--ease), background 0.55s var(--ease);
}
.btn:hover { color: var(--paper); transform: scale(0.98); }
.btn i {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.12);
  transition: transform 0.55s var(--ease);
}
.btn:hover i { transform: translate(2px, -1px) scale(1.06); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.72rem 1.15rem;
}
.btn-ghost:hover { background: rgba(27,23,19,.04); color: var(--ink); }

.bento {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  margin-top: 3.5rem;
}
.shell {
  padding: 0.35rem;
  border-radius: 2rem;
  background: rgba(27,23,19,.045);
  border: 1px solid var(--line);
}
.core {
  background: #fffdf8;
  border-radius: 1.7rem;
  padding: 1.5rem 1.55rem 1.35rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
  min-height: 100%;
}
.core h3 {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 500;
  margin: 0 0 0.45rem;
  letter-spacing: -0.03em;
}
.core p { margin: 0; color: var(--ink-soft); }
.tall { grid-row: span 2; }
.core .num {
  font-family: var(--serif);
  font-size: 2.4rem;
  color: var(--thread);
  line-height: 1;
  margin-bottom: 0.6rem;
}

section {
  padding: 5.5rem 0 0;
  max-width: 52rem;
}
section.wide { max-width: 64rem; }
section h2 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 2.85rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0.55rem 0 1rem;
}
section h3 {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 520;
  margin: 2.2rem 0 0.6rem;
}
section h4 { margin: 1.4rem 0 0.4rem; font-size: 1.02rem; }
section p { color: var(--ink); }
section li { margin: 0.28rem 0; }
.reveal {
  opacity: 0;
  transform: translateY(1.4rem);
  filter: blur(6px);
  animation: rise 0.9s var(--ease) forwards;
}
@keyframes rise {
  to { opacity: 1; transform: none; filter: none; }
}

.table-wrap {
  overflow: auto;
  margin: 1rem 0 1.6rem;
  padding: 0.3rem;
  border-radius: 1.4rem;
  background: rgba(27,23,19,.04);
  border: 1px solid var(--line);
}
table {
  width: 100%;
  border-collapse: collapse;
  background: #fffdf8;
  border-radius: 1.15rem;
  overflow: hidden;
  font-size: 0.95rem;
}
th, td {
  text-align: left;
  padding: 0.72rem 0.9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 650;
  background: rgba(244,239,230,.7);
}
tr:last-child td { border-bottom: 0; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.pill.keep { background: rgba(47,74,60,.12); color: var(--keep); }
.pill.later { background: rgba(138,98,48,.14); color: var(--later); }
.pill.skip { background: rgba(143,61,50,.12); color: var(--skip); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1.1rem 0 0.4rem;
}
.chip {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 0.38rem 0.8rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--ink-soft);
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}
.chip.on, .chip:hover { background: var(--ink); color: var(--paper); }

.search {
  width: min(28rem, 100%);
  margin: 0.8rem 0 0;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fffdf8;
  font: inherit;
  outline: none;
}
.search:focus { border-color: var(--thread); }

.mermaid {
  background: #fffdf8;
  border-radius: 1.4rem;
  padding: 1.2rem;
  margin: 1rem 0 1.4rem;
  border: 1px solid var(--line);
}
.note {
  padding: 1rem 1.15rem;
  border-radius: 1.2rem;
  background: rgba(196,92,38,.08);
  color: var(--ink);
  margin: 1rem 0;
}
.timeline { list-style: none; padding: 0; margin: 1rem 0 0; }
.timeline li {
  padding: 1.1rem 0 1.1rem 1.3rem;
  border-left: 2px solid rgba(196,92,38,.35);
  position: relative;
}
.timeline li::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 99px;
  background: var(--thread);
  position: absolute;
  left: -0.32rem;
  top: 1.35rem;
}
.timeline strong { font-family: var(--serif); font-size: 1.25rem; display: block; }

footer {
  margin: 5rem 0 0;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.9rem;
  max-width: 52rem;
}

@media (max-width: 860px) {
  .island {
    display: none;
    inset: 0;
    width: auto;
    border-radius: 0;
    padding: 4.5rem 1rem 1.5rem;
  }
  body.nav-open .island { display: block; }
  .menu-btn { display: grid; place-items: center; }
  .wrap { margin-left: 0; padding: 5.5rem 1.15rem 4rem; }
  .bento { grid-template-columns: 1fr; }
  .tall { grid-row: auto; }
  section { padding-top: 3.5rem; }
}
@page { margin: 16mm; }
@media print {
  .island, .menu-btn, .grain, .weave, .filters, .search, .hero-actions { display: none !important; }
  .wrap { margin: 0; padding: 0; max-width: none; }
  section { break-inside: avoid; padding-top: 1.4rem; }
}
