/* The Curious Community — front door
   Pastel pop on lilac paper, with Leonardo's sanguine construction lines as a quiet undertone. */

:root {
  --paper: #F7F4FD;
  --ink: #241B35;
  --ink-soft: #5B5172;
  --line: #DCD3EE;
  --sanguine: #B0503A;
  --cobalt: #3340E6;
  --cobalt-deep: #2630B8;
  --coral: #FF5A5F;
  --sun: #FFC53D;

  --lilac: #E4DCFA;
  --mint: #CFEFDF;
  --butter: #FFEDB0;
  --blush: #FAD6DD;
  --sky: #D3E5FA;

  --serif: "Young Serif", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "La Belle Aurore", "Snell Roundhand", cursive;

  --r-lg: 28px;
  --r-md: 18px;
  --r-sm: 10px;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.12; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.6rem, 5.6vw, 4.6rem); letter-spacing: -0.025em; }
h2 { font-size: clamp(2rem, 3.6vw, 2.9rem); letter-spacing: -0.02em; }
h3 { font-size: 1.4rem; }
p { margin: 0; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }

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

[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 16px; top: -60px; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--r-sm); z-index: 100; }
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font: 600 1rem/1 var(--sans);
  padding: 1rem 1.5rem;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--cobalt);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { background: var(--cobalt-deep); transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: none; }
.btn--ghost:hover { background: #fff; box-shadow: none; transform: none; }
.btn--small { padding: .65rem 1.1rem; font-size: .95rem; box-shadow: 3px 3px 0 var(--ink); }
.btn--block { width: 100%; }
.btn--text { background: none; border: 0; box-shadow: none; color: var(--cobalt); padding: .5rem 0; text-decoration: underline; text-underline-offset: 3px; }
.btn--text:hover { background: none; box-shadow: none; transform: none; color: var(--cobalt-deep); }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 72px; }
.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; font-family: var(--serif); font-size: 1.15rem; white-space: nowrap; }
.brand__mark { width: 40px; height: 40px; color: var(--ink); flex: none; }
.nav__links { display: flex; align-items: center; gap: 1.75rem; }
.nav__links a:not(.btn) { text-decoration: none; font-weight: 500; font-size: .98rem; color: var(--ink-soft); }
.nav__links a:not(.btn):hover { color: var(--ink); }

/* Hero */
.hero { padding: clamp(40px, 6vw, 80px) 0 clamp(64px, 8vw, 110px); }
.hero__grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(32px, 5vw, 72px); align-items: center; }
.hero__copy h1 { max-width: 12ch; }
.lede { margin-top: 1.5rem; font-size: 1.25rem; line-height: 1.55; color: var(--ink-soft); max-width: 36ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 2.25rem; }
.hero__note { margin-top: 1.25rem; font-size: .95rem; color: var(--ink-soft); }

.hero__art { position: relative; margin: 0; }
.codex { width: 100%; height: auto; overflow: visible; }
.hand { font-family: var(--hand); font-size: 22px; }
.mirror { font-size: 26px; }

.draw > * { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.4s cubic-bezier(.6,.1,.3,1) forwards; }
.draw > *:nth-child(1) { animation-delay: .1s; }
.draw > *:nth-child(2) { animation-delay: .35s; }
.draw > *:nth-child(3), .draw > *:nth-child(4) { animation-delay: .9s; opacity: .5; }
.draw > *:nth-child(5), .draw > *:nth-child(6) { animation-delay: 1.1s; opacity: .5; }
.draw > *:nth-child(7), .draw > *:nth-child(8) { animation-delay: 1.4s; opacity: .6; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.pin {
  position: absolute;
  display: grid; gap: .15rem;
  width: min(220px, 44%);
  padding: .9rem 1rem 1rem;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: 5px 5px 0 var(--ink);
  font-size: .9rem; line-height: 1.35;
  color: var(--ink-soft);
  opacity: 0;
  animation: pin .5s cubic-bezier(.2,.9,.3,1.3) forwards;
}
.pin strong { color: var(--ink); font-weight: 600; font-size: .98rem; }
.pin__room {
  justify-self: start;
  font-size: .78rem; font-weight: 600;
  padding: .15rem .55rem; border-radius: 999px;
  margin-bottom: .3rem; color: var(--ink);
}
.pin--a { top: 0; left: -8%; transform: rotate(-4deg); animation-delay: 2s; }
.pin--a .pin__room { background: var(--lilac); }
.pin--b { top: 46%; right: -7%; transform: rotate(3deg); animation-delay: 2.2s; }
.pin--b .pin__room { background: var(--butter); }
.pin--c { bottom: -2%; left: -2%; transform: rotate(-1.5deg); animation-delay: 2.4s; }
.pin--c .pin__room { background: var(--mint); }
@keyframes pin { from { opacity: 0; translate: 0 12px; } to { opacity: 1; translate: 0 0; } }

/* Sections */
.section { padding: clamp(72px, 9vw, 120px) 0; }
.section__head { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: end; margin-bottom: clamp(36px, 5vw, 56px); }
.section__head p { color: var(--ink-soft); font-size: 1.125rem; max-width: 44ch; justify-self: end; }
.section--tint { background: var(--butter); }

/* Rooms */
.rooms {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: auto;
  gap: 18px;
}
.room {
  position: relative;
  display: flex; flex-direction: column; gap: .8rem;
  padding: clamp(24px, 3vw, 36px);
  border-radius: var(--r-lg);
  background: var(--lilac);
}
.room p { color: var(--ink-soft); max-width: 52ch; }
.room--art { grid-column: span 4; }
.room--poll { grid-column: span 2; grid-row: span 2; background: var(--butter); }
.room--story { grid-column: span 2; background: var(--mint); }
.room--books { grid-column: span 2; background: var(--blush); }
.room--market {
  grid-column: span 6;
  flex-direction: row; align-items: center; gap: clamp(20px, 3vw, 40px);
  background: transparent;
  border: 2px dashed var(--line);
}
.room--market .sketch { width: 120px; margin: 0; flex: none; }
.room--market > div { display: grid; gap: .5rem; flex: 1; }
.room__status {
  flex: none;
  font-weight: 600; font-size: .9rem;
  padding: .45rem .9rem; border-radius: 999px;
  border: 1.5px solid var(--ink-soft); color: var(--ink-soft);
}
.room__eg { margin-top: auto; padding-top: .5rem; font-size: .92rem; font-weight: 500; color: var(--ink); }
.room__link {
  margin-top: auto; padding-top: .5rem;
  font-weight: 600; color: var(--cobalt);
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px;
}
.room__link:hover { color: var(--cobalt-deep); }

.sketch { width: 132px; height: auto; margin-bottom: .4rem; }
.sketch, .sketch * { fill: none; stroke: var(--sanguine); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sketch .fill { fill: var(--sanguine); fill-opacity: .18; }
.room--poll .sketch { width: 150px; }

/* Poll */
.poll { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.poll__intro h2 { max-width: 14ch; }
.poll__intro p { margin-top: 1.25rem; color: var(--ink-soft); font-size: 1.125rem; max-width: 40ch; }
.poll__intro .poll__fine { font-size: .92rem; margin-top: 1.5rem; }
.poll__card {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: var(--r-lg);
  box-shadow: 8px 8px 0 var(--ink);
  padding: clamp(20px, 3vw, 32px);
}
.poll__card fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.poll__options { display: grid; gap: 10px; }
.opt {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: 100%;
  padding: 1rem 1.2rem;
  font: 500 1.05rem/1.2 var(--sans); color: var(--ink);
  text-align: left;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.opt:hover:not(:disabled) { border-color: var(--ink); background: #fff; }
.opt:disabled { cursor: default; }
.opt__bar {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: var(--lilac);
  transition: width .8s cubic-bezier(.2,.8,.2,1);
  z-index: 0;
}
.opt.is-mine .opt__bar { background: #BFC3FF; }
.opt.is-mine { border: 2px solid var(--cobalt); font-weight: 600; }
.opt__label, .opt__pct { position: relative; z-index: 1; }
.opt__pct { font-variant-numeric: tabular-nums; font-weight: 600; opacity: 0; transition: opacity .3s ease .3s; }
.poll.is-voted .opt__pct { opacity: 1; }
.opt.is-mine .opt__label::after { content: "  your answer"; font-size: .85rem; font-weight: 400; opacity: .85; }
.poll__status { margin-top: 1.25rem; font-size: 1.05rem; min-height: 1.6em; }
.poll__status strong { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; }

/* Notebook posts */
.posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 32px); }
.post { display: flex; flex-direction: column; gap: .6rem; }
.post__thumb { aspect-ratio: 5 / 3; border-radius: var(--r-md); margin-bottom: .6rem; display: grid; place-items: center; overflow: hidden; }
.post__thumb svg { width: 70%; }
.post__thumb--lilac { background: var(--lilac); }
.post__thumb--mint { background: var(--mint); }
.post__thumb--blush { background: var(--blush); }
.post__room { font-size: .88rem; font-weight: 600; color: var(--sanguine); }
.post h3 { font-size: 1.5rem; }
.post p { color: var(--ink-soft); }
.post__meta { margin-top: auto; padding-top: .4rem; font-size: .88rem; color: var(--ink-soft); font-style: italic; }

/* Shelf */
.section--shelf { background: var(--lilac); }
.shelf { display: grid; grid-template-columns: 1fr 1.25fr; gap: clamp(32px, 6vw, 80px); align-items: start; }
.shelf__intro p { margin-top: 1.25rem; color: var(--ink-soft); font-size: 1.125rem; max-width: 38ch; }
.books { display: grid; gap: 12px; counter-reset: book; }
.book {
  display: grid; grid-template-columns: 14px 1fr auto; gap: 1.1rem; align-items: center;
  background: var(--paper);
  border-radius: var(--r-md);
  padding: 1rem 1rem 1rem 1.1rem;
  transition: transform .4s ease;
}
.book__spine { width: 14px; height: 56px; border-radius: 4px; border: 1.5px solid var(--ink); }
.book__spine--butter { background: var(--butter); }
.book__spine--sky { background: var(--sky); }
.book__spine--blush { background: var(--blush); }
.book h3 { font-size: 1.2rem; }
.book p { font-size: .95rem; color: var(--ink-soft); margin-top: .2rem; }
.vote {
  display: grid; justify-items: center; gap: 2px;
  min-width: 58px; padding: .5rem .6rem;
  font: 600 1rem/1 var(--sans); color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-sm);
  cursor: pointer; font-variant-numeric: tabular-nums;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.vote__arrow { font-size: .7rem; }
.vote:hover { border-color: var(--ink); }
.vote[aria-pressed="true"] { background: var(--cobalt); border-color: var(--ink); color: #fff; }

/* Tiers */
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1.5px solid var(--ink); }
.tier { padding: 2rem clamp(16px, 2.5vw, 32px) 0 0; display: grid; gap: .7rem; align-content: start; }
.tier + .tier { padding-left: clamp(16px, 2.5vw, 32px); border-left: 1px solid var(--line); }
.tier__num { font-family: var(--serif); font-size: 2.6rem; line-height: 1; color: var(--sanguine); }
.tier p { color: var(--ink-soft); max-width: 34ch; }

/* Join */
.join { background: var(--ink); color: var(--paper); }
.join__grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(36px, 6vw, 88px); align-items: start; }
.join__copy p { margin-top: 1.25rem; color: #CFC6E2; font-size: 1.125rem; max-width: 42ch; }
.stages { margin-top: 2.25rem; display: grid; gap: 0; }
.stages li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; padding: .85rem 0; border-top: 1px solid #3E3452; color: #CFC6E2; }
.stages li:last-child { border-bottom: 1px solid #3E3452; }
.stages strong { font-weight: 600; color: var(--paper); }
.stages .is-now strong { color: var(--butter); }
.stages .is-now { color: var(--paper); }

.join__form {
  display: grid; gap: .45rem;
  background: var(--paper); color: var(--ink);
  border-radius: var(--r-lg);
  padding: clamp(24px, 3.5vw, 40px);
  box-shadow: 8px 8px 0 var(--cobalt);
}
.join__form label { font-weight: 600; font-size: .95rem; margin-top: .6rem; }
.join__form label:first-child { margin-top: 0; }
.optional { font-weight: 400; color: var(--ink-soft); }
.join__form input {
  width: 100%;
  font: 400 1.05rem/1.3 var(--sans); color: var(--ink);
  padding: .9rem 1rem;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
}
.join__form input::placeholder { color: #9A91AE; }
.join__form input:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cobalt) 25%, transparent); }
.join__form input[aria-invalid="true"] { border-color: var(--sanguine); }
.join__form .btn { margin-top: 1.25rem; }
.join__status { min-height: 1.5em; font-size: .98rem; margin-top: .4rem; }
.join__status.is-error { color: var(--sanguine); }
.join__status.is-ok { color: var(--ink); font-weight: 500; }
.join__fine { font-size: .88rem; color: var(--ink-soft); }

/* Footer */
.footer { padding: 64px 0 32px; }
.footer__inner { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.footer__mirror {
  margin-top: 1.4rem;
  font-family: var(--hand); font-size: 1.9rem; line-height: 1.2; color: var(--sanguine);
  transform: scaleX(-1); transform-origin: center; display: table;
}
.footer__hint { font-size: .9rem; color: var(--ink-soft); margin-top: .3rem; }
.footer__links { display: grid; grid-template-columns: repeat(2, auto); gap: .6rem 2.5rem; }
.footer__links a { text-decoration: none; color: var(--ink-soft); }
.footer__links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.footer__base { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); font-size: .88rem; color: var(--ink-soft); }

/* Responsive */
@media (max-width: 960px) {
  .hero__grid, .poll, .shelf, .join__grid { grid-template-columns: 1fr; }
  .hero__art { max-width: 560px; margin: 0 auto; width: 100%; }
  .section__head { grid-template-columns: 1fr; gap: 1rem; }
  .section__head p { justify-self: start; }
  .rooms { grid-template-columns: repeat(2, 1fr); }
  .room--art { grid-column: span 2; }
  .room--poll { grid-column: span 1; grid-row: auto; }
  .room--story { grid-column: span 1; }
  .room--books { grid-column: span 2; }
  .room--market { grid-column: span 2; }
  .posts { grid-template-columns: 1fr 1fr; }
  .posts .post:last-child { grid-column: span 2; max-width: calc(50% - 16px); }
}
@media (max-width: 720px) {
  .nav__links li:not(:last-child) { display: none; }
  .brand span { font-size: 1.02rem; }
  .rooms { grid-template-columns: 1fr; }
  .room--art, .room--poll, .room--story, .room--books, .room--market { grid-column: auto; }
  .room--market { flex-direction: column; align-items: flex-start; }
  .posts { grid-template-columns: 1fr; }
  .posts .post:last-child { grid-column: auto; max-width: none; }
  .tiers { grid-template-columns: 1fr; border-top: 0; }
  .tier, .tier + .tier { padding: 1.5rem 0; border-left: 0; border-top: 1.5px solid var(--ink); }
  .pin { width: 56%; font-size: .82rem; padding: .7rem .8rem .8rem; box-shadow: 3px 3px 0 var(--ink); }
  .pin strong { font-size: .88rem; }
  .pin--a { left: -2%; }
  .pin--b { right: -2%; }
  .pin--c { display: none; }
  .stages li { grid-template-columns: 4.5rem 1fr; }
}
@media (max-width: 400px) {
  .brand span { font-size: .92rem; }
  .brand__mark { width: 28px; height: 28px; }
  .nav .btn--small { padding: .55rem .85rem; font-size: .9rem; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .draw > * { animation: none; stroke-dashoffset: 0; }
  .pin { animation: none; opacity: 1; }
  .opt__bar, .opt__pct { transition: none; }
}
