/* That's Relatable. Newspaper meets pub quiz: paper, big serif headlines, yellow highlighter. */

:root {
  --paper: #fbf6ec;
  --card: #fffdf8;
  --ink: #1c1a17;
  --muted: #6d665b;
  --line: #e4dccb;
  --accent: #e8462b;
  --accent-dark: #c93718;
  --tint: #fdece6;
  --ok: #1b7f3b;
  --bad: #b00020;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 16px;
  --shadow: 0 1px 0 rgba(28, 26, 23, .06), 0 8px 24px -12px rgba(28, 26, 23, .25);
}

/* Dark follows the device unless the visitor has chosen with the toggle (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14120f;
    --card: #1d1a16;
    --ink: #f4eee2;
    --muted: #a69d8e;
    --line: #322d25;
    --accent: #ff6a4d;
    --accent-dark: #ff866c;
    --tint: #2b1b16;
    --ok: #55c27a;
    --bad: #ff7a8c;
    --shadow: 0 1px 0 rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .8);
  }
}
:root[data-theme="dark"] {
  --paper: #14120f;
  --card: #1d1a16;
  --ink: #f4eee2;
  --muted: #a69d8e;
  --line: #322d25;
  --accent: #ff6a4d;
  --accent-dark: #ff866c;
  --tint: #2b1b16;
  --ok: #55c27a;
  --bad: #ff7a8c;
  --shadow: 0 1px 0 rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.65 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap { width: 100%; max-width: 46rem; margin: 0 auto; padding: 0 1.1rem; }
main.wrap { flex: 1; padding-bottom: 3rem; }

a { color: var(--accent-dark); text-underline-offset: .18em; }
a:hover { color: var(--accent); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.12; letter-spacing: -.01em; margin: 0 0 .6em; }
h2 { font-size: 1.45rem; }

/* The lens and key words: accent colour, no background. */
mark {
  background: none;
  color: var(--accent-dark);
}

/* ---------- Header and footer ---------- */

.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.site-header .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 46rem;
  margin: 0 auto;
  padding: .9rem 1.1rem;
}
.logo {
  font: 800 1.35rem/1 var(--serif);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.02em;
}
.logo span {
  background: var(--accent);
  color: #fff;
  padding: .1em .35em .15em;
  border-radius: .3em;
  display: inline-block;
  transform: rotate(-2deg);
  margin-left: .05em;
}
.logo:hover { color: var(--ink); }

.bar-actions { display: flex; align-items: center; gap: .6rem; }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
.theme-toggle[data-mode="dark"] .sun { display: block; }
.theme-toggle[data-mode="dark"] .moon { display: none; }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; padding: 1.4rem 0 2rem; }
.site-footer p { margin: 0 auto; max-width: 46rem; padding: 0 1.1rem; }

/* ---------- Buttons ---------- */

