/* ===== Tokens ===== */
:root {
  --bg: #0d0e10;
  --surface: #15171b;
  --surface-2: #1c1f24;
  --border: #262a31;
  --text: #ecedef;
  --muted: #9a9ea8;
  --accent: #6ee7b7;
  --radius: 14px;
  --max: 1080px;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-head: "Space Grotesk", "Inter", system-ui, sans-serif;
}

/* ===== Base ===== */
*, *::before, *::after { 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;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.eyebrow { font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); margin-bottom: 1rem; display: block; }

/* ===== Header ===== */
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(13,14,16,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-family: var(--font-head); font-weight: 700; color: var(--text); font-size: 1.1rem; }
.logo:hover { text-decoration: none; }
.nav { display: flex; gap: 24px; }
.nav a { color: var(--muted); font-size: .95rem; }
.nav a:hover { color: var(--text); text-decoration: none; }

/* ===== Sections ===== */
section { padding: 96px 0; border-bottom: 1px solid var(--border); }
.hero { padding: 120px 0 104px; }
.hero h1 { max-width: 16ch; }
.hero .sub { font-size: 1.2rem; color: var(--muted); max-width: 52ch; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 2rem; }
.btn { display: inline-block; padding: 12px 22px; border-radius: 999px; font-weight: 600; font-size: .95rem; border: 1px solid var(--border); color: var(--text); }
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--accent); color: #0d0e10; border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }

/* ===== Work cards ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 2.5rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: var(--text); transition: border-color .2s, transform .2s; }
.card:hover { border-color: var(--accent); transform: translateY(-3px); text-decoration: none; }
.card .thumb { aspect-ratio: 16/10; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.card .body { padding: 22px; }
.card .tags { color: var(--muted); font-size: .85rem; margin-bottom: .5rem; }
.card p { color: var(--muted); margin: 0; }

/* Group headings inside the Work section ("Personal projects", "Client work") */
.work-group { margin: 3rem 0 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-family: var(--font-body); font-weight: 500; }
.work-group + .cards { margin-top: 1.25rem; }

/* ===== About ===== */
.about-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 48px; }
.about-grid p { color: #cfd1d6; }

/* ===== Contact ===== */
.contact { text-align: center; border-bottom: none; }
.contact .btn-row { justify-content: center; }

/* ===== Footer ===== */
.site-footer { padding: 32px 0; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); }

/* ===== Case study pages ===== */
.cs-hero { padding: 96px 0 56px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 24px; color: var(--muted); font-size: .95rem; margin: 1rem 0 1.5rem; }
.meta strong { color: var(--text); font-weight: 600; }
.cs-body { padding: 56px 0; }
.cs-body .container { max-width: 760px; }
.cs-body h2 { font-size: 1.5rem; margin-top: 2.5rem; }
.cs-body ul { padding-left: 1.2rem; }
.cs-body li { margin-bottom: .7em; color: #cfd1d6; }
.cs-body li strong { color: var(--text); }
figure { margin: 2.5rem 0; }
.figure-wide { max-width: var(--max); margin: 2.5rem auto; padding: 0 20px; }
.img-frame { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.img-placeholder { aspect-ratio: 1600/778; display: grid; place-items: center; color: var(--muted); font-size: .9rem; text-align: center; padding: 20px; }
.labels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: .75rem; font-size: .85rem; color: var(--muted); }
.labels span:first-child::before { content: "← "; }
.labels span:last-child { text-align: right; }
.labels span:last-child::after { content: " →"; }
figcaption { color: var(--muted); font-size: .95rem; margin-top: .75rem; }
.back { display: inline-block; margin-bottom: 1.5rem; color: var(--muted); font-size: .95rem; }
.next-cs { padding: 56px 0; text-align: center; border-bottom: none; }

/* ===== Mobile ===== */
@media (max-width: 720px) {
  section { padding: 72px 0; }
  .hero { padding: 88px 0 72px; }
  .nav { gap: 16px; }
  .nav a.hide-sm { display: none; }
  .about-grid { grid-template-columns: 1fr; gap: 8px; }
}

/* ===== Testimonial ===== */
.testimonial { padding: 72px 0; }
.testimonial figure { max-width: 760px; margin: 0 auto; padding-left: 28px; border-left: 3px solid var(--accent); }
.testimonial blockquote { margin: 0; }
.testimonial blockquote p { font-family: var(--font-head); font-size: clamp(1.25rem, 2.4vw, 1.6rem); line-height: 1.45; color: var(--text); margin: 0 0 1.25rem; }
.testimonial figcaption { display: flex; flex-direction: column; gap: 2px; margin: 0; font-size: .95rem; }
.testimonial figcaption strong { color: var(--text); font-weight: 600; }
.testimonial figcaption span { color: var(--muted); }

/* ===== Case study summary + split ===== */
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0 0 3rem; }
.summary > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.summary dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); margin-bottom: .4rem; }
.summary dd { margin: 0; color: #cfd1d6; font-size: .95rem; line-height: 1.5; }
.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: start; margin-bottom: 1rem; }
.split h2 { margin-top: 0; }
.split-img { margin: .4rem 0 0; }
.cs-body .container:has(.split), .cs-body .container:has(.summary) { max-width: 900px; }
@media (max-width: 720px) {
  .summary { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; gap: 16px; }
}

