:root {
  --bg: #faf6ef;
  --surface: #ffffff;
  --ink: #1f1b2e;
  --muted: #6b6578;
  --line: #e8e1d4;
  --brand: #ff8a3d;
  --accent: #ff8a3d;
  --shadow: 0 1px 2px rgba(31, 27, 46, .06), 0 8px 24px rgba(31, 27, 46, .07);
  --radius: 20px;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, sans-serif;
  /* status colours */
  --s-live: #1f9d55; --s-preview: #2563eb; --s-wip: #c2410c; --s-personal: #6b7280;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15121f; --surface: #1f1b2e; --ink: #f4efe6; --muted: #a9a2b8; --line: #2f2a40;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
    --s-live: #34d27b; --s-preview: #60a5fa; --s-wip: #fb923c; --s-personal: #9ca3af;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--body); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); line-height: 1.05; letter-spacing: -.02em; margin: 0; }
main { max-width: 1160px; margin: 0 auto; padding: 0 20px; }

/* header */
.top { max-width: 1160px; margin: 0 auto; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 800 21px var(--display); letter-spacing: -.02em; }
.top nav { display: flex; gap: 20px; }
.top nav a { text-decoration: none; color: var(--muted); font-weight: 500; font-size: 15px; }
.top nav a:hover { color: var(--ink); }

/* hero */
.hero { padding: 56px 0 40px; max-width: 820px; }
.eyebrow { margin: 0 0 14px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hero h1 { font-size: clamp(40px, 7vw, 76px); font-weight: 800; }
.lede { font-size: clamp(17px, 2vw, 20px); color: var(--muted); margin: 20px 0 0; max-width: 640px; }
.hero-stats { display: flex; gap: 36px; margin-top: 32px; }
.hero-stats { flex-wrap: wrap; gap: 20px 36px; }
.stat { display: flex; flex-direction: column; text-decoration: none; }
.stat b { font: 800 40px/1 var(--display); }
.stat span { color: var(--muted); font-size: 14px; margin-top: 4px; }
.stat-live b { color: var(--s-live); } .stat-preview b { color: var(--s-preview); }
.stat-wip b { color: var(--s-wip); } .stat-personal b { color: var(--s-personal); }

/* projects */
.projects { padding: 24px 0 40px; }
.projects-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.projects-head h2, .about h2 { font-size: 30px; }
.filters { display: flex; gap: 10px 22px; flex-wrap: wrap; }
.filter-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.chip { font: 500 14px var(--body); color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .chip:hover { border-color: var(--muted); } }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 22px; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; box-shadow: var(--shadow); transition: transform .2s ease, box-shadow .2s ease; }
.card:hover { transform: translateY(-4px); box-shadow: 0 2px 4px rgba(31,27,46,.08), 0 18px 40px rgba(31,27,46,.14); }
.card[hidden] { display: none; }
.card-body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.kind { font-size: 13px; color: var(--muted); }
.card h3 { font-size: 26px; font-weight: 700; }
.card p { margin: 0; color: var(--muted); }
.card-go, .card-note { margin-top: auto; padding-top: 12px; font-size: 14px; font-weight: 600; }
.card-go { color: var(--s-live); }
.card-note { color: var(--muted); font-weight: 500; }
.card-preview { color: var(--s-preview); }
.card-tags, .status-row { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.status-row { gap: 6px; }
.tag { font-size: 12px; font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }
.tag-type { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); border-color: transparent; }

/* stage sections */
.stage { margin-bottom: 44px; }
.stage[hidden], .no-match[hidden] { display: none; }
.stage-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.stage-head h3 { font: inherit; }
.stage-head .pill { font-size: 15px; padding: 6px 14px 6px 12px; }
.stage-head .pill i { width: 9px; height: 9px; }
.stage-head p { margin: 0; color: var(--muted); }
.no-match { color: var(--muted); padding: 30px 0; }

/* thumbnails: two phones on the project's colour */
.thumb { position: relative; height: 230px; overflow: hidden; background: var(--accent);
  background-image: radial-gradient(circle at 20% 0%, rgba(255,255,255,.35), transparent 60%), radial-gradient(circle at 100% 100%, rgba(0,0,0,.18), transparent 55%); }
.phone { position: absolute; width: 150px; border-radius: 18px; border: 4px solid #121018; box-shadow: 0 12px 30px rgba(0,0,0,.3); transition: transform .3s ease; }
.phone-0 { left: 50%; top: 26px; transform: translateX(-88%) rotate(-5deg); z-index: 2; }
.phone-1 { left: 50%; top: 40px; transform: translateX(-4%) rotate(5deg); }
.phone-0:only-child { transform: translateX(-50%); }
.card:hover .phone-0 { transform: translateX(-92%) rotate(-7deg) translateY(-6px); }
.card:hover .phone-1 { transform: translateX(0%) rotate(7deg) translateY(-6px); }
.placeholder { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: #fff; }
.placeholder span { font: 800 96px/1 var(--display); opacity: .9; }
.placeholder small { font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: 12px; opacity: .85; margin-top: 6px; }

/* status pill */
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; padding: 4px 10px 4px 9px; border-radius: 999px; white-space: nowrap;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.pill-live { --c: var(--s-live); } .pill-preview { --c: var(--s-preview); }
.pill-wip { --c: var(--s-wip); } .pill-personal { --c: var(--s-personal); }
.pill-live i { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 60%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* about */
.about { padding: 40px 0 60px; border-top: 1px solid var(--line); max-width: 720px; }
.about p { color: var(--muted); font-size: 17px; }
.legend { list-style: none; padding: 0; display: grid; gap: 10px; }
.legend li { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.legend .pill { min-width: 150px; }

.foot { max-width: 1160px; margin: 0 auto; padding: 28px 20px 40px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }

/* project page */
.p-hero { padding: 20px 0 32px; }
.back { display: inline-block; text-decoration: none; color: var(--muted); font-size: 15px; font-weight: 500; margin-bottom: 28px; }
.back:hover { color: var(--ink); }
.p-head { display: flex; justify-content: space-between; align-items: end; gap: 28px; flex-wrap: wrap; }
.p-head h1 { font-size: clamp(44px, 8vw, 84px); font-weight: 800; }
.p-head h1::after { content: ""; display: block; width: 72px; height: 7px; border-radius: 4px; background: var(--accent); margin-top: 16px; }
.p-actions { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; min-width: 260px; }
.btn { display: inline-flex; gap: 8px; align-items: center; background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 600; font-size: 17px; padding: 14px 24px; border-radius: 14px; transition: transform .15s ease; }
.btn:hover { transform: translateY(-2px); }
.btn-preview { background: var(--accent); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.preview-note { margin: -4px 0 0; font-size: 13px; color: var(--muted); max-width: 280px; }
.status-box { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.status-box p { margin: 0; color: var(--muted); font-size: 15px; }

.gallery { display: flex; gap: 18px; overflow-x: auto; padding: 28px; margin: 0 -20px; scroll-snap-type: x mandatory;
  background: var(--accent); background-image: radial-gradient(circle at 15% 0%, rgba(255,255,255,.3), transparent 55%); border-radius: 0; }
@media (min-width: 760px) { .gallery { margin: 0; border-radius: 28px; padding: 36px; } }
/* centre a short row, but let a long row scroll from its first screenshot */
.gallery figure:first-child { margin-left: auto; }
.gallery figure:last-child { margin-right: auto; }
.gallery figure { margin: 0; flex: 0 0 auto; scroll-snap-align: center; }
.gallery button { padding: 0; border: 0; background: none; cursor: zoom-in; display: block; }
.gallery img { width: 240px; border-radius: 26px; border: 6px solid #121018; box-shadow: 0 18px 40px rgba(0,0,0,.3); }
.gallery figcaption { text-align: center; color: #fff; font-size: 14px; font-weight: 600; margin-top: 12px; text-shadow: 0 1px 3px rgba(0,0,0,.35); }
.gallery.empty { display: block; }
.placeholder.big { position: relative; height: 300px; }

.p-body { display: grid; grid-template-columns: 1fr 300px; gap: 48px; padding: 44px 0 30px; }
@media (max-width: 820px) { .p-body { grid-template-columns: 1fr; gap: 28px; } }
.p-body h2 { font-size: 26px; margin: 0 0 12px; }
.p-body article p { font-size: 17px; margin: 0 0 16px; max-width: 680px; }
.p-body article h2:not(:first-child) { margin-top: 32px; }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.features li { position: relative; padding-left: 28px; }
.features li::before { content: ""; position: absolute; left: 4px; top: .55em; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); transform: rotate(45deg); }
.facts { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; align-self: start; box-shadow: var(--shadow); }
.facts dl { margin: 0; display: grid; gap: 4px; }
.facts dt { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 10px; }
.facts dt:first-child { margin-top: 0; }
.facts dd { margin: 0; font-weight: 500; }
.owner { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.owner span { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.owner a { font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.tags span { font-size: 13px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; color: var(--muted); }
.next { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; border-top: 1px solid var(--line); padding: 28px 0 40px; margin-top: 10px; }
.next span { color: var(--muted); }
.next b { font: 700 24px var(--display); }
.next:hover b { color: var(--accent); }
.missing { padding: 80px 0; }

/* lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(10, 8, 16, .9); z-index: 10; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 20px; }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; max-height: 100%; }
.lightbox img { max-height: calc(100vh - 100px); width: auto; border-radius: 22px; }
.lightbox figcaption { color: #fff; margin-top: 12px; font-weight: 500; }
.lightbox button { background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 50%; width: 48px; height: 48px; font-size: 28px; line-height: 1; cursor: pointer; flex: 0 0 auto; }
.lightbox button:hover { background: rgba(255,255,255,.22); }
.lightbox button[hidden] { display: none; }
.lb-close { position: absolute; top: 16px; right: 16px; }
@media (max-width: 600px) { .lb-nav { position: absolute; bottom: 20px; } .lb-prev { left: 30%; } .lb-next { right: 30%; } }

@media (max-width: 600px) {
  .hero { padding: 32px 0 28px; }
  .grid { grid-template-columns: 1fr; }
  .top nav { gap: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media (max-width: 600px) {
  .hero-stats { gap: 16px 22px; }
  .stat b { font-size: 32px; }
  .stat span { font-size: 13px; }
}
