:root{
  /* Warm dark, not cold black — paired with a bold display face for
     headings and a monospace face for nav/labels/meta, in place of the
     previous all-system-sans look. */
  --bg:#15130f;
  --bg-card:#1e1c17;
  --text:#f3f0ea;
  --text-dim:#a39b8c;
  --accent:#3b58f5; /* same blue as the icon mark in assets/logo.svg */
  --border:#322e26;
  --header-bg:rgba(21,19,15,.85);
  --shimmer-a:#1e1c17;
  --shimmer-b:#29261f;
  --shadow:rgba(0,0,0,.5);
  --radius:28px;
  --header-h:76px;

  --font-body:"Inter","Helvetica Neue",Arial,sans-serif;
  --font-display:"Space Grotesk","Inter",sans-serif;
  --font-mono:"JetBrains Mono","SFMono-Regular",Consolas,monospace;
}

:root[data-theme="light"]{
  --bg:#f7f4ec;
  --bg-card:#ffffff;
  --text:#1a1712;
  --text-dim:#6e6656;
  --accent:#3b58f5;
  --border:#e7e0d0;
  --header-bg:rgba(247,244,236,.85);
  --shimmer-a:#efe9db;
  --shimmer-b:#f8f5ee;
  --shadow:rgba(30,25,15,.12);
}

*{box-sizing:border-box;}
html{
  scroll-behavior:smooth;
}

/* Nav-link jump targets — without this, the sticky header (var(--header-h)
   tall) lands right on top of the section, covering its heading. The
   extra 24px is a bit of breathing room past just clearing the header. */
#work, #about, #case-studies, #animations, #contact{
  scroll-margin-top:calc(var(--header-h) + 24px);
}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  -webkit-font-smoothing:antialiased;
  transition:background-color .25s ease, color .25s ease;
}

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

/* Header */
.site-header{
  position:sticky;top:0;z-index:50;
  height:var(--header-h);
  background:var(--header-bg);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--border);
  transition:background-color .25s ease, border-color .25s ease;
}
.header-inner{
  max-width:1200px;margin:0 auto;height:100%;
  display:flex;align-items:center;justify-content:space-between;
  padding:0 24px;
}
.logo{display:flex;align-items:center;}

/* Groups the hamburger (mobile only) and theme toggle at the header's
   right edge, in normal flex flow — no more fixed-to-viewport-corner
   positioning, so it can't drift out of alignment with the rest of the
   header controls at different header heights. */
.header-actions{
  display:flex;align-items:center;gap:12px;
}
.logo-mark{
  display:block;
  height:26px;width:auto;
  color:var(--text); /* wordmark paths use fill="currentColor"; the icon mark keeps its own fixed brand blue */
  transition:color .25s ease;
}

.site-nav{
  /* Centered on .site-header (the nearest positioned ancestor — sticky
     counts), not on .header-inner, so it sits in the true middle of the
     page regardless of the logo's width or the fixed theme-toggle. */
  position:absolute;
  left:50%;top:50%;
  transform:translate(-50%, -50%);
  display:flex;align-items:center;gap:6px;
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:999px;
  padding:5px;
}
.site-nav a{
  font-family:var(--font-mono);
  font-size:12.5px;font-weight:500;color:var(--text-dim);
  padding:8px 16px;
  border-radius:999px;
  transition:color .2s ease, background-color .2s ease;
}
.site-nav a:hover{color:var(--text);background:var(--shimmer-a);}

/* Pill switch, pinned to the true top-right corner of the viewport
   (fixed, not inside the header's centered content column). */
.theme-toggle{
  flex-shrink:0;
  width:52px;height:28px;
  padding:3px;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--bg-card);
  cursor:pointer;
  display:flex;align-items:center;
  transition:background-color .2s ease, border-color .2s ease;
}
.theme-toggle:hover{border-color:var(--accent);}
.theme-toggle-knob{
  width:20px;height:20px;
  border-radius:50%;
  background:var(--accent);
  color:#fff;
  display:flex;align-items:center;justify-content:center;
  font-size:11px;
  transform:translateX(0);
  transition:transform .25s ease;
}
:root[data-theme="light"] .theme-toggle-knob{transform:translateX(24px);}

