/* Review-site shell for the It's That Simple email program.
   Tokens first, rem everywhere, px only for hairlines. */
:root {
  --c-cream: #fcf7de;
  --c-cream-deep: #f0e9cb;
  --c-paper: #fffdf4;
  --c-black: #231f20;
  --c-ink: #111111;
  --c-red: #a61c1c;
  --c-teal: #015870;
  --c-gold: #f8bc1c;
  --c-purple: #742f88;
  --c-gray: #5f5f5f;
  --c-line: rgba(35, 31, 32, 0.16);
  --c-line-soft: rgba(35, 31, 32, 0.08);
  --c-focus: #015870;

  --f-display: 'League Gothic', 'Arial Narrow', Impact, sans-serif;
  --f-body: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --t-xs: 0.75rem;
  --t-sm: 0.875rem;
  --t-base: 1rem;
  --t-md: 1.125rem;
  --t-lg: 1.375rem;
  --t-xl: 2rem;
  --t-2xl: 3.25rem;
  --t-3xl: clamp(4rem, 12vw, 9rem);

  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;
  --s-9: 6rem;

  --r-sm: 0.25rem;
  --r-md: 0.5rem;
  --r-pill: 999px;
  --w-page: 76rem;
  --w-prose: 44rem;
  --topbar: 3.5rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--c-cream);
  color: var(--c-black);
  font-family: var(--f-body);
  font-size: var(--t-base);
  line-height: 1.55;
  text-wrap: pretty;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-red); text-underline-offset: 0.15em; }
a:hover { color: var(--c-ink); }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
p { margin: 0 0 var(--s-4); }
ul, ol { margin: 0 0 var(--s-4); padding-left: 1.25rem; }
li { margin-bottom: var(--s-2); }
code, kbd { font-family: var(--f-mono); font-size: 0.9em; background: var(--c-cream-deep); padding: 0.1em 0.35em; border-radius: var(--r-sm); }
button { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; border-radius: var(--r-sm); }
.skip { position: absolute; left: var(--s-4); top: -4rem; background: var(--c-black); color: var(--c-cream); padding: var(--s-2) var(--s-4); z-index: 100; }
.skip:focus { top: var(--s-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Display type */
.display { font-family: var(--f-display); font-weight: 400; text-transform: uppercase; line-height: 0.9; letter-spacing: 0.005em; }
.eyebrow { font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--c-gray); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar);
  background: var(--c-black); color: var(--c-cream);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.topbar-inner { max-width: var(--w-page); margin: 0 auto; height: 100%; padding: 0 var(--s-4); display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.brand { display: flex; align-items: center; gap: var(--s-3); color: var(--c-cream); text-decoration: none; }
.brand img { width: 1.75rem; height: auto; }
.brand strong { font-family: var(--f-display); font-size: var(--t-lg); text-transform: uppercase; letter-spacing: 0.02em; font-weight: 400; }
.brand span { font-size: var(--t-xs); letter-spacing: 0.12em; text-transform: uppercase; color: rgba(252, 247, 222, 0.55); }
.nav { display: flex; gap: var(--s-1); }
.nav a { color: rgba(252, 247, 222, 0.7); text-decoration: none; font-size: var(--t-sm); font-weight: 600; padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); }
.nav a:hover { color: var(--c-cream); background: rgba(255, 255, 255, 0.08); }
.nav a[aria-current="page"] { color: var(--c-black); background: var(--c-cream); }

/* Page scaffolding */
.page { max-width: var(--w-page); margin: 0 auto; padding: 0 var(--s-4) var(--s-9); }
.hero { padding: var(--s-8) 0 var(--s-7); border-bottom: 1px solid var(--c-line); }
.hero h1 { font-size: var(--t-3xl); color: var(--c-black); margin: var(--s-3) 0 var(--s-4); }
.hero h1 em { font-style: normal; color: var(--c-red); }
.hero .lede { font-size: var(--t-md); max-width: var(--w-prose); color: var(--c-black); }
.meta { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); font-size: var(--t-sm); color: var(--c-gray); margin-top: var(--s-5); }
.meta b { color: var(--c-black); font-weight: 600; }

