:root {
  --ink: #17211b;
  --muted: #6d746b;
  --paper: #f1f1f1;
  --paper-deep: #dfdfdf;
  --hard-ink: #000;
  --hard-paper: #fff;
  --surface: rgba(255,255,255,.9);
  --surface-strong: #fff;
  --surface-soft: rgba(255,255,255,.55);
  --comment-root: #fff;
  --comment-child: #f3ecff;
  --card-lightness: 90%;
  --card-chroma: .12;
  --acid: #dfff52;
  --line: rgba(23, 33, 27, 0.2);
  --backdrop: rgba(23,33,27,.42);
  --stroke: 2px;
  --lift: 6px 6px 0 var(--ink);
  --focus-ring: 0 0 0 5px rgba(0, 0, 0, .1);
  --logo-radius: 20px;
  --logo-center-x: 12px;
}

html[data-theme="inverse"] {
  color-scheme: dark;
  --ink: #f4f4f1;
  --muted: #aaaead;
  --paper: #101010;
  --paper-deep: #292929;
  --hard-ink: #fff;
  --hard-paper: #000;
  --surface: rgba(10,10,10,.9);
  --surface-strong: #080808;
  --surface-soft: rgba(0,0,0,.5);
  --comment-root: #151515;
  --comment-child: #201b28;
  --card-lightness: 28%;
  --card-chroma: .09;
  --acid: #2000ad;
  --line: rgba(255,255,255,.22);
  --backdrop: rgba(255,255,255,.26);
  --focus-ring: 0 0 0 5px rgba(255,255,255,.14);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 7%, rgba(255,255,255,.95), rgba(255,255,255,.2) 19rem, transparent 34rem),
    radial-gradient(circle at 92% 24%, rgba(0,0,0,.09), rgba(0,0,0,.025) 18rem, transparent 34rem),
    radial-gradient(circle at 44% 78%, rgba(255,255,255,.72), transparent 31rem),
    linear-gradient(135deg, #e5e5e5 0%, #f5f5f5 48%, #dedede 100%);
  background-attachment: fixed;
  font-family: "Manrope", sans-serif;
  min-height: 100vh;
}

