/* Shared site styles. Palette: signature #344271 + brass accent on warm-paper neutrals. */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@700;800&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --brand: #344271;
  --brand-dark: #232d54;
  --brand-tint: #5c6ba3;
  --brand-50: rgba(52, 66, 113, 0.07);
  --brand-100: rgba(52, 66, 113, 0.13);
  --accent: #a9781f;
  --accent-strong: #8a6316;
  --accent-soft: rgba(169, 120, 31, 0.14);
  /* Brighter amber for text on navy (base brass reads muddy there). */
  --accent-on-dark: #eda52d;
  --bg: #f7f4ee;
  --surface: #ffffff;
  --text: #1c2033;
  --text-light: #5c6178;
  --border: #e6e1d5;
  --shadow-sm: 0 1px 2px rgba(28, 32, 51, 0.06), 0 1px 1px rgba(28, 32, 51, 0.04);
  --shadow-md: 0 18px 36px -14px rgba(28, 32, 51, 0.24);
  --radius: 12px;
  --container: 1080px;
  --font-display: 'Manrope', 'Inter', system-ui, sans-serif;
  --header-bg: var(--brand);
  --footer-bg: var(--surface);
  color-scheme: light dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv01', 'ss01';
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Top tab bar (signature brand color). */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg); border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 8px 24px -12px rgba(28, 32, 51, 0.45);
}
.site-header .bar { max-width: var(--container); margin: 0 auto; display: flex; align-items: center; gap: 24px; padding: 0 24px; min-height: 60px; }
.site-header .brand { display: inline-flex; align-items: center; font-family: var(--font-display); font-size: 16.5px; font-weight: 800; letter-spacing: -0.01em; color: #fff; }
.site-header nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.site-header nav > a, .nav-drop .drop-toggle { padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 500; color: rgba(255, 255, 255, 0.72); white-space: nowrap; transition: color 0.15s ease, background-color 0.15s ease; }
.site-header nav > a:hover, .nav-drop .drop-toggle:hover { color: #ffffff; background: rgba(255, 255, 255, 0.1); }
.site-header nav > a.active, .nav-drop .drop-toggle.active { color: #ffffff; font-weight: 600; background: rgba(255, 255, 255, 0.14); box-shadow: inset 0 -2px 0 var(--accent-on-dark); }
/* Keyboard-focus ring stays vibrant on the dark header. */
.site-header .brand:focus-visible,
.site-header nav a:focus-visible,
.site-header .theme-toggle:focus-visible { outline-color: var(--accent-on-dark); }

/* Theme toggle. */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; margin-left: 6px; flex-shrink: 0;
  border: none; border-radius: 8px; background: rgba(255, 255, 255, 0.12); color: #fff;
  cursor: pointer; transition: background-color 0.15s ease;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.22); }
.theme-toggle svg { width: 17px; height: 17px; display: block; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  html:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* Products page (reuses policy card grid). */
.products-head { max-width: 860px; margin: 0 auto; }

.page { max-width: var(--container); margin: 0 auto; padding: 52px 24px 80px; }

/* Product page header: launch button pinned right of the 860px title block;
   back in flow, full width, under 960px. */
.prod-head { position: relative; }
.prod-head .launch { position: absolute; top: 0; right: 0; padding: 16px 30px; border-radius: 12px; font-size: 16.5px; font-weight: 700; }
@media (max-width: 960px) {
  .prod-head .launch { position: static; width: 100%; justify-content: center; margin-top: 22px; }
}

/* Buttons. */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 10px; font-size: 15px; font-weight: 600; line-height: 1; cursor: pointer; text-decoration: none; transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease; }
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 8px 20px -6px rgba(52, 66, 113, 0.55); }
.btn.primary:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { border-color: var(--brand); color: var(--brand); }
/* Buy Me a Coffee keeps its own yellow/black brand pair so the cup stays recognisable. */
.btn.bmc { background: #ffdd00; color: #0d0c22; position: relative; }
.btn.bmc:hover { background: #ffe94d; transform: translateY(-1px); }
.btn.bmc .bmc-logo { width: 18px; height: 18px; flex-shrink: 0; fill: currentColor; }

/* Donate sparkles: 4 hover-only clip-path stars (2 per corner, staggered);
   --sx/--sy aim each star away from its corner. */
.btn.bmc::before, .btn.bmc::after,
.btn.bmc .bmc-label::before, .btn.bmc .bmc-label::after {
  content: ''; position: absolute; pointer-events: none; opacity: 0;
  background: var(--accent-on-dark);
  clip-path: polygon(50% 0%, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0% 50%, 39% 39%);
}
.btn.bmc .bmc-label { position: relative; }
/* top-right corner - travel up and to the right */
.btn.bmc::before, .btn.bmc .bmc-label::before { top: -7px; right: -7px; --sx: 1; --sy: -1; }
/* bottom-left corner - travel down and to the left */
.btn.bmc::after, .btn.bmc .bmc-label::after { bottom: -7px; left: -7px; --sx: -1; --sy: 1; }
.btn.bmc::before, .btn.bmc::after { width: 11px; height: 11px; }
.btn.bmc .bmc-label::before, .btn.bmc .bmc-label::after { width: 7px; height: 7px; }
.btn.bmc:hover::before, .btn.bmc:hover::after,
.btn.bmc:hover .bmc-label::before, .btn.bmc:hover .bmc-label::after {
  animation: bmc-sparkle 1.1s ease-out infinite;
}
.btn.bmc:hover .bmc-label::before { animation-delay: -0.55s; }
.btn.bmc:hover::after { animation-delay: -0.28s; }
.btn.bmc:hover .bmc-label::after { animation-delay: -0.83s; }
@keyframes bmc-sparkle {
  0% { opacity: 0; transform: translate(0, 0) scale(0.25) rotate(0deg); }
  35% { opacity: 1; transform: translate(calc(var(--sx) * 3px), calc(var(--sy) * 3px)) scale(1) rotate(45deg); }
  100% { opacity: 0; transform: translate(calc(var(--sx) * 9px), calc(var(--sy) * 9px)) scale(1.15) rotate(90deg); }
}
@media (prefers-reduced-motion: reduce) {
  .btn.bmc:hover::before, .btn.bmc:hover::after,
  .btn.bmc:hover .bmc-label::before, .btn.bmc:hover .bmc-label::after { animation: none; }
}

/* Nav dropdowns: JS-owned .is-open only (never CSS :hover, which latches on hybrid touch laptops). */
.nav-drop { position: relative; }
.nav-drop .drop-toggle { display: inline-flex; align-items: center; gap: 5px; }
.nav-drop .caret { transition: transform 0.16s ease; }
.nav-drop .drop-menu {
  display: none;
  position: absolute; top: 100%; left: 0; z-index: 100; min-width: 172px;
  margin: 8px 0 0; padding: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-md);
}
.nav-drop.is-open .drop-menu { display: block; animation: drop-in 0.14s ease; }
.nav-drop.is-open .caret { transform: rotate(180deg); }
@keyframes drop-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
/* invisible bridge so moving the cursor down doesn't close the menu */
.nav-drop .drop-menu::before { content: ''; position: absolute; top: -12px; left: 0; right: 0; height: 12px; }
/* keep the right-most menu inside the viewport */
.nav-drop:last-child .drop-menu { left: auto; right: 0; }
.nav-drop .drop-menu a { display: block; padding: 8px 12px; border-radius: 6px; font-size: 13.5px; font-weight: 500; color: var(--text-light); white-space: nowrap; }
.nav-drop .drop-menu a:hover { background: var(--brand-50); color: var(--text); }

/* Home hero: asymmetric two-column, left-aligned. */
.hero {
  max-width: var(--container); margin: 0 auto; padding: 68px 0 8px;
  display: grid; grid-template-columns: 1.35fr 1fr; gap: 56px; align-items: center;
}
.eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--accent-strong); background: var(--accent-soft); padding: 5px 13px; border-radius: 999px; letter-spacing: 0.01em; }
.hero h1 { margin: 18px 0 14px; font-family: var(--font-display); font-size: 42px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.12; }
.hero p { margin: 0 0 26px; font-size: 16.5px; line-height: 1.65; color: var(--text-light); max-width: 46ch; }
/* Support link sits directly under "Read my policies". */
.hero .actions { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.hero-panel {
  background: var(--brand); color: #fff; border-radius: 16px; padding: 30px 30px 26px;
  box-shadow: 0 20px 44px -18px rgba(52, 66, 113, 0.55);
}
.hero-panel-label { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.03em; color: rgba(255, 255, 255, 0.6); margin-bottom: 16px; }
.hero-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.hero-panel li { position: relative; padding-left: 24px; font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.hero-panel li::before { content: ''; position: absolute; left: 0; top: 6px; width: 10px; height: 10px; border-radius: 3px; background: var(--accent-on-dark); }

/* Home mission sections. */
.section-head { max-width: 620px; margin: 0 0 30px; }
.section-head h2 { margin: 0 0 8px; font-family: var(--font-display); font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.section-head p { margin: 0; color: var(--text-light); font-size: 15.5px; line-height: 1.65; }
.goals { margin: 88px auto 0; max-width: 980px; }

/* Hairline-divided columns (not card boxes): the commitments read as a set. */
.goal-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.goal-card { padding: 30px 30px 6px 30px; margin-left: 30px; border-left: 1px solid var(--border); }
.goal-card:first-child { margin-left: 0; border-left: none; padding-left: 0; }
.goal-card h3 { margin: 0 0 10px; font-family: var(--font-display); font-size: 16.5px; font-weight: 800; letter-spacing: -0.01em; color: var(--brand); }
.goal-card p { margin: 0; color: var(--text-light); font-size: 14.5px; line-height: 1.7; }

/* Tech stack tiles: each brand's own colour; logos inlined as SVG (no third-party fetch). */
.stack { margin: 88px auto 0; max-width: 980px; }
.stack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.stack-item {
  --tech: var(--brand); --tech-ink: var(--brand); --tech-tint: var(--brand-50); --tech-line: var(--border); --tech-glow: var(--tech-tint);
  position: relative; overflow: hidden; display: block; color: inherit; text-decoration: none;
  background: radial-gradient(140% 130% at 100% 0%, var(--tech-glow) 0%, transparent 60%), var(--surface);
  border: 1px solid var(--tech-line); border-top: 3px solid var(--tech); border-radius: 16px;
  box-shadow: var(--shadow-sm); padding: 22px 24px 22px;
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.stack-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--tech); }
/* radius is re-declared because the global a:focus-visible rule sets 4px */
.stack-item:focus-visible { outline: 2px solid var(--tech); outline-offset: 3px; border-radius: 16px; }
.stack-head { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; }
.stack-logo {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center;
  color: var(--tech-ink); background: var(--tech-tint); border: 1px solid var(--tech-line);
}
.stack-logo svg { width: 21px; height: 21px; display: block; fill: currentColor; }
.stack-item h3 { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 800; letter-spacing: -0.01em; color: var(--text); }
.stack-item p { margin: 0 0 16px; color: var(--text-light); font-size: 14.5px; line-height: 1.65; }
.stack-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.stack-tags li { font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: var(--tech-tint); color: var(--tech-ink); border: 1px solid var(--tech-line); }

/* One palette per brand (--tech logo, --tech-ink text, --tech-tint/--tech-line washes, --tech-glow light-theme corner glow). */
.stack-item--cloudflare { --tech: #f38020; --tech-ink: #a9570a; --tech-tint: rgba(243,128,32,0.14); --tech-line: rgba(243,128,32,0.32); --tech-glow: rgba(243,128,32,0.30); }
.stack-item--resend { --tech: #16181d; --tech-ink: #16181d; --tech-tint: rgba(22,24,29,0.07); --tech-line: rgba(22,24,29,0.20); --tech-glow: rgba(22,24,29,0.15); }
.stack-item--capacitor { --tech: #119eff; --tech-ink: #0a6cb0; --tech-tint: rgba(17,158,255,0.14); --tech-line: rgba(17,158,255,0.34); --tech-glow: rgba(17,158,255,0.30); }
.stack-item--react { --tech: #61dafb; --tech-ink: #087ea4; --tech-tint: rgba(97,218,251,0.20); --tech-line: rgba(97,218,251,0.48); --tech-glow: rgba(97,218,251,0.40); }
.stack-item--vite { --tech: #646cff; --tech-ink: #4b52d6; --tech-tint: rgba(100,108,255,0.14); --tech-line: rgba(100,108,255,0.32); --tech-glow: rgba(100,108,255,0.30); }
.stack-item--webcrypto { --tech: #344271; --tech-ink: #344271; --tech-tint: rgba(52,66,113,0.10); --tech-line: rgba(52,66,113,0.26); --tech-glow: rgba(52,66,113,0.20); }

/* Brands on dark: lift text colours; flip near-black ones (Resend, Web Crypto). */
/* Both dark triggers: explicit toggle + OS preference (media-guarded so the
   :not() half only applies with no stored choice). */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .stack-item { --tech-glow: var(--tech-tint); }
  html:not([data-theme="light"]) .stack-item--cloudflare { --tech: #f38020; --tech-ink: #f5a35c; }
  html:not([data-theme="light"]) .stack-item--resend { --tech: #e3e6ed; --tech-ink: #e3e6ed; --tech-tint: rgba(227,230,237,0.10); --tech-line: rgba(227,230,237,0.28); }
  html:not([data-theme="light"]) .stack-item--capacitor { --tech: #3aacff; --tech-ink: #63bdff; }
  html:not([data-theme="light"]) .stack-item--react { --tech: #61dafb; --tech-ink: #7ee0fb; }
  html:not([data-theme="light"]) .stack-item--vite { --tech: #7d84ff; --tech-ink: #a2a9ff; }
  html:not([data-theme="light"]) .stack-item--webcrypto { --tech: #7987b8; --tech-ink: #a7b1d3; }
}
html[data-theme="dark"] .stack-item { --tech-glow: var(--tech-tint); }
html[data-theme="dark"] .stack-item--cloudflare { --tech: #f38020; --tech-ink: #f5a35c; }
html[data-theme="dark"] .stack-item--resend { --tech: #e3e6ed; --tech-ink: #e3e6ed; --tech-tint: rgba(227,230,237,0.10); --tech-line: rgba(227,230,237,0.28); }
html[data-theme="dark"] .stack-item--capacitor { --tech: #3aacff; --tech-ink: #63bdff; }
html[data-theme="dark"] .stack-item--react { --tech: #61dafb; --tech-ink: #7ee0fb; }
html[data-theme="dark"] .stack-item--vite { --tech: #7d84ff; --tech-ink: #a2a9ff; }
html[data-theme="dark"] .stack-item--webcrypto { --tech: #7987b8; --tech-ink: #a7b1d3; }

/* Portfolio strip: solid brand band so the outbound button reads as the next step. */
.portfolio-strip { margin: 20px auto 0; max-width: 980px; background: var(--brand); color: #fff; border-radius: 16px; padding: 30px 34px; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; box-shadow: 0 20px 44px -18px rgba(52, 66, 113, 0.55); }
.portfolio-strip h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 21px; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.portfolio-strip p { margin: 0; font-size: 15px; line-height: 1.6; color: rgba(255, 255, 255, 0.78); max-width: 54ch; }
.portfolio-strip .actions { display: flex; flex-shrink: 0; }
.portfolio-strip .btn.primary { background: #fff; color: var(--brand); box-shadow: none; }
.portfolio-strip .btn.primary:hover { background: rgba(255, 255, 255, 0.86); color: var(--brand-dark); }
.portfolio-strip .btn.primary:focus-visible { outline-color: var(--accent-on-dark); }

.contact-strip { text-align: left; margin: 72px auto 0; max-width: 980px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 40px 44px; display: flex; flex-direction: column; gap: 20px; }
.contact-strip .contact-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.contact-strip h2 { margin: 0; font-family: var(--font-display); font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.contact-strip p { margin: 0; color: var(--text-light); font-size: 15px; }
.contact-strip .actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* 404 route-miss report (hero geometry + goal list). */
.err { max-width: var(--container); margin: 0 auto; padding: 68px 0 8px; display: grid; grid-template-columns: 1.35fr 1fr; gap: 56px; align-items: start; }
.err-head { margin: 18px 0 14px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 16px; }
.err-code { font-family: var(--font-display); font-size: 74px; font-weight: 800; letter-spacing: -0.05em; line-height: 1; color: var(--brand); }
.err-code .err-zero { color: var(--accent); }
.err-title { font-family: var(--font-display); font-size: 21px; font-weight: 800; letter-spacing: -0.02em; color: var(--text-light); }
.err-lead { margin: 0 0 22px; font-size: 16.5px; line-height: 1.65; color: var(--text-light); max-width: 46ch; }

/* Shows the exact missed path (filled in by script). */
.err-path { margin: 0 0 26px; display: inline-flex; align-items: baseline; gap: 10px; max-width: 100%; padding: 9px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.err-path[hidden] { display: none; }
.err-path-label { flex-shrink: 0; font-size: 10.5px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent-strong); }
.err-path code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; color: var(--text); overflow-wrap: anywhere; }

.err .actions { display: flex; gap: 12px; flex-wrap: wrap; }

.err-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px 28px 10px; box-shadow: var(--shadow-sm); }
.err-panel-label { display: block; font-family: var(--font-display); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-light); padding-bottom: 9px; border-bottom: 1px solid var(--border); }
.err-routes { list-style: none; margin: 0; padding: 0; }
.err-routes li + li { border-top: 1px solid var(--border); }
.err-routes a { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.err-routes-text { min-width: 0; }
.err-routes-text strong { display: block; font-family: var(--font-display); font-size: 15px; font-weight: 800; letter-spacing: -0.01em; transition: color 0.15s ease; }
.err-routes-text span { display: block; margin-top: 2px; font-size: 13px; line-height: 1.5; color: var(--text-light); }
.err-routes-go { margin-left: auto; flex-shrink: 0; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--brand-50); color: var(--brand); transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease; }
.err-routes-go svg { display: block; }
.err-routes a:hover .err-routes-text strong { color: var(--brand); }
.err-routes a:hover .err-routes-go { background: var(--brand); color: #fff; transform: translateX(3px); }

/* Closest-match row: brass guess-tag, free to ignore. */
.err-routes li.is-match { background: var(--accent-soft); }
.err-routes li.is-match a { padding-left: 14px; padding-right: 12px; border-left: 3px solid var(--accent); }
.err-routes .err-match-tag {
  display: inline-block; margin: 0 0 0 8px; padding: 2px 7px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid var(--accent); color: var(--accent-strong);
  font-family: 'Inter', system-ui, sans-serif; font-size: 9.5px; font-weight: 800;
  letter-spacing: 0.07em; text-transform: uppercase; vertical-align: 1px;
}

/* Help widget (bottom-right FAB + info hub). */
.help-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 20px; border-radius: 999px; border: none;
  background: var(--brand); color: #fff;
  font-family: var(--font-display); font-size: 14.5px; font-weight: 800;
  cursor: pointer; box-shadow: 0 10px 26px -8px rgba(52, 66, 113, 0.6);
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.help-fab:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 14px 30px -8px rgba(52, 66, 113, 0.65); }
.help-fab:active { transform: scale(0.92); transition: transform 0.08s ease; }
.help-fab svg { width: 17px; height: 17px; display: block; flex-shrink: 0; }
.help-fab[aria-expanded="true"] .help-fab-icon-open { display: none; }
.help-fab[aria-expanded="true"] .help-fab-icon-close { display: block; }
.help-fab-icon-close { display: none; }

.help-panel {
  position: fixed; bottom: 86px; right: 24px; z-index: 199;
  width: 356px; max-width: calc(100vw - 32px); max-height: min(640px, calc(100vh - 120px));
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-md);
  overflow: hidden; opacity: 0; pointer-events: none;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.help-panel.is-open { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }

.help-panel-header {
  background: var(--brand); color: #fff; padding: 20px 22px 18px;
}
.help-panel-header h2 { margin: 0 0 4px; font-family: var(--font-display); font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.help-panel-header p { margin: 0; font-size: 13px; color: rgba(255, 255, 255, 0.72); line-height: 1.55; }

.help-panel-body { padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }

.help-card {
  display: flex; align-items: flex-start; gap: 13px;
  width: 100%; text-align: left; padding: 14px 16px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; color: var(--text);
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}
.help-card:hover { border-color: var(--brand); background: var(--surface); transform: translateY(-1px); }
.help-card .help-card-icon {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: var(--brand-50); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
}
.help-card .help-card-icon svg { width: 16px; height: 16px; }
.help-card .help-card-text { min-width: 0; }
.help-card .help-card-text strong { display: block; font-size: 13.5px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.help-card .help-card-text span { display: block; font-size: 12.5px; line-height: 1.5; color: var(--text-light); }

.help-form { display: flex; flex-direction: column; gap: 12px; }
.help-form .help-form-label { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-light); display: block; margin-bottom: 5px; }
.help-form select,
.help-form input[type="text"],
.help-form input[type="email"],
.help-form textarea {
  width: 100%; padding: 10px 13px; border-radius: 9px;
  border: 1.5px solid var(--border); background: var(--bg);
  font-family: 'Inter', system-ui, sans-serif; font-size: 13.5px; color: var(--text);
  outline: none; box-sizing: border-box;
  transition: border-color 0.15s ease;
}
.help-form select:focus, .help-form input[type="text"]:focus, .help-form input[type="email"]:focus, .help-form textarea:focus { border-color: var(--brand); }
.help-form textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.help-form input[type="email"].is-valid { border-color: #22c55e; }
html[data-theme="dark"] .help-form input[type="email"].is-valid { border-color: #4ade80; }
.help-form input[type="email"].is-invalid:not(:focus) { border-color: #dc2626; }
html[data-theme="dark"] .help-form input[type="email"].is-invalid:not(:focus) { border-color: #f87171; }
.help-form input[type="email"]:focus.is-invalid { border-color: var(--brand); }
.help-form .help-form-submit {
  padding: 12px 16px; border-radius: 10px; border: none;
  background: var(--brand); color: #fff; font-family: var(--font-display);
  font-size: 14px; font-weight: 800; cursor: pointer;
  transition: background-color 0.15s ease;
}
.help-form .help-form-submit:hover { background: var(--brand-dark); }
.help-form .help-form-submit:disabled { opacity: 0.6; cursor: default; }
.help-form .required-star { color: #dc2626; font-weight: 800; }
html[data-theme="dark"] .help-form .required-star { color: #f87171; }
.help-form-message { font-size: 13.5px; line-height: 1.55; border-radius: 10px; padding: 12px 14px; }
.help-form-message.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.help-form-message.success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
html[data-theme="dark"] .help-form-message.error { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }
html[data-theme="dark"] .help-form-message.success { background: rgba(34, 197, 94, 0.12); color: #4ade80; border-color: rgba(34, 197, 94, 0.3); }

@media (max-width: 480px) {
  .help-fab { bottom: 16px; right: 16px; padding: 12px 17px; }
  .help-panel { bottom: 76px; right: 16px; }
}

/* Help page (/help). */
.help-head { max-width: 700px; margin: 0 auto; text-align: left; }
.help-head h1 { margin: 0 0 8px; font-family: var(--font-display); font-size: 32px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.help-head .lede { margin: 0; color: var(--text-light); font-size: 15.5px; line-height: 1.65; max-width: 660px; }

.help-page-form {
  max-width: 560px; margin: 30px auto 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px 30px; box-shadow: var(--shadow-sm);
}
.help-page-form .help-form { gap: 16px; }
.help-page-form .help-form-submit { width: 100%; padding: 13px 16px; font-size: 14.5px; }
.help-success-page {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 36px 24px;
}
.help-success-icon {
  width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
  background: rgba(22, 163, 74, 0.14); color: #15803d;
  display: flex; align-items: center; justify-content: center; margin-bottom: 8px;
}
.help-success-icon svg { width: 26px; height: 26px; }
html[data-theme="dark"] .help-success-icon { background: rgba(34, 197, 94, 0.16); color: #4ade80; }
.help-success-page h3 { margin: 0; font-family: var(--font-display); font-size: 19px; font-weight: 800; color: var(--text); }
.help-success-page p { margin: 0 0 16px; font-size: 13.5px; line-height: 1.6; color: var(--text-light); }
.help-success-page .btn { margin-top: 4px; }

/* Admin login link + modal. */
.admin-login-link {
  display: block;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--text-light);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-align: center;
  width: 100%;
  transition: color 0.15s ease;
}
.admin-login-link:hover { color: var(--text); }

.admin-modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}
.admin-modal-overlay.is-open { opacity: 1; visibility: visible; pointer-events: auto; }

.admin-modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px 30px;
  width: 360px; max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-md);
  transform: scale(0.95); transition: transform 0.18s ease;
}
.admin-modal-overlay.is-open .admin-modal { transform: scale(1); }
.admin-modal h3 {
  margin: 0 0 4px; font-family: var(--font-display);
  font-size: 18px; font-weight: 800; color: var(--text);
}
.admin-modal .admin-modal-sub {
  margin: 0 0 18px; font-size: 13px; color: var(--text-light);
}
.admin-modal-field { margin-bottom: 14px; }
.admin-modal-field label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-light); margin-bottom: 5px;
}
.admin-modal-field input {
  width: 100%; padding: 10px 13px; border-radius: 9px;
  border: 1.5px solid var(--border); background: var(--bg);
  font-family: 'Inter', system-ui, sans-serif; font-size: 13.5px;
  color: var(--text); outline: none; box-sizing: border-box;
  transition: border-color 0.15s ease;
}
.admin-modal-field input:focus { border-color: var(--brand); }
.admin-modal-submit {
  width: 100%; padding: 12px 16px; border-radius: 10px; border: none;
  background: var(--brand); color: #fff; font-family: var(--font-display);
  font-size: 14px; font-weight: 800; cursor: pointer;
  transition: background-color 0.15s ease;
}
.admin-modal-submit:hover { background: var(--brand-dark); }
.admin-modal-submit:disabled { opacity: 0.6; cursor: default; }
.admin-modal-error {
  font-size: 13px; color: #dc2626; margin-bottom: 12px;
  min-height: 18px;
}
html[data-theme="dark"] .admin-modal-error { color: #f87171; }



/* Admin dashboard. */
.admin-page { max-width: 900px; margin: 0 auto; padding: 40px 24px; }
.admin-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.admin-header h1 {
  margin: 0; font-family: var(--font-display); font-size: 26px;
  font-weight: 800; letter-spacing: -0.02em; color: var(--text);
}
.admin-header-actions { display: flex; align-items: center; gap: 10px; }
.admin-logout-btn {
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-light);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.admin-logout-btn:hover { border-color: var(--brand); color: var(--brand); }

.admin-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.admin-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px;
}
.admin-stat .value {
  font-family: var(--font-display); font-size: 24px; font-weight: 800;
  color: var(--brand);
}
.admin-stat .label {
  font-size: 12px; color: var(--text-light); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px;
}

.admin-tabs {
  display: flex; gap: 6px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.admin-tab {
  padding: 8px 16px; border: none; background: none;
  font-size: 13px; font-weight: 600; color: var(--text-light);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color 0.15s ease, border-color 0.15s ease;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.admin-tickets { display: flex; flex-direction: column; gap: 10px; }
.admin-ticket {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px;
}
.admin-ticket-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; flex-wrap: wrap; gap: 8px;
}
.admin-ticket-id {
  font-family: 'SF Mono', 'Consolas', monospace; font-size: 11px;
  color: var(--text-light); font-weight: 600;
}
.admin-ticket-meta {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.admin-ticket-badge {
  font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em;
}
.admin-ticket-badge.open { background: rgba(52, 66, 113, 0.12); color: var(--brand); }
.admin-ticket-badge.resolved { background: rgba(22, 163, 74, 0.14); color: #15803d; }
html[data-theme="dark"] .admin-ticket-badge.resolved { background: rgba(34, 197, 94, 0.16); color: #4ade80; }
.admin-ticket-type {
  font-size: 11px; font-weight: 600; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.admin-ticket-time {
  font-size: 11px; color: var(--text-light);
}
.admin-ticket-message {
  font-size: 13.5px; line-height: 1.55; color: var(--text);
  margin-bottom: 10px;
}
.admin-ticket-footer {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.admin-ticket-contact {
  font-size: 12px; color: var(--text-light);
}
.admin-ticket-actions { margin-left: auto; display: flex; gap: 6px; }
.admin-ticket-btn {
  padding: 6px 12px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--bg); font-size: 12px; font-weight: 600;
  color: var(--text-light); cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.admin-ticket-btn:hover { border-color: var(--brand); color: var(--brand); }
.admin-ticket-btn.resolve { border-color: #22c55e; }
.admin-ticket-btn.resolve:hover { background: rgba(22, 163, 74, 0.08); border-color: #16a34a; color: #15803d; }
html[data-theme="dark"] .admin-ticket-btn.resolve { border-color: #4ade80; }
html[data-theme="dark"] .admin-ticket-btn.resolve:hover { background: rgba(34, 197, 94, 0.14); border-color: #4ade80; color: #4ade80; }
.admin-ticket-btn.danger { border-color: #dc2626; }
.admin-ticket-btn.danger:hover { background: rgba(220, 38, 38, 0.08); border-color: #dc2626; color: #b91c1c; }
html[data-theme="dark"] .admin-ticket-btn.danger { border-color: #f87171; }
html[data-theme="dark"] .admin-ticket-btn.danger:hover { background: rgba(239, 68, 68, 0.14); border-color: #f87171; color: #f87171; }

.admin-empty {
  text-align: center; padding: 40px 24px; color: var(--text-light);
  font-size: 14px;
}
.admin-loading { text-align: center; padding: 40px; color: var(--text-light); }

/* Footer. */
.site-footer .grid { max-width: var(--container); margin: 0 auto; padding: 40px 24px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 28px; }
.site-footer .col { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.site-footer .col h2 { margin: 0; font-family: var(--font-display); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-light); }
.site-footer .col .blurb { color: var(--text-light); font-size: 13.5px; line-height: 1.65; max-width: 230px; }
.site-footer .col a { color: var(--text-light); font-size: 14px; transition: color 0.15s ease; }
.site-footer .col a:hover { color: var(--brand); }
.site-footer .bottom { max-width: var(--container); margin: 0 auto; text-align: center; padding: 20px 24px 18px; font-size: 12.5px; color: var(--text-light); border-top: 1px solid var(--border); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 48px; }
  .hero-panel { display: none; }
  /* 404 route panel stays (unlike .hero-panel): it stacks under the copy. */
  .err { grid-template-columns: 1fr; gap: 34px; padding-top: 48px; }
  .goal-grid { grid-template-columns: 1fr; border-top: none; }
  .goal-card { margin-left: 0; border-left: none; padding: 22px 0; border-top: 1px solid var(--border); }
  .goal-card:first-child { border-top: none; }
  .portfolio-strip { flex-direction: column; align-items: flex-start; }
  .contact-strip { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 640px) {
  .site-header .bar { gap: 12px; padding: 0 16px; }
  .site-header nav { gap: 0; }
  .site-header nav > a, .nav-drop .drop-toggle { padding: 8px 10px; font-size: 13px; }
  .hero h1 { font-size: 30px; }
  .stack-item { padding: 20px 18px 18px; }
  .portfolio-strip { padding: 24px 22px; }
  .contact-strip { padding: 24px 22px; }
  /* Scale the 404 numeral with the stacked layout. */
  .err { padding-top: 34px; }
  .err-code { font-size: 54px; }
  .err-panel { padding: 20px 22px 8px; }
  .site-header .brand { white-space: nowrap; }
  .theme-toggle { display: none; }
}
@media (max-width: 400px) {
  .site-header .bar { padding: 0 12px; gap: 8px; }
  .site-header nav > a, .nav-drop .drop-toggle { padding: 6px 7px; font-size: 12.5px; }
  .site-header .brand { font-size: 15.5px; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11141e; --surface: #191d2b; --text: #edeff5; --text-light: #9aa0b4;
    --border: #2a2e40; --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 18px 36px -14px rgba(0, 0, 0, 0.6);
    --brand: #55679e; --brand-dark: #3e4c7f; --brand-tint: #7987b8;
    --brand-50: rgba(85, 103, 158, 0.14); --brand-100: rgba(85, 103, 158, 0.22);
    --accent: #d9a521; --accent-strong: #e8b845; --accent-soft: rgba(217, 165, 33, 0.14);
    --accent-on-dark: #d9a521;
    --header-bg: #232c4c; --footer-bg: #161a26;
  }
}
:root[data-theme="dark"] {
  --bg: #11141e; --surface: #191d2b; --text: #edeff5; --text-light: #9aa0b4;
  --border: #2a2e40; --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 18px 36px -14px rgba(0, 0, 0, 0.6);
  --brand: #55679e; --brand-dark: #3e4c7f; --brand-tint: #7987b8;
  --brand-50: rgba(85, 103, 158, 0.14); --brand-100: rgba(85, 103, 158, 0.22);
  --accent: #d9a521; --accent-strong: #e8b845; --accent-soft: rgba(217, 165, 33, 0.14);
  --accent-on-dark: #d9a521;
  --header-bg: #232c4c; --footer-bg: #161a26;
}


