:root {
  --bg: #0a0a0a;
  --surface: #161616;
  --text: #f2f2f2;
  --muted: #b5b5b5;          /* 9.6:1 on --bg — smallest body text */
  --subtle: #8f8f8f;         /* 6.2:1 — meta text only */
  --divider: rgb(242 242 242 / 0.14);
  --accent: #b91c1c;         /* blood-red ink: fills, borders (6.5:1 with white text) */
  --accent-hover: #d42a2a;
  --accent-ink: #f05a5a;     /* accent as text on dark (5.9:1) */
  --font-display: "Pirata One", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius-md: 10px;
  --radius-lg: 16px;
  --wrap: 1200px;
  --gutter: clamp(20px, 5vw, 72px);
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }
body {
  margin: 0; min-height: 100dvh; overflow-x: hidden;
  background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
a:hover { color: var(--accent-ink); }
h1, h2, h3, p, figure, blockquote { margin: 0; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
::selection { background: rgb(185 28 28 / 0.45); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #303030; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #4a4a4a; }

.display { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.01em; line-height: 1.02; }

/* ── ambient layers (all fixed, non-interactive) ── */
.fx { position: fixed; pointer-events: none; }
.fx-watermark {
  top: 50%; right: clamp(-60px, -4vw, -20px); width: min(95vw, 1080px); z-index: 0;
  transform: translateY(-50%) rotate(10deg); opacity: 0.09;
  mask-image: radial-gradient(circle at 50% 50%, black 55%, transparent 85%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 55%, transparent 85%);
}
.fx-canvas { inset: 0; width: 100vw; height: 100vh; z-index: 0; display: block; transition: opacity 0.6s ease; }
.fx-canvas.is-hidden { opacity: 0; }
.fx-vignette { inset: 0; z-index: 0; box-shadow: inset 0 0 260px 80px rgb(0 0 0 / 0.62); }
.fx-sweep {
  top: 10%; left: 10%; width: 80%; height: 80%; z-index: 0; opacity: 0.12;
  background: radial-gradient(circle at 50% 50%, rgb(185 28 28 / 0.35), transparent 70%);
}
.fx-grain {
  inset: 0; z-index: 2; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.fx-streak { inset: 0; z-index: 35; }
.fx-streak span { position: absolute; top: 0; left: 0; border-radius: 50%; mix-blend-mode: screen; will-change: transform; }
.fx-intro { inset: 0; z-index: 80; background: var(--bg); animation: introFade 1.1s ease 0.06s both; }
@keyframes introFade { to { opacity: 0; visibility: hidden; } }

/* ── nav ── */
.nav {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h);
  display: flex; align-items: center; gap: 28px; padding: 0 var(--gutter);
  background: rgb(10 10 10 / 0.74);
  backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid rgb(242 242 242 / 0.1);
}
.nav-brand { margin-right: auto; display: flex; }
.nav-brand img { height: 38px; width: auto; }
.nav-links { display: flex; align-items: center; gap: 28px; list-style: none; margin: 0; padding: 0; }
.nav-links a:not(.btn) { text-decoration: none; font-size: 15px; color: var(--muted); }
.nav-links a:not(.btn):hover { color: var(--text); }
.nav .nav-toggle { display: none; }

/* ── buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border-radius: var(--radius-md);
  font: 500 15px/1.2 var(--font-body); text-decoration: none; cursor: pointer;
  border: 1px solid transparent; color: var(--text); background: transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn i { font-size: 18px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-secondary { border-color: rgb(242 242 242 / 0.28); }
.btn-secondary:hover { border-color: var(--text); color: var(--text); background: rgb(242 242 242 / 0.06); }
.btn-ghost { padding-inline: 10px; color: var(--text); }
.btn-ghost:hover { color: var(--accent-ink); }
.btn-icon { width: 44px; padding: 0; }

/* ── chapter dots ── */
.chapters {
  position: fixed; top: 50%; right: 22px; transform: translateY(-50%); z-index: 40;
  display: flex; flex-direction: column; gap: 6px; list-style: none; margin: 0; padding: 0;
}
.chapters a { display: grid; place-items: center; width: 20px; height: 20px; }
.chapters a::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: rgb(242 242 242 / 0.35); transition: all 0.3s ease;
}
.chapters a[aria-current="true"]::before {
  width: 10px; height: 10px; background: var(--accent-ink);
  box-shadow: 0 0 10px 2px rgb(240 90 90 / 0.55);
}

/* ── layout ── */
main, footer { position: relative; z-index: 1; }
.section { position: relative; padding: clamp(72px, 9vw, 120px) 0; overflow: hidden; }
.wrap { position: relative; z-index: 1; max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }
.glow {
  position: absolute; inset: -10%; z-index: 0; pointer-events: none;
  background: radial-gradient(600px 460px at var(--gx, 30%) var(--gy, 40%), rgb(34 34 34 / 0.5), transparent 65%);
}
/* desktop: content keeps to the left; the right side is left free for the 3D machine */
@media (min-width: 1024px) { .col { max-width: 62%; } }

.eyebrow {
  display: inline-flex; align-items: center; gap: 12px; margin-bottom: 18px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-ink);
}
.eyebrow::before { content: ""; width: 36px; height: 1px; background: currentColor; flex-shrink: 0; }
.h2 { font-size: clamp(36px, 4.2vw, 54px); margin-bottom: 24px; }
.lede { color: var(--muted); font-size: 17px; max-width: 52ch; }

/* ── hero ── */
.hero { min-height: calc(100dvh - var(--nav-h)); display: flex; align-items: center; padding: 48px 0 96px; }
.hero .eyebrow::before { display: none; }
.hero h1 { font-size: clamp(56px, 7.5vw, 96px); }
.hero h1 span { display: block; }
.hero h1 span + span { color: #d4d4d4; }
.hero .lede { margin-top: 20px; max-width: 40ch; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.scroll-cue {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; color: var(--subtle);
}
.scroll-cue i { font-size: 18px; animation: bobY 2s ease-in-out infinite; }
@keyframes bobY { 50% { transform: translateY(8px); } }

/* ── about ── */
.about { display: flex; flex-wrap: wrap; gap: 48px; align-items: center; }
.about figure { flex: 1 1 260px; max-width: 360px; border-radius: var(--radius-lg); overflow: hidden; }
.about figure img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.about-body { flex: 1.5 1 300px; }
.about-body .lede { margin-bottom: 22px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 26px; padding: 0; }
.tags li { font-size: 13px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--divider); color: var(--muted); }
.quote { font-size: 20px; line-height: 1.5; font-weight: 500; max-width: 36ch; }
.quote-by { margin-top: 8px; font-size: 14px; color: var(--subtle); }

/* ── services ── */
.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; list-style: none; margin: 0; padding: 0; }
.card {
  display: flex; flex-direction: column; gap: 10px; padding: 22px;
  background: rgb(22 22 22 / 0.94); border: 1px solid rgb(242 242 242 / 0.09); border-radius: var(--radius-md);
  transition: border-color 0.2s ease;
}
.card:hover { border-color: rgb(240 90 90 / 0.45); }
.card-icon {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--radius-md);
  background: rgb(185 28 28 / 0.16); color: var(--accent-ink); font-size: 20px;
}
.card h3 { font-size: 18px; font-weight: 600; line-height: 1.25; }
.card p { font-size: 15px; color: var(--muted); flex: 1; }
.card-meta { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--subtle); }
.note { margin-top: 28px; font-size: 15px; color: var(--muted); }