.button, .ask button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 46px;
  padding: .65rem 1.3rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: 700 1rem/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.button:hover, .ask button:hover { color: #fff; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.button:active, .ask button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.button.ghost { background: var(--card); color: var(--ink); }
.button.ghost:hover { color: var(--ink); }
.button.small { min-height: 38px; padding: .45rem .95rem; font-size: .9rem; box-shadow: 2px 2px 0 var(--ink); }

/* ---------- Home ---------- */

.hero { padding: 2.4rem 0 1.4rem; }
/* Two lines: the first part, then "something you know." on its own line. Sized so each line fits. */
.hero h1 { font-size: clamp(1.4rem, 5.6vw, 3.1rem); font-weight: 800; line-height: 1.1; margin-bottom: .5em; }
.hero h1 .l1, .hero h1 .l2 { display: block; white-space: nowrap; }
/* Where supported, size from the width of the box itself, with room for wider fallback fonts (line one is about 13-14.5 times the font size). */
@supports (font-size: 1cqi) {
  .hero { container-type: inline-size; }
  .hero h1 { font-size: min(3.4rem, 6.6cqi); }
}
.hero p { font-size: 1.15rem; color: var(--muted); margin: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: .85rem;
  font-family: var(--sans);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.ask { display: grid; gap: .9rem; }
.ask label {
  display: grid;
  gap: .3rem;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.ask input, .ask select {
  width: 100%;
  min-height: 50px;
  padding: .6rem .9rem;
  font: 600 1.05rem/1.2 var(--sans);
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px;
  text-transform: none;
  letter-spacing: 0;
}
.ask select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%236d665b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}
.ask select:disabled { opacity: .5; cursor: not-allowed; }
.ask input::placeholder { color: var(--muted); font-weight: 500; }
.ask button { justify-self: start; }

.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.tile {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  height: 100%;
  padding: 1rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease;
}
.tile:hover { color: var(--ink); transform: translateY(-2px); border-color: var(--ink); }
.tile .t-subject { font: 800 1.2rem/1.15 var(--serif); }
.tile .t-in { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.tile mark { align-self: flex-start; font-weight: 700; font-size: .95rem; }

.section-title { margin: 2.2rem 0 1rem; }

/* ---------- Explanation page ---------- */

.explanation { padding-top: 1.8rem; }
.explanation .kicker { margin: 0 0 .3rem; font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-dark); }
.explanation h1 { font-size: clamp(2rem, 7.5vw, 3.4rem); font-weight: 800; line-height: 1.05; margin-bottom: 1.2rem; }
.explanation h1 .in {
  display: block;
  font: 600 .95rem/1.4 var(--sans);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin: .55rem 0 .4rem;
}

.explanation .hook { font: 600 1.3rem/1.4 var(--serif); margin: 0 0 1.3rem; padding-bottom: 1.2rem; border-bottom: 2px solid var(--ink); }
.explanation p { margin: 0 0 1.1rem; }
.explanation .breakdown {
  background: var(--card);
  border: 2px solid var(--ink);
  border-left: 8px solid var(--accent);
  border-radius: 12px;
  padding: .9rem 1.1rem;
  margin-top: 1.6rem;
  box-shadow: 3px 3px 0 var(--ink);
}
.explanation .breakdown b { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-dark); margin-bottom: .2rem; }

.meta { color: var(--muted); font-size: .85rem; }
.badge { display: inline-block; padding: .15rem .65rem; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: .78rem; font-weight: 700; color: var(--muted); }

.actions-row { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; margin: 1.8rem 0 1rem; }

.report { margin: 0; }
.report button, .linkish {
  font: inherit;
  font-size: .85rem;
  background: none;
  border: 0;
  padding: .4rem 0;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}
.report button:hover, .linkish:hover { color: var(--ink); }

/* ---------- Messages ---------- */

.notice {
  background: var(--tint);
  color: var(--ink);
  border: 1px solid var(--accent);
  border-left: 6px solid var(--accent);
  border-radius: 12px;
  padding: .85rem 1.1rem;
  margin: 1.4rem 0;
  font-weight: 600;
}
.message-page { padding: 2.5rem 0; }
.message-page h1 { font-size: 2.2rem; }

/* ---------- Admin ---------- */

.adminbar {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  background: #e9efff; color: #14204d; border: 2px solid #14204d; border-radius: 12px;
  padding: .55rem .8rem; margin: 1.2rem 0 0; font-size: .9rem;
}
.adminbar button { font: 700 .85rem var(--sans); padding: .35rem .8rem; border: 2px solid #14204d; border-radius: 999px; background: #fff; color: #14204d; cursor: pointer; }
.review { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.review h3 { font-size: 1.15rem; margin-bottom: .3rem; }
.review p { margin: .5rem 0; font-size: .95rem; }
.review .meta { font-size: .8rem; }
.review .actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.review .actions button { font: 700 .85rem var(--sans); padding: .45rem .95rem; border: 2px solid var(--ink); border-radius: 999px; background: var(--card); color: var(--ink); cursor: pointer; }
.review .actions button[value="approve"], .review .actions button[value="restore"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.review .actions button[value="hide"] { border-color: var(--bad); color: var(--bad); }

/* ---------- Avatars, header extras ---------- */

.avatar { border-radius: 50%; object-fit: cover; display: inline-block; vertical-align: middle; flex: none; }
.avatar.initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--h) 55% 40%);
  color: #fff;
  font: 800 1em var(--serif);
}
.with-avatar { display: flex; align-items: center; gap: .7rem; }
.button.acct { gap: .45rem; padding-left: .5rem; }
.button.acct span:last-child { max-width: 8ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navlink { display: none; font-weight: 700; font-size: .9rem; color: var(--ink); text-decoration: none; }
.navlink:hover { color: var(--accent); }
.bar-actions { gap: .45rem; }

/* ---------- Page furniture ---------- */

.kicker { margin: 0 0 .3rem; font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-dark); }
.hero.compact { padding: 1.8rem 0 1rem; }
.hero.compact h1 { font-size: clamp(1.9rem, 6.5vw, 3rem); }
.crumbs { font-size: .85rem; color: var(--muted); padding-top: 1.2rem; }
.crumbs a { color: var(--muted); }
.crumbs + .explanation { padding-top: .8rem; }
.madeby a { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; }

.tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0 1.2rem; }
.tabs a { padding: .45rem .95rem; border: 2px solid var(--ink); border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: .9rem; background: var(--card); }
.tabs a.on { background: var(--ink); color: var(--paper); }

