/* Free IQ Test Lab */
@font-face { font-family: "Bricolage Grotesque"; font-weight: 600; font-display: swap; src: url("../fonts/bricolage-grotesque-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 800; font-display: swap; src: url("../fonts/bricolage-grotesque-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 400; font-display: swap; src: url("../fonts/instrument-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 700; font-display: swap; src: url("../fonts/instrument-sans-latin-700-normal.woff2") format("woff2"); }

:root {
  --paper: #F2F5F9;
  --sheet: #FFFFFF;
  --ink: #10203F;
  --graphite: #4B5870;
  --line: #CBD5E3;
  --marker: #FFD43B;
  --pass: #17734B;
  --miss: #B4380B;
  --fig-ink: #10203F;
  --fig-tint: #9FB0C8;
  --fig-bg: #FFFFFF;
  --display: "Bricolage Grotesque", "Arial Narrow", Arial, sans-serif;
  --body: "Instrument Sans", "Segoe UI", Arial, sans-serif;
  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 1.0625rem; line-height: 1.6;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--marker); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 6px var(--marker); }
h1, h2, h3 { font-family: var(--display); line-height: 1.08; margin: 0; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-weight: 800; font-size: clamp(2.5rem, 6.4vw, 4.6rem); }
h2 { font-weight: 800; font-size: clamp(1.8rem, 3.6vw, 2.75rem); }
h3 { font-weight: 600; font-size: 1.3rem; }
p { margin: 0 0 1em; max-width: 68ch; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 10px 14px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

/* header */
.site-head { border-bottom: 2px solid var(--ink); background: var(--sheet); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 1.2rem; }
.brand svg { width: 30px; height: 30px; }
.site-nav { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 28px); flex-wrap: wrap; }
.site-nav a { text-decoration: none; font-weight: 700; font-size: 1rem; padding: 6px 0; }
.site-nav a:hover, .site-nav a[aria-current="page"] { box-shadow: inset 0 -0.55em 0 var(--marker); }

/* buttons */
.btn {
  display: inline-block; font: inherit; font-family: var(--display); font-weight: 800; font-size: 1.15rem;
  background: var(--ink); color: #fff; border: 2px solid var(--ink); padding: 14px 26px; border-radius: 6px;
  text-decoration: none; cursor: pointer; line-height: 1.2;
}
.btn:hover { background: #1B326A; }
.btn[disabled] { background: var(--line); border-color: var(--line); color: var(--graphite); cursor: not-allowed; }
.btn-small { font-size: 1rem; padding: 9px 16px; }
.btn-quiet { background: transparent; color: var(--ink); }
.btn-quiet:hover { background: var(--marker); }
.site-nav a.btn { color: #fff; padding: 9px 16px; box-shadow: none; }
.site-nav a.btn:hover { box-shadow: none; }

/* hero */
.hero { padding: clamp(36px, 7vw, 88px) 0 clamp(40px, 6vw, 80px); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.hero p.lede { font-size: 1.25rem; margin: 22px 0 28px; max-width: 34ch; }
.hero-actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.facts { list-style: none; padding: 0; margin: 36px 0 0; display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 0 clamp(20px, 3vw, 40px); }
.facts li { border-left: 3px solid var(--marker); padding-left: 12px; }
.facts b { display: block; font-family: var(--display); font-weight: 800; font-size: 1.9rem; line-height: 1; }
.facts span { color: var(--graphite); font-size: 0.98rem; }

/* puzzle sheet */
.sheet {
  background-color: var(--sheet); border: 2px solid var(--ink); border-radius: 8px; padding: clamp(16px, 2.6vw, 28px);
  background-image: linear-gradient(var(--paper) 1px, transparent 1px), linear-gradient(90deg, var(--paper) 1px, transparent 1px);
  background-size: 22px 22px;
}
.sheet h2, .sheet h3 { font-size: 1.25rem; font-weight: 800; margin-bottom: 14px; }
.matrix { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 360px; }
.matrix .cell, .tile {
  aspect-ratio: 1; background: var(--sheet); border: 2px solid var(--ink); border-radius: 4px; padding: 8%;
  display: grid; place-items: center;
}
.matrix .cell.gap { border-style: dashed; font-family: var(--display); font-weight: 800; font-size: 2rem; color: var(--graphite); background: var(--paper); }
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 16px; }
.tile { cursor: pointer; font: inherit; color: inherit; position: relative; width: 100%; }
.tile:hover { background: #FFF7D1; }
.tile[aria-checked="true"] { background: var(--marker); --fig-bg: var(--marker); box-shadow: 0 0 0 2px var(--ink); }
.tile .key { position: absolute; left: 4px; top: 2px; font-size: 0.72rem; font-weight: 700; color: var(--graphite); }
.sample-note { margin: 14px 0 0; min-height: 3.2em; font-size: 1rem; }
.sample-note b.ok { color: var(--pass); }
.sample-note b.no { color: var(--miss); }

/* sections */
.section { padding: clamp(40px, 6vw, 80px) 0; border-top: 2px solid var(--ink); }
.section.alt { background: var(--sheet); }
.section h2 { margin-bottom: 18px; max-width: 20ch; }
.section .intro { font-size: 1.15rem; margin-bottom: 32px; }

.areas { width: 100%; border-collapse: collapse; }
.areas th, .areas td { text-align: left; vertical-align: top; padding: 18px 16px 18px 0; border-top: 1px solid var(--line); }
.areas tr:last-child th, .areas tr:last-child td { border-bottom: 1px solid var(--line); }
.areas th { font-family: var(--display); font-weight: 800; font-size: 1.35rem; width: 22%; }
.areas td.eg { width: 30%; color: var(--graphite); }
.areas .count { display: block; font-family: var(--body); font-weight: 400; font-size: 0.95rem; color: var(--graphite); margin-top: 4px; }

.scale { margin: 0; }
.scale svg { width: 100%; height: auto; }
.scale .bell-compact { display: none; }
.bands { width: 100%; border-collapse: collapse; margin-top: 28px; max-width: 720px; }
.bands th, .bands td { text-align: left; padding: 10px 14px 10px 0; border-top: 1px solid var(--line); }
.bands thead th { border-top: 0; font-size: 0.95rem; color: var(--graphite); font-weight: 700; }
.bands td.num { font-variant-numeric: tabular-nums; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); }
.plain-list { margin: 0; padding-left: 1.1em; }
.plain-list li { margin-bottom: 0.6em; max-width: 60ch; }

.faq details { border-top: 1px solid var(--line); padding: 16px 0; max-width: 780px; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-family: var(--display); font-weight: 600; font-size: 1.25rem; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-weight: 800; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: 12px 0 0; }

.closing { background: var(--marker); }
.closing h2 { max-width: 18ch; margin-bottom: 24px; }

/* footer */
.site-foot { background: var(--ink); color: #DCE4F2; padding: 44px 0 32px; }
.site-foot a { color: #fff; }
.site-foot .cols { display: flex; flex-wrap: wrap; gap: 24px 56px; justify-content: space-between; }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; }
.site-foot .brand { color: #fff; }
.site-foot .fine { margin-top: 28px; font-size: 0.95rem; max-width: 80ch; color: #B9C5DA; }

/* article pages */
.page { padding: clamp(32px, 6vw, 72px) 0 clamp(48px, 7vw, 96px); }
.page h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); margin-bottom: 20px; max-width: 18ch; }
.page h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin: 44px 0 14px; }
.page .lede { font-size: 1.2rem; }
.page table { border-collapse: collapse; margin: 8px 0 24px; width: 100%; max-width: 720px; }
.page th, .page td { text-align: left; padding: 9px 14px 9px 0; border-top: 1px solid var(--line); }
.note { background: var(--sheet); border-left: 6px solid var(--marker); padding: 16px 20px; max-width: 68ch; margin: 24px 0; }
.note p:last-child { margin-bottom: 0; }

/* ---- test ---- */
.test-shell { padding: clamp(20px, 4vw, 48px) 0 clamp(48px, 7vw, 96px); min-height: 70vh; }
.test-shell .wrap { max-width: 860px; }
.start h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); margin-bottom: 16px; }
.start .rules { list-style: none; padding: 0; margin: 28px 0; border-top: 1px solid var(--line); }
.start .rules li { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 9.5em 1fr; gap: 12px; }
.start .rules b { font-family: var(--display); font-weight: 800; }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; font-weight: 700; }
.bar .area { color: var(--graphite); font-weight: 400; }
.timer { font-variant-numeric: tabular-nums; background: var(--sheet); border: 2px solid var(--ink); border-radius: 4px; padding: 2px 10px; }
.timer.low { background: var(--marker); }
.progress { height: 10px; background: var(--sheet); border: 2px solid var(--ink); border-radius: 5px; overflow: hidden; margin-bottom: 26px; }
.progress i { display: block; height: 100%; background: var(--ink); width: 0; transition: width .25s ease; }
.q h2 { font-size: clamp(1.35rem, 2.8vw, 1.8rem); font-weight: 600; margin-bottom: 20px; max-width: 34ch; line-height: 1.25; letter-spacing: 0; }
.q h2.long { font-family: var(--body); font-weight: 400; font-size: 1.2rem; line-height: 1.55; max-width: 62ch; text-wrap: pretty; }
.q .sheet.board { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: clamp(20px, 4vw, 44px); align-items: center; }
.q .sheet.board .tiles { grid-template-columns: repeat(3, 1fr); margin-top: 0; max-width: 330px; }
.q .pick { font-weight: 700; margin: 0 0 10px; }
.q .sheet { margin-bottom: 8px; }
.q .matrix { max-width: 330px; }
.series { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.series span { min-width: 58px; text-align: center; font-family: var(--display); font-weight: 800; font-size: 1.6rem; background: var(--sheet); border: 2px solid var(--ink); border-radius: 4px; padding: 8px 10px; }
.series span.gap { border-style: dashed; background: var(--paper); color: var(--graphite); }
.choices { display: grid; gap: 8px; }
.choice {
  font: inherit; text-align: left; background: var(--sheet); color: var(--ink); border: 2px solid var(--ink); border-radius: 4px;
  padding: 12px 14px; cursor: pointer; display: grid; grid-template-columns: 1.6em 1fr; gap: 6px;
}
.choice:hover { background: #FFF7D1; }
.choice[aria-checked="true"] { background: var(--marker); }
.choice .key { font-weight: 700; color: var(--graphite); }
.choices.short { grid-template-columns: repeat(5, 1fr); }
.choices.short .choice { text-align: center; grid-template-columns: 1fr; font-family: var(--display); font-weight: 800; font-size: 1.3rem; }
.choices.short .choice .key { font-family: var(--body); font-size: 0.72rem; font-weight: 700; text-align: left; }
.actions { display: flex; align-items: center; gap: 18px; margin-top: 26px; flex-wrap: wrap; }
.linkish { font: inherit; background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; }

/* result */
.result h1 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 600; margin-bottom: 4px; }
.score-line { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }
.score-num { font-family: var(--display); font-weight: 800; font-size: clamp(5rem, 16vw, 9rem); line-height: 0.9; letter-spacing: -0.04em; }
.score-band { font-family: var(--display); font-weight: 800; font-size: 1.6rem; background: var(--marker); padding: 2px 10px; }
.result .scale { margin: 22px 0 8px; }
.parts { width: 100%; border-collapse: collapse; margin: 8px 0 8px; }
.parts th, .parts td { text-align: left; padding: 12px 12px 12px 0; border-top: 1px solid var(--line); }
.parts td.meter { width: 50%; }
.meter-track { height: 14px; border: 2px solid var(--ink); border-radius: 3px; background: var(--sheet); }
.meter-track i { display: block; height: 100%; background: var(--ink); }
.result h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin: 44px 0 14px; }
.review { list-style: none; padding: 0; margin: 0; counter-reset: rv; }
.review li { border-top: 1px solid var(--line); padding: 16px 0; display: grid; grid-template-columns: 2.4em 1fr; gap: 8px; }
.review li::before { counter-increment: rv; content: counter(rv); font-family: var(--display); font-weight: 800; font-size: 1.2rem; }
.review .mark { font-weight: 700; }
.review .mark.ok { color: var(--pass); }
.review .mark.no { color: var(--miss); }
.review p { margin: 4px 0 0; }
.review .mini { display: flex; gap: 14px; align-items: flex-start; margin-top: 10px; flex-wrap: wrap; }
.review .mini figure { margin: 0; width: 76px; font-size: 0.85rem; color: var(--graphite); }
.review .mini .tile { cursor: default; margin-bottom: 4px; }
.review .mini .tile:hover { background: var(--sheet); }
.review .mini-grid { display: grid; grid-template-columns: repeat(3, 34px); gap: 3px; }
.review .mini-grid .cell { width: 34px; height: 34px; border: 1.5px solid var(--ink); border-radius: 2px; padding: 3px; background: var(--sheet); display: grid; place-items: center; font-weight: 700; }
.copied { margin-left: 4px; color: var(--pass); font-weight: 700; }
[hidden] { display: none !important; }

@media (max-width: 860px) {
  .hero .wrap, .two-col { grid-template-columns: 1fr; }
  .areas, .areas tbody, .areas tr, .areas th, .areas td { display: block; width: 100%; }
  .areas th { padding-bottom: 4px; }
  .areas td { border-top: 0; padding-top: 0; padding-bottom: 10px; }
  .areas td.eg { width: 100%; padding-bottom: 18px; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .scale .bell-wide { display: none; }
  .scale .bell-compact { display: block; }
  .q .sheet.board { grid-template-columns: 1fr; }
  .q .sheet.board .matrix { max-width: 250px; }
  .q .sheet.board .tiles { max-width: 250px; }
  .choices.short { grid-template-columns: repeat(3, 1fr); }
  .start .rules li { grid-template-columns: 1fr; gap: 2px; }
  .parts td.meter { width: 38%; }
}
@media (max-width: 480px) {
  body { font-size: 1rem; }
  .facts { grid-template-columns: 1fr 1fr; gap: 16px 20px; }
  .site-nav a:not(.btn) { font-size: 0.95rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .progress i { transition: none; }
}
@media print {
  .site-head, .site-foot, .actions { display: none; }
}
