/* ==========================================================
   Chris McGuire — portfolio styles
   Dark by default, light via prefers-color-scheme or toggle.
   ========================================================== */

:root {
  --bg: #f7f7fb;
  --bg-elev: #ffffff;
  --bg-soft: #eeeef6;
  --text: #14141f;
  --muted: #55566b;
  --border: #dcdce8;
  --accent: #6a3fe0;
  --accent-ink: #ffffff;
  --accent-soft: rgba(106, 63, 224, 0.1);
  --warn-bg: #fff3bf;
  --warn-text: #5c4400;
  --orange: #e8590c;
  --radius: 14px;
  --maxw: 1200px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b14;
    --bg-elev: #12121d;
    --bg-soft: #181826;
    --text: #f2f2f8;
    --muted: #a3a4b8;
    --border: #262637;
    --accent: #9b7bff;
    --accent-ink: #0b0b14;
    --accent-soft: rgba(155, 123, 255, 0.14);
    --warn-bg: #3d3000;
    --warn-text: #ffe27a;
    --orange: #ff7a3d;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b14;
  --bg-elev: #12121d;
  --bg-soft: #181826;
  --text: #f2f2f8;
  --muted: #a3a4b8;
  --border: #262637;
  --accent: #9b7bff;
  --accent-ink: #0b0b14;
  --accent-soft: rgba(155, 123, 255, 0.14);
  --warn-bg: #3d3000;
  --warn-text: #ffe27a;
  --orange: #ff7a3d;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
p a, .prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.02em; margin: 0; font-weight: 700; }
p { margin: 0 0 1em; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 1.1rem; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px; background: var(--text); color: var(--bg);
  display: grid; place-items: center; font-family: var(--font-mono); font-weight: 700; font-size: 0.95rem;
}
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 16px; border-radius: 10px; color: var(--muted); font-size: 0.97rem; transition: background .15s, color .15s; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { background: var(--bg-soft); color: var(--text); }
.header-tools { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px;
  background: none; border: 0; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-soft); }
.icon-btn svg { width: 22px; height: 22px; }
.menu-btn { display: none; }

@media (max-width: 860px) {
  .menu-btn { display: grid; }
  .nav {
    display: none; position: absolute; top: 72px; left: 0; right: 0; flex-direction: column;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 12px 24px 20px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 8px; font-size: 1.05rem; }
  .header-tools .hide-sm { display: none; }
}

