:root {
  --paper: #f7f3ed;
  --ink: #121313;
  --muted: #44433f;
  --line: rgba(20, 20, 19, .28);
  --coral: #ed7657;
  --accent: #ed8067;
  --display: "Instrument Serif", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--paper); color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 34%),
    linear-gradient(rgba(255,255,255,.2), rgba(255,255,255,.2)),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .5s ease;
}
button, input { font: inherit; }
button { color: inherit; }
.bot-field { position: fixed; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.site-header {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  height: calc(74px + env(safe-area-inset-top));
  padding: calc(24px + env(safe-area-inset-top)) clamp(22px, 5.5vw, 70px) 0;
  pointer-events: none;
}
.site-header .wordmark {
  color: var(--ink);
  font: 32px/1 var(--display);
  letter-spacing: .24em;
  text-decoration: none;
  pointer-events: auto;
}
.site-header > span {
  font-size: 10px;
  letter-spacing: .34em;
  text-transform: uppercase;
}

.app-shell { min-height: 100svh; }
.screen {
  min-height: 100svh;
  padding: calc(76px + env(safe-area-inset-top)) clamp(22px, 5vw, 64px) calc(24px + env(safe-area-inset-bottom));
  opacity: 0;
}
.screen.is-active { opacity: 1; animation: screen-in .58s cubic-bezier(.2,.75,.25,1) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.screen-layout { width: min(1120px, 100%); min-height: calc(100svh - 100px); margin: 0 auto; }

.art-window { position: relative; min-width: 0; overflow: hidden; }
.art-window svg { display: block; width: 100%; height: 100%; }
.art-window img { display: block; width: 100%; height: 100%; object-fit: contain; }

.intro-screen .screen-layout { display: grid; align-content: center; }
.intro-art {
  height: auto;
  aspect-ratio: 853 / 680;
  margin-inline: clamp(-64px, -5vw, -22px);
}
.intro-copy { width: min(100%, 680px); min-width: 0; margin: 0 auto; overflow: visible; }
.eyebrow,
.field > span,
.submit-meta,
.person-name,
.result-label,
.keywords,
.progress-meta,
.remaining,
.source-note {
  font-size: 10px;
  line-height: 1.35;
  letter-spacing: .28em;
  text-transform: uppercase;
}
.eyebrow { margin: 0 0 14px; }
h1, h2 { overflow: visible; font-family: var(--display); font-weight: 400; letter-spacing: -.025em; text-wrap: balance; }
h1 { margin: 0; font-size: clamp(48px, 13vw, 72px); line-height: .93; }
h1 em, h2 em { font-weight: 400; }
.lede { margin: 18px 0 22px; color: var(--muted); font: 25px/1.25 var(--display); }

#matchForm { display: grid; gap: 13px; }
.field { display: grid; gap: 4px; }
.field input {
  width: 100%;
  height: 42px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
}
.field input::placeholder { color: #77746e; }
.field input:focus { border-bottom-color: var(--coral); }
.form-error { min-height: 17px; margin: -4px 0 -8px; color: #9f3829; font-size: 12px; }
.submit-meta { text-align: right; }
.find-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 5px;
  padding: 14px 20px;
  background: var(--coral);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  transition: transform .15s ease, background .2s ease;
}
.find-button:hover { background: #df684b; transform: translateY(-1px); }
.find-button:focus-visible, .again-button:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.find-button:disabled { opacity: .58; cursor: wait; transform: none; }

.loading-screen .screen-layout,
.result-screen .screen-layout { display: grid; align-content: center; }
.loading-art, .result-art { height: clamp(390px, 54svh, 590px); }
.loading-aura {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 56%;
  width: min(70vw, 460px);
  aspect-ratio: 1;
  border-radius: 50%;
  background-color: var(--accent);
  opacity: .26;
  mix-blend-mode: multiply;
  -webkit-mask: radial-gradient(circle, transparent 0 13%, #000 32%, transparent 71%);
  mask: radial-gradient(circle, transparent 0 13%, #000 32%, transparent 71%);
  transform: translate(-50%, -50%);
  transition: background-color .8s ease;
}
.loading-art svg { position: relative; z-index: 1; }
.loading-copy, .result-copy { width: min(100%, 760px); min-width: 0; margin: 0 auto; overflow: visible; text-align: center; }
.person-name { margin: 0 0 14px; }
.loading-copy h2 { margin: 0; font-size: clamp(46px, 11vw, 72px); line-height: .98; }
.loading-copy > p:not(.person-name, .remaining, .source-note) { margin: 20px 0 28px; color: var(--muted); font: 24px/1.3 var(--display); }
.progress-track { position: relative; height: 2px; margin: 0 2px 18px; background: rgba(20,20,19,.14); }
.progress-track span { display: block; width: 8%; height: 2px; background: linear-gradient(90deg,#ef7659,#a9d2df,#bda7db,#b6c3a7,#e7c963); transition: width .25s linear; }
.progress-track i { position: absolute; top: 50%; left: 8%; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); transform: translate(-50%,-50%); transition: left .25s linear; }
.progress-meta { display: flex; justify-content: space-between; text-align: left; }
.progress-meta b { font-weight: 400; }
.remaining { margin: 28px 0 0; }
.source-note { margin: 60px 0 0; color: #55534e; }

.result-copy { padding-bottom: 6px; }
.result-label { display: block; margin-bottom: 12px; }
.result-copy h2 { margin: 0; font-size: clamp(50px, 12vw, 79px); line-height: .94; }
.result-line { margin: 18px auto 24px; color: #33322f; font: italic clamp(21px, 5vw, 30px)/1.25 var(--display); }
.keywords { margin: 0 auto; line-height: 1.8; }
.share-block { margin-top: 20px; }
.share-label {
  display: block;
  margin-bottom: 10px;
  font-size: 9px;
  letter-spacing: .24em;
  text-transform: uppercase;
}
.share-actions {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr .8fr;
  gap: 8px;
  width: min(100%, 430px);
  margin: 0 auto;
}
.share-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 42px;
  border: 1px solid rgba(18,19,19,.22);
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(255,255,255,.34);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.share-action:hover { border-color: var(--ink); background: rgba(255,255,255,.68); transform: translateY(-1px); }
.share-action:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.share-action svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.share-action.icon-only svg.x-logo { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.share-action.icon-only svg.x-logo path { fill: currentColor; stroke: none; }
.share-action span { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.share-status { min-height: 15px; margin: 7px 0 -5px; color: #55534e; font-size: 10px; }
.again-button {
  margin-top: 26px;
  border: 0;
  border-bottom: 1px solid var(--ink);
  padding: 4px 0;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
}
body[data-profile="first-principles"] .result-copy h2 { font-size: clamp(46px, 10vw, 70px); }

@media (min-width: 860px) {
  .site-header { height: 94px; padding-top: 32px; }
  .site-header .wordmark { font-size: 40px; }
  .screen { padding-top: 100px; }
  .screen-layout { min-height: calc(100svh - 124px); grid-template-columns: minmax(390px, 1.06fr) minmax(380px, .94fr); gap: clamp(50px, 7vw, 100px); align-items: center; }
  .loading-art, .result-art { height: min(74svh, 760px); }
  .intro-art { height: auto; aspect-ratio: 853 / 680; margin-inline: 0; overflow: hidden; }
  .intro-copy, .loading-copy, .result-copy { margin: 0; }
  .intro-copy { max-width: 540px; }
  h1 { font-size: clamp(66px, 6.2vw, 94px); }
  .lede { font-size: 28px; }
  .loading-copy h2, .result-copy h2 { font-size: clamp(66px, 6vw, 90px); }
  body[data-profile="first-principles"] .result-copy h2 { font-size: clamp(58px, 5vw, 78px); }
  .loading-copy > p:not(.person-name, .remaining, .source-note) { font-size: 28px; }
}

@media (max-width: 480px) and (max-height: 900px) {
  .site-header { height: calc(62px + env(safe-area-inset-top)); padding-top: calc(18px + env(safe-area-inset-top)); }
  .site-header .wordmark { font-size: 27px; }
  .site-header > span { font-size: 8px; }
  .screen { padding-top: calc(62px + env(safe-area-inset-top)); }
  .intro-art { margin-bottom: 0; }
  h1 {
    margin-inline: -.08em;
    padding: .04em .08em .08em;
    font-size: clamp(39px, 11.4vw, 45px);
    line-height: .98;
  }
  .lede { margin: 12px 0 14px; font-size: 21px; }
  #matchForm { gap: 7px; }
  .field input { height: 34px; font-size: 16px; }
  .find-button { min-height: 48px; font-size: 16px; }
  .loading-art, .result-art { height: clamp(300px, 39svh, 340px); }
  .loading-copy h2 { padding-inline: .08em; font-size: clamp(38px, 10.8vw, 44px); line-height: 1; }
  .loading-copy > p:not(.person-name, .remaining, .source-note) { margin: 14px 0 20px; font-size: 20px; }
  .remaining { margin-top: 20px; }
  .source-note { margin-top: 34px; }
  .result-copy h2 { padding-inline: .08em; font-size: clamp(38px, 10.5vw, 46px); line-height: .98; }
  body[data-profile="first-principles"] .result-copy h2 { font-size: clamp(36px, 9.6vw, 42px); line-height: 1; }
  .result-line { margin: 12px auto 16px; font-size: 20px; }
  .share-block { margin-top: 14px; }
  .again-button { margin-top: 14px; }
}

@media (max-width: 370px) {
  .site-header { padding-inline: 16px; }
  .site-header .wordmark { font-size: 24px; letter-spacing: .18em; }
  .site-header > span { font-size: 7px; letter-spacing: .24em; }
  .share-actions { gap: 6px; }
  .share-action { gap: 5px; padding-inline: 7px; }
  .share-action span { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
