/* Shared styles for all pages: design tokens, base, layout and the components used on more than one page. */

/* ---------- Tokens ---------- */
:root {
  --bg: #07090a;
  --bg-2: #0d1210;
  --panel: #111915;
  --text: #e8f2e6;
  --muted: #93a596;
  --portal: #5ee33f;
  --portal-dark: #2f9e24;
  --on-portal: #061004;
  --mustard: #f6c21c;
  --line: rgba(94, 227, 63, .18);
  --font-display: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  --max: 1080px;
  --nav-h: 64px;
  --glow: 0 0 24px rgba(94, 227, 63, .35);
  --glow-text: 0 0 18px rgba(94, 227, 63, .55);
  --glow-top: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(94, 227, 63, .14), transparent 70%);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
body { -webkit-font-smoothing: antialiased; }
a { color: var(--portal); }
:focus-visible { outline: 2px solid var(--mustard); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Layout ---------- */
.wrap { width: min(var(--max), 100% - 2.5rem); margin-inline: auto; }
/* Page sections alternate plain and .alt (darker background with separator lines). */
.section { padding: clamp(4rem, 9vw, 6.5rem) 0; }
.alt { background: var(--bg-2); border-block: 1px solid var(--line); }
.alt:last-child { border-bottom: 0; }

/* ---------- Terminal prompt line ("flowkap@earth:~$ …") ---------- */
.prompt { font-family: var(--font-display); color: var(--muted); font-size: .9rem; line-height: 1.5; margin: 0 0 .6rem; }
.prompt b { color: var(--portal); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .8rem 1.4rem; border: 0; border-radius: 10px; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: .9rem; text-decoration: none;
  transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease;
}
.btn-primary { background: var(--portal); color: var(--on-portal); box-shadow: 0 4px 0 var(--portal-dark), var(--glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--portal-dark), 0 0 34px rgba(94, 227, 63, .55); }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--portal-dark), var(--glow); }

/* ---------- Title bar ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--nav-h);
  background: rgba(7, 9, 10, .82);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.nav-brand { display: flex; align-items: center; gap: .7rem; margin-right: auto; font-size: 1.0625rem; text-decoration: none; color: var(--text); font-family: var(--font-display); font-weight: 700; }
.nav-brand img { width: 36px; height: 36px; border-radius: 50%; box-shadow: 0 0 0 2px var(--portal); }
.nav-brand span::after { content: "_"; color: var(--portal); animation: blink 1.1s steps(1) infinite; }
.nav-links { display: flex; gap: 1.75rem; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  font-family: var(--font-display); font-size: .9rem; text-decoration: none; color: var(--muted);
  padding: .3rem 0; transition: color .2s, text-shadow .2s;
}
.nav-links a::before { content: "./"; color: transparent; transition: color .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); text-shadow: 0 0 12px rgba(94, 227, 63, .6); }
.nav-links a:hover::before, .nav-links a.active::before { color: var(--portal); }
.nav-prefs { order: 2; margin-left: 1.75rem; font-size: .9rem; }
.nav-toggle { order: 3; display: none; background: none; border: 0; color: var(--text); padding: .5rem; cursor: pointer; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: currentColor; margin: 6px 0; transition: transform .25s, opacity .25s; }
@media (max-width: 720px) {
  .nav-toggle { display: block; margin-left: .75rem; }
  .nav-prefs { margin-left: 0; }
  .nav-links {
    position: absolute; top: var(--nav-h); left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--bg-2); border-bottom: 1px solid var(--line);
    max-height: 0; overflow: hidden; visibility: hidden; transition: max-height .3s ease, visibility 0s linear .3s;
  }
  .nav-links a { display: block; padding: 1rem 1.25rem; }
  .nav.open .nav-links { max-height: 360px; visibility: visible; transition: max-height .3s ease; }
  .nav.open .nav-toggle span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .nav.open .nav-toggle span:nth-child(2) { opacity: 0; }
  .nav.open .nav-toggle span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}
@media (max-width: 400px) {
  .nav-prefs .prefs, .nav-prefs .prefs-group { gap: .1rem; }
  .nav-prefs .prefs-group + .prefs-group { margin-left: .3rem; padding-left: .3rem; }
  .nav-prefs .prefs-option { padding: .25rem .2rem; }
}

/* ---------- Preference toggles, rendered by js/prefs.js ---------- */
.prefs { display: flex; align-items: center; gap: .9rem; }
.prefs-group { display: flex; align-items: center; gap: .15rem; }
.prefs-group + .prefs-group { padding-left: .9rem; border-left: 1px solid var(--line); }
.prefs-option {
  position: relative; display: inline-flex; align-items: center; padding: .3rem; font: inherit; line-height: 1; cursor: pointer;
  color: var(--muted); background: none; border: 0; border-radius: 4px; transition: color .2s;
}
.prefs-option:hover { color: var(--text); }
.prefs-option[aria-pressed="true"] { color: var(--portal); }
.prefs-option .icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: filter .2s; }
.prefs-option:hover .icon, .prefs-option[aria-pressed="true"] .icon { filter: drop-shadow(0 0 6px rgba(94, 227, 63, .5)); }
.prefs-option::after {
  content: attr(aria-label); position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; padding: 3px 8px; white-space: nowrap;
  font-family: var(--font-display); font-size: .75rem; color: var(--bg); background: var(--text); border-radius: 4px;
  pointer-events: none; opacity: 0; transition: opacity .1s ease;
}
.prefs-option:hover::after, .prefs-option:focus-visible::after { opacity: 1; transition-delay: .5s; }

