/* Black/white with one electric-blue accent, the Website's body.opt7 values (src/pages/index.astro).
   Neutrals follow the Internship page (Apple greys).
   Contrast: #0F2BFF on white 7.47:1 (also white text on it); dark: #7A93FF text on black 7.45:1, white on #2438FF 6.81:1. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #6e6e73;
  --solid: #f5f5f7;
  --line: rgba(0, 0, 0, .10);
  --accent: #0f2bff;      /* blue as text, links, focus */
  --fill: #0f2bff;        /* filled button, white text */
  --ring: var(--accent);  /* own name: bb8.css redefines --accent (orange) inside the toggle */
  --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 96px;
  --h: 44px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --fg: #f5f5f7;
  --muted: #98989d;
  --solid: #141416;
  --line: rgba(255, 255, 255, .14);
  --accent: #7a93ff;
  --fill: #2438ff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, dl, dd, ol, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); font-size: .9em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--fill); color: #fff; }
.accent { color: var(--accent); }
.skip-link { position: absolute; z-index: 10; top: -100px; left: var(--s4); padding: var(--s2) var(--s3); background: var(--fill); color: #fff; border-radius: 8px; }
.skip-link:focus { top: var(--s3); }

/* one column width for everything */
.site-header, main, .site-footer { width: min(1120px, 100% - 2 * var(--s5)); margin-inline: auto; }

.site-header { display: flex; align-items: center; gap: var(--s5); min-height: 72px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand img { display: block; }
.site-nav { display: flex; gap: var(--s5); margin-left: auto; font-size: 14px; color: var(--muted); }
.site-nav a:hover, .site-footer a:hover { color: var(--accent); }

/* BB-8: artwork untouched; just size, outline, and a focusable checkbox (bb8.css hides it with display:none) */
.bb8-toggle { --toggle-size: 5.6px; flex: none; }
.bb8-toggle__container { box-shadow: 0 0 0 2px var(--fg); }
.bb8-toggle__checkbox { display: block !important; position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.bb8-toggle__checkbox:focus-visible + .bb8-toggle__container { outline: 3px solid var(--ring); outline-offset: 4px; }

.hero { padding: var(--s8) 0; text-align: center; }
.status { display: inline-flex; align-items: center; gap: var(--s2); padding: 4px var(--s3); border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--muted); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fill); }
h1 { margin: var(--s5) 0; font-size: clamp(40px, 7vw, 80px); font-weight: 800; line-height: 1.02; letter-spacing: -.035em; text-wrap: balance; }
.lede { max-width: 36rem; margin-inline: auto; color: var(--muted); font-size: clamp(17px, 2vw, 19px); }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s3); margin-top: var(--s6); }
.button { display: inline-flex; align-items: center; min-height: var(--h); padding: 0 22px; border: 1px solid var(--line); border-radius: 999px; font-size: 15px; font-weight: 600; transition: background-color .2s, border-color .2s; }
.button:hover { border-color: var(--fg); }
.button.primary { background: var(--fill); border-color: transparent; color: #fff; }
.button.primary:hover { filter: brightness(.9); }

.preview { margin-top: var(--s8); text-align: left; }
.preview figcaption { margin-top: var(--s3); font-size: 13px; color: var(--muted); text-align: center; }
.app-window { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); box-shadow: 0 20px 60px rgba(0, 0, 0, .08); }
.window-toolbar { display: flex; align-items: center; gap: var(--s3); height: 44px; padding: 0 var(--s4); border-bottom: 1px solid var(--line); background: var(--solid); font-size: 12px; }
.traffic-lights { display: flex; gap: 6px; }
.traffic-lights i { width: 11px; height: 11px; border-radius: 50%; background: var(--line); }
.window-title { margin-right: auto; font-weight: 600; }
.build-chip { padding: 3px 12px; border-radius: 999px; background: var(--fill); color: #fff; font-weight: 600; }
.window-content { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 300px; }
.source-pane { padding: var(--s4) 0; border-right: 1px solid var(--line); overflow: hidden; }
.code { display: flex; gap: var(--s3); padding: 3px var(--s4); font-size: 12.5px; white-space: nowrap; }
.code span { min-width: 1ch; color: var(--muted); font-family: var(--mono); }
.code .hl { color: var(--accent); }
/* PDF paper stays white in both themes: it shows the real output */
.pdf-pane { padding: var(--s5); background: var(--solid); }
.paper-page { max-width: 300px; margin-inline: auto; padding: 28px 24px; background: #fff; color: #222; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); font-family: Georgia, "Times New Roman", serif; font-size: 10px; line-height: 1.5; }
.paper-title { margin-bottom: 20px; font-size: 15px; text-align: center; }
.paper-section { margin-bottom: 6px; font-size: 11px; font-weight: 700; }
.paper-equation { margin: 16px 0; font-size: 12px; font-style: italic; text-align: center; }
.paper-line { height: 4px; margin-top: 8px; background: #e6e6e6; }
.paper-line.short { width: 65%; }

.section { padding: var(--s8) 0; border-top: 1px solid var(--line); }
h2 { max-width: 20ch; font-size: clamp(30px, 4.5vw, 48px); font-weight: 800; line-height: 1.08; letter-spacing: -.03em; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s6); margin-top: var(--s7); padding: 0; list-style: none; }
.steps li { padding-top: var(--s4); border-top: 2px solid var(--fg); }
.step-number { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.steps h3 { margin: var(--s3) 0 var(--s2); font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.steps p, .principle-list dd { color: var(--muted); font-size: 15px; }
.principle-list { margin-top: var(--s7); border-top: 1px solid var(--line); }
.principle-list div { display: grid; grid-template-columns: 220px 1fr; gap: var(--s4); padding: var(--s5) 0; border-bottom: 1px solid var(--line); }
.principle-list dt { font-weight: 700; }

.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3); padding: var(--s6) 0 var(--s7); border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }

@media (max-width: 800px) {
  .window-content { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 0; }
    .steps { grid-template-columns: 1fr; gap: var(--s5); }
  .principle-list div { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 600px) {
  .site-header, main, .site-footer { width: calc(100% - 2 * var(--s4)); }
  .site-header { gap: var(--s3); min-height: 64px; }
  .site-nav { display: none; }
  /* padding grows the tap target to 44px; negative margin keeps the artwork in place */
  .bb8-toggle { --toggle-size: 5.2px; margin: -8px -8px -8px auto; padding: 8px; }
  .hero { padding: var(--s7) 0 var(--s8); }
  .preview { margin-top: var(--s7); }
  .button { flex: 1 1 100%; justify-content: center; }
  .source-pane { padding: var(--s3) 0; }
  .code { gap: var(--s2); padding: 2px var(--s3); font-size: 9px; }
  .pdf-pane { padding: var(--s3); }
  .paper-page { padding: 14px 12px; font-size: 7px; }
  .paper-title { margin-bottom: 10px; font-size: 10px; }
  .paper-section, .paper-equation { font-size: 8px; }
  .section { padding: var(--s7) 0; }
}

@media (prefers-reduced-motion: reduce) {
  /* no blanket transform:none: BB-8 positions its parts with transforms */
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
/* Increase Contrast: stronger greys and dividers; the blues already pass at 6.8:1 or more */
@media (prefers-contrast: more) {
  :root { --line: #8e8e93; --muted: #3a3a3c; }
  html[data-theme="dark"] { --line: #8e8e93; --muted: #c7c7cc; }
}
