/* =========================================================
   Matthew Aquila — thought leadership on tech, software & AI
   Bold, modern, dark-first. Hand-coded. No build step.
   ========================================================= */

:root {
  /* Accent — amber / gold */
  --gold-1: #ffd166;
  --gold-2: #f5a623;
  --gold-3: #d98800;
  --accent: var(--gold-2);
  --accent-grad: linear-gradient(135deg, var(--gold-1), var(--gold-3));

  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1120px;
  --readw: 720px;

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;

  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* Dark theme (default) */
:root, [data-theme="dark"] {
  --bg: #0a0b0d;
  --bg-2: #101216;
  --surface: #14171c;
  --surface-2: #1b1f26;
  --border: #262b33;
  --text: #eef1f5;
  --text-dim: #a3adba;
  --text-faint: #6b7480;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, .7);
  --glow: 0 0 0 1px rgba(245, 166, 35, .12), 0 20px 60px -25px rgba(245, 166, 35, .25);
}

/* Light theme */
[data-theme="light"] {
  --bg: #f7f7f4;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f1ec;
  --border: #e4e2da;
  --text: #16181d;
  --text-dim: #4b525c;
  --text-faint: #8a919c;
  --shadow: 0 20px 50px -25px rgba(20, 22, 28, .18);
  --glow: 0 0 0 1px rgba(217, 136, 0, .16), 0 20px 60px -30px rgba(217, 136, 0, .28);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Ambient glow behind the page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 40% at 80% -5%, rgba(245, 166, 35, .10), transparent 60%),
    radial-gradient(50% 40% at 0% 5%, rgba(245, 166, 35, .06), transparent 55%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 .5em;
}

p { margin: 0 0 1.1em; }

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

.accent { color: var(--accent); }

.gradient-text {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .55em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .95rem;
  padding: .8em 1.35em;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: var(--accent-grad);
  color: #1a1200;
  box-shadow: 0 10px 30px -12px rgba(245, 166, 35, .6);
}
.btn-primary:hover { box-shadow: 0 16px 40px -12px rgba(245, 166, 35, .8); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand .logo {
  width: 34px;
  height: 34px;
  color: var(--accent);
  flex: none;
  filter: drop-shadow(0 4px 10px rgba(245, 166, 35, .35));
}
.brand b { font-weight: 700; }
.brand span { color: var(--text-dim); font-weight: 500; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  font-size: .95rem;
  color: var(--text-dim);
  font-weight: 500;
  transition: color .2s var(--ease);
  position: relative;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -22px;
  height: 2px;
  background: var(--accent-grad);
}

.nav-right { display: flex; align-items: center; gap: 14px; }

/* Theme toggle */
.theme-toggle {
  width: 40px; height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: rotate(-12deg); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Mobile menu button */
.nav-toggle { display: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(64px, 12vw, 130px) 0 clamp(56px, 9vw, 96px);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  font-family: var(--font-display);
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: .45em 1em;
  border-radius: 999px;
  margin-bottom: 26px;
}
.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(245, 166, 35, .18);
}
.hero h1 {
  font-size: clamp(2.6rem, 7vw, 5rem);
  max-width: 15ch;
  margin-bottom: .35em;
}
.hero .lede {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--text-dim);
  max-width: 56ch;
  margin-bottom: 34px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* ---------- Section headings ---------- */
.section { padding: clamp(48px, 8vw, 88px) 0; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 40px;
}
.section-head h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.section-head p { color: var(--text-dim); margin: .4em 0 0; }
.section-kicker {
  font-family: var(--font-display);
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

/* ---------- Post grid ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 26px;
}
.post-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.post-card:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--glow);
}
.post-thumb {
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.post-thumb .art { position: absolute; inset: 0; width: 100%; height: 100%; }
.post-body { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1; }
.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .78rem;
  color: var(--text-faint);
  margin-bottom: 12px;
}
.tag {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: .3em .7em;
  border-radius: 999px;
}
.post-card h3 {
  font-size: 1.3rem;
  margin-bottom: .4em;
  transition: color .2s var(--ease);
}
.post-card:hover h3 { color: var(--accent); }
.post-card .excerpt { color: var(--text-dim); font-size: .95rem; margin-bottom: 18px; }
.post-card .read {
  margin-top: auto;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .85rem;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: .4em;
}
.post-card .read .arrow { transition: transform .25s var(--ease); }
.post-card:hover .read .arrow { transform: translateX(4px); }

/* Featured (first post spans wider on large screens) */
.post-grid.featured .post-card:first-child {
  grid-column: 1 / -1;
}
@media (min-width: 900px) {
  .post-grid.featured .post-card:first-child {
    flex-direction: row;
  }
  .post-grid.featured .post-card:first-child .post-thumb {
    width: 52%;
    aspect-ratio: auto;
    border-bottom: none;
    border-right: 1px solid var(--border);
  }
  .post-grid.featured .post-card:first-child .post-body { justify-content: center; padding: 40px; }
  .post-grid.featured .post-card:first-child h3 { font-size: 2rem; }
  .post-grid.featured .post-card:first-child .excerpt { font-size: 1.05rem; }
}

/* ---------- Newsletter ---------- */
.newsletter {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(80% 120% at 100% 0%, rgba(245, 166, 35, .12), transparent 55%),
    var(--bg-2);
}
.newsletter .inner {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
  align-items: center;
  padding: clamp(48px, 8vw, 84px) 0;
}
.newsletter h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
.newsletter p { color: var(--text-dim); max-width: 46ch; }
.subscribe {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.subscribe input {
  flex: 1;
  min-width: 220px;
  padding: .9em 1.1em;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
}
.subscribe input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, .2);
}
.form-note { font-size: .82rem; color: var(--text-faint); margin: 12px 0 0; }
.form-status { font-size: .9rem; color: var(--accent); margin: 12px 0 0; min-height: 1.2em; font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer {
  padding: 56px 0 40px;
  color: var(--text-dim);
}
.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 30px;
  padding-bottom: 34px;
  border-bottom: 1px solid var(--border);
}
.footer-top .brand { color: var(--text); }
.footer-blurb { max-width: 40ch; margin-top: 14px; font-size: .95rem; }
.socials { display: flex; gap: 12px; margin-top: 18px; }
.socials a {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-dim);
  transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-3px); }
