/* ===========================================================
   Typically You — typicallyyou.com
   One stylesheet for all three page types: browse, quiz, result.
   Layout follows the ProProfs browse grid; palette and type are ours.
   =========================================================== */


/* Self-hosted so the first paint waits on nothing but our own origin.
   Variable fonts: one file covers weights 400-700. Latin only — Chinese
   is rendered with the reader's own system fonts, which are better at it
   and cost nothing to download. */
@font-face {
  font-family: "Literata";
  src: url("/fonts/literata.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Karla";
  src: url("/fonts/karla.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  --bg:      #F7F6F4;   /* page ground — cards sit lighter on top of it */
  --card:    #FFFFFF;
  --surface: #F1EFEB;
  --sunken:  #E7E4DE;
  --text:    #1B1A17;
  --muted:   #63605A;
  --faint:   #918C85;
  --rule:    #E4E0D9;
  --rule-2:  #CFCAC1;

  --accent:      #2D6A5B;
  --accent-soft: #E2ECE8;

  --shadow:    0 1px 2px rgba(27, 26, 23, .05);
  --shadow-up: 0 6px 20px rgba(27, 26, 23, .11);

  --serif: "Literata", Georgia, "Songti SC", "Times New Roman", serif;
  --sans:  "Karla", -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;

  --wide: 1180px;
  --col:  660px;
  --pad:  clamp(16px, 4vw, 28px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.012em;
  text-wrap: balance;
  margin: 0;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
}

.wide { max-width: var(--wide); margin-inline: auto; padding-inline: var(--pad); }
.col  { max-width: var(--col);  margin-inline: auto; padding-inline: var(--pad); }

.label {
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--faint);
}
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── header + search ────────────────────────────────────── */
.site-head {
  background: var(--card);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 40;
}
.site-head .wide {
  display: flex; align-items: center; gap: 14px;
  min-height: 62px; padding-block: 10px;
}
.brand {
  font-family: var(--serif); font-weight: 600; font-size: 18px;
  letter-spacing: -.02em; white-space: nowrap; flex: 0 0 auto;
}
.brand b { color: var(--accent); font-weight: 600; }

.search {
  position: relative; flex: 1 1 auto;
  max-width: 520px; margin-inline: auto;
}
.search input {
  width: 100%; height: 42px;
  padding: 0 42px 0 16px;
  font: inherit; font-size: 15px;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--rule-2); border-radius: 999px;
  transition: border-color .14s ease, background .14s ease;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-color: var(--accent); background: var(--card); }
.search svg {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; stroke: var(--faint); fill: none; stroke-width: 2; pointer-events: none;
}

.head-links { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.head-links a, .head-links button {
  font-size: 14px; color: var(--muted); padding: 7px 10px; border-radius: 7px;
}
.head-links a:hover, .head-links button:hover { color: var(--text); background: var(--surface); }
@media (max-width: 760px) {
  .site-head .wide { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
  .head-links { margin-left: auto; }
}

/* ── notices (sample data, empty state) ─────────────────── */
.notice {
  border: 1px solid var(--rule-2); border-left: 3px solid var(--accent);
  background: var(--card); border-radius: 6px;
  padding: 14px 16px; margin: 20px 0 0;
  font-size: 14px; color: var(--muted);
}
.notice b { color: var(--text); }
.notice code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 12.5px; background: var(--surface);
  padding: 1px 5px; border-radius: 3px;
}

/* ── browse: filters + grid ─────────────────────────────── */
.browse-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 26px 0 14px;
}
.browse-head h1 { font-size: clamp(21px, 3vw, 26px); }
.browse-head .count { margin-left: auto; font-size: 13.5px; color: var(--faint); }

.filters {
  display: flex; gap: 7px; overflow-x: auto; padding-bottom: 14px;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filters a, .filters .on {
  flex: 0 0 auto; font-size: 13.5px; font-weight: 500;
  padding: 6px 14px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--rule-2); color: var(--muted);
  transition: border-color .12s, color .12s, background .12s;
}
.filters a:hover { border-color: var(--accent); color: var(--accent); }
.filters .on { background: var(--text); border-color: var(--text); color: var(--bg); }

.grid {
  display: grid; gap: 22px;
  grid-template-columns: 1fr;
  padding-bottom: 8px;
}
@media (min-width: 640px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px)  { .grid { grid-template-columns: repeat(3, 1fr); } }

/* ── quiz card ──────────────────────────────────────────── */
.qcard {
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px; overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease;
}
.qcard:hover, .qcard:focus-within {
  box-shadow: var(--shadow-up); transform: translateY(-2px); border-color: var(--rule-2);
}

.qcard .thumb {
  position: relative; aspect-ratio: 16 / 9;
  background: var(--surface); overflow: hidden;
  display: grid; place-items: center;
}
.qcard .thumb img, .qcard .thumb svg { width: 100%; height: 100%; object-fit: cover; }
.qcard .thumb::after {
  content: ""; position: absolute; inset: 0;
  background: rgba(27, 26, 23, .55);
  opacity: 0; transition: opacity .16s ease;
}
.qcard:hover .thumb::after, .qcard:focus-within .thumb::after { opacity: 1; }

.qcard .take {
  position: absolute; z-index: 2;
  left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.96);
  background: var(--accent); color: #fff;
  font-size: 14px; font-weight: 600;
  padding: 10px 22px; border-radius: 999px;
  opacity: 0; pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
  white-space: nowrap;
}
.qcard:hover .take, .qcard:focus-within .take { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.qcard .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.qcard .top { display: flex; align-items: center; gap: 10px; }
.pill {
  font-size: 11.5px; font-weight: 600; line-height: 1.5;
  padding: 3px 10px; border-radius: 999px;
  background: var(--pill-tint, var(--surface));
  color: var(--pill-ink, var(--muted));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%;
}
a.pill { display: inline-block; transition: opacity .12s; }
a.pill:hover { opacity: .78; }

.qcard .attempts { margin-left: auto; font-size: 12px; color: var(--faint); white-space: nowrap; }
.qcard h2 {
  font-size: 17px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.qcard:hover h2, .qcard:focus-within h2 { color: var(--accent); }
.qcard .desc {
  margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.qcard .foot {
  margin-top: auto; padding-top: 10px; border-top: 1px solid var(--rule);
  font-size: 12.5px; color: var(--faint);
}

/* ── breadcrumbs ────────────────────────────────────────── */
.crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  padding: 18px 0 0; font-size: 13px; color: var(--faint);
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.crumbs i { font-style: normal; color: var(--rule-2); }
.crumbs [aria-current] { color: var(--faint); }

/* ── the other results of this quiz ─────────────────────── */
/* Turns a set of leaf pages into one cluster: every result links to
   every sibling, so a crawler can reach all of them from any one. */
.siblings {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  padding-bottom: 8px;
}
.siblings a {
  display: flex; align-items: baseline; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--rule); border-radius: 7px;
  background: var(--card); font-size: 14.5px;
  transition: border-color .12s, color .12s;
}
.siblings a:hover { border-color: var(--accent); color: var(--accent); }
.siblings a b {
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  letter-spacing: .05em; color: var(--faint);
  font-variant-numeric: tabular-nums; flex: 0 0 auto;
}
.siblings a:hover b { color: var(--accent); }
.siblings a span { min-width: 0; }

.sub { font-size: 20px; margin: 34px 0 14px; }
.backlink { padding: 26px 0 0; font-size: 14.5px; }
.backlink a { color: var(--accent); }

/* ── ad slots ───────────────────────────────────────────── */
.ad { margin: 30px 0; display: grid; place-items: center; min-height: 90px; }
.ad-placeholder {
  width: 100%; border: 1px dashed var(--rule-2); border-radius: 6px;
  background: var(--surface); color: var(--faint);
  display: grid; place-items: center; gap: 3px;
  text-align: center; padding: 26px 16px; font-size: 13px;
}
.ad-placeholder em { font-style: normal; font-size: 11.5px; opacity: .75; }

/* ── quiz page ──────────────────────────────────────────── */
.qhead { background: var(--card); border-bottom: 1px solid var(--rule); position: sticky; top: 62px; z-index: 30; }
.qhead .col { display: flex; align-items: center; gap: 12px; min-height: 46px; }
.qhead .back { font-size: 13.5px; color: var(--muted); }
.qhead .back:hover { color: var(--text); }
.qhead .step { margin-left: auto; font-size: 13px; color: var(--faint); }
.bar { height: 3px; background: var(--sunken); }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .28s ease; }

.qintro { padding: clamp(30px, 5vw, 50px) 0 0; }
.qintro h1 { font-size: clamp(26px, 4.4vw, 38px); }
.qintro .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; font-size: 13.5px; color: var(--muted); }
.qintro .meta span::after { content: "·"; margin-left: 8px; color: var(--rule-2); }
.qintro .meta span:last-child::after { content: none; }
.qintro .lede p { font-family: var(--serif); font-size: 17px; line-height: 1.65; color: var(--muted); }