/* Hamburger button — hidden on desktop (.site-nav shows instead), see
   the max-width:640px block near the bottom for where they swap. */
.menu-toggle{
  display:none;
  width:40px;height:40px;
  border-radius:50%;
  border:1px solid var(--border);
  background:var(--bg-card);
  align-items:center;justify-content:center;
  flex-direction:column;
  gap:4px;
  cursor:pointer;
  transition:border-color .2s ease;
}
.menu-toggle:hover{border-color:var(--accent);}
.menu-toggle-bar{
  width:16px;height:2px;
  border-radius:1px;
  background:var(--text);
}

/* Mobile nav drawer */
body.mobile-nav-open{overflow:hidden;}

.mobile-nav{
  position:fixed;inset:0;z-index:150;
}
.mobile-nav[hidden]{display:none;}

.mobile-nav-backdrop{
  position:absolute;inset:0;
  background:rgba(10,9,7,.6);
}

.mobile-nav-panel{
  position:absolute;
  top:0;right:0;bottom:0;
  width:min(320px, 80vw);
  background:var(--bg-card);
  border-left:1px solid var(--border);
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:80px 24px 24px;
}
.mobile-nav-panel a{
  font-family:var(--font-mono);
  font-size:16px;font-weight:500;
  color:var(--text);
  padding:14px 4px;
  border-bottom:1px solid var(--border);
}
.mobile-nav-close{
  position:absolute;top:16px;right:16px;
  width:40px;height:40px;
  border-radius:50%;
  border:1px solid var(--border);
  background:var(--bg-card);
  color:var(--text);
  font-size:22px;line-height:1;
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;
}
.mobile-nav-close:hover{border-color:var(--accent);}

/* Feed */
.feed-wrap{max-width:960px;margin:0 auto;padding:64px 20px 100px;}
.feed{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:72px;
}

.video-item{
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  opacity:0;
  transform:translateY(24px);
  animation:itemIn .6s ease forwards;
}
@keyframes itemIn{to{opacity:1;transform:translateY(0);}}

.media-wrap{
  position:relative;
  width:100%;
  aspect-ratio:16/9;
  /* Not pure black: at the rounded corners, a <video>'s own clip and this
     container's overflow:hidden clip don't always land on the exact same
     sub-pixel edge, and whatever this background is shows through that
     hairline gap. A near-card-color background makes that gap disappear
     instead of reading as a hard black seam. */
  background:var(--shimmer-a);
  border-radius:var(--radius);
  overflow:hidden;
  border:1px solid var(--border);
  transition:border-color .25s ease;
}
.media-wrap.loading{
  background:linear-gradient(110deg,var(--shimmer-a) 8%,var(--shimmer-b) 18%,var(--shimmer-a) 33%);
  background-size:200% 100%;
  animation:shimmer 1.4s linear infinite;
}
@keyframes shimmer{to{background-position-x:-200%;}}

.thumb{
  width:100%;height:100%;object-fit:cover;display:block;
  transition:opacity .25s ease;
}
.video-item.is-playing .thumb{opacity:0;}

.media-wrap iframe{
  position:absolute;inset:0;width:100%;height:100%;border:0;
  opacity:0;transition:opacity .25s ease;
}
.media-wrap iframe.active{opacity:1;}

.media-wrap video.self-video{
  position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;
}

/* Center play/pause button — the only control */
.center-btn{
  position:absolute;
  top:50%;left:50%;
  transform:translate(-50%,-50%);
  width:84px;height:84px;
  border-radius:50%;
  /* Always sits on top of video/poster imagery, not the page background,
     so this stays a dark scrim + white icon in both themes for contrast. */
  border:1px solid rgba(255,255,255,.35);
  background:rgba(0,0,0,.5);
  backdrop-filter:blur(6px);
  color:#fff;
  font-size:28px;
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;
  z-index:4;
  transition:opacity .25s ease, transform .2s ease, background .2s ease;
}
.center-btn:hover{background:var(--accent);transform:translate(-50%,-50%) scale(1.06);}

/* While playing, the button fades out after a few idle seconds and
   reappears on mouse movement (desktop only — see app.js). */
