/* ternquest.css — the TernQuest look for the server-rendered Jinja pages
   (blog, legal, login). Tokens mirror prototype/src/theme.css [data-theme="arcade"]
   (the app's default) so these pages match the React shell. Loaded AFTER
   Bootstrap + main.css and overrides them. */
:root {
  --font-display: "Fredoka", "Baloo 2", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
  --bg: #edf8f5; --bg-2: #d8eeea; --surface: #ffffff; --surface-2: #f3fbf9;
  --ink: #123540; --ink-soft: #53727a; --border: #cfe6e1; --border-strong: #acd3cc;
  --primary: #ef5b50; --primary-ink: #ffffff; --primary-soft: #ffe1dd;
  --math: #0d9f9b; --math-soft: #d7f3ef; --english: #7665d8; --english-soft: #e8e4fa;
  --xp: #ffc233; --success: #2bb673;
  --radius: 22px; --radius-sm: 14px; --radius-lg: 30px;
  --shadow: 0 10px 0 rgba(8,70,74,0.055), 0 18px 30px rgba(8,70,74,0.12);
  --shadow-sm: 0 5px 0 rgba(8,70,74,0.045), 0 8px 16px rgba(8,70,74,0.10);
  --press: 6px;
}
html { background: var(--bg); }
body {
  background: var(--bg) !important; color: var(--ink);
  font-family: var(--font-body); font-size: 17px; line-height: 1.65;
  padding-top: 84px; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, .h1, .h2, .h3, .h4, .h5, .display-5 {
  font-family: var(--font-display); color: var(--ink); font-weight: 600; letter-spacing: -.01em;
}
a { color: var(--math); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--primary); }

/* ---- header ---- */
.tq-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1030; height: 74px;
  background: var(--surface); border-bottom: 2px solid var(--border);
  box-shadow: 0 6px 18px rgba(8,70,74,0.06);
}
.tq-nav .tq-wrap { max-width: 1140px; margin: 0 auto; padding: 0 20px; height: 100%; display: flex; align-items: center; gap: 18px; }
.tq-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none !important; color: var(--ink) !important; }
.tq-brand svg { width: 40px; height: 40px; display: block; }
.tq-brand strong { font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1; }
.tq-brand strong span { color: var(--primary); }
.tq-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.tq-links a { font-weight: 700; color: var(--ink-soft) !important; text-decoration: none !important; padding: 9px 14px; border-radius: 999px; font-size: 15px; }
.tq-links a:hover, .tq-links a.on { color: var(--ink) !important; background: var(--surface-2); }
.tq-btn, .btn-primary, .btn-outline-secondary, .btn-outline-dark {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); font-weight: 600; font-size: 15px; line-height: 1;
  padding: 12px 18px; border-radius: 999px; border: 2px solid transparent; text-decoration: none !important;
  transition: transform .06s ease, box-shadow .06s ease; cursor: pointer;
}
.tq-btn--primary, .btn-primary {
  background: var(--primary) !important; color: var(--primary-ink) !important; border-color: var(--primary) !important;
  box-shadow: 0 var(--press) 0 #c4463c;
}
.tq-btn--primary:hover, .btn-primary:hover { transform: translateY(2px); box-shadow: 0 calc(var(--press) - 2px) 0 #c4463c; }
.tq-btn--ghost, .btn-outline-secondary, .btn-outline-dark {
  background: var(--surface) !important; color: var(--ink) !important; border-color: var(--border-strong) !important;
  box-shadow: 0 var(--press) 0 var(--border);
}
.tq-btn--ghost:hover, .btn-outline-secondary:hover, .btn-outline-dark:hover { transform: translateY(2px); box-shadow: 0 calc(var(--press) - 2px) 0 var(--border); }
.tq-burger { display: none; margin-left: auto; background: none; border: 2px solid var(--border); border-radius: 12px; padding: 8px 10px; color: var(--ink); }
@media (max-width: 820px) {
  .tq-links { display: none; position: absolute; top: 74px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--surface); border-bottom: 2px solid var(--border); padding: 10px 16px 16px; gap: 6px; }
  .tq-links.open { display: flex; }
  .tq-links a, .tq-links .tq-btn { justify-content: center; }
  .tq-burger { display: inline-block; }
}

