/* jbuschmann.com portfolio. Hand-written, no build step. */
:root {
  color-scheme: dark;
  --bg: #000000;
  --bg-alt: #0b0b0b;
  --surface: #121212;
  --fg: #ededed;
  --muted: #a3a3a3;
  --border: #2a2a2a;
  --accent: #e0b25c;
  --accent-hover: #f0c97f;
  --on-accent: #0a0a0a;
  --focus: #e0b25c;
  --badge-bg: #1f1f1f;
  --shadow: none;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: 16px;
}
/* Dark is the default on every device; light is opt-in through the toggle. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3ead3;
  --bg-alt: #eadfc2;
  --surface: #faf4e4;
  --fg: #2a1f14;
  --muted: #5c4a35;
  --border: #cdbb94;
  --accent: #8a3a12;
  --accent-hover: #6e2d0c;
  --on-accent: #fdf8ec;
  --focus: #8a3a12;
  --badge-bg: #e6d8b6;
  --shadow: 0 1px 2px rgba(42, 31, 20, 0.08), 0 4px 14px rgba(42, 31, 20, 0.06);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 1rem; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  overflow-wrap: break-word;
}
img, iframe { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6rem; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 7vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 4.5vw, 2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--badge-bg); padding: 0.1em 0.35em; border-radius: 4px; }

.container { width: 100%; max-width: 72rem; margin: 0 auto; padding-inline: var(--gutter); }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--gutter); top: -4rem; background: var(--accent); color: var(--on-accent); padding: 0.5rem 0.9rem; border-radius: 6px; z-index: 100; }
.skip:focus { top: 0.5rem; }
[hidden] { display: none !important; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: var(--bg); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1.25rem; padding-block: 0.75rem; }
.brand { font-weight: 700; color: var(--fg); text-decoration: none; margin-right: auto; }
.brand:hover { color: var(--accent); }
.nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.nav a { color: var(--fg); text-decoration: none; font-size: 0.95rem; padding: 0.25rem 0; }
.nav a:hover { color: var(--accent); text-decoration: underline; }
.nav-ext a { color: var(--muted); }
@media (max-width: 640px) {
  .brand { flex: 1 1 auto; order: 0; }
  .theme-toggle { order: 1; }
  .nav { flex: 1 0 100%; order: 2; }
  .header-inner { padding-block: 0.5rem; }
}

/* Hero */
.hero { padding-block: clamp(2.5rem, 8vw, 5.5rem) clamp(2rem, 6vw, 4rem); }
.eyebrow { color: var(--muted); font-size: 0.9rem; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 0.75rem; }
.lead { font-size: clamp(1.05rem, 2.6vw, 1.3rem); color: var(--muted); max-width: 44rem; }
.hero .lead { margin-bottom: 1.5rem; }
.cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.5rem 0.95rem; min-height: 2.5rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--fg);
  font: inherit; font-size: 0.95rem; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: transparent; }

/* Sections */
.section { padding-block: clamp(2rem, 6vw, 4rem); }
.section-alt { background: var(--bg-alt); }
.section-intro { color: var(--muted); max-width: 46rem; margin-bottom: 1.5rem; }
.subhead { margin-top: 3rem; }

/* Cards */
.grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .grid-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.1rem 1.1rem 1rem; box-shadow: var(--shadow); min-width: 0;
}
.card-featured { padding: 1.35rem; }
.card-title { margin-bottom: 0.4rem; }
.card-title a { color: var(--fg); text-decoration: none; }
.card-title a:hover { color: var(--accent); text-decoration: underline; }
.tagline { color: var(--muted); margin-bottom: 0.75rem; }
.meta-line { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.6rem; }
.card-actions { margin-top: auto; display: flex; flex-direction: column; gap: 0.75rem; }

ul.badges, ul.tags, ul.links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
ul.badges { margin-bottom: 0.7rem; }
ul.tags { margin-bottom: 1rem; }
.badge { font-size: 0.78rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--badge-bg); color: var(--fg); border: 1px solid var(--border); }
.badge-sample { background: transparent; color: var(--muted); border-style: dashed; font-weight: 500; }
.badge-live { border-color: var(--accent); }
ul.tags li { font-size: 0.8rem; color: var(--muted); }
ul.tags li::before { content: "#"; opacity: 0.6; }

