/* ============================================================
   Terminal Tutor — Shared Design System
   Color-coded pedagogy: color tells you WHAT a thing is.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* ----- Pedagogy palette (concept colors) ----- */
  --you:        #ee8a5e;   /* coral / peach — YOU, the human */
  --you-soft:   #fde3d1;
  --you-ink:    #7a3a18;

  --shell:      #e8b53b;   /* warm yellow — the shell (bash/zsh/PowerShell) */
  --shell-soft: #fbeec2;
  --shell-ink:  #6b4d05;

  --kernel:     #8398ea;   /* periwinkle — kernel / OS core */
  --kernel-soft:#dde3f9;
  --kernel-ink: #2a3577;

  --fs:         #6fb286;   /* sage — filesystem / files / dirs */
  --fs-soft:    #d6ead8;
  --fs-ink:     #1e5435;

  --proc:       #c084b8;   /* mauve — process / running thing */
  --proc-soft:  #ecd6e8;
  --proc-ink:   #5e2b54;

  --hw:         #a8a299;   /* stone — hardware */
  --hw-soft:    #e6e1d8;
  --hw-ink:     #4a443c;

  /* ----- Surface / neutral ----- */
  --bg:         #faf6ef;   /* warm paper */
  --bg-alt:     #f3ede1;
  --card:       #ffffff;
  --line:       #e7dfce;
  --line-strong:#cdc0a3;

  --ink:        #1d1a14;
  --ink-soft:   #5e564a;
  --ink-mute:   #8b8170;

  /* ----- Type ----- */
  --display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --sans:    'Geist', 'Helvetica Neue', system-ui, sans-serif;
  --mono:    'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* ----- Layout ----- */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-xl: 28px;

  --shadow-card: 0 1px 0 rgba(0,0,0,.04), 0 6px 22px -12px rgba(50,40,20,.18);
  --shadow-pop:  0 2px 0 rgba(0,0,0,.04), 0 18px 40px -18px rgba(50,40,20,.32);
}

/* ============================================================
   Base
   ============================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-family: var(--display); font-weight: 400; letter-spacing: -0.02em; line-height: 1.02; }
h2 { font-family: var(--display); font-weight: 400; letter-spacing: -0.015em; line-height: 1.1; }
p { margin: 0; text-wrap: pretty; }

a { color: inherit; }

code, .mono { font-family: var(--mono); font-variant-ligatures: none; }

/* ============================================================
   Layout primitives
   ============================================================ */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 40px 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 40px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(1.2);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}
.topbar .brand .mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 14px;
}
.topbar .brand .mark::before { content: "›_"; }
.topbar .brand .name {
  font-family: var(--display); font-size: 22px; line-height: 1;
}
.topbar nav {
  display: flex; gap: 4px;
}
.topbar nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 999px;
}
.topbar nav a:hover { color: var(--ink); background: var(--bg-alt); }
.topbar nav a.active { color: var(--ink); background: var(--bg-alt); }

/* ============================================================
   OS toggle (chip group)
   ============================================================ */
.os-toggle {
  display: inline-flex;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.os-toggle button {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.os-toggle button:hover { color: var(--ink); }
.os-toggle button[aria-pressed="true"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.os-toggle .dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.os-toggle [data-os="mac"]    .dot { background: var(--you); }
.os-toggle [data-os="windows"].dot,
.os-toggle [data-os="windows"] .dot { background: var(--kernel); }
.os-toggle [data-os="linux"]  .dot { background: var(--fs); }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--ink-soft);
}
.tag.you     { background: var(--you-soft);    color: var(--you-ink); }
.tag.shell   { background: var(--shell-soft);  color: var(--shell-ink); }
.tag.kernel  { background: var(--kernel-soft); color: var(--kernel-ink); }
.tag.fs      { background: var(--fs-soft);     color: var(--fs-ink); }
.tag.proc    { background: var(--proc-soft);   color: var(--proc-ink); }
.tag.hw      { background: var(--hw-soft);     color: var(--hw-ink); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-pop); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn.ghost:hover { background: var(--bg-alt); }

/* ============================================================
   Terminal (used across many surfaces)
   ============================================================ */
.term {
  background: #1c1a16;
  color: #f4ecd9;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid #2c2820;
  box-shadow: 0 14px 40px -18px rgba(0,0,0,.45);
}
.term-chrome {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: #25221c;
  border-bottom: 1px solid #2e2a22;
  font-family: var(--sans);
  font-size: 12px;
  color: #a59a82;
}
.term-chrome .dots { display: flex; gap: 6px; margin-right: 8px; }
.term-chrome .dots span {
  width: 11px; height: 11px; border-radius: 50%;
  background: #54504a;
}
.term-chrome .dots span:nth-child(1) { background: #ef6a5e; }
.term-chrome .dots span:nth-child(2) { background: #f5be4e; }
.term-chrome .dots span:nth-child(3) { background: #61c554; }
.term-chrome .title { flex: 1; text-align: center; }
.term-body {
  padding: 14px 16px;
  min-height: 220px;
  white-space: pre-wrap;
  word-break: break-word;
}
.term .prompt { color: #88c0a1; }
.term .prompt-win { color: #aeb9ee; }
.term .cmd { color: #f4ecd9; }
.term .out { color: #c8c0aa; }
.term .err { color: #ef9b8b; }
.term .dim { color: #7d7665; }
.term .cursor {
  display: inline-block;
  width: 8px; height: 1em;
  background: #f4ecd9;
  vertical-align: text-bottom;
  animation: blink 1s steps(2) infinite;
  margin-left: 1px;
}
@keyframes blink { 50% { opacity: 0; } }

.term input.term-input {
  background: transparent;
  border: 0;
  outline: 0;
  color: #f4ecd9;
  font-family: var(--mono);
  font-size: 14px;
  width: 100%;
  caret-color: #f4ecd9;
}

/* ============================================================
   Code chips, inline keys
   ============================================================ */
.kbd {
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
}
code.inline {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 5px;
}

/* ============================================================
   Print
   ============================================================ */
@media print {
  .topbar, .no-print { display: none !important; }
  body { background: white; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .page { max-width: none; padding: 0; }
  @page { margin: 18mm; }
}