/* ---- page shell ---- */
.tq-page { max-width: 1140px; margin: 0 auto; padding: 24px 20px 40px; }
.tq-kicker { font-family: var(--font-display); color: var(--math); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: 13px; }
.tq-card, .card {
  background: var(--surface) !important; border: 2.5px solid var(--border) !important; border-radius: var(--radius) !important;
  box-shadow: var(--shadow-sm) !important;
}
.tq-card { padding: 22px 24px; }
.tq-card + .tq-card { margin-top: 18px; }
.tq-card h3 { font-size: 24px; margin: 0 0 6px; }
.tq-card h3 a { color: var(--ink); text-decoration: none; }
.tq-card h3 a:hover { color: var(--primary); }
.tq-meta { color: var(--ink-soft); font-size: 14px; font-weight: 600; }
.tq-tag {
  display: inline-block; font-family: var(--font-display); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  background: var(--math-soft); color: #0a6b68; padding: 5px 11px; border-radius: 999px; text-decoration: none !important; margin: 0 6px 6px 0;
}
.tq-tag:hover { background: var(--primary-soft); color: #a8332a; }
.tq-tag--eng { background: var(--english-soft); color: #4f3fb0; }
.tq-more { font-family: var(--font-display); font-weight: 600; color: var(--primary); text-decoration: none; }
.tq-side .tq-card { padding: 18px 20px; }
.tq-side h5 { font-size: 18px; margin-bottom: 10px; }
.tq-search { display: flex; gap: 8px; }
.tq-search input {
  flex: 1; min-width: 0; border: 2px solid var(--border); border-radius: 999px; padding: 10px 16px;
  background: var(--surface-2); color: var(--ink); font: inherit; outline: none;
}
.tq-search input:focus { border-color: var(--math); }
.tq-note { background: var(--math-soft); border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 10px 16px; font-weight: 600; margin-bottom: 18px; }
.tq-pager { display: flex; gap: 10px; margin-top: 24px; }
.tq-pager .off { opacity: .45; pointer-events: none; }

/* ---- article ---- */
.tq-crumbs { font-size: 14px; color: var(--ink-soft); font-weight: 600; margin-bottom: 10px; }
.tq-crumbs a { color: var(--ink-soft); text-decoration: none; }
.tq-crumbs a:hover { color: var(--primary); }
.tq-article { background: var(--surface); border: 2.5px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 40px 48px; max-width: 860px; }
.tq-article h1 { font-size: clamp(30px, 4.2vw, 44px); line-height: 1.12; margin: 8px 0 10px; }
.post-content { font-size: 17.5px; }
.post-content h2 { font-size: 28px; margin: 40px 0 12px; }
.post-content h3 { font-size: 22px; margin: 30px 0 8px; }
.post-content p, .post-content li { color: var(--ink); }
.post-content img { max-width: 100%; border-radius: var(--radius-sm); }
.post-content blockquote { border-left: 5px solid var(--math); background: var(--surface-2); margin: 20px 0; padding: 12px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.post-content table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 18px 0; font-size: 15.5px; }
.post-content th, .post-content td { padding: 10px 12px; border-bottom: 2px solid var(--border); vertical-align: top; }
.post-content th { background: var(--surface-2); font-family: var(--font-display); font-weight: 600; text-align: left; }
.post-content code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: .92em; }
.post-content pre { background: #0f2a33; color: #e6f4f1; border-radius: var(--radius-sm); padding: 16px 18px; overflow: auto; }
.post-content pre code { background: none; border: 0; color: inherit; }
.post-content a { color: var(--math); }
.tq-article hr { border-top: 2px solid var(--border); opacity: 1; }
.tq-prevnext { display: flex; justify-content: space-between; gap: 16px; font-weight: 700; }
.btn-x-share { border-radius: 999px !important; font-family: var(--font-display); font-weight: 600; padding: 8px 16px !important; }
@media (max-width: 720px) { .tq-article { padding: 26px 20px; border-radius: var(--radius); } body { font-size: 16px; } }

/* ---- footer ---- */
.tq-footer { margin-top: 56px; background: var(--surface); border-top: 2px solid var(--border); }
.tq-footer .tq-wrap { max-width: 1140px; margin: 0 auto; padding: 36px 20px 18px; display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 28px; }
.tq-footer h5 { font-size: 15px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 10px; }
.tq-footer ul { list-style: none; padding: 0; margin: 0; }
.tq-footer li { margin: 0 0 6px; }
.tq-footer a { color: var(--ink); text-decoration: none; font-weight: 600; }
.tq-footer a:hover { color: var(--primary); }
.tq-footer p { color: var(--ink-soft); margin: 8px 0 0; }
.tq-copy { border-top: 2px solid var(--border); text-align: center; color: var(--ink-soft); font-size: 14px; padding: 14px 20px; }
@media (max-width: 820px) { .tq-footer .tq-wrap { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .tq-footer .tq-wrap { grid-template-columns: 1fr; } }

/* Bootstrap leftovers used by legal/login pages */
.breadcrumb { background: none; padding: 0; }
.alert { border-radius: var(--radius-sm); border-width: 2px; }
.form-control { border: 2px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.form-control:focus { border-color: var(--math); box-shadow: none; }
.text-muted { color: var(--ink-soft) !important; }