/* ---------- Hero ---------- */
.hero { padding: 56px 0 48px; display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
.eyebrow { font-family: var(--font-mono); font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 20px; }
.hero h1 { font-size: clamp(2.4rem, 5.2vw, 4rem); margin-bottom: 20px; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 34em; margin-bottom: 28px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: 0.97rem; border: 1px solid var(--border); transition: transform .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn svg { width: 16px; height: 16px; }
.hero-photo {
  aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  background: radial-gradient(120% 120% at 80% 10%, var(--accent-soft), transparent 60%), var(--bg-elev);
  display: grid; place-items: center; text-align: center; color: var(--muted);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 32px; }
  .hero-photo { order: -1; }
}

/* ---------- Proof bar ---------- */
.proof { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 56px; }
.proof div { background: var(--bg-elev); padding: 18px 20px; }
.proof b { display: block; font-family: var(--font-mono); font-size: 1.15rem; margin-bottom: 2px; }
.proof span { font-size: 0.88rem; color: var(--muted); }
@media (max-width: 860px) { .proof { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Sections ---------- */
.section { padding: 40px 0; border-top: 1px solid var(--border); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.link-more { color: var(--muted); display: inline-flex; gap: 8px; align-items: center; font-size: 0.97rem; }
.link-more:hover { color: var(--text); }
.link-more svg { width: 18px; height: 18px; }

.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 860px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Cards ---------- */
.card {
  display: flex; flex-direction: column; gap: 12px; padding: 24px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-elev); transition: border-color .15s, transform .15s;
}
a.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h3 { font-size: 1.3rem; }
.card p { color: var(--muted); font-size: 0.97rem; margin: 0; }
.card-feature { grid-column: span 3; }
.meta { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.meta .dot { color: var(--orange); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.tag { font-family: var(--font-mono); font-size: 0.74rem; padding: 3px 9px; border-radius: 6px; background: var(--bg-soft); color: var(--muted); }
.badge { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); width: fit-content; }
.thumb { aspect-ratio: 16 / 9; border-radius: 10px; background: linear-gradient(135deg, var(--accent-soft), transparent), var(--bg-soft); border: 1px solid var(--border); display: grid; place-items: center; font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
@media (max-width: 860px) { .card-feature { grid-column: auto; } }

/* Latest articles: big feature + two */
.articles-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 20px; }
.articles-grid .card:first-child { justify-content: center; padding: 36px; background: radial-gradient(90% 120% at 0% 100%, var(--accent-soft), transparent 60%), var(--bg-elev); }
.articles-grid .card:first-child h3 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
@media (max-width: 860px) { .articles-grid { grid-template-columns: 1fr; } }

/* Section jump row on home */
.jump { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); margin-top: 24px; }
.jump a { display: flex; align-items: center; gap: 16px; padding: 28px 24px 28px 0; }
.jump a + a { padding-left: 24px; border-left: 1px solid var(--border); }
.jump svg.lead { width: 36px; height: 36px; flex: none; }
.jump svg.arrow { width: 22px; height: 22px; margin-left: auto; flex: none; color: var(--muted); }
.jump b { display: block; font-size: 1.05rem; }
.jump small { color: var(--muted); font-size: 0.9rem; line-height: 1.4; display: block; }
.jump a:hover svg.arrow { color: var(--text); }
@media (max-width: 860px) {
  .jump { grid-template-columns: 1fr; }
  .jump a, .jump a + a { padding: 20px 0; border-left: 0; border-top: 1px solid var(--border); }
  .jump a:first-child { border-top: 0; }
}

/* ---------- Inner pages ---------- */
.page-head { padding: 64px 0 32px; }
.page-head h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin-bottom: 16px; }
.prose { max-width: 44em; }
.prose h2 { font-size: 1.6rem; margin: 2em 0 0.6em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 0.4em; }

.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 22px 24px; margin: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.timeline .when { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
.timeline b { display: block; }
.timeline .nested { margin-top: 10px; padding-left: 16px; border-left: 2px dashed var(--border); }
.timeline .nested > div { margin-bottom: 10px; }

.stack-group { margin-bottom: 20px; }
.stack-group h3 { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; font-weight: 500; }

/* ---------- Placeholders (unverified content) ---------- */
.todo {
  background: var(--warn-bg); color: var(--warn-text); padding: 1px 7px; border-radius: 5px;
  font-family: var(--font-mono); font-size: 0.85em; border: 1px dashed currentColor;
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 36px 0 48px; color: var(--muted); font-size: 0.93rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-links a:hover { color: var(--text); }

/* ---------- Motion ---------- */
.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity .5s ease, transform .5s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  * { transition: none !important; }
}

.brand img { height: 32px; width: auto; }
.brand-name { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; }
.hero-photo img { object-position: 70% 50%; }

/* ---------- Hero polish (glow, swoosh, arc) ---------- */
.brand img { filter: drop-shadow(0 0 10px rgba(124, 92, 255, 0.55)); }
.swoosh { position: relative; display: inline-block; }
.swoosh::after {
  content: ""; position: absolute; left: 12%; right: 0; bottom: -0.2em; height: 0.22em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 20' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g'%3E%3Cstop offset='0' stop-color='%232f8bff'/%3E%3Cstop offset='1' stop-color='%23a66bff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M2 16C80 4 200 2 298 10' fill='none' stroke='url(%23g)' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}
.hero-visual { position: relative; }
.hero-visual::before {
  content: ""; position: absolute; inset: -14% -8% -14% 8%; border-radius: 50%; z-index: 0;
  border: 2px solid transparent;
  background: linear-gradient(135deg, rgba(155,123,255,0.7), rgba(47,139,255,0.15) 45%, transparent 70%) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0.8; pointer-events: none;
}
.hero-visual .hero-photo {
  position: relative; z-index: 1; border: 1.5px solid rgba(155, 123, 255, 0.85);
  box-shadow: 0 0 40px rgba(124, 92, 255, 0.35), 0 0 90px rgba(47, 139, 255, 0.15);
  aspect-ratio: 10 / 8;
}
.hero-photo img { object-position: 50% 30%; }
.btn-primary { box-shadow: 0 0 0 1px rgba(155,123,255,0.6), 0 0 22px rgba(124,92,255,0.35); }
@media (max-width: 860px) { .hero-visual::before { display: none; } }
@media (max-width: 860px) { .hero-visual { order: -1; } }