/* ===== Case study flow: no dividers inside a case study ===== */
section.cs-body { border-bottom: none; padding: 40px 0; }
.cs-hero { border-bottom: none; }
.figure-wide + section.cs-body { padding-top: 48px; }
h3.decision { font-size: 1.25rem; margin: 2rem 0 .6rem; display: flex; gap: 12px; align-items: baseline; }
h3.decision span { font-size: .85rem; color: var(--accent); letter-spacing: .1em; }

/* ===== Outcome with phone ===== */
.split.outcome { grid-template-columns: 1fr 240px; align-items: center; }
.phone { margin: 0; }
.phone .img-frame { border-radius: 22px; border-width: 6px; border-color: var(--surface-2); }
.phone figcaption { font-size: .85rem; }
@media (max-width: 720px) {
  .split.outcome { grid-template-columns: 1fr; }
  .phone { max-width: 240px; }
}

/* ===== Click-to-enlarge images ===== */
a.zoom { display: block; cursor: zoom-in; }
a.zoom:hover { text-decoration: none; }
a.zoom .img-frame { transition: border-color .2s; }
a.zoom:hover .img-frame { border-color: var(--accent); }
.zoom-hint { display: block; margin-top: .25rem; color: var(--accent); font-size: .85rem; }

/* ===== Side projects ===== */
.side-card { display: grid; grid-template-columns: 1fr 1.2fr; gap: 0; margin-top: 2.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.side-thumb { background: var(--surface-2); }
.side-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.side-body { padding: 28px; }
.side-body .tags { color: var(--muted); font-size: .85rem; margin-bottom: .5rem; }
.side-body p { color: #cfd1d6; }
.side-body p.muted { color: var(--muted); font-size: .95rem; margin-bottom: 0; }
.footer-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
@media (max-width: 720px) { .side-card { grid-template-columns: 1fr; } .side-body { padding: 22px; } }
/* side card: image on top so the full wide screenshot shows */
.side-card { grid-template-columns: 1fr; }
.side-thumb img { height: auto; object-fit: contain; }
.side-body { max-width: 760px; }

/* ===== Image pairs (side by side) ===== */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 720px) { .pair { grid-template-columns: 1fr; } }

/* =====================================================================
   Motion
   Everything in here is extra polish. Browsers that don't support an
   effect simply skip it, and visitors who've asked their device to
   "reduce motion" get none of it.
   ===================================================================== */
@media (prefers-reduced-motion: no-preference) {

  /* 1. Page-to-page transition: pages fade across when you click a link.
        The project title also glides from its card into the case study
        heading: each card title and its page heading share a
        "view-transition-name" (set in the HTML, e.g. title-dynasty). */
  @view-transition { navigation: auto; }
  ::view-transition-old(root),
  ::view-transition-new(root) { animation-duration: .5s; animation-timing-function: ease; }
  ::view-transition-group(*) { animation-duration: .7s; animation-timing-function: cubic-bezier(.25, .8, .25, 1); }

  /* 2. Homepage entrance: headline, line, and buttons rise in, one after another.
        Change the 1.1s to speed it up or slow it down; the delays set the stagger. */
  @keyframes rise-in {
    from { opacity: 0; transform: translateY(32px); }
    to   { opacity: 1; transform: none; }
  }
  .hero .eyebrow, .hero h1, .hero .sub, .hero .btn-row {
    animation: rise-in 1.1s cubic-bezier(.2, .8, .2, 1) both;
  }
  .hero .eyebrow { animation-delay: .1s; }
  .hero h1       { animation-delay: .3s; }
  .hero .sub     { animation-delay: .6s; }
  .hero .btn-row { animation-delay: .85s; }

  /* 3. Card hover: lift, slight zoom on the screenshot, soft mint glow */
  .card { transition: border-color .25s, transform .25s, box-shadow .25s; }
  .card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px -18px rgba(110, 231, 183, .35); }
  .card .thumb { overflow: hidden; }
  .card .thumb img { transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
  .card:hover .thumb img { transform: scale(1.04); }

  /* 4. Scroll reveal: blocks fade up once they come into view.
        motion.js adds the "reveal" class, then "is-visible" when each block
        scrolls into view. Change .9s to make it faster or slower. */
  .reveal { opacity: 0; transform: translateY(48px); transition: opacity .9s ease, transform .9s cubic-bezier(.2, .8, .2, 1); }
  .reveal.is-visible { opacity: 1; transform: none; }
  .cards .card.reveal:nth-child(2) { transition-delay: .15s; }   /* second card in a row arrives a beat later */
}
