/* ─────────────────────────────────────────
   Grammar concept pages (/grammar/{slug})
   Namespaced .gc-* — page-specific only.

   Teacher/learner reference page, not a marketing page: compact,
   information-dense. Deliberately avoids the "component-library demo" look
   (rounded white container / heading / paragraph, repeated for every
   section) — only interactive, selectable, or exceptional material sits in
   a box: the Form callout, the quick check, and resource cards. Everything
   else sits directly on the paper background. Reuses tokens.css variables
   (--text, --muted, --border, --bg-panel) for color, but defines its own
   spacing/radius scale (see :root below) rather than the app-wide token
   radii, which read rounder than this page wants.

   Font and background match welcome.php (the site's common Nunito font
   stack and its warm-paper cream/grid background).
───────────────────────────────────────── */

:root {
  --gc-radius-card: 13px;
  --gc-radius-input: 11px;
  --gc-space-section: 52px;
  --gc-border: 1px solid var(--border);
}

/* Same warm paper texture as welcome.php's body background (and the game
   setup screens) — base.css's site-wide cream is flatter than this, so
   this page opts into the grainier, more "paper" version on purpose. */
body[data-view="page"] {
  background-color: #FBF6E9;
  background-image:
    repeating-linear-gradient(2deg, rgba(115, 91, 59, .018) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(91deg, rgba(255,255,255,.15) 0 1px, transparent 1px 11px),
    radial-gradient(ellipse at 16% 19%, rgba(230, 174, 47, .055) 0 1px, transparent 1.7px),
    radial-gradient(ellipse at 78% 67%, rgba(91, 70, 43, .04) 0 .8px, transparent 1.5px),
    linear-gradient(105deg, rgba(255,255,255,.08), transparent 38%, rgba(126,98,62,.025));
  background-size: auto, auto, 23px 21px, 31px 29px, 100% 100%;
  background-repeat: repeat, repeat, repeat, repeat, no-repeat;
  background-attachment: fixed;
}

.gc-main { width: 100%; }

.gc-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px 72px;
  box-sizing: border-box;
}

/* Hero — compact, star beside the title, CEFR folded into the metadata line
   instead of floating as a separate badge shape. */
.gc-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}
.gc-hero-star { display: block; width: clamp(44px, 7vw, 56px); height: auto; flex: 0 0 auto; }
.gc-title {
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.15;
  margin: 0 0 4px;
  color: var(--text);
}
.gc-meta { font-size: 15px; color: var(--muted); margin: 0; }
.gc-meta .gc-badge { font-weight: 700; color: var(--text); }

.gc-definition { font-size: 18px; line-height: 1.6; margin: 0; color: var(--text); }

/* The one restrained callout: the form formula. Only rendered when a
   concept's JSON has a "form" value (most don't yet — see
   data/grammar-concepts/present-perfect.json for the one populated so
   far). This is the page's single most load-bearing fact when present, so
   it's one of only three things on the page that gets a box/border. */
.gc-form {
  border: 3px dotted #108bff;
  border-radius: var(--gc-radius-card);
  padding: 16px 18px;
  margin: 0 0 var(--gc-space-section);
  background: none;
}
.gc-form-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}
.gc-form-formula {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}
.gc-form-formula strong { font-weight: 800; }

.gc-section { margin: 0 0 var(--gc-space-section); }
.gc-section h2 {
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: var(--text);
  margin: 0 0 14px;
}
.gc-qual-intro { margin: 0 0 14px; font-size: 15px; line-height: 1.6; color: var(--text); }

/* Examples / qualification examples — compact rows directly on the paper,
   separated by a faint rule instead of individual white cards. Both
   sections share this class; there's no visual reason to style them
   differently. */
.gc-rows { list-style: none; margin: 0; padding: 0; }
.gc-rows li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.gc-rows li:first-child { padding-top: 0; }
.gc-rows li:last-child { border-bottom: none; padding-bottom: 0; }
.gc-row-sentence { font-size: 16px; margin: 0 0 3px; color: var(--text); }
.gc-row-gloss { font-size: 15px; line-height: 1.45; margin: 0 0 3px; color: var(--text); }
.gc-row-note { font-size: 14px; color: var(--muted); margin: 0; }

.gc-verb {
  color: #1d4ed8;
  background: color-mix(in srgb, #3b82f6 18%, transparent);
  border-radius: 4px;
  padding: 0 3px;
}

/* Comparison — a plain two-column table-like layout, not two cards. */
.gc-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: var(--gc-border);
  border-bottom: var(--gc-border);
  margin-bottom: 10px;
}
.gc-compare-col { padding: 14px 16px; }
.gc-compare-col:first-child { border-right: var(--gc-border); }
@media (max-width: 560px) {
  .gc-compare { grid-template-columns: 1fr; }
  .gc-compare-col:first-child { border-right: none; border-bottom: var(--gc-border); }
}
.gc-compare-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}
.gc-compare-sentence { font-size: 16px; margin: 0 0 3px; color: var(--text); }
.gc-compare-gloss { font-size: 14px; line-height: 1.45; margin: 0 0 3px; color: var(--text); }
.gc-compare-note { font-size: 13px; color: var(--muted); margin: 0; font-style: italic; }
.gc-compare-conclusion { font-size: 14px; color: var(--muted); margin: 0; }

/* Mistakes — thin left rule only, two compact lines and a short rule
   instead of a full white panel per mistake. */
