/* ==========================================================================
   Gnosis SAT Prep - Design tokens
   Palette: ink-teal ground, brass/gold insight accent, parchment surfaces,
   coral reserved strictly for error/weak-spot flags.
   ========================================================================== */

:root {
  --ink-teal: #0F3D3E;
  --ink-teal-deep: #0A2C2D;
  --brass: #C9A227;
  --brass-soft: #E4C766;
  --parchment: #F5F1E8;
  --parchment-dim: #EDE6D6;
  --coral: #D96C4F;
  --ink-text: #16241F;
  --muted-text: #6B7A76;
  --line: rgba(245, 241, 232, 0.14);
  --line-on-parchment: rgba(15, 61, 62, 0.12);

  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --sidebar-width: 232px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink-teal);
  color: var(--parchment);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button { font-family: var(--font-body); cursor: pointer; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================================
   App shell / sidebar
   ========================================================================== */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--ink-teal-deep);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
  padding-left: 4px;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--brass);
  line-height: 1;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
}

.nav-link {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 500;
  color: rgba(245, 241, 232, 0.72);
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: rgba(245, 241, 232, 0.06);
  color: var(--parchment);
}

.nav-link.active {
  background: rgba(201, 162, 39, 0.14);
  color: var(--brass-soft);
  font-weight: 600;
}

.nav-link:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.sidebar-footer {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.student-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.student-initial {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brass);
  color: var(--ink-teal-deep);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
}

.student-name {
  font-size: 13.5px;
  font-weight: 500;
}

.logout-link {
  font-size: 12.5px;
  color: var(--muted-text);
  padding-left: 38px;
}

.logout-link:hover { color: var(--parchment); }

.main-content {
  flex-grow: 1;
  padding: 40px 48px 64px;
  max-width: 1180px;
}

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 14px 18px;
    gap: 20px;
  }
  .sidebar-brand { margin-bottom: 0; }
  .sidebar-nav { flex-direction: row; flex-grow: 1; }
  .sidebar-footer { flex-direction: row; align-items: center; border-top: none; padding-top: 0; }
  .logout-link { padding-left: 0; }
  .main-content { padding: 24px 20px 48px; }
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--parchment);
}

h1 { font-size: 32px; letter-spacing: -0.01em; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }

p { line-height: 1.6; color: rgba(245, 241, 232, 0.82); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-soft);
  margin-bottom: 6px;
  display: block;
}

.page-header {
  margin-bottom: 32px;
}

.page-header p {
  max-width: 560px;
  color: rgba(245, 241, 232, 0.65);
}

/* ==========================================================================
   Cards (parchment surfaces)
   ========================================================================== */

.card {
  background: var(--parchment);
  color: var(--ink-text);
  border-radius: var(--radius-lg);
  padding: 26px;
}

.card p { color: rgba(22, 36, 31, 0.72); }

.card-dark {
  background: rgba(245, 241, 232, 0.05);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px;
  color: var(--parchment);
}

.card-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 860px) {
  .card-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Signature element: the "proof underline"
   Used any time we show the evidence sentence that proves/disproves an answer.
   ========================================================================== */

.proof {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15.5px;
  line-height: 1.6;
  position: relative;
  display: inline;
  background-image: linear-gradient(
    to right,
    var(--brass) 0%, var(--brass) 100%
  );
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 3px;
  padding-bottom: 3px;
}

.proof-block {
  border-left: 3px solid var(--brass);
  padding: 4px 0 4px 16px;
  margin: 14px 0;
}

.proof-block .proof-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brass);
  display: block;
  margin-bottom: 4px;
  font-style: normal;
}

/* ==========================================================================
   Error taxonomy tags
   ========================================================================== */

.tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 100px;
  background: rgba(217, 108, 79, 0.14);
  color: var(--coral);
  font-weight: 500;
  border: 1px solid rgba(217, 108, 79, 0.28);
}

.tag-correct {
  background: rgba(15, 61, 62, 0.08);
  color: #2E7D5B;
  border-color: rgba(46, 125, 91, 0.28);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--brass);
  color: var(--ink-teal-deep);
}

.btn-primary:hover { opacity: 0.9; }

.btn-outline {
  background: transparent;
  border: 1.5px solid rgba(245, 241, 232, 0.3);
  color: var(--parchment);
}

.btn-outline:hover { border-color: var(--brass); color: var(--brass-soft); }

.btn-external {
  background: transparent;
  border: 1.5px solid var(--line-on-parchment);
  color: var(--ink-teal);
}

.btn-external:hover { border-color: var(--brass); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==========================================================================
   Onboarding (bare layout, no sidebar)
   ========================================================================== */

.onboarding-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.onboarding-card {
  max-width: 420px;
  width: 100%;
  background: var(--parchment);
  color: var(--ink-text);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
}

.onboarding-card .brand-mark-lg {
  font-family: var(--font-display);
  font-size: 40px;
  color: var(--brass);
  display: block;
  margin-bottom: 4px;
}

.onboarding-card h1 { color: var(--ink-text); font-size: 26px; }
.onboarding-card p { color: rgba(22, 36, 31, 0.65); margin-bottom: 24px; }

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink-text);
}

.field input {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(15, 61, 62, 0.18);
  font-family: var(--font-body);
  font-size: 14.5px;
  background: #fff;
  color: var(--ink-text);
}

.field input:focus {
  outline: none;
  border-color: var(--brass);
}

.error-msg {
  color: var(--coral);
  font-size: 13px;
  margin-bottom: 14px;
}

/* ==========================================================================
   Dashboard
   ========================================================================== */

.weak-spot-hero {
  background: linear-gradient(135deg, rgba(201,162,39,0.16), rgba(245,241,232,0.04));
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: var(--radius-lg);
  padding: 30px;
  margin-bottom: 24px;
}

.weak-spot-hero .eyebrow { margin-bottom: 10px; }

.weak-spot-hero h2 { font-size: 24px; margin-bottom: 10px; }

.weak-spot-hero .coaching-tip {
  font-size: 14px;
  color: rgba(245,241,232,0.7);
  margin-top: 12px;
}

.external-links {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.chart-card canvas { max-height: 260px; }

.mistake-card .tag { margin-bottom: 12px; }

/* ==========================================================================
   Practice page
   ========================================================================== */

.subject-toggle {
  display: inline-flex;
  background: rgba(245,241,232,0.06);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px;
  margin-bottom: 24px;
}

.subject-toggle button {
  border: none;
  background: transparent;
  color: rgba(245,241,232,0.6);
  padding: 8px 20px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 13.5px;
}

.subject-toggle button.active {
  background: var(--brass);
  color: var(--ink-teal-deep);
}

.mastery-meter {
  margin-bottom: 20px;
}

.mastery-meter-bar {
  height: 8px;
  background: rgba(245,241,232,0.1);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 8px;
}

.mastery-meter-fill {
  height: 100%;
  background: var(--brass);
  border-radius: 100px;
  transition: width 0.3s ease;
}

.question-card { min-height: 220px; }

.passage-text {
  font-family: var(--font-display);
  font-size: 15.5px;
  line-height: 1.75;
  margin-bottom: 18px;
  color: rgba(22, 36, 31, 0.85);
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.choice-btn {
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid rgba(15, 61, 62, 0.15);
  background: #fff;
  color: var(--ink-text);
  font-size: 14.5px;
  display: flex;
  gap: 12px;
}

.choice-btn:hover { border-color: var(--brass); }

.choice-btn .choice-key {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--brass);
}

.choice-btn.correct { border-color: #2E7D5B; background: rgba(46,125,91,0.08); }
.choice-btn.incorrect { border-color: var(--coral); background: rgba(217,108,79,0.08); }
.choice-btn:disabled { cursor: default; }

.feedback-panel {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid rgba(15,61,62,0.12);
}

.loading-state {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(22,36,31,0.5);
  font-size: 14px;
  padding: 40px 0;
  justify-content: center;
}

/* ==========================================================================
   Progress
   ========================================================================== */

.session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(15,61,62,0.1);
  font-size: 14px;
}

.session-row:last-child { border-bottom: none; }

/* ==========================================================================
   Community / roadmap
   ========================================================================== */

.roadmap-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brass-soft);
  border: 1px solid rgba(201,162,39,0.4);
  border-radius: 100px;
  padding: 4px 12px;
  margin-bottom: 16px;
}