/* ---------- Light-mode joke dialogs, rendered by js/prefs.js ---------- */
dialog.nope { border: 0; padding: 0; background: transparent; color: var(--text); max-width: min(34rem, 100vw - 32px); }
dialog.nope::backdrop { background: rgba(7, 9, 10, .85); backdrop-filter: blur(3px); }
.nope-body {
  font-family: var(--font-display); padding: 2rem 1.5rem; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--glow-top), var(--bg);
}
.nope-body h2 { margin: 0 0 .5rem; font-family: var(--font-display); font-size: clamp(2.2rem, 9vw, 3.4rem); line-height: 1.2; letter-spacing: -.01em; color: var(--portal); text-shadow: var(--glow-text); }
.nope-body p { color: var(--muted); line-height: 1.6; }
.nope-install-log { margin: 0; min-height: 17em; line-height: 1.5; font-family: var(--font-display); font-size: .85rem; color: var(--muted); white-space: pre-wrap; }
.nope-install-log .spin { color: var(--portal); }
.nope-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.nope-actions .btn { line-height: 1.2; }
.nope-actions .doom { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.nope-actions .doom:hover { color: var(--mustard); box-shadow: inset 0 0 0 1px var(--mustard); }

/* ---------- Social links (contact section, footer) ---------- */
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; }
.socials a {
  display: inline-flex; align-items: center; gap: .65rem;
  padding: .8rem 1.3rem; border-radius: 10px; text-decoration: none;
  font-family: var(--font-display); font-weight: 700; font-size: .9rem; color: var(--text);
  background: var(--panel); box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .15s ease, box-shadow .2s ease, color .2s ease, background-color .2s ease;
}
.socials a:hover, .socials a:focus-visible {
  background: var(--portal); color: var(--on-portal); transform: translateY(-2px);
  box-shadow: 0 4px 0 var(--portal-dark), var(--glow);
}
.socials svg { width: 20px; height: 20px; flex: none; }
.socials-small a { padding: 0; width: 40px; height: 40px; justify-content: center; }
.socials-small svg { width: 18px; height: 18px; }

/* ---------- Footer, rendered by js/footer.js ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 2rem 0; font-size: .88rem; color: var(--muted); font-family: var(--font-display); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1.25rem; justify-content: space-between; align-items: center; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--portal); }