.gc-mistake { border-left: 3px solid #ef4444; padding: 2px 0 2px 14px; margin-bottom: 14px; }
.gc-mistake:last-child { margin-bottom: 0; }
.gc-mistake-wrong { color: #b91c1c; margin: 0 0 3px; font-size: 16px; }
.gc-mistake-right { color: #1d4ed8; margin: 0 0 5px; font-size: 16px; }
.gc-mistake-note { font-size: 13px; color: var(--muted); margin: 0; }

/* Quick check — kept boxed on purpose (interactive/selectable). */
.gc-quickcheck {
  border: var(--gc-border);
  border-radius: var(--gc-radius-card);
  padding: 20px 20px 22px;
  background: var(--bg-panel);
}
.gc-qc-progress { font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 0 12px; }
.gc-qc-question { font-size: 16px; font-weight: 700; margin: 0 0 14px; color: var(--text); }
.gc-qc-options { display: grid; gap: 8px; }
.gc-qc-option {
  text-align: left;
  font: inherit;
  font-size: 15px;
  padding: 11px 14px;
  border-radius: var(--gc-radius-input);
  border: 1.5px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.gc-qc-option:hover:not([disabled]) { border-color: #94a3b8; }
.gc-qc-option[disabled] { cursor: default; }
.gc-qc-option.is-correct { background: #dbeafe; border-color: #2563eb; }
.gc-qc-option.is-wrong { background: #fee2e2; border-color: #dc2626; animation: gc-shake 0.3s; }
@keyframes gc-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.gc-qc-feedback { margin: 14px 0 0; font-size: 15px; font-weight: 600; }
.gc-qc-feedback.is-correct { color: #1d4ed8; }
.gc-qc-feedback.is-wrong { color: #b91c1c; }

/* The done row (message + restart) stays hidden until the last question is
   answered correctly. That last question itself is never hidden — see
   js/grammar-concept-page.js — so this row fades in below it rather than
   abruptly replacing it. */
.gc-qc-done-row {
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  animation: gc-fadein 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.gc-qc-done { font-size: 15px; font-weight: 700; color: #1d4ed8; margin: 0; }
.gc-qc-restart {
  flex: 0 0 auto;
  margin-left: auto;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--gc-radius-input);
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.gc-qc-restart:hover { border-color: #94a3b8; background: #f8fafc; }
@keyframes gc-fadein {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* Related concepts — demoted to ordinary text links, not pills, but with a
   clear section label so it doesn't read as a stray line of grey text.
   Only concepts with a real page are ever rendered here (see the PHP), so
   every link on this line is always live — no "coming soon" styling needed.
   Bold + dotted underline instead of blue/underlined, so it still reads as
   clickable without the classic link look. */
.gc-related { margin: 0 0 var(--gc-space-section); }
.gc-related-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 8px;
}
.gc-related-links { font-size: 15px; margin: 0; }
.gc-related-links a {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  border-bottom: 1.5px dotted var(--muted);
  padding-bottom: 1px;
  transition: border-color 0.15s, color 0.15s;
}
.gc-related-links a:hover { border-bottom-style: solid; border-bottom-color: var(--text); }
.gc-related-sep { color: var(--border); margin: 0 8px; }

/* Resource cards — all shown at once, nothing collapsed behind a toggle. */
.gc-resource-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 560px) { .gc-resource-grid { grid-template-columns: 1fr; } }

.gc-resource-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  background: var(--bg-panel);
  border: 1.5px solid var(--border);
  border-radius: var(--gc-radius-card);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.gc-resource-card:hover { border-color: #94a3b8; box-shadow: 0 4px 14px rgba(15,23,42,0.08); }

.gc-resource-top { display: flex; align-items: center; gap: 10px; }
.gc-resource-logo { width: 32px; height: 32px; object-fit: contain; border-radius: 8px; }
.gc-resource-name { margin: 0; font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.gc-resource-type { margin: 0; font-size: 12px; color: var(--muted); }
.gc-resource-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); }
.gc-resource-desc { margin: 0; font-size: 14px; color: var(--text); line-height: 1.4; }
.gc-resource-badge {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: #eef2ff;
  color: #4338ca;
}
.gc-resource-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.gc-resource-arrow {
  flex: 0 0 auto;
  margin-left: auto;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  border-radius: 50%;
  background: #111827;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: transform 0.15s;
}
.gc-resource-card:hover .gc-resource-arrow { transform: translateX(2px); }

.gc-final-cta {
  text-align: center;
  padding: 16px 18px;
}

/* Exact copy of welcome.php's .sp-cta / .sp-btn / .sp-trust CTA block. */
.gc-final-cta .sp-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.gc-final-cta .sp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  padding: 0 34px;
  border-radius: 12px;
  font-family: "Nunito", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .01em;
  text-decoration: none;
  color: #ffffff;
  background: #0B1020;
  transition: background 140ms ease, transform 120ms ease;
}
.gc-final-cta .sp-btn:hover  { background: #1c2640; transform: translateY(-1px); }
.gc-final-cta .sp-btn:active { background: #080c16; transform: none; }

.gc-final-cta .sp-trust {
  font-size: 12.5px;
  font-weight: 600;
  color: #6b8490;
  letter-spacing: .02em;
  text-align: center;
  margin: 0;
}

.gc-final-cta .free-word {
  color: #6b8490;
  font-weight: 700;
}

.gc-final-cta .sp-trust-hl {
  position: relative;
  display: inline;
}
.gc-final-cta .sp-trust-wave {
  position: absolute;
  bottom: -5px;
  left: -2px;
  width: calc(100% + 4px);
  height: 7px;
}