.video-item.is-playing.controls-hidden .center-btn{
  opacity:0;
  pointer-events:none;
}

.caption{
  width:100%;
  max-width:520px;
  margin:0 auto;
  padding:14px 4px 0;
  text-align:center;
}
.caption h3{margin:0 0 2px;font-family:var(--font-display);font-size:16px;font-weight:600;}
.caption .cat{font-family:var(--font-mono);font-size:12px;color:var(--text-dim);}
.caption .desc{margin:8px 0 0;font-size:13px;line-height:1.5;color:var(--text-dim);}

/* Professional credit block — role in small caps, name alongside it. */
.credits{
  list-style:none;
  margin:10px 0 0;
  padding:10px 0 0;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
  border-top:1px solid var(--border);
}
.credits li{
  display:flex;
  align-items:baseline;
  gap:8px;
  font-size:12.5px;
}
.credits .role{
  font-family:var(--font-mono);
  text-transform:uppercase;
  letter-spacing:.06em;
  font-size:10px;
  font-weight:500;
  color:var(--text-dim);
}
.credits .name{
  color:var(--text);
  font-weight:500;
}

/* Self-hosted clips grid (no captions) — two square videos per row */
.local-video-section{
  padding:0 0 60px;
}
.local-video-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:0;
}
/* Reuses .video-item entrance animation and .media-wrap's fill/object-fit
   behavior, but each clip autoplays muted+looping (see
   setupAutoplayLoopVideo in app.js), and this specific grid goes edge-to-
   edge — full viewport width, tiles touching with no gap, no rounded
   corners, no border — unlike every other card on the site. */
.local-video-item .media-wrap{
  border-radius:0;
  border:none;
}

/* About */
.about-section{
  max-width:700px;
  margin:0 auto;
  padding:20px 24px 80px;
  text-align:center;
}
.about-section h2,
.case-studies-header h2,
.animations-header h2{
  font-family:var(--font-display);
  font-weight:600;
  letter-spacing:-.02em;
}

.about-section h2{
  font-size:clamp(28px,5vw,40px);
  margin:0 0 20px;
}
.about-section p{
  color:var(--text-dim);
  font-size:15px;
  line-height:1.7;
  margin:0 0 28px;
}
.about-section p a{color:var(--text);text-decoration:underline;text-underline-offset:2px;}
.about-section p a:hover{color:var(--accent);}

.about-subhead{
  font-family:var(--font-mono);
  font-size:11px;
  font-weight:500;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--text-dim);
  margin:0 0 12px;
}

.about-tools{
  list-style:none;
  display:flex;flex-wrap:wrap;align-items:center;justify-content:center;
  gap:10px;
  margin:0 0 32px;
  padding:0;
}
.about-tools li{
  font-family:var(--font-mono);
  font-size:12px;font-weight:500;
  color:var(--text-dim);
  border:1px solid var(--border);
  border-radius:999px;
  padding:6px 14px;
}