.section { padding: var(--s-7) 0 var(--s-6); border-bottom: 1px solid var(--c-line); }
.section:last-of-type { border-bottom: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-5); }
.section-head h2 { font-size: var(--t-2xl); }
.section-head p { margin: 0; color: var(--c-gray); max-width: 36rem; }
.prose { max-width: var(--w-prose); }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: var(--s-6); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: var(--s-4); }
.card { background: var(--c-paper); border: 1px solid var(--c-line); border-radius: var(--r-md); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: transform 160ms ease, box-shadow 160ms ease; }
.card:hover { transform: translateY(-0.125rem); box-shadow: 0 0.75rem 1.5rem -0.75rem rgba(35, 31, 32, 0.35); color: inherit; }
.card .bar { height: 0.375rem; }
.card img { aspect-ratio: 3 / 2; object-fit: cover; width: 100%; }
.card-body { padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); flex: 1; }
.card-body h3 { font-size: var(--t-md); line-height: 1.25; }
.card-body .sub { font-size: var(--t-sm); color: var(--c-gray); margin: 0; }
.tag { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; padding: 0.2rem 0.6rem; border-radius: var(--r-pill); color: var(--c-cream); width: fit-content; }
.tag.on-dark { color: var(--c-black); }

/* Lists of notes */
.notes { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-3); }
.notes li { padding: var(--s-3) var(--s-4); background: var(--c-paper); border: 1px solid var(--c-line); border-left: 0.25rem solid var(--c-teal); border-radius: var(--r-sm); }
.notes.flags li { border-left-color: var(--c-red); }
.notes.plain li { border-left-color: var(--c-gold); }

/* Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-paper); }
table { border-collapse: collapse; width: 100%; font-size: var(--t-sm); }
th, td { text-align: left; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--c-line-soft); vertical-align: top; }
th { font-size: var(--t-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-gray); font-weight: 700; background: var(--c-cream-deep); }
tr:last-child td { border-bottom: 0; }
td.wave { background: var(--c-black); color: var(--c-cream); font-family: var(--f-display); font-size: var(--t-lg); text-transform: uppercase; letter-spacing: 0.02em; }
.status { font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.15rem 0.5rem; border-radius: var(--r-pill); white-space: nowrap; }
.status.built { background: var(--c-teal); color: var(--c-cream); }
.status.open { background: var(--c-cream-deep); color: var(--c-gray); }
.status.gated { background: var(--c-gold); color: var(--c-black); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: var(--s-2); padding: 0.6rem 1rem; border-radius: var(--r-pill); border: 1px solid var(--c-black); background: var(--c-black); color: var(--c-cream); font-size: var(--t-sm); font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1; }
.btn:hover { background: var(--c-red); border-color: var(--c-red); color: var(--c-cream); }
.btn.ghost { background: transparent; color: var(--c-black); }
.btn.ghost:hover { background: var(--c-black); color: var(--c-cream); }
.btn.primary { background: var(--c-red); border-color: var(--c-red); }
.btn.primary:hover { background: var(--c-black); border-color: var(--c-black); }
.btn svg { width: 1em; height: 1em; }

/* Templates page */
.library { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: var(--s-6); padding-top: var(--s-6); align-items: start; }
.sidenav { position: sticky; top: calc(var(--topbar) + var(--s-4)); display: grid; gap: var(--s-5); }
.sidenav h2 { font-size: var(--t-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--c-gray); font-weight: 700; margin-bottom: var(--s-2); }
.tlist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-1); }
.tlist button { width: 100%; text-align: left; background: transparent; border: 1px solid transparent; border-radius: var(--r-sm); padding: var(--s-2) var(--s-3); display: grid; grid-template-columns: 0.5rem 1fr; gap: var(--s-3); align-items: start; cursor: pointer; }
.tlist button:hover { background: var(--c-paper); border-color: var(--c-line); }
.tlist button[aria-current="true"] { background: var(--c-black); color: var(--c-cream); border-color: var(--c-black); }
.tlist .dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; margin-top: 0.45rem; }
.tlist .name { font-weight: 600; font-size: var(--t-sm); line-height: 1.3; }
.tlist .who { font-size: var(--t-xs); opacity: 0.7; }
.zip { padding: var(--s-4); background: var(--c-paper); border: 1px solid var(--c-line); border-radius: var(--r-md); font-size: var(--t-sm); }
.zip p { margin-bottom: var(--s-3); }