html[data-theme="inverse"] body {
  background:
    radial-gradient(circle at 10% 7%, rgba(0,0,0,.95), rgba(0,0,0,.2) 19rem, transparent 34rem),
    radial-gradient(circle at 92% 24%, rgba(255,255,255,.09), rgba(255,255,255,.025) 18rem, transparent 34rem),
    radial-gradient(circle at 44% 78%, rgba(0,0,0,.72), transparent 31rem),
    linear-gradient(135deg, #1a1a1a 0%, #070707 48%, #222 100%);
  background-attachment: fixed;
}

button, input, textarea { font: inherit; }
button { color: inherit; }

.grain {
  position: fixed;
  inset: 0;
  opacity: 0.32;
  pointer-events: none;
  z-index: 10;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.1'/%3E%3C/svg%3E");
}
html[data-theme="inverse"] .grain { filter: invert(1); }

.site-header, footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.site-header { height: 88px; transition: height .6s cubic-bezier(.2,.8,.2,1); }
.brand { position: relative; display: inline-grid; padding: 0; border: 0; background: transparent; color: var(--hard-ink); font-size: 24px; font-weight: 800; letter-spacing: 0; cursor: pointer; transition: transform .2s ease; }
.brand::before { content: ""; position: absolute; z-index: 0; width: calc(var(--logo-radius) * 2); height: calc(var(--logo-radius) * 2); left: calc(var(--logo-center-x) - var(--logo-radius)); top: 50%; border-radius: 50%; background: var(--hard-ink); pointer-events: none; transform: translateY(-50%); }
.brand:hover { transform: rotate(-1deg); }
.brand:focus { outline: none; }
.brand:focus-visible { outline: var(--stroke) solid var(--hard-ink); outline-offset: 8px; border-radius: 4px; }
.brand-word { position: relative; z-index: 1; grid-area: 1 / 1; color: var(--hard-ink); }
.brand-word-inverse { z-index: 2; color: var(--hard-paper); clip-path: circle(var(--logo-radius) at var(--logo-center-x) 50%); pointer-events: none; }

main { overflow: visible; }
.hero { width: min(900px, calc(100% - 48px)); margin: 78px auto 0; text-align: center; position: relative; transition: margin .7s cubic-bezier(.2,.8,.2,1); }
.hero-copy { max-height: 560px; overflow: hidden; opacity: 1; transform: translateY(0) scale(1); transition: max-height .75s cubic-bezier(.2,.8,.2,1), opacity .42s ease, transform .65s cubic-bezier(.2,.8,.2,1); }
h1 { font-size: clamp(52px, 8.3vw, 108px); line-height: .88; letter-spacing: -.075em; margin: 0; font-weight: 700; transition: font-size .65s cubic-bezier(.2,.8,.2,1), line-height .65s cubic-bezier(.2,.8,.2,1), letter-spacing .65s cubic-bezier(.2,.8,.2,1); }
.topic-editor { display: inline-block; position: relative; max-width: 100%; min-width: 3.4em; padding: .04em .28em .1em; border: var(--stroke) solid var(--ink); border-radius: 999px; background: var(--surface); box-shadow: var(--lift); font-family: inherit; font-weight: 700; color: var(--hard-ink); line-height: .82; letter-spacing: -.055em; cursor: text; outline: none; transition: background .2s, box-shadow .2s, transform .2s; }
.topic-editor:empty::before { content: attr(data-placeholder); color: var(--muted); opacity: .7; }
.topic-editor:hover { background: var(--surface-strong); transform: translate(-1px, -1px); }
.topic-editor:focus { background: var(--surface-strong); box-shadow: var(--lift), var(--focus-ring); transform: translate(-1px, -1px); }
.intro { max-width: 520px; max-height: 110px; overflow: hidden; opacity: 1; margin: 34px auto 42px; font-size: 16px; line-height: 1.65; color: var(--muted); transition: max-height .55s ease, margin .55s ease, opacity .3s ease, transform .5s ease; }

.idea-form { width: min(720px, 100%); margin: 0 auto; position: relative; display: flex; align-items: center; padding: 9px; background: var(--surface); border: var(--stroke) solid var(--ink); border-radius: 999px; box-shadow: var(--lift); transition: width .65s cubic-bezier(.2,.8,.2,1), transform .3s ease, box-shadow .2s, background .35s; z-index: 2; }
.idea-form::before,
.idea-form::after { content: ""; position: absolute; border: var(--stroke) solid var(--ink); border-radius: 50%; background: var(--surface-strong); box-shadow: var(--lift); }
.idea-form::before {
  width: 22px;
  height: 22px;
  left: 38px;
  bottom: -25px;
  animation: thought-dot-float 3.8s ease-in-out infinite;
}
.idea-form::after {
  width: 10px;
  height: 10px;
  left: 24px;
  bottom: -36px;
  animation: thought-dot-float-small 3.2s .4s ease-in-out infinite;
}

@keyframes thought-dot-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-2px, 4px); }
}