.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem 1rem; margin: 0 0 1rem; }
@media (min-width: 700px) { .detail .metrics-3, .detail .metrics-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.metric { display: flex; flex-direction: column-reverse; min-width: 0; }
.metric dt { font-size: 0.8rem; color: var(--muted); }
.metric dd { margin: 0; font-size: 1.75rem; font-weight: 700; line-height: 1.1; color: var(--accent); }
.detail .metric dd { font-size: 2.25rem; }

.writeup-only {
  margin: 0; padding: 0.55rem 0.8rem; font-size: 0.9rem; color: var(--muted);
  border-left: 3px solid var(--accent); background: var(--bg-alt); border-radius: 0 8px 8px 0;
}
.writeup-only strong { color: var(--fg); }
.more { font-size: 0.9rem; font-weight: 600; }
.arrow { font-size: 0.9em; }

/* Filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.chip {
  font: inherit; font-size: 0.9rem; padding: 0.35rem 0.8rem; min-height: 2.25rem;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--fg); cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }

/* Theme switch: sun and moon on a track, a thumb slides under the active one */
.theme-switch { position: relative; display: inline-flex; align-items: center; flex: none; width: 3.5rem; height: 1.9rem; padding: 0; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); cursor: pointer; color: var(--muted); }
.theme-switch:hover { border-color: var(--accent); }
.ts-thumb { position: absolute; top: 3px; left: 3px; width: calc(1.9rem - 8px); height: calc(1.9rem - 8px); border-radius: 50%; background: var(--accent);
  transition: transform .3s cubic-bezier(.3, 1.4, .5, 1); }
:root[data-theme="dark"] .ts-thumb { transform: translateX(calc(3.5rem - 1.9rem)); }
.ts-icon { position: absolute; top: 50%; width: 1rem; height: 1rem; margin-top: -0.5rem; z-index: 1; transition: color .25s; }
.ts-sun { left: calc((1.9rem - 1rem) / 2 - 1px); }
.ts-moon { right: calc((1.9rem - 1rem) / 2 - 1px); }
:root[data-theme="light"] .ts-sun, :root[data-theme="dark"] .ts-moon { color: var(--on-accent); }

/* Homelab */
.stack-grid { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0.75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .stack-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stack-item { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0.9rem 1rem; box-shadow: var(--shadow); }
.stack-item h3 { font-size: 1.05rem; margin-bottom: 0.25rem; color: var(--accent); }
.stack-item p { margin: 0; font-size: 0.9rem; color: var(--muted); }
.panel-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0; }

/* Ask */
.ask-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: clamp(1.1rem, 4vw, 2rem); box-shadow: var(--shadow); }
.ask-card .section-intro { margin-bottom: 1.25rem; }
.ask-mobile { display: none; margin: 1rem 0 0; }
@media (max-width: 768px) {
  .ask-open { display: none !important; }
  .ask-mobile { display: block; }
}

/* Click-to-open panels */
.panel { width: min(960px, calc(100vw - 2rem)); height: min(720px, calc(100vh - 2rem)); padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--fg); }
.panel[open] { display: flex; flex-direction: column; }
.panel::backdrop { background: rgba(0, 0, 0, 0.6); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 1.1rem; margin: 0; }
.panel-iframe { flex: 1; width: 100%; border: 0; background: #fff; color-scheme: light; }
.panel-embed { flex: 1; min-height: 0; overflow: hidden; background: var(--bg); }
.panel-embed .chat-layout, .panel-embed .chat-wrapper { height: 100%; }
.chat-note { padding: 1rem; color: var(--muted); }

/* Prose and detail page */
.prose { max-width: 46rem; }
.prose h2 { margin-top: 2rem; }
.prose ul, .prose ol { padding-left: 1.25rem; margin: 0 0 1rem; }
.prose li { margin: 0.25rem 0; }
.detail { padding-block: 1.5rem 3rem; }
.back { margin-bottom: 1.5rem; }
.detail-head { margin-bottom: 1rem; }
.detail-head h1 { font-size: clamp(1.9rem, 6vw, 2.75rem); }
.meta-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem 1.5rem; margin: 1.25rem 0; padding: 1rem 0; border-block: 1px solid var(--border); }
.meta-row dt { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.meta-row dd { margin: 0; }
.detail-links { margin-bottom: 1.5rem; }
.next { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.next a { font-weight: 600; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding-block: 1.5rem; color: var(--muted); font-size: 0.9rem; }
.site-footer p { margin: 0 0 0.5rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }

/* ===== Visual effects (see static/fx.js) ===== */
.scroll-progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 200; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), var(--accent-hover), var(--accent)); pointer-events: none; }
.site-header { position: sticky; top: 0; z-index: 150;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); transition: box-shadow .25s, border-color .25s; }
.site-header.is-scrolled { box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22); }
html { scroll-padding-top: 4.5rem; }

/* Hero */
.hero { position: relative; overflow: hidden; isolation: isolate; min-height: min(78vh, 46rem); display: flex; align-items: center; padding-block: clamp(3rem, 9vw, 6rem); }
.hero-content { position: relative; z-index: 2; }
.hero-bg { position: absolute; inset: 0; z-index: 0; }
#hero-canvas { position: absolute; inset: 0; display: block; }
.aurora { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(80px); opacity: 0.32; will-change: transform; }
.aurora-a { background: radial-gradient(circle, var(--accent), transparent 65%); top: -18vmax; left: -10vmax; animation: drift-a 18s ease-in-out infinite alternate; }
.aurora-b { background: radial-gradient(circle, var(--accent-hover), transparent 65%); bottom: -24vmax; right: -12vmax; opacity: 0.22; animation: drift-b 22s ease-in-out infinite alternate; }
@keyframes drift-a { to { transform: translate(14vmax, 10vmax) scale(1.15); } }
@keyframes drift-b { to { transform: translate(-12vmax, -8vmax) scale(1.2); } }
.hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 30%; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg)); }