.board { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.board li { display: flex; align-items: center; gap: .8rem; padding: .65rem .9rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.board .rank { font: 800 1.2rem var(--serif); min-width: 1.6rem; color: var(--muted); }
.board li:nth-child(1) .rank { color: var(--accent-dark); }
.board .who { display: flex; align-items: center; gap: .6rem; flex: 1; font-weight: 700; color: var(--ink); text-decoration: none; min-width: 0; }
.board .who span { overflow: hidden; text-overflow: ellipsis; }
.score-pill { font-weight: 800; white-space: nowrap; }
.score-pill small { font-weight: 600; color: var(--muted); }

.t-score { font-size: .85rem; color: var(--muted); }
.tile .badge { align-self: flex-start; }
.browse-group { margin-bottom: 1.4rem; }
.browse-group h2 { font-size: 1.2rem; margin-bottom: .3rem; }
.plain { margin: 0; padding-left: 1.1rem; }
.plain li { margin: .15rem 0; }

/* ---------- Votes, reactions, share ---------- */

.engage { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.2rem; margin: 1.4rem 0 .4rem; padding: .8rem 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.engage > .meta { flex-basis: 100%; margin: 0; }
.act { display: flex; align-items: center; gap: .4rem; margin: 0; flex-wrap: wrap; }
.vbtn {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); color: var(--ink); cursor: pointer; padding: 0;
}
.vbtn svg { width: 18px; height: 18px; fill: currentColor; }
.vbtn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-dark); }
.vbtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.score { min-width: 2ch; text-align: center; font: 800 1.15rem var(--serif); }
.chip {
  display: inline-flex; align-items: center; gap: .3rem; min-height: 40px; padding: .25rem .7rem;
  border: 2px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); cursor: pointer; font: 700 .9rem var(--sans);
}
.chip .emoji { font-size: 1.2rem; line-height: 1; }
.chip:hover:not(:disabled) { border-color: var(--ink); }
.chip.on { border-color: var(--accent); background: var(--tint); }
.engage button:disabled { opacity: .45; cursor: not-allowed; }
.login-hint { flex-basis: 100%; margin: 0; }

.share h2, .related h2 { font-size: 1.1rem; margin: 1.6rem 0 .7rem; }
.share-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.share-row .button[hidden] { display: none; }
.related { margin-top: 1rem; }

/* ---------- Forms: more field types ---------- */

