/* ============================================================
   pwaos.net site styles — dark terminal-native design system
   Drawn from the pwaos shell itself: near-black charcoal, one
   cyan accent, ANSI colors used functionally (labels, commands).
   Space Grotesk for UI, JetBrains Mono for code/terminal.
   ============================================================ */

:root {
  --bg: #0b0d12;
  --bg-elev: #10131a;
  --surface: #141823;
  --surface-2: #181d2a;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8eaf0;
  --muted: #9aa1b2;
  --faint: #6b7284;
  --accent: #40d0e0;
  --accent-dim: rgba(64, 208, 224, 0.14);
  --accent-ink: #06222a; /* text on accent buttons */
  /* GitHub corner ribbon colors */
  --gc-fill: var(--accent);
  --gc-ink: #0b0d12;
  /* Terminal mockup keeps its own dark palette in BOTH color modes,
     so its internals pin constants instead of themed vars. */
  --term-accent: #40d0e0;
  --term-dim: #6b7284;
  --term-text: #c8cdd9;
  /* Code viewer too: hljs dark.min.css expects a dark surface — pin it
     in both color modes, consistent with the terminal mockup. */
  --code-bg: #141823;
  /* ANSI palette from the shell's own Features box — bright values,
     constant across color modes (only used inside the dark terminal) */
  --ansi-yellow: #f5c542;
  --ansi-blue: #5b9cf5;
  --ansi-magenta: #e05fa8;
  --ansi-green: #58c98b;
  --font-ui: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  --radius-lg: 14px;
  --header-h: 64px;
  color-scheme: dark;
}

/* ============ Light color mode ============
   Opt-in via html[data-theme="light"] (set from localStorage choice or
   prefers-color-scheme by the inline head script). ANSI and terminal
   constants above are deliberately NOT overridden. */

html[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --border: rgba(13, 20, 34, 0.12);
  --border-strong: rgba(13, 20, 34, 0.22);
  --text: #16202e;
  --muted: #4d576b;
  --faint: #6b7284;
  --accent: #0c7c8c;
  --accent-dim: rgba(12, 124, 140, 0.12);
  --accent-ink: #f2fbfd;
  --gc-fill: #16202e;
  --gc-ink: #f5f6f8;
  color-scheme: light;
}

/* Header glass must follow the mode — a permanently dark bar would
   leave the themed (dark) wordmark and nav links dark-on-dark. */
html[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, 0.85);
}

html[data-theme="light"] .site-nav a:hover {
  background: rgba(13, 20, 34, 0.06);
}

