/* ==========================================================================
   The Jam Labs: styles.css
   Static, dependency-free. Light theme is the CSS default; the inline
   <head> script adds .theme-dark to <html> when dark is active (before
   paint, to avoid a flash). All interactive targets are WCAG 2.2 AA.
   ========================================================================== */

/* ---- Tokens ------------------------------------------------------------- */
:root {
  /* brand gradient (matches the supplied logo mark) */
  --grad-1: #1E9BFF;
  --grad-2: #12C4E8;
  --grad-3: #14E8B0;

  /* surfaces */
  --bg: #F5F8FC;
  --bg-elev: #FFFFFF;
  --bg-header: rgba(245, 248, 252, 0.82);
  --border: #D8E0EC;
  --border-strong: #C3CEDD;

  /* text */
  --text: #0B1220;
  --text-muted: #3E4A5E;
  --text-faint: #5B6880;

  /* interactive */
  --accent: #0E7490;          /* cyan-700, AA on white */
  --accent-strong: #0B5E73;
  --accent-contrast: #FFFFFF;
  --accent-soft: #E1F3F9;
  --ring: #1E9BFF;

  /* effects */
  --shadow-1: 0 1px 2px rgba(11, 18, 32, 0.05), 0 6px 20px rgba(11, 18, 32, 0.06);
  --shadow-2: 0 12px 40px rgba(11, 18, 32, 0.12);
  --hero-glow: rgba(18, 196, 232, 0.16);
  --backdrop: blur(10px) saturate(1.4);

  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 68px;
  --maxw: 1120px;

  color-scheme: light;
}

html.theme-dark {
  --bg: #0A0E14;
  --bg-elev: #111826;
  --bg-header: rgba(10, 14, 20, 0.82);
  --border: #1E2A3C;
  --border-strong: #2C3B52;

  --text: #E6EDF5;
  --text-muted: #A6B4C8;
  --text-faint: #8494AB;

  --accent: #22D3EE;
  --accent-strong: #67E8F9;
  --accent-contrast: #04222B;
  --accent-soft: #0E2A35;
  --ring: #22D3EE;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 12px 40px rgba(0, 0, 0, 0.5);
  --hero-glow: rgba(34, 211, 238, 0.12);

  color-scheme: dark;
}

/* ---- Base --------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

html {
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

img, svg { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  line-height: 1.15;
  margin: 0 0 0.5em;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.4rem, 5.5vw, 3.6rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.75rem, 3.6vw, 2.35rem); }
h3 { font-size: 1.2rem; letter-spacing: -0.005em; }
p  { margin: 0 0 1em; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1.5px;
}
a:hover { color: var(--accent-strong); }

/* Visible, high-contrast focus for keyboard users (WCAG 2.4.13 / 2.4.7) */
:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: var(--accent); color: var(--accent-contrast); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.container {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 40px);
}

.section { padding-block: clamp(56px, 9vw, 96px); }
.section-alt { background: var(--bg-elev); border-block: 1px solid var(--border); }

.section-head { max-width: 62ch; margin-bottom: clamp(28px, 5vw, 44px); }
.section-head h2 { margin-bottom: 0.35em; }
.section-sub { color: var(--text-muted); font-size: 1.05rem; margin: 0; }
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75em;
}

/* ---- Skip link ---------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; color: var(--accent-contrast); }

/* ---- Header ------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--bg-header);
  -webkit-backdrop-filter: var(--backdrop);
  backdrop-filter: var(--backdrop);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: 0.005em;
  border-radius: var(--radius-sm);
}
.brand img {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}
.brand:hover { color: var(--text); }

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav ul {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav a {
  display: inline-block;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
}
.nav a:hover { color: var(--text); background: var(--accent-soft); }

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .ic { display: none; width: 18px; height: 18px; }
.theme-toggle[data-icon="system"] .ic-system,
.theme-toggle[data-icon="light"]  .ic-light,
.theme-toggle[data-icon="dark"]   .ic-dark { display: block; }

/* Mobile menu button (hidden on desktop) */
.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
}
.menu-btn svg { width: 22px; height: 22px; }
.menu-btn .ic-close { display: none; }
.menu-btn[aria-expanded="true"] .ic-open  { display: none; }
.menu-btn[aria-expanded="true"] .ic-close { display: block; }