.socials svg { width: 18px; height: 18px; }
.footer-nav { display: flex; gap: 40px; flex-wrap: wrap; }
.footer-nav h4 {
  font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 14px;
}
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-nav a { color: var(--text-dim); font-size: .95rem; }
.footer-nav a:hover { color: var(--accent); }
.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding-top: 26px; font-size: .85rem; color: var(--text-faint);
}

/* ---------- About page ---------- */
.about-hero { padding: clamp(56px, 9vw, 104px) 0 40px; }
.about-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 54px;
  align-items: start;
}
.about-portrait {
  position: sticky;
  top: 96px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow);
}
.about-portrait .art { aspect-ratio: 4 / 5; width: 100%; }
.about-portrait .caption {
  padding: 16px 18px;
  border-top: 1px solid var(--border);
  font-size: .85rem;
  color: var(--text-dim);
}
.about-body h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-top: 1.4em; }
.about-body p { color: var(--text-dim); }
.about-body .intro { font-size: 1.2rem; color: var(--text); }
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 34px 0;
}
.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  background: var(--surface);
}
.stat .n { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat .l { font-size: .85rem; color: var(--text-dim); }

/* ---------- Article page ---------- */
.article-header { padding: clamp(48px, 8vw, 92px) 0 30px; }
.article-header .container { max-width: var(--readw); }
.article-header h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  margin: 18px 0 20px;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-faint);
  font-size: .92rem;
}
.article-meta .author {
  display: inline-flex; align-items: center; gap: 10px; color: var(--text);
}
.article-meta .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-grad); color: #1a1200;
}
.article-hero-art {
  aspect-ratio: 21 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 8px 0 10px;
}
.article-hero-art .art { width: 100%; height: 100%; }
.article-body { padding: 20px 0 40px; }
.article-body .container { max-width: var(--readw); }
.article-body p, .article-body ul, .article-body ol { color: var(--text-dim); }
.article-body h2 {
  font-size: 1.7rem; margin: 1.7em 0 .5em; color: var(--text);
}
.article-body h3 { font-size: 1.3rem; margin: 1.4em 0 .4em; color: var(--text); }
.article-body a.link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.article-body blockquote {
  margin: 1.6em 0;
  padding: .4em 0 .4em 26px;
  border-left: 3px solid var(--accent);
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.4;
  color: var(--text);
}
.article-body .lead:first-letter {
  float: left;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3.6rem;
  line-height: .8;
  padding: 6px 12px 0 0;
  color: var(--accent);
}
.article-body pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  overflow-x: auto;
  font-size: .9rem;
}
.article-body code { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.article-footer {
  max-width: var(--readw);
  margin: 40px auto 0;
  padding: 30px 24px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}

/* Reading progress bar */
.progress-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--accent-grad); z-index: 60;
  transition: width .1s linear;
}

/* Back link */
.back-link {
  display: inline-flex; align-items: center; gap: .5em;
  font-family: var(--font-display); font-weight: 600; font-size: .9rem;
  color: var(--text-dim);
}
.back-link:hover { color: var(--accent); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .newsletter .inner { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .about-portrait { position: static; max-width: 320px; }
}
@media (max-width: 720px) {
  .nav-links {
    position: fixed;
    inset: 68px 0 auto 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px 22px;
    transform: translateY(-120%);
    transition: transform .3s var(--ease);
  }
  .nav-links.open { transform: none; }
  .nav-links a { padding: 10px 0; width: 100%; }
  .nav-links a.active::after { display: none; }
  .nav-toggle {
    display: inline-grid; place-items: center;
    width: 40px; height: 40px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    cursor: pointer;
  }
  .stats { grid-template-columns: 1fr; }
}