@keyframes thought-dot-float-small {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-3px, 2px); }
}
.idea-form:focus-within { transform: translate(-1px, -2px); box-shadow: var(--lift), var(--focus-ring); }
.idea-form input { min-width: 0; flex: 1; height: 68px; padding: 0 23px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: clamp(17px, 2vw, 22px); font-weight: 600; position: relative; z-index: 1; }
.idea-form input::placeholder { color: #9a9b90; }
.submit-idea { height: 54px; display: flex; align-items: center; gap: 18px; border: 0; background: var(--hard-ink); color: var(--hard-paper); border-radius: 999px; padding: 0 18px; cursor: pointer; font-weight: 800; transition: filter .2s, transform .2s, opacity .2s; position: relative; z-index: 1; }
.submit-idea:disabled { opacity: .35; cursor: not-allowed; }
.submit-idea:hover { filter: brightness(.95); transform: rotate(-1deg); }
.submit-idea span:last-child { font-size: 22px; }

.idea-field { width: min(1180px, calc(100% - 48px)); min-height: 520px; margin: 110px auto 0; position: relative; border-top: var(--stroke) solid var(--line); transition: margin .7s cubic-bezier(.2,.8,.2,1); }
.field-heading { height: 58px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font: 500 10px/1 "DM Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.constellation { min-height: 420px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 24px; align-items: start; padding: 8px 0 80px; }
.empty-topic { grid-column: 1 / -1; min-height: 250px; display: grid; place-content: center; gap: 10px; padding: 40px; border: var(--stroke) dashed var(--line); border-radius: 18px; text-align: center; color: var(--muted); }
.empty-topic strong { color: var(--ink); font-size: clamp(20px, 3vw, 30px); letter-spacing: -.035em; }
.empty-topic span { font-size: 13px; }

.idea-card { position: relative; min-width: 0; height: auto; display: flex; flex-direction: column; border: var(--stroke) solid var(--ink); border-radius: 18px; background: oklch(var(--card-lightness) var(--card-chroma) var(--card-hue)); box-shadow: var(--lift); overflow: hidden; opacity: 0; transform: translateY(18px); animation: arrive .5s forwards; animation-delay: var(--delay, 0ms); transition: background .35s, box-shadow .2s, color .35s, translate .2s; }
.idea-card.is-settled { animation: none; opacity: 1; transform: none; }
.idea-card:hover { box-shadow: var(--lift); translate: -2px -3px; z-index: 3; }
.idea-open { display: block; flex: 1; width: 100%; min-height: 154px; padding: 20px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.similarity { display: block; color: var(--muted); font: 500 9px/1 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }
.idea-open strong { display: block; font-size: 18px; line-height: 1.25; letter-spacing: -.025em; }
.idea-open .description { display: block; overflow: visible; color: var(--muted); font-size: 12px; line-height: 1.55; margin-top: 10px; }
.idea-open .description[hidden] { display: none; }
.card-actions { display: flex; align-items: center; min-height: 43px; padding: 0 10px; border-top: var(--stroke) solid rgba(23,33,27,.18); }
.vote-group { display: flex; align-items: center; gap: 4px; }
.vote-group button, .relate-button { border: 0; background: transparent; cursor: pointer; border-radius: 6px; }
.vote-group button { width: 25px; height: 27px; font-weight: 800; }
.vote-group button:hover, .vote-group button.active { background: var(--ink); color: var(--hard-paper); }
.score { font: 600 11px/1 "DM Mono", monospace; min-width: 19px; text-align: center; }
.relate-button { margin-left: auto; font: 600 10px/1 "DM Mono", monospace; padding: 7px; }
.relate-button:hover, .relate-button.active { background: var(--surface-soft); }
.comment-count { margin-left: 8px; color: var(--muted); font: 500 9px/1 "DM Mono", monospace; white-space: nowrap; }

body.searching .site-header { height: 64px; }
body.searching .hero { margin-top: 10px; }
body.searching .hero-copy { max-height: 220px; opacity: 1; transform: none; }
body.searching .hero-copy .intro { max-height: 0; margin: 0; opacity: 0; transform: translateY(-12px); }
body.searching h1 { font-size: clamp(34px, 5vw, 56px); line-height: .96; letter-spacing: -.055em; }
body.searching .idea-form { width: min(760px, 100%); background: var(--surface-strong); box-shadow: var(--lift); }
body.searching .idea-form:focus-within { transform: translate(-1px, -2px); box-shadow: var(--lift), var(--focus-ring); }
body.searching .idea-field { margin-top: 64px; }

footer { justify-content: center; padding: 30px 0 44px; border-top: var(--stroke) solid var(--line); color: var(--muted); font-size: 12px; text-align: center; }

.toast { position: fixed; z-index: 30; left: 50%; bottom: 28px; max-width: calc(100% - 40px); transform: translate(-50%, 20px); background: var(--ink); color: var(--hard-paper); padding: 12px 18px; border-radius: 10px; font-size: 12px; pointer-events: none; opacity: 0; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.idea-dialog { width: min(680px, calc(100% - 28px)); max-height: min(800px, calc(100vh - 36px)); border: var(--stroke) solid var(--ink); border-radius: 22px; padding: 0; background: var(--paper); box-shadow: var(--lift); color: var(--ink); }
.idea-dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(7px); }
.dialog-close { position: sticky; float: right; top: 14px; margin: 14px 14px -50px 0; z-index: 3; border: var(--stroke) solid var(--ink); background: var(--paper); width: 36px; height: 36px; border-radius: 50%; font-size: 24px; line-height: 1; cursor: pointer; }
.dialog-inner { padding: 42px 42px 36px; }
.dialog-kicker { font: 500 10px/1 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.dialog-inner h2 { max-width: 540px; margin: 14px 0 20px; font-size: clamp(29px, 5vw, 45px); line-height: 1.06; letter-spacing: -.05em; }
.dialog-description { color: var(--muted); line-height: 1.65; }
.dialog-meta { display: flex; gap: 18px; padding: 16px 0; border-block: var(--stroke) solid var(--line); margin: 28px 0; font: 500 10px/1 "DM Mono", monospace; text-transform: uppercase; }
.editor, .comment-form { display: grid; gap: 9px; margin: 22px 0; }
.editor textarea, .comment-form textarea, .reply-form textarea { resize: vertical; width: 100%; min-height: 82px; padding: 13px; border: var(--stroke) solid var(--ink); border-radius: 10px; background: var(--surface-soft); color: var(--ink); outline: 0; font-size: 13px; }
.editor button, .comment-form button, .reply-form button { justify-self: end; border: var(--stroke) solid var(--ink); border-radius: 8px; background: var(--acid); padding: 8px 13px; font-size: 11px; font-weight: 800; cursor: pointer; }
.discussion-title { margin: 36px 0 18px; font-size: 17px; }
.comment { margin: 30px 0 18px; }
.comment-bubble {
  --comment-bg: var(--comment-root);
  position: relative;
  isolation: isolate;
  border: var(--stroke) solid var(--ink);
  border-radius: 18px;
  padding: 15px 17px 13px;
  margin-bottom: 20px;
  background: var(--comment-bg);
  box-shadow: var(--lift);
}
.comment-bubble::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 18px;
  height: 18px;
  left: 24px;
  top: -11px;
  border-top: var(--stroke) solid var(--ink);
  border-left: var(--stroke) solid var(--ink);
  background: var(--comment-bg);
  transform: rotate(45deg);
}
.comment-bubble::after {
  content: "";
  position: absolute;
  z-index: 1;
  width: 30px;
  height: 5px;
  left: 19px;
  top: -2px;
  background: var(--comment-bg);
}
.comment-bubble > * { position: relative; z-index: 2; }
.comment-head { color: var(--muted); font: 500 9px/1 "DM Mono", monospace; text-transform: uppercase; }
.comment-body { margin: 7px 0 9px; font-size: 13px; line-height: 1.55; }
.comment-actions { display: flex; align-items: center; gap: 5px; }
.comment-actions button { border: 0; background: transparent; cursor: pointer; font: 600 10px/1 "DM Mono", monospace; padding: 5px; }
.comment-actions button:hover, .comment-actions button.active { background: var(--paper-deep); border-radius: 5px; }
.comment-children { margin: 30px 0 0 22px; }
.comment-children .comment-bubble { --comment-bg: var(--comment-child); }
.reply-form { display: grid; gap: 8px; margin-top: 8px; }
.reply-form[hidden] { display: none; }
.reply-form textarea { min-height: 58px; }
.empty-discussion { color: var(--muted); font-size: 12px; font-style: italic; }

.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; }
@keyframes arrive { to { opacity: 1; transform: translateY(0); } }

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) {
  z-index: 2;
  clip-path: circle(var(--logo-radius) at var(--theme-x) var(--theme-y));
  animation: theme-reveal .9s cubic-bezier(.65,0,.2,1) both;
}
@keyframes theme-reveal {
  to { clip-path: circle(var(--theme-radius) at var(--theme-x) var(--theme-y)); }
}

@media (max-width: 800px) {
  .site-header, footer, .hero, .idea-field { width: min(100% - 28px, 680px); }
  .site-header { height: 72px; }
  .hero { margin-top: 54px; }
  h1 { font-size: clamp(47px, 14vw, 82px); }
  .intro { margin: 28px auto 34px; font-size: 14px; }
  .idea-form { border-radius: 999px; }
  .idea-form input { height: 58px; padding: 0 13px; }
  .submit-idea { width: 48px; height: 48px; padding: 0; justify-content: center; }
  .submit-idea span:first-child { display: none; }
  .idea-form::before { left: 35px; }
  .idea-form::after { left: 22px; }
  .idea-field { margin-top: 80px; min-height: auto; }
  .constellation { min-height: auto; gap: 18px; padding: 6px 2px 72px; }
  .idea-card { transform: translateY(18px); }
  .idea-card:hover { translate: 0 -2px; }
  .idea-open { min-height: 118px; }
  .dialog-inner { padding: 38px 22px 28px; }
  footer { margin-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