.resume-btn{
  display:inline-flex;align-items:center;justify-content:center;
  padding:12px 26px;
  border-radius:999px;
  border:1px solid var(--accent);
  color:var(--accent);
  font-family:var(--font-display);
  font-size:14px;font-weight:600;
  letter-spacing:.01em;
  transition:background-color .2s ease, color .2s ease, transform .2s ease;
}
.resume-btn:hover{background:var(--accent);color:#fff;transform:translateY(-1px);}

/* Resume lightbox */
body.resume-modal-open{overflow:hidden;}

.resume-modal{
  position:fixed;inset:0;z-index:200;
  display:flex;align-items:center;justify-content:center;
  padding:24px;
}
.resume-modal[hidden]{display:none;}

.resume-modal-backdrop{
  position:absolute;inset:0;
  background:rgba(10,10,14,.7);
}

.resume-modal-panel{
  position:relative;
  width:min(760px, 100%);
  height:min(85vh, 960px);
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:24px;
  box-shadow:0 30px 80px var(--shadow);
  overflow:hidden;
  display:flex;flex-direction:column;
  z-index:1;
}

.resume-modal-close{
  position:absolute;top:12px;right:12px;z-index:2;
  width:36px;height:36px;
  border-radius:50%;
  border:1px solid var(--border);
  background:var(--bg-card);
  color:var(--text);
  font-size:20px;line-height:1;
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;
  transition:border-color .2s ease, color .2s ease;
}
.resume-modal-close:hover{border-color:var(--accent);color:var(--accent);}

.resume-modal-pages{
  flex:1;
  overflow-y:auto;
  overflow-x:hidden;
  background:#e5e5e5; /* neutral canvas so the white page edges read clearly */
  padding:32px 24px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:20px;
}
.resume-modal-pages img{
  display:block;
  width:100%;
  max-width:640px;
  height:auto;
  border-radius:4px;
  box-shadow:0 4px 20px rgba(0,0,0,.18);
}

.resume-modal-download{
  flex-shrink:0;
  margin:16px auto;
}

@media (max-width:640px){
  .resume-modal{padding:0;}
  .resume-modal-panel{
    width:100%;height:100%;
    border-radius:0;
  }
}

/* Case studies (external links to Behance — no hotlinked images, since
   Behance serves a "blocked" placeholder for at least one cover when
   fetched without a logged-in session, so hotlinking isn't reliable). */
.case-studies-section{
  max-width:1200px;
  margin:0 auto;
  padding:20px 24px 80px;
}
.case-studies-header{
  text-align:center;
  max-width:640px;
  margin:0 auto 32px;
}
.case-studies-header h2{
  font-size:clamp(24px,4vw,34px);
  margin:0 0 8px;
}
.case-studies-header p{
  color:var(--text-dim);
  font-size:14px;
  margin:0;
}

.case-studies-viewport{
  position:relative;
}

/* One row, always — with 4 cards this scrolls horizontally instead of
   wrapping to a second row or squeezing every card narrower. Sized so
   three sit fully in view and the fourth just peeks in on the right,
   as a "there's more" hint — the arrow button scrolls to reveal it.
   No visible scrollbar (still scrolls fine via touch/trackpad/arrow). */
.case-studies-grid{
  display:flex;
  gap:16px;
  overflow-x:auto;
  scroll-snap-type:x proximity;
  scrollbar-width:none;
  -ms-overflow-style:none;
  padding:2px; /* keeps card focus rings from clipping */
  margin:0 -2px;
}
.case-studies-grid::-webkit-scrollbar{display:none;}
.case-study-card{
  flex:0 0 max(240px, calc((100% - 108px) / 3));
  scroll-snap-align:start;
  display:flex;
  flex-direction:column;
  border:1px solid var(--border);
  border-radius:20px;
  background:var(--bg-card);
  overflow:hidden; /* clips the thumbnail to the card's rounded top corners */
  transition:border-color .25s ease;
}
.case-study-card:hover{border-color:var(--accent);}

/* Scroll-forward arrow — same dark-scrim-and-blur treatment as the video
   play buttons elsewhere on the site, just smaller. Fades out once
   there's nothing further right to reveal (see app.js). */
.case-studies-next{
  position:absolute;
  top:50%;right:8px;
  transform:translateY(-50%);
  width:48px;height:48px;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.35);
  background:rgba(0,0,0,.45);
  backdrop-filter:blur(6px);
  color:#fff;
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;
  z-index:2;
  transition:opacity .2s ease, background-color .2s ease, transform .2s ease;
}
.case-studies-next svg{width:20px;height:20px;}
.case-studies-next:hover{background:var(--accent);transform:translateY(-50%) scale(1.06);}
.case-studies-next.is-hidden{opacity:0;pointer-events:none;}
.case-study-thumb{
  display:block;
  width:100%;
  aspect-ratio:3/2; /* cropped shorter than the 808x632 source (~4:3.13) to keep cards compact */
  object-fit:cover;
  background:var(--shimmer-a);
}
.case-study-body{
  display:flex;
  flex-direction:column;
  padding:16px;
}
.case-study-card h3{
  margin:0 0 6px;
  font-family:var(--font-display);
  font-size:15px;
  font-weight:600;
  line-height:1.3;
}
.case-study-card .desc{
  margin:0 0 12px;
  font-size:12px;
  line-height:1.5;
  color:var(--text-dim);
  flex-grow:1;
}
.case-study-card .meta{
  font-family:var(--font-mono);
  margin:0 0 12px;
  font-size:10px;
  color:var(--text-dim);
  padding-top:10px;
  border-top:1px solid var(--border);
}
.case-study-link{
  font-family:var(--font-mono);
  align-self:flex-start;
  font-size:12px;
  font-weight:500;
  color:var(--accent);
}
.case-study-link:hover{text-decoration:underline;}