.start {
  display: inline-block; margin-top: 8px;
  background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 600;
  padding: 13px 30px; border-radius: 8px;
  transition: background .14s ease;
}
.start:hover { background: var(--text); }

.qbody { padding: clamp(28px, 5vw, 48px) 0 70px; }
.qbody > .label { color: var(--accent); }
.qbody h2 { font-size: clamp(21px, 3.4vw, 29px); margin: 12px 0 26px; max-width: 27ch; }

.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: flex-start; gap: 13px;
  width: 100%; text-align: left; padding: 15px 16px;
  background: var(--card); border: 1px solid var(--rule-2); border-radius: 8px;
  font-family: var(--serif); font-size: 16.5px; line-height: 1.45;
  transition: border-color .12s ease, background .12s ease;
}
.opt .k {
  flex: 0 0 22px; width: 22px; height: 22px; margin-top: 1px;
  border: 1px solid var(--rule-2); border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--sans); font-size: 11.5px; font-weight: 700; color: var(--faint);
  transition: inherit;
}
.opt:hover, .opt:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.opt:hover .k, .opt:focus-visible .k { border-color: var(--accent); color: var(--accent); }
.hint { font-size: 13px; color: var(--faint); margin: 22px 0 0; }

.lookup { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.lookup input {
  height: 46px; padding: 0 14px; font: inherit;
  color: var(--text); background: var(--card);
  border: 1px solid var(--rule-2); border-radius: 8px;
}
.lookup input:focus { outline: none; border-color: var(--accent); }

/* ── result page ────────────────────────────────────────── */
.reveal { padding: clamp(30px, 5vw, 52px) 0 6px; border-bottom: 1px solid var(--rule); }
.reveal .code {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(42px, 10vw, 70px); line-height: 1;
  letter-spacing: -.03em; margin: 8px 0 6px;
}
.reveal h1 { font-size: clamp(20px, 3.2vw, 26px); font-weight: 400; color: var(--muted); }
.reveal .rare {
  margin: 20px 0 24px; padding: 13px 15px; border-radius: 0 6px 6px 0;
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  font-size: 14.5px;
}

.axes { display: flex; flex-direction: column; gap: 12px; padding: 24px 0 4px; }
.ax { display: grid; grid-template-columns: 66px 1fr 66px; gap: 10px; align-items: center; font-size: 12.5px; }
.ax .l { text-align: right; color: var(--faint); }
.ax .r { color: var(--faint); }
.ax .on { color: var(--text); font-weight: 700; }
.ax .track { height: 8px; background: var(--sunken); border-radius: 999px; position: relative; overflow: hidden; }
.ax .track i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 999px; }