.hero h1 { font-size: clamp(2.6rem, 9vw, 5.5rem); letter-spacing: -0.03em; line-height: 1.02; }
.grad-text { background: linear-gradient(100deg, var(--fg) 0%, var(--accent) 45%, var(--accent-hover) 60%, var(--fg) 100%);
  background-size: 220% auto; -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  animation: shimmer 7s linear infinite; }
@keyframes shimmer { to { background-position: -220% center; } }
.eyebrow { display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.8rem; border: 1px solid var(--border); border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent); }
.pulse-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: pulse 2.2s ease-out infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 0.6rem transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.typed-line { font-size: clamp(1.15rem, 3.4vw, 1.8rem); font-weight: 600; margin-bottom: 1rem; min-height: 1.5em; }
.typed { color: var(--accent); }
.caret { display: inline-block; width: 2px; height: 1.1em; margin-left: 3px; vertical-align: -0.15em; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.btn-glow { position: relative; box-shadow: 0 0 0 0 transparent; transition: box-shadow .25s, transform .2s, background .2s; }
.btn-glow:hover { box-shadow: 0 0 28px 2px color-mix(in srgb, var(--accent) 55%, transparent); }
.cta .btn { transition: transform .15s ease-out, box-shadow .25s, background .2s, border-color .2s, color .2s; }

.hero-in { opacity: 0; animation: rise .8s cubic-bezier(.2, .7, .2, 1) forwards; }
.hero-content > :nth-child(1) { animation-delay: .05s; }
.hero-content > :nth-child(2) { animation-delay: .18s; }
.hero-content > :nth-child(3) { animation-delay: .32s; }
.hero-content > :nth-child(4) { animation-delay: .46s; }
.hero-content > :nth-child(5) { animation-delay: .6s; }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
.scroll-cue { position: absolute; left: 50%; bottom: 1.2rem; z-index: 3; width: 1.6rem; height: 2.6rem; margin-left: -0.8rem; border: 2px solid var(--muted); border-radius: 999px; opacity: 0.7; }
.scroll-cue span { position: absolute; left: 50%; top: 0.4rem; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--accent); animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }
@media (max-width: 640px) { .scroll-cue { display: none; } }
@media (max-width: 768px) { #hero-canvas { opacity: 0.6; } }

:root[data-theme="light"] .hero-bg { background: linear-gradient(to bottom, #4f94d4 0%, #86bdea 38%, #c4dff3 78%, var(--bg) 100%); }
:root[data-theme="light"] .aurora { opacity: 0.12; }
:root[data-theme="light"] .hero .lead, :root[data-theme="light"] .eyebrow { color: #3d2e1e; }
.hero-bg { transition: background .4s; }
.sky-tip { position: absolute; z-index: 4; pointer-events: none; padding: 0.3rem 0.7rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--surface); color: var(--fg); border: 1px solid var(--accent); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); white-space: nowrap; }
.hero.sky-hover { cursor: pointer; }

/* Scroll reveal (class added by fx.js) */
.reveal:not(.in) { opacity: 0; transform: translateY(28px); }
.reveal.in { animation: rise .75s cubic-bezier(.2, .7, .2, 1) var(--d, 0ms) backwards; }

/* Cards: spotlight + tilt + gradient edge */
.card, .stack-item, .ask-card { position: relative; overflow: hidden; transition: transform .2s ease-out, border-color .25s, box-shadow .25s; transform-style: preserve-3d; }
.card::before, .stack-item::before, .ask-card::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%); }
.card:hover::before, .stack-item:hover::before, .ask-card:hover::before { opacity: 1; }
.card:hover, .stack-item:hover { border-color: color-mix(in srgb, var(--accent) 65%, var(--border)); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28); }
.card > *, .stack-item > *, .ask-card > * { position: relative; }
.metric dd { font-variant-numeric: tabular-nums; }
.section h2 { position: relative; display: inline-block; }
.section h2::after { content: ""; display: block; height: 3px; width: 2.5rem; margin-top: 0.45rem; border-radius: 2px; background: linear-gradient(90deg, var(--accent), transparent); }
.badge-live::before { content: ""; display: inline-block; width: 0.45rem; height: 0.45rem; margin-right: 0.4rem; border-radius: 50%; background: #3ddc84; animation: pulse 2.2s ease-out infinite; }
.chip { transition: background .2s, border-color .2s, transform .15s; }
.chip:hover { transform: translateY(-2px); }

@media (prefers-reduced-motion: reduce) {
  .hero-in { opacity: 1; }
  .aurora, .grad-text, .pulse-dot, .caret, .scroll-cue span { animation: none !important; }
  .reveal:not(.in) { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