/* ── portfolio carousel ── */
.carousel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.carousel-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.carousel-count { font-size: 14px; color: var(--subtle); font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; }
.carousel-controls .btn:disabled { opacity: 0.35; cursor: default; }
.track {
  display: grid; grid-auto-flow: column; grid-auto-columns: clamp(220px, 70vw, 300px); gap: 14px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  scrollbar-width: none; padding-bottom: 4px; list-style: none; margin: 0;
  padding-left: 0;
}
.track::-webkit-scrollbar { display: none; }
.slide { scroll-snap-align: start; }
.slide figure { position: relative; border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.slide button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.slide img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; transition: transform 0.5s ease; }
.slide button:hover img { transform: scale(1.04); }
.slide figcaption {
  position: absolute; inset: auto 0 0 0; padding: 40px 14px 12px; pointer-events: none;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.85));
}
.slide figcaption b { display: block; font-size: 15px; font-weight: 600; color: #fff; }
.slide figcaption span { font-size: 13px; color: #d0d0d0; }
.progress { height: 2px; margin-top: 18px; background: var(--divider); border-radius: 2px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent-ink); transition: width 0.2s ease; }

.lightbox { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100dvh; }
.lightbox::backdrop { background: rgb(0 0 0 / 0.9); }
.lightbox img { max-width: min(92vw, 1100px); max-height: 86dvh; width: auto; border-radius: var(--radius-md); }
.lightbox p { margin-top: 10px; text-align: center; color: var(--muted); font-size: 15px; }
.lightbox-close { position: fixed; top: 16px; right: 16px; background: rgb(22 22 22 / 0.9); }

/* ── contact ── */
.contact { display: flex; flex-wrap: wrap; gap: 40px; }
.contact-info { flex: 1 1 260px; }
.info { display: grid; gap: 14px; list-style: none; margin: 0; padding: 0; }
.info li { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; color: var(--muted); }
.info i { color: var(--accent-ink); font-size: 20px; margin-top: 2px; flex-shrink: 0; }
.info a { color: var(--text); text-decoration: none; }
.info a:hover { color: var(--accent-ink); }
.book-card {
  flex: 1 1 280px; align-self: flex-start; display: flex; flex-direction: column; gap: 14px; padding: 28px;
  background: rgb(22 22 22 / 0.94); border: 1px solid rgb(242 242 242 / 0.1); border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgb(0 0 0 / 0.55);
}
.book-card h3 { font-size: 22px; font-weight: 600; }
.book-card p { color: var(--muted); }
.book-card .btn { width: 100%; }

/* ── footer ── */
.footer { background: rgb(10 10 10 / 0.86); border-top: 1px solid rgb(242 242 242 / 0.1); padding: 36px 0; }
.footer-row { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between; }
.footer-row img { height: 30px; width: auto; }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.footer-links a, .footer-social { font-size: 15px; color: var(--muted); text-decoration: none; }
.footer-social { font-size: 22px; display: inline-flex; padding: 10px; margin: -10px; }
.footer small { display: block; margin-top: 18px; font-size: 14px; color: var(--subtle); }

/* ── scroll-driven motion, only where the browser supports it ── */
@supports (animation-timeline: view()) {
  .reveal { animation: revealUp linear both; animation-timeline: view(); animation-range: entry 0% cover 25%; }
  .glow { animation: parallaxBg linear both; animation-timeline: view(); animation-range: cover 0% cover 100%; }
}
@keyframes revealUp { from { opacity: 0; transform: translateY(36px); } }
@keyframes parallaxBg { from { transform: translateY(-70px) scale(1.08); } to { transform: translateY(70px) scale(1.08); } }

/* ── mobile ── */
@media (max-width: 860px) {
  .nav .nav-toggle { display: inline-flex; }
  .nav-links {
    position: fixed; top: var(--nav-h); left: 0; right: 0; z-index: 49;
    flex-direction: column; align-items: stretch; gap: 0; padding: 8px var(--gutter) 24px;
    background: rgb(10 10 10 / 0.97); border-bottom: 1px solid var(--divider);
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  }
  .nav.is-open .nav-links { transform: none; opacity: 1; visibility: visible; }
  .nav-links a:not(.btn) { display: block; padding: 14px 0; font-size: 18px; border-bottom: 1px solid var(--divider); }
  .nav-links .btn { margin-top: 16px; width: 100%; }
  .chapters { display: none; }
  .hero { align-items: flex-end; padding-bottom: 112px; }
}

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