/* base.css — design tokens + shared mac-window chrome.
   Pulled from the inline styles in index.html / login.html / terminal.html.
   No redesign — just consolidation. */

:root {
  /* GitHub-dark palette */
  --bg:           #0c0c0c;
  --bg-titlebar:  #1e1e1e;
  --bg-elevated: #161b22;
  --bg-soft:     #21262d;
  --border:      #30363d;
  --border-soft: #21262d;
  --text:        #c9d1d9;
  --text-dim:    #8b949e;
  --text-mute:   #484f58;
  --accent:      #58a6ff;     /* cyan */
  --accent-2:    #79c0ff;     /* heading blue */
  --green:       #3fb950;
  --green-dot:   #28c840;
  --yellow:      #d29922;
  --red:         #f85149;
  --red-dot:     #ff5f57;
  --yellow-dot:  #ffbd2e;

  /* Spacing scale (4px base) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;

  /* Typography */
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
  --fs-sm: 12px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;

  /* Layout */
  --window-max: 860px;
  --radius: 10px;
  --radius-sm: 4px;
  --radius-xs: 3px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: linear-gradient(180deg, #050607 0%, #0c0c0c 60%, #0a0a0a 100%);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-base);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--s-8) var(--s-5) calc(var(--s-8) + var(--s-5));
}

/* macOS-style window chrome */
.window {
  width: 100%;
  max-width: var(--window-max);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .7);
  border: 1px solid #1a1a1a;
}

.titlebar, .title-bar {
  background: var(--bg-titlebar);
  padding: var(--s-3) var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  border-bottom: 1px solid #2d2d2d;
}

.dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.dot.red,    .dot-red    { background: var(--red-dot); }
.dot.yellow, .dot-yellow { background: var(--yellow-dot); }
.dot.green,  .dot-green  { background: var(--green-dot); }

.title-text {
  flex: 1;
  text-align: center;
  color: #666;
  font-size: var(--fs-sm);
}

.body {
  background: var(--bg);
  padding: var(--s-7) var(--s-7) var(--s-8);
}

/* Terminal typography helpers (kept compatible with index.html) */
.prompt  { color: var(--green-dot); }
.cmd     { color: #e6edf3; }
.heading { color: var(--accent-2); font-weight: 700; letter-spacing: .05em; margin: var(--s-5) 0 var(--s-2); }
.dim     { color: var(--text-mute); }
.green   { color: var(--green); }
.cyan    { color: var(--accent); }
.yellow  { color: var(--yellow); }
.divider { color: var(--border-soft); margin: var(--s-5) 0; }

pre { white-space: pre-wrap; word-break: break-word; font: inherit; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Generic buttons (used on landing + quiz) */
.btn {
  display: inline-block;
  padding: 10px 22px;
  border: 1px solid;
  border-radius: var(--radius-xs);
  background: transparent;
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  min-height: 44px;
  line-height: 1.2;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary   { border-color: var(--green); color: var(--green); }
.btn-primary:hover   { background: var(--green); color: var(--bg); text-decoration: none; }
.btn-secondary { border-color: var(--text-mute); color: var(--text-dim); }
.btn-secondary:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.btn-danger    { border-color: var(--red); color: var(--red); }
.btn-danger:hover    { background: var(--red); color: var(--bg); text-decoration: none; }
.btn-ghost     { border-color: var(--border); color: var(--text-dim); }
.btn-ghost:hover     { background: var(--bg-soft); color: var(--text); text-decoration: none; }

/* Mobile: slim chrome, tighter padding */
@media (max-width: 640px) {
  body { padding: var(--s-3) var(--s-3) var(--s-7); }
  .window { border-radius: 8px; }
  .titlebar, .title-bar { padding: 6px var(--s-3); min-height: 28px; }
  .dot { width: 9px; height: 9px; }
  .title-text { font-size: 11px; }
  .body { padding: var(--s-5) var(--s-4) var(--s-7); }
}

/* ─────────────────────── Accessibility helpers ─────────────────────── */

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--s-3);
  background: var(--accent);
  color: #0a0a0a;
  padding: 8px 14px;
  border-radius: var(--radius-xs);
  font-weight: 700;
  z-index: 200;
  transition: top .15s ease;
  text-decoration: none;
}
.skip-link:focus,
.skip-link:focus-visible {
  top: var(--s-3);
  outline: 2px solid var(--text);
  outline-offset: 2px;
  text-decoration: none;
}

/* Global focus-visible — visible 2px accent outline w/ offset */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
/* Tone down :focus (mouse) so only keyboard users see the ring */
:focus:not(:focus-visible) { outline: none; }

main:focus { outline: none; }

/* Loading / disabled button state (set by JS on submit) */
.btn[disabled],
.btn.is-loading {
  opacity: .65;
  cursor: progress;
  pointer-events: none;
}

/* Reduced motion respect */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Flash / alert messages */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  margin-bottom: var(--s-4);
  font-size: 13px;
  border: 1px solid;
}
.alert-error,
.alert-danger  { background: #2d1117; border-color: var(--red);    color: var(--red); }
.alert-info,
.alert-message { background: #0d1117; border-color: #388bfd;       color: var(--accent-2); }
.alert-success { background: #0d1117; border-color: var(--green);  color: var(--green); }
.alert-warning { background: #1f1a0a; border-color: var(--yellow); color: var(--yellow); }