/* ---- Hero ---------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(64px, 11vw, 120px);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(620px 420px at 82% 30%, var(--hero-glow), transparent 70%),
    radial-gradient(520px 420px at 10% 90%, var(--hero-glow), transparent 72%);
}
.hero .container {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(28px, 5vw, 56px);
  flex-wrap: wrap;
}
.hero-text { flex: 1 1 480px; min-width: 0; }
.hero-mark {
  flex: 0 1 300px;
  width: clamp(180px, 30vw, 300px);
  margin-inline: auto;
  filter: drop-shadow(0 18px 40px var(--hero-glow));
}
.tagline {
  font-size: clamp(1.1rem, 2.3vw, 1.35rem);
  font-weight: 600;
  color: var(--text-muted);
  margin: 0.2em 0 0.9em;
}
.lede {
  font-size: 1.06rem;
  color: var(--text-muted);
  max-width: 54ch;
  margin-bottom: 1.6em;
}
.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-strong); color: var(--accent-contrast); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Cards / grids ------------------------------------------------------- */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.section-alt .card { background: var(--bg); }
.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-1);
  transform: translateY(-3px);
}
.card-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 6px;
}
.card-icon svg { width: 24px; height: 24px; }
.card h3 { margin: 0; }
.card p { color: var(--text-muted); font-size: 0.98rem; margin: 0; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }
.tag {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}

/* Project cards */
.project-card { padding: 0; overflow: hidden; }
.project-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 26px 0;
}
.project-glyph {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
}
.project-glyph svg { width: 28px; height: 28px; }
.project-top h3 { margin: 0; }
.project-top .project-url {
  display: block;
  font-size: 0.85rem;
  color: var(--text-faint);
  font-weight: 600;
}
.project-body { padding: 14px 26px 26px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.project-body p { margin: 0; }
.project-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  margin-top: auto;
}
.project-link svg { width: 16px; height: 16px; transition: transform 0.15s ease; }
.project-link:hover svg { transform: translate(2px, -2px); }

/* Values */
.values { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 32px; }
.value { display: flex; gap: 16px; }
.value-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
}
.value-icon svg { width: 22px; height: 22px; }
.value h3 { font-size: 1.08rem; margin: 2px 0 4px; }
.value p { margin: 0; color: var(--text-muted); font-size: 0.97rem; }

/* Writing */
.post { gap: 8px; }
.post-meta {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.post h3 { margin: 0; }
.post p { color: var(--text-muted); font-size: 0.97rem; margin: 0; }
.post-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  margin-top: auto;
  padding-top: 6px;
}
.post-link svg { width: 16px; height: 16px; }

.cta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: clamp(28px, 5vw, 40px);
  padding: 26px 28px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.section-alt .cta-row { background: var(--bg); }
.cta-row p { margin: 0; color: var(--text-muted); max-width: 46ch; }

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(28px, 5vw, 56px);
  align-items: start;
}
.contact-methods { display: flex; flex-direction: column; gap: 14px; }
.contact-method {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 18px 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.contact-method:hover { border-color: var(--accent); box-shadow: var(--shadow-1); color: var(--text); }
.contact-method .cm-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
}
.contact-method .cm-icon svg { width: 22px; height: 22px; }
.contact-method .cm-label { display: block; font-size: 0.82rem; color: var(--text-faint); font-weight: 600; }
.contact-method .cm-value { display: block; font-size: 1.02rem; word-break: break-word; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 40px;
  background: var(--bg-elev);
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
}
.footer-brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-weight: 800; text-decoration: none; }
.footer-brand img { width: 34px; height: 34px; }
.footer-nav ul { display: flex; flex-wrap: wrap; gap: 4px 18px; list-style: none; margin: 0; padding: 0; }
.footer-nav a { color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.footer-nav a:hover { color: var(--accent); }
.footer-bottom {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.9rem;
}
.footer-bottom a { color: var(--text-faint); }
.footer-bottom a:hover { color: var(--accent); }
.footer-social { display: inline-flex; gap: 6px; }
.footer-social a {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.footer-social a:hover { color: var(--accent); border-color: var(--accent); }
.footer-social svg { width: 19px; height: 19px; }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  :root { --header-h: 62px; }
  .brand { font-size: 1.05rem; }
  .brand img { width: 36px; height: 36px; }
  .theme-toggle .theme-label { display: none; }
  .theme-toggle { padding: 10px; }

  .menu-btn { display: inline-flex; }
  .nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
  .nav ul { flex-direction: column; gap: 2px; padding: 14px 20px 20px; }
  .nav a { display: block; padding: 13px 14px; font-size: 1.05rem; }

  .hero .container { flex-direction: column-reverse; text-align: center; }
  .hero-mark { flex-basis: auto; width: clamp(140px, 46vw, 200px); }
  .lede { margin-inline: auto; }
  .hero-actions, .cta-row { justify-content: center; }
  .cta-row p { text-align: center; }

  .grid-3, .grid-2, .contact-grid { grid-template-columns: 1fr; }
  .values { grid-template-columns: 1fr; }
}

/* ---- Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}