@import url('fonts/fonts.css');

/* ------------------------------------------------------------------ tokens (from design/) */
:root {
  --bg: #F3F0E8;
  --surface: #FFFFFF;
  --surface-2: #F6F4EE;   /* cells, media wells */
  --chip: #FAF8F3;
  --line: #DDD8CC;
  --ink: #15171C;
  --ink-2: #3D414A;
  --text-2: #454952;
  --muted: #555A64;
  --faint: #9A9DA4;
  --accent: #2A3FD0;
  --accent-hover: #1C2C9E;
  --accent-soft: #E4E7FB;
  --accent-on-dark: #A9B3FF;
  --dark: #15171C;
  --dark-2: #23262D;
  --dark-line: #3A3E47;
  --on-dark: #F3F0E8;
  --on-dark-muted: #C9C6BE;
  --ok: #1E7A45;
  --ok-soft: #E3F2E8;
  --bad: #A5321F;
  --bad-soft: #F8E6E1;
  --warn: #B7791F;

  --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --r-card: 28px;
  --r-card-sm: 22px;
  --r-cell: 14px;
  --r-ctl: 12px;
  --shadow-card: 0 1px 0 var(--line), 0 30px 60px -30px rgba(21, 23, 28, .25);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 4px; }
a:hover { color: var(--accent-hover); }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 780px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
@media (max-width: 640px) { .hide-sm { display: none; } .demo-head .mono-label { font-size: 12px; } }

/* ------------------------------------------------------------------ type */
h1, h2, h3 { margin: 0; }
.display { font: 400 clamp(58px, 7.2vw, 104px)/.96 var(--serif); letter-spacing: -.025em; }
.hero-title { font-size: clamp(48px, 6vw, 88px); line-height: 1; }
.display em, .h-serif em { font-style: italic; color: var(--accent); }
.h-serif { font: 400 clamp(42px, 4.5vw, 64px)/1 var(--serif); letter-spacing: -.02em; }
.h-page { font: 400 clamp(44px, 5.5vw, 72px)/1 var(--serif); letter-spacing: -.02em; margin: 56px 0 20px; }
.lead { font-size: clamp(17px, 1.5vw, 20px); line-height: 1.55; color: var(--text-2); max-width: 560px; margin: 0; }
.eyebrow { font: 500 13px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.mono-label { font: 400 13px/1.2 var(--mono); letter-spacing: .04em; color: var(--muted); }
.prose h2 { font: 400 clamp(32px, 3.5vw, 44px)/1.05 var(--serif); letter-spacing: -.015em; margin: 56px 0 14px; }
.prose h3 { font-size: 19px; font-weight: 600; margin: 32px 0 8px; }
.prose p, .prose li { color: var(--text-2); max-width: 68ch; }
.prose li { margin: 6px 0; }
.sources li { font-size: 14px; color: var(--muted); }

/* ------------------------------------------------------------------ header / footer */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; justify-content: space-between; align-items: center; min-height: 88px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.brand:hover { color: var(--ink); }
.brand img { display: block; height: 31px; width: auto; }
.nav { display: flex; align-items: center; gap: 36px; }
.nav a:not(.btn) { font-size: 15px; color: var(--muted); text-decoration: none; }
.nav a:not(.btn):hover { color: var(--ink); }
.menu { display: none; position: relative; }
.menu summary { list-style: none; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 999px; background: var(--chip); cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: 54px; z-index: 20; width: 240px; display: flex; flex-direction: column; gap: 4px;
  padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-card); }
.menu-panel a { padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 15px; }
.menu-panel a:hover { background: var(--surface-2); color: var(--ink); }
.menu-panel .btn { margin-top: 6px; }
@media (max-width: 860px) {
  .site-header .wrap { min-height: 72px; }
  .nav { display: none; }
  .menu { display: block; }
  .brand { font-size: 16px; gap: 10px; }
  .brand img { height: 27px; }
  .brand { font-size: 18px; }
}
.site-footer { margin-top: 96px; border-top: 1px solid var(--line); }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: flex-start; gap: 32px 48px; flex-wrap: wrap; padding-top: 40px; padding-bottom: 40px; }
.site-footer .name { font-size: 16px; font-weight: 600; display: block; margin-bottom: 8px; }
.site-footer nav { display: flex; gap: 28px; flex-wrap: wrap; font-size: 14px; }
.site-footer nav a { color: var(--ink); }
.site-footer .company { flex-basis: 100%; font-style: normal; padding-top: 20px; border-top: 1px solid var(--line); }
.site-footer .company a { color: var(--muted); }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; height: 60px; padding: 0 30px;
  border-radius: 999px; border: 0; background: var(--accent); color: #fff; font: 500 18px var(--sans); text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.12); color: #fff; }
.btn.sm { height: 44px; padding: 0 20px; font-size: 15px; gap: 8px; }
.btn.dark { background: var(--ink); }
.btn.light { background: #fff; color: var(--ink); }
.btn.light:hover { background: #E9E6DD; filter: none; color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { background: var(--chip); filter: none; color: var(--ink); }
.btn:disabled { opacity: .4; cursor: not-allowed; filter: none; }
.btn svg { flex: none; }
.text-link { font-size: 16px; font-weight: 500; color: var(--ink); }
.text-link:hover { color: var(--accent); }

/* ------------------------------------------------------------------ generic surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 36px; }
.card.lift { box-shadow: var(--shadow-card); }
.card + .card { margin-top: 20px; }
.chip { align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px 8px 10px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--chip); font-size: 14px; color: var(--ink-2); }
.chip .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent); }
.tag { padding: 6px 12px; border-radius: 999px; background: var(--bg); font: 400 12px var(--mono); color: var(--text-2); letter-spacing: .04em; }
.checks { display: flex; gap: 24px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.checks span { display: inline-flex; align-items: center; gap: 8px; }
.notice { padding: 16px 20px; border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 14px; background: var(--chip); color: var(--ink-2); font-size: 15px; margin: 16px 0; }
.notice p { margin: .25em 0; }
.notice.info { border-left-color: var(--accent); }
@media (max-width: 640px) { .card { padding: 22px; border-radius: var(--r-card-sm); } }

/* ------------------------------------------------------------------ landing page */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 72px; align-items: center; padding: 96px 0 104px; }
.hero-copy { display: flex; flex-direction: column; gap: 32px; }
.hero-cta { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.demo { display: flex; flex-direction: column; gap: 20px; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-card); }
.demo-head { display: flex; justify-content: space-between; align-items: center; }
.demo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.demo-grid > div { aspect-ratio: 1; background: var(--surface-2); border-radius: var(--r-cell); }
.demo-grid .q { display: flex; align-items: center; justify-content: center; background: transparent; border: 2px dashed var(--accent); font: 400 64px var(--serif); color: var(--accent); }
.demo-opts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.demo-opts > div { height: 64px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: #fff; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.stats > div { display: flex; flex-direction: column; gap: 6px; padding: 28px; border-left: 1px solid var(--line); }
.stats > div:first-child { padding-left: 0; border-left: 0; }
.stats b { font: 400 52px/1 var(--serif); }
.stats span { font-size: 15px; color: var(--muted); }
.section { padding-top: 128px; }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 72px; align-items: end; margin-bottom: 48px; }
.section-head > div { display: flex; flex-direction: column; gap: 16px; }
.section-head p { margin: 0; font-size: 18px; line-height: 1.6; color: var(--text-2); }
.subtests { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.subtest { display: flex; flex-direction: column; gap: 20px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card-sm); }
.subtest .media { height: 132px; display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--surface-2); border-radius: var(--r-cell);
  font: 500 24px var(--mono); }
.subtest .media .sep { color: var(--faint); }
.subtest .media .q { color: var(--accent); }
.subtest h3 { font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.subtest p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); }
.dark-block { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 72px; align-items: center; padding: 64px; background: var(--dark); color: var(--on-dark); border-radius: 32px; }
.dark-block .eyebrow { color: var(--accent-on-dark); }
.dark-block p { margin: 0; font-size: 18px; line-height: 1.6; color: var(--on-dark-muted); }
.dark-block a { color: #fff; }
.split { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 72px; align-items: center; }
.split > div:first-child { display: flex; flex-direction: column; gap: 20px; }
.split p { margin: 0; font-size: 18px; line-height: 1.6; color: var(--text-2); }
.tips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tips > div { display: flex; flex-direction: column; gap: 16px; padding: 24px 0; border-top: 1px solid var(--ink); }
.tips h3 { font-size: 18px; font-weight: 600; }
.tips p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); }
.cta { display: flex; justify-content: space-between; align-items: center; gap: 32px 48px; padding: 56px 64px; background: var(--accent); color: #fff; border-radius: 32px; }
.cta h2 { font: 400 clamp(40px, 4vw, 56px)/1.02 var(--serif); letter-spacing: -.02em; }
.cta p { margin: 12px 0 0; font-size: 18px; color: #E4E7FB; }
.cta .btn { flex-shrink: 0; }
@media (max-width: 1080px) {
  .subtests, .tips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .hero, .dark-block, .split, .section-head { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .hero { padding: 40px 0 36px; gap: 22px; }
  .hero-copy { gap: 22px; }
  .dark-block { padding: 36px 24px; border-radius: 24px; }
  .section { padding-top: 72px; }
  .section-head { margin-bottom: 28px; gap: 16px; }
  .cta { flex-direction: column; align-items: stretch; padding: 36px 24px; border-radius: 24px; }
}
@media (max-width: 640px) {
  .hero-cta .btn { width: 100%; height: 56px; font-size: 17px; }
  .hero-cta .text-link { display: none; }
  .checks { justify-content: center; gap: 16px; font-size: 13px; }
  .demo { padding: 18px; border-radius: var(--r-card-sm); gap: 14px; }
  .demo-grid .q { font-size: 44px; }
  .demo-opts > div { height: 48px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > div { padding: 20px 0 22px 0; border-left: 0; }
  .stats > div:nth-child(even) { padding-left: 20px; border-left: 1px solid var(--line); }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stats b { font-size: 40px; }
  .subtests, .tips { grid-template-columns: minmax(0, 1fr); }
  .tips > div { padding: 20px 0; }
}

/* ------------------------------------------------------------------ forms */
.form-card { max-width: 720px; }
label { display: block; font-size: 15px; font-weight: 600; margin: 22px 0 8px; }
label .muted { font-weight: 400; }
input[type=number], input[type=text], select {
  width: 100%; max-width: 380px; height: 52px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: #fff; color: var(--ink); font: 400 16px var(--sans); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2315171C' stroke-width='1.8'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; font-size: 16px; color: var(--ink-2); margin: 18px 0 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.hint { font-size: 14px; color: var(--muted); margin: 6px 0 0; }
.error { color: var(--bad); font-size: 14px; margin: 6px 0 0; }
.form-actions { margin-top: 28px; }

/* ------------------------------------------------------------------ test */
body.bare .site-header .nav, body.bare .site-header .menu { display: none; }
.test-top { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 16px 0 14px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.test-top .where { font: 400 13px/1.3 var(--mono); letter-spacing: .04em; color: var(--muted); text-transform: uppercase; }
.progress { height: 3px; width: min(320px, 50vw); background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.timer-box { text-align: right; font: 400 13px var(--mono); color: var(--muted); letter-spacing: .04em; }
.timer { display: block; font: 500 22px var(--mono); color: var(--ink); letter-spacing: 0; }
.timer.low { color: var(--bad); }
.test-main { max-width: 760px; margin: 0 auto; padding: 28px 0 48px; }
.item-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-card); padding: 28px;
  /* One cell size for the matrix and the answer options, so figure sizes (a rule attribute)
     look identical in both. A matrix SVG is 316 units wide (3 cells of 100 + 2 gaps of 8). */
  --cell: clamp(64px, calc((100vw - 114px) / 3), 128px); }
.item-card .demo-head { margin-bottom: 18px; }
.stem { display: flex; justify-content: center; }
.stem svg { width: calc(var(--cell) * 3.16); max-width: 100%; height: auto; display: block; }
.stem.small { background: var(--surface-2); border-radius: var(--r-cell); padding: 16px; max-width: 540px; margin: 0 auto; }
/* Rotation: target and options share the cube scale, so they get the same width. */
.stem.small svg { width: calc(var(--cell) * 1.25); }
.pick-label { font-size: 14px; color: var(--muted); margin: 22px auto 10px; text-align: center; }
.pick-label.center { text-align: center; max-width: none; }
.opts { display: grid; grid-template-columns: repeat(auto-fill, calc(var(--cell) + 14px)); justify-content: center; gap: 10px; max-width: calc(4 * (var(--cell) + 14px) + 30px); margin: 0 auto; }
.opts.six { grid-template-columns: repeat(auto-fill, calc(var(--cell) * 1.25 + 14px)); max-width: calc(3 * (var(--cell) * 1.25 + 14px) + 20px); }
.opt { position: relative; display: flex; flex-direction: column; align-items: stretch; padding: 6px 6px 4px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.opt:hover { border-color: var(--faint); }
.opt svg { width: var(--cell); height: auto; display: block; }
.opts.six .opt svg { width: calc(var(--cell) * 1.25); }
.opt .n { order: 2; display: block; text-align: center; font: 400 11px/1.4 var(--mono); color: var(--faint); } /* below the figure: never covers rule-bearing strokes */
.opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.opt.correct { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.series { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 36px 8px;
  background: var(--surface-2); border-radius: var(--r-cell); font: 500 clamp(22px, 4.5vw, 32px) var(--mono); }
.series .sep { color: var(--faint); }
.series .q { color: var(--accent); }
.answer-row { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 22px; }
.answer-row input { max-width: 200px; height: 60px; text-align: center; font: 500 26px var(--mono); }
.sign { width: 60px; height: 60px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--chip); font: 500 20px var(--mono); color: var(--ink); cursor: pointer; }
.alphabet { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 6px; margin-top: 22px; }
.key { height: 46px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: 500 16px var(--mono); color: var(--ink); cursor: pointer; padding: 0; }
.key:hover { border-color: var(--faint); }
.key[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; }
.feedback { margin-top: 18px; padding: 14px 18px; border-radius: 14px; font-size: 15px; }
.feedback p { margin: .2em 0; }
.feedback.good { background: var(--ok-soft); color: #14512E; }
.feedback.bad { background: var(--bad-soft); color: #7A2415; }
.intro { display: flex; flex-direction: column; gap: 16px; margin-bottom: 28px; }
.intro p { margin: 0; font-size: 18px; line-height: 1.6; color: var(--text-2); }
@media (max-width: 640px) {
  .item-card { padding: 16px; border-radius: var(--r-card-sm); }
  .opts { gap: 6px; }
  .item-card { --cell: clamp(60px, calc((100vw - 132px) / 3), 128px); } /* page 2x20 + card 2x16 + border + 3 option frames + gaps */
  .alphabet { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .timer { font-size: 18px; }
  .actions .btn { height: 52px; font-size: 16px; padding: 0 22px; }
}

/* ------------------------------------------------------------------ result & report */
.page { max-width: 1000px; }
.score-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 40px; align-items: center; }
@media (max-width: 860px) { .score-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; } }
.two-col > .card { margin-top: 0; }
.score-card { display: flex; flex-direction: column; gap: 24px; }
.score-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.score-top .label { font-size: 14px; color: var(--muted); }
.score-value { font: 400 clamp(88px, 12vw, 128px)/1 var(--serif); letter-spacing: -.02em; }
.score-ci { font-size: 16px; color: var(--text-2); }
.score-band { font-weight: 600; }
.scale svg { width: 100%; height: auto; display: block; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border-top: 1px solid var(--ink); }
.kv > div { display: flex; flex-direction: column; gap: 6px; padding: 20px 20px 22px 0; font-size: 14px; color: var(--muted); }
.kv b { font: 400 40px/1 var(--serif); color: var(--ink); }
.amounts { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.amounts label { margin: 0; font-weight: 500; }
.amounts input { position: absolute; opacity: 0; pointer-events: none; }
.amounts span { display: inline-flex; align-items: center; height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; font-size: 15px; }
.amounts input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hover); }
.amounts input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.reading { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.reading > div { padding: 22px 0; border-top: 1px solid var(--ink); }
.reading h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.reading p { margin: 0; font-size: 15px; color: var(--muted); }
.buy-list { padding-left: 1.1em; color: var(--text-2); }
.profile svg { width: 100%; height: auto; }
@media (max-width: 640px) { .reading { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------------------------ admin tables */
table.data { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
table.data th { font: 500 12px var(--mono); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; background: var(--chip); }

@media print {
  .site-header, .site-footer, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