.viewer { min-width: 0; }
.viewer-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-4); align-items: flex-start; padding-bottom: var(--s-4); border-bottom: 1px solid var(--c-line); }
.viewer-head h1 { font-size: var(--t-xl); line-height: 1.1; margin-top: var(--s-2); }
.subject-lines { display: grid; gap: var(--s-2); margin-top: var(--s-4); font-size: var(--t-sm); }
.subject-lines div { display: grid; grid-template-columns: 7rem 1fr; gap: var(--s-3); }
.subject-lines dt { color: var(--c-gray); font-size: var(--t-xs); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; padding-top: 0.2rem; }
.subject-lines dd { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.status-live { font-size: var(--t-sm); color: var(--c-teal); font-weight: 600; min-height: 1.25rem; }

.stage { margin-top: var(--s-5); background: var(--c-cream-deep); border: 1px solid var(--c-line); border-radius: var(--r-md); padding: var(--s-5) var(--s-4); display: grid; gap: var(--s-4); justify-items: center; }
.stage-tools { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--c-black); border-radius: var(--r-pill); overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 0.45rem 0.9rem; font-size: var(--t-sm); font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--c-black); color: var(--c-cream); }
.frame { width: 100%; max-width: 37.5rem; background: var(--c-cream); border: 1px solid var(--c-line); box-shadow: 0 1.5rem 3rem -1.5rem rgba(35, 31, 32, 0.45); transition: max-width 220ms ease; }
.frame.mobile { max-width: 23.4375rem; }
.frame iframe { display: block; width: 100%; height: 40rem; border: 0; background: var(--c-cream); overflow: hidden; }

.detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: var(--s-5); margin-top: var(--s-6); }
.detail h2 { font-size: var(--t-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--c-gray); font-weight: 700; margin-bottom: var(--s-3); }
.detail .notes li { font-size: var(--t-sm); }

/* System page */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: var(--s-3); }
.swatch { border: 1px solid var(--c-line); border-radius: var(--r-md); overflow: hidden; background: var(--c-paper); text-align: left; padding: 0; cursor: pointer; }
.swatch .chip { height: 4.5rem; }
.swatch .lab { padding: var(--s-3); display: grid; gap: 0.15rem; }
.swatch .lab b { font-size: var(--t-sm); }
.swatch .lab code { background: none; padding: 0; font-size: var(--t-xs); }
.swatch .lab small { color: var(--c-gray); font-size: var(--t-xs); }
.specimen { background: var(--c-paper); border: 1px solid var(--c-line); border-radius: var(--r-md); padding: var(--s-5); display: grid; gap: var(--s-3); }
.specimen .h { font-family: 'Montserrat', Arial, sans-serif; font-weight: 900; font-size: var(--t-xl); line-height: 1.1; letter-spacing: -0.01em; }
.specimen .b { font-family: 'Montserrat', Arial, sans-serif; font-size: var(--t-base); line-height: 1.6; max-width: 36rem; }
.specimen .l { font-family: 'Montserrat', Arial, sans-serif; font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.steps { counter-reset: step; list-style: none; padding: 0; display: grid; gap: var(--s-3); max-width: var(--w-prose); }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2.5rem 1fr; gap: var(--s-3); padding: var(--s-4); background: var(--c-paper); border: 1px solid var(--c-line); border-radius: var(--r-md); }
.steps li::before { content: counter(step); font-family: var(--f-display); font-size: var(--t-xl); line-height: 1; color: var(--c-red); }
.steps li p:last-child { margin-bottom: 0; }
.anatomy { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--s-3); }
.anatomy div { padding: var(--s-4); background: var(--c-paper); border: 1px solid var(--c-line); border-radius: var(--r-md); font-size: var(--t-sm); }
.anatomy b { display: block; margin-bottom: var(--s-1); }

footer.site { max-width: var(--w-page); margin: 0 auto; padding: var(--s-6) var(--s-4) var(--s-8); font-size: var(--t-xs); color: var(--c-gray); display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--s-3); border-top: 1px solid var(--c-line); }

@media (max-width: 56rem) {
  .library { grid-template-columns: 1fr; }
  .sidenav { position: static; }
  .subject-lines div { grid-template-columns: 1fr; gap: 0; }
  .topbar-inner { gap: var(--s-2); }
  .brand span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .frame { transition: none; }
}

/* `hidden` must win over the grid display on subject rows */
.subject-lines div[hidden] { display: none; }