/* Interactive animations (dotLottie) */
.animations-section{
  max-width:1200px;
  margin:0 auto;
  padding:20px 24px 100px;
}
.animations-header{
  text-align:center;
  max-width:640px;
  margin:0 auto 32px;
}
.animations-header h2{
  font-size:clamp(24px,4vw,34px);
  margin:0 0 8px;
}
.animations-header p{
  color:var(--text-dim);
  font-size:14px;
  margin:0;
}

.lottie-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:24px;
}

.load-more-btn{
  display:flex;
  margin:32px auto 0;
  padding:12px 26px;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--bg-card);
  color:var(--text);
  font-family:var(--font-display);
  font-size:14px;font-weight:600;
  cursor:pointer;
  transition:border-color .2s ease, transform .2s ease;
}
.load-more-btn:hover{border-color:var(--accent);transform:translateY(-1px);}

.lottie-card{
  display:flex;
  flex-direction:column;
  opacity:0;
  transform:translateY(16px);
  animation:itemIn .5s ease forwards;
}

.lottie-frame{
  position:relative;
  width:100%;
  aspect-ratio:16/9;
  border-radius:20px;
  overflow:hidden;
  background:var(--bg-card);
  border:1px solid var(--border);
}
.lottie-frame.loading{
  background:linear-gradient(110deg,var(--shimmer-a) 8%,var(--shimmer-b) 18%,var(--shimmer-a) 33%);
  background-size:200% 100%;
  animation:shimmer 1.4s linear infinite;
}

.lottie-wc{
  display:block;
  width:100%;
  height:100%;
}

/* Sentinel */
.sentinel{height:1px;}
.hidden{display:none !important;}

/* Footer */
.site-footer{
  border-top:1px solid var(--border);
  padding:40px 24px 60px;text-align:center;
  color:var(--text-dim);font-size:12px;
  display:flex;flex-direction:column;align-items:center;gap:20px;
}

.calendly-btn{
  display:inline-flex;align-items:center;justify-content:center;
  padding:12px 26px;
  border-radius:999px;
  background:var(--accent);
  color:#fff;
  font-family:var(--font-display);
  font-size:14px;font-weight:600;
  letter-spacing:.01em;
  transition:transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.calendly-btn:hover{transform:translateY(-1px);box-shadow:0 8px 24px var(--shadow);opacity:.92;}

.social-links{
  display:flex;align-items:center;gap:18px;
}
.social-links a{
  display:flex;align-items:center;justify-content:center;
  width:36px;height:36px;
  border-radius:50%;
  border:1px solid var(--border);
  color:var(--text-dim);
  transition:color .2s ease, border-color .2s ease, transform .2s ease;
}
.social-links a:hover{
  color:var(--accent);
  border-color:var(--accent);
  transform:translateY(-2px);
}
.social-links svg{width:18px;height:18px;}

/* Responsive tweaks */
@media (max-width:640px){
  .header-inner{padding:0 16px;}
  .site-nav{display:none;}
  .menu-toggle{display:flex;}
  .theme-toggle{display:none;}
  .feed-wrap{padding:40px 12px 80px;}
  .feed{gap:48px;}
  .center-btn{width:64px;height:64px;font-size:22px;}
  :root{--radius:18px;}
  .about-section{padding:8px 16px 56px;}
  .case-studies-section{padding:8px 16px 56px;}
  .case-study-card{flex-basis:82%;}
  .animations-section{padding:8px 16px 80px;}
  .lottie-grid{grid-template-columns:1fr;gap:10px;}
  .local-video-section{padding:0 0 40px;}
  .local-video-grid{grid-template-columns:1fr;}
}

@media (max-width:480px){
  .lottie-grid{gap:8px;}
  .lottie-frame{border-radius:12px;}
}