.prose { padding: 8px 0; }
.prose p { font-family: var(--serif); font-size: 17.5px; line-height: 1.68; margin: 0 0 18px; max-width: 64ch; }
.prose h2 { font-size: 21px; margin: 32px 0 14px; }

.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { border: 1px solid var(--rule-2); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--muted); }

.rows { margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.rows li {
  list-style: none; display: flex; gap: 12px; align-items: baseline;
  padding: 11px 0; border-bottom: 1px solid var(--rule); font-size: 15px;
}
.rows li span { margin-left: auto; font-size: 12.5px; color: var(--faint); }

.actions { display: flex; gap: 9px; flex-wrap: wrap; padding: 28px 0 0; }
.actions button, .actions a {
  border: 1px solid var(--rule-2); border-radius: 8px;
  padding: 10px 16px; font-size: 14.5px; font-weight: 500;
  transition: border-color .12s, background .12s, color .12s;
}
.actions button:hover, .actions a:hover { border-color: var(--accent); color: var(--accent); }
.actions .go { background: var(--accent); border-color: var(--accent); color: #fff; }
.actions .go:hover { background: var(--text); border-color: var(--text); color: #fff; }

.faq { padding: 34px 0 0; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { padding: 14px 0; cursor: pointer; font-weight: 600; font-size: 15.5px; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+ "; color: var(--accent); font-weight: 700; }
.faq details[open] summary::before { content: "– "; }
.faq p { margin: 0 0 14px; font-family: var(--serif); color: var(--muted); }

/* ── language switcher (dropdown) ───────────────────────── */
.langs { position: relative; flex: 0 0 auto; }
.langs > summary {
  display: flex; align-items: center; gap: 7px;
  list-style: none; cursor: pointer; user-select: none;
  font-size: 13.5px; font-weight: 500; color: var(--muted);
  border: 1px solid var(--rule-2); border-radius: 999px;
  padding: 6px 12px; white-space: nowrap;
  transition: border-color .12s, color .12s;
}
.langs > summary::-webkit-details-marker { display: none; }
.langs > summary:hover { border-color: var(--accent); color: var(--text); }
.langs > summary svg {
  width: 10px; height: 10px; flex: 0 0 10px;
  stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round;
  transition: transform .16s ease;
}
.langs[open] > summary { border-color: var(--accent); color: var(--text); }
.langs[open] > summary svg { transform: rotate(180deg); }

.langmenu {
  position: absolute; right: 0; top: calc(100% + 7px); z-index: 60;
  min-width: 168px; padding: 5px;
  background: var(--card);
  border: 1px solid var(--rule-2); border-radius: 9px;
  box-shadow: var(--shadow-up);
  display: flex; flex-direction: column; gap: 1px;
}
.langmenu a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 6px;
  font-size: 14.5px; color: var(--text);
}
.langmenu a:hover { background: var(--surface); }
.langmenu a[aria-current="true"] { color: var(--accent); font-weight: 600; }
.langmenu a[aria-current="true"]::after { content: "✓"; margin-left: auto; font-size: 12.5px; }

/* ── Chinese typography ─────────────────────────────────── */
/* Latin still renders in Literata / Karla; CJK falls through to the
   reader's system face. Chinese headings read better in a sans, and
   Chinese body copy needs more leading than English. */
[lang|="zh"] {
  --serif: "Literata", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --sans:  "Karla", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
[lang|="zh"] h1, [lang|="zh"] h2, [lang|="zh"] h3 { letter-spacing: 0; line-height: 1.35; }
[lang|="zh"] .prose p { line-height: 1.9; }
[lang|="zh"] .qbody h2 { max-width: 22ch; }
[lang|="zh"] .reveal .code { letter-spacing: 0; }

/* One-sentence summary under a result name. */
.lede-one {
  font-family: var(--serif); font-size: 18px; line-height: 1.55;
  color: var(--muted); margin: 10px 0 0; max-width: 56ch;
}

/* ── standing pages (about / privacy / terms / contact) ─── */
.page { padding: clamp(34px, 6vw, 58px) 0 20px; }
.page h1 { font-size: clamp(28px, 4.6vw, 40px); }
.page .updated { font-size: 13.5px; color: var(--faint); margin: 12px 0 0; }
.page .prose { padding-top: 18px; }
.page .prose h2 { font-size: 20px; margin: 34px 0 12px; }
.page .prose h2:first-child { margin-top: 8px; }
.page .prose p { font-size: 17px; }
.page .prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.bullets { margin: 0 0 18px; padding-left: 22px; max-width: 64ch; }
.bullets li {
  font-family: var(--serif); font-size: 17px; line-height: 1.65;
  margin-bottom: 9px;
}
.bullets li::marker { color: var(--accent); }
[lang|="zh"] .bullets li { line-height: 1.85; }

/* Visible reminder that a legal field in data/site.json is still blank. */
mark.todo {
  background: #FFF3C4; color: #6B4E00;
  padding: 1px 7px; border-radius: 3px;
  font-family: var(--sans); font-size: 14px; font-weight: 600;
}

/* ── footer ─────────────────────────────────────────────── */
.site-foot {
  border-top: 1px solid var(--rule); margin-top: 54px;
  padding: 30px 0 46px; background: var(--card);
  font-size: 13.5px; color: var(--muted);
}
.site-foot .wide { display: flex; gap: 26px; flex-wrap: wrap; }
.site-foot p { margin: 10px 0 0; max-width: 46ch; line-height: 1.55; }
.site-foot .links { display: flex; flex-direction: column; gap: 7px; margin-left: auto; }
.site-foot .links a:hover { color: var(--accent); text-decoration: underline; }

/* ── result artwork ───────────────────────────────────────
   Cat art arrives at wildly different aspect ratios (0.56 to
   1.99). A fixed 3:2 frame with object-fit:cover makes every
   result page sit at the same rhythm regardless of the source. */
.resultart {
  display: block;
  width: 100%;
  margin: 22px 0 0;
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
  background: var(--sunken);
  aspect-ratio: 3 / 2;
}
.resultart img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;   /* faces sit above centre */
}
@media (max-width: 560px) {
  .resultart { aspect-ratio: 4 / 3; }
}