.ask textarea {
  width: 100%; padding: .7rem .9rem; font: 500 1.05rem/1.5 var(--sans); color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 12px; resize: vertical; text-transform: none; letter-spacing: 0;
}
.ask input[type="file"] { padding: .55rem; min-height: 0; font: 500 .95rem var(--sans); }
.ask label.check { display: flex; align-items: center; gap: .6rem; text-transform: none; letter-spacing: 0; font-size: 1rem; font-weight: 600; color: var(--ink); }
.ask label.check input { width: 22px; height: 22px; min-height: 0; flex: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.auth { margin-top: 1.5rem; }
.auth h1 { font-size: 2rem; }
.auth-links { margin-top: 1rem; }
.settings .avatar-edit { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.2rem; }
.settings .avatar-edit > div { flex: 1; min-width: 0; }
.danger { margin-top: 1.4rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.danger summary { cursor: pointer; color: var(--bad); font-weight: 700; }

/* ---------- Text pages ---------- */

.prose { padding: 1.6rem 0 1rem; max-width: 42rem; }
.prose h1 { font-size: clamp(2rem, 7vw, 3rem); margin-bottom: .6em; }
.prose h2 { font-size: 1.35rem; margin: 1.8em 0 .5em; }
.prose p, .prose li { max-width: 40rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin: .3rem 0; }
.prose .lede { font: 600 1.25rem/1.45 var(--serif); }
.datatable { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 1rem 0; display: block; overflow-x: auto; }
.datatable th, .datatable td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; min-width: 9rem; }
.datatable th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
code { background: var(--card); border: 1px solid var(--line); padding: .05rem .35rem; border-radius: 6px; font-size: .9em; }

/* ---------- Footer ---------- */

.site-footer { margin-top: 2rem; padding: 2rem 0; }
.site-footer .wrap { max-width: 64rem; }
.foot-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.6rem 1.2rem; }
.site-footer h2 { font: 800 .72rem var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--ink); margin: 0 0 .6rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.site-footer li a { color: var(--muted); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-footer li a:hover { color: var(--accent-dark); text-decoration: underline; }
.foot-note { margin: 1.8rem 0 0 !important; padding: 1.2rem 0 0 !important; border-top: 1px solid var(--line); max-width: none !important; }

@media (min-width: 640px) {
  .foot-grid { grid-template-columns: repeat(3, 1fr); }
  .navlink { display: inline; }
}
@media (max-width: 440px) {
  .bar-actions .button.ghost.small { display: none; }
}
@media (min-width: 900px) {
  .foot-grid { grid-template-columns: repeat(6, 1fr); }
}

/* ---------- Wider screens ---------- */

@media (min-width: 640px) {
  body { font-size: 18px; }
  .hero { padding: 3.4rem 0 1.8rem; }
  .card { padding: 1.6rem; }
  .sentence { grid-template-columns: 1fr 1fr; }
}

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

/* Unverified-email banner */
.verify-banner { background: var(--tint); border-bottom: 2px solid var(--accent); font-size: .92rem; }
.verify-banner .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem 1rem; padding-top: 1.1rem; padding-bottom: 1.1rem; max-width: 46rem; }
.verify-banner form { margin: 0; }
.verify-banner span { flex: 1 1 18rem; }

/* Intro copy can be several paragraphs */
.hero p + p { margin-top: .7rem; }
.hero p strong { color: var(--ink); font-weight: 800; }

/* Likes, dislikes and emoji counts on cards */
.t-stats { display: flex; flex-wrap: wrap; gap: .2rem .8rem; margin-top: auto; padding-top: .5rem; font-size: .85rem; font-weight: 700; color: var(--muted); }
.t-stats .up { color: var(--ok); }
.t-stats .down { color: var(--bad); }
.t-stats .emo { color: var(--ink); }

/* Admin activity feed */
.feed { list-style: none; margin: 0 0 1.5rem; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); max-height: 22rem; overflow-y: auto; }
.feed li { display: flex; align-items: baseline; gap: .6rem; padding: .55rem .9rem; border-bottom: 1px solid var(--line); font-size: .92rem; }
.feed li:last-child { border-bottom: 0; }
.feed-icon { flex: none; width: 1.6rem; text-align: center; }
.feed-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.feed-time { flex: none; color: var(--muted); font-size: .78rem; white-space: nowrap; }