html[data-theme="light"] .theme-toggle:hover {
  background: rgba(13, 20, 34, 0.06);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }

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

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============ Header ============ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(11, 13, 18, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-row {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.01em;
}
.brand:hover { text-decoration: none; }

.brand-logo {
  height: 30px;
  width: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #000;
  padding: 3px 6px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.site-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}
.site-nav a.active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ============ Main / page scaffolding ============ */

main.page {
  flex: 1;
  padding: 64px 0 88px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 16px;
}

h1.hero-title {
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  text-wrap: balance;
}

.lede {
  font-size: clamp(16px, 2vw, 18.5px);
  color: var(--muted);
  max-width: 56ch;
  margin: 0 0 32px;
  text-wrap: pretty;
}

.section-title {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

.section-sub {
  color: var(--muted);
  margin: 0 0 28px;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

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

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  padding: 14px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
              color 0.15s ease, transform 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { background: var(--accent); filter: brightness(1.12); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Download buttons (demo / usage) */
.dl-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.dl-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  text-decoration: none;
}
.dl-card.disabled {
  opacity: 0.45;
  pointer-events: none;
}
.dl-name { font-weight: 600; font-size: 16px; }
.dl-file {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}
.dl-get {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.dl-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin: 0 0 8px;
}

/* ============ Terminal mockup ============ */

.terminal {
  background: #07090d;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* Terminal stays dark in both color modes — deep shadow sells the
     elevation on light backgrounds too. */
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.55);
}

.terminal-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #10141c;
  border-bottom: 1px solid var(--border);
}

.terminal-dots { display: flex; gap: 6px; }
.terminal-dots span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #2a3040;
}
.terminal-dots span:first-child { background: #e0564b; }
.terminal-dots span:nth-child(2) { background: #f5c542; }
.terminal-dots span:last-child { background: #58c98b; }

.terminal-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
  margin: 0 auto;
  transform: translateX(-28px);
}

.terminal-body {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.75;
  padding: 18px 20px 22px;
  color: var(--term-text);
  overflow-x: auto;
}
.terminal-body .prompt { color: var(--ansi-green); }
.terminal-body .cmd { color: var(--term-accent); }
.terminal-body .dim { color: var(--term-dim); }

.term-features {
  border: 1px solid #3a4152;
  border-radius: 6px;
  position: relative;
  margin: 14px 0;
  padding: 14px 16px 12px;
}
.term-features .legend {
  position: absolute;
  top: -0.85em;
  left: 12px;
  background: #07090d;
  padding: 0 8px;
  font-size: 12px;
  color: var(--muted);
}
.term-features .row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.term-features .label { min-width: 218px; }
.term-features .label.yellow { color: var(--ansi-yellow); font-weight: 600; }
.term-features .label.blue { color: var(--ansi-blue); font-weight: 600; }
.term-features .label.magenta { color: var(--ansi-magenta); font-weight: 600; }
.term-features .label.green { color: var(--ansi-green); font-weight: 600; }

.term-help {
  display: grid;
  /* cmd | desc | cmd | desc — pairs stay adjacent and aligned */
  grid-template-columns: minmax(56px, auto) minmax(175px, 1fr) minmax(56px, auto) minmax(175px, 1fr);
  gap: 2px 24px;
  margin: 8px 0 4px;
  justify-content: start;
}

/* ============ API chips ============ */

.api-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px 0 0;
}
.api-chips .chip {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  background: var(--bg-elev);
}

/* ============ Hero layout ============ */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 56px;
  align-items: center;
}

/* ============ Cards (about / patents) ============ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
}
.card + .card { margin-top: 16px; }

.patent-id {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.card p { color: var(--muted); margin: 8px 0 0; }
.card p strong { color: var(--text); }

/* ============ Code tabs (usage) ============ */

.code-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}
.code-tabs button {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 18px;
  color: var(--muted);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-bottom-color: transparent;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.code-tabs button:hover { color: var(--text); }
.code-tabs button.active {
  color: var(--accent);
  background: var(--surface);
  border-bottom-color: var(--surface);
}

.code-panel {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}
.code-panel pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
  color: #c8cdd9;
}
.code-panel code { font-family: var(--font-mono); background: transparent; }

/* ============ Figure / screenshot ============ */

.shot-frame {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #07090d;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.55);
}
.shot-frame img { width: 100%; }
.shot-frame figcaption {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}

/* ============ Footer ============ */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 0;
}
.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--faint);
}
.footer-row .mono { font-family: var(--font-mono); font-size: 12.5px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }

/* ============ GitHub corner ============ */

.github-corner { position: fixed; top: 0; right: 0; z-index: 60; }
.github-corner svg { display: block; }
.github-corner:hover .octo-arm { animation: octocat-wave 560ms ease-in-out; }
@keyframes octocat-wave {
  0%, 100% { transform: rotate(0); }
  20%, 60% { transform: rotate(-25deg); }
  40%, 80% { transform: rotate(10deg); }
}

/* ============ Responsive ============ */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 768px) {
  main.page { padding: 44px 0 64px; }
  .nav-row {
    height: auto;
    min-height: var(--header-h);
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .site-header { height: auto; }
  .site-nav {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 2px;
    scrollbar-width: none;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { padding: 8px 10px; white-space: nowrap; }
  .terminal-body { font-size: 12px; }
  .term-features .label { min-width: 0; }
  .term-features .row { flex-direction: column; gap: 4px; }
  .footer-row { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .github-corner:hover .octo-arm { animation: none; }
}
