/* ════════════════════════════════════════════════════════════
   Project pages: same bold, playful system as the homepage
   (cream grid paper, thick borders, hard shadows).
   ════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #2b3cff;
  --orange: #ff6a2b;
  --yellow: #ffd23f;
  --cream: #fbf7ee;
  --ink: #111;
  --mint: #9ef0c4;
  --accent: #e2553b;
  --border: 3px solid var(--ink);
  --shadow: 6px 6px 0 var(--ink);
  --serif: "Instrument Serif", Georgia, serif;
  --grid-size: 1.5rem;
}

html { scroll-behavior: smooth; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    linear-gradient(rgba(17, 17, 17, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 17, 0.07) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img, video { max-width: 100%; display: block; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* Panels fade in via GSAP; hide them until it runs */
html.project-page [data-panel]:not([data-proj-hero]) { opacity: 0; visibility: hidden; }

/* ── Chunky buttons (same as homepage) ── */
.chunky {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 50px; padding: 0 22px;
  border: var(--border); border-radius: 14px; box-shadow: var(--shadow);
  font-weight: 800; font-size: 1rem; text-decoration: none; color: var(--ink);
  transition: transform .12s, box-shadow .12s, background .2s;
}
.chunky:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }
.chunky:active { transform: translate(4px, 4px); box-shadow: 2px 2px 0 var(--ink); }
.chunky-y { background: var(--yellow); }
.chunky-w { background: #fff; }
.chunky-k { background: var(--ink); color: #fff; }
.chunky-k:hover { background: var(--accent); }

/* ── Back link ── */
.proj-back-nav {
  position: fixed; top: 16px; left: 16px; z-index: 100;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  font-weight: 800; font-size: .92rem; text-decoration: none;
  background: #fff; border: var(--border); border-radius: 999px; box-shadow: 3px 3px 0 var(--ink);
  transition: transform .12s, box-shadow .12s, background .2s;
}
.proj-back-nav:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); background: var(--yellow); }

/* ── Hero ── */
.proj-hero { padding: 110px 24px 72px; }
.proj-hero-inner {
  max-width: 1160px; margin: 0 auto;
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: center;
}
.proj-hero-copy { display: flex; flex-direction: column; gap: 18px; }
.proj-hero-tags { display: flex; gap: 10px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: .88rem;
  background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 4px 12px;
}
.pill--complete::before, .pill--in-progress::before, .pill--archived::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor;
}
.pill--complete { color: #157a46; }
.pill--in-progress { color: #9a6a00; }
.pill--archived { color: #6b675f; }

.proj-hero-title { font-size: clamp(3.4rem, 9vw, 7.2rem); font-weight: 800; letter-spacing: -0.05em; line-height: .9; }
.proj-hero-role { font-size: 1.1rem; font-weight: 600; }
.proj-hero-role em { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.35rem; color: var(--accent); }
.proj-hero-desc { font-size: 1.2rem; line-height: 1.55; max-width: 46ch; }

.proj-metrics { list-style: none; display: flex; gap: 28px; flex-wrap: wrap; margin: 6px 0; }
.proj-metrics li { display: flex; flex-direction: column; }
.proj-metrics strong { font-size: 3rem; line-height: 1; font-weight: 800; letter-spacing: -0.04em; color: var(--blue); }
.proj-metrics span { font-weight: 600; opacity: .8; }

.proj-hero-links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; }

.proj-stack { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.proj-stack li { font-size: .85rem; font-weight: 600; background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 11px; }

.proj-hero-art { display: grid; place-items: center; }
.proj-icon {
  width: min(320px, 80%); aspect-ratio: 1;
  display: grid; place-items: center; overflow: hidden;
  background: #fff; border: var(--border); border-radius: 48px; box-shadow: 12px 12px 0 var(--ink);
  transform: rotate(3deg);
}
.proj-icon img { width: 100%; height: 100%; object-fit: cover; }
.proj-icon--txt { font-size: 6rem; font-weight: 800; letter-spacing: -0.04em; background: var(--yellow); }

/* ── MDX sections as cards ── */
.project-layout { padding: 0 24px 120px; }
.project-layout article { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 32px; }

.project-layout [data-panel] > .panel-card {
  background: #fff; border: var(--border); border-radius: 26px; box-shadow: var(--shadow);
  padding: clamp(24px, 4vw, 44px);
}

.panel-card h2 {
  font-size: clamp(1.9rem, 3.6vw, 2.6rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05;
  margin-bottom: 20px;
}
.panel-card h3 { font-size: 1.3rem; font-weight: 800; margin: 24px 0 8px; }
.panel-card p { margin-bottom: 16px; max-width: 70ch; line-height: 1.65; }
.panel-card ul, .panel-card ol { padding-left: 1.3rem; margin-bottom: 18px; max-width: 70ch; }
.panel-card li { margin-bottom: 8px; line-height: 1.6; }
.panel-card strong { font-weight: 800; }
.panel-card a { color: var(--blue); font-weight: 700; text-underline-offset: 3px; }
.panel-card a:hover { color: var(--accent); }
.panel-card code { font-size: .88em; background: var(--cream); border: 1.5px solid var(--ink); border-radius: 6px; padding: 0 5px; }

.panel-card table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: .95rem; }
.panel-card th { text-align: left; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; padding: 10px 12px; border-bottom: 3px solid var(--ink); }
.panel-card td { padding: 12px; border-bottom: 1.5px solid rgba(17, 17, 17, .15); vertical-align: top; }
.panel-card th:first-child, .panel-card td:first-child { padding-left: 0; }
.panel-card td:first-child { font-weight: 700; white-space: nowrap; }

.panel-card img {
  width: 100%; height: auto; margin-top: 24px;
  border: var(--border); border-radius: 18px; box-shadow: var(--shadow);
}

.proj-video-wrap { margin: 24px 0; border: var(--border); border-radius: 18px; overflow: hidden; aspect-ratio: 16 / 9; }
.proj-video-wrap video { width: 100%; height: 100%; object-fit: cover; }

.proj-end { max-width: 1000px; margin: 48px auto 0; }

/* ── Scroll dots (built by GSAP script on project pages) ── */
.scroll-dots {
  position: fixed; right: 18px; top: 50%; transform: translateY(-50%); z-index: 90;
  display: flex; flex-direction: column; gap: 10px;
}
.scroll-dots button {
  position: relative; width: 14px; height: 14px; padding: 0;
  background: #fff; border: 2px solid var(--ink); border-radius: 50%; cursor: pointer;
  transition: background .2s, transform .2s;
}
.scroll-dots button:hover { transform: scale(1.2); }
.scroll-dots button.is-active { background: var(--orange); }
.scroll-dots svg { display: none; }
.dot-preview {
  position: absolute; right: 24px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; font-size: .8rem; font-weight: 800;
  background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 2px 10px;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.scroll-dots button:hover .dot-preview { opacity: 1; }

/* ── Full-page background video (e.g. DriverHub) ── */
body.has-bg-video { background: #0d0f0e; }
.proj-bg-video-wrap { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.proj-bg-video-wrap video { width: 100%; height: 100%; object-fit: cover; transform: scale(1.5); }
.proj-bg-video-wrap::after { content: ""; position: absolute; inset: 0; background: rgba(8, 14, 10, .6); }
body.has-bg-video .proj-hero-copy { color: #fff; }
body.has-bg-video .pill, body.has-bg-video .proj-stack li { color: var(--ink); }
body.has-bg-video .pill--archived { color: #6b675f; }
body.has-bg-video .proj-hero-role em { color: var(--yellow); }
body.has-bg-video .proj-metrics strong { color: var(--yellow); }

/* ── View transitions: horizontal slide (kept from original) ── */
@keyframes vt-slide-out-left { from { transform: translateX(0); } to { transform: translateX(-100vw); } }
@keyframes vt-slide-in-right { from { transform: translateX(100vw); } to { transform: translateX(0); } }
@keyframes vt-slide-out-right { from { transform: translateX(0); } to { transform: translateX(100vw); } }
@keyframes vt-slide-in-left { from { transform: translateX(-100vw); } to { transform: translateX(0); } }
::view-transition-old(root) { animation: vt-slide-out-left 430ms cubic-bezier(0.45, 0, 0.55, 1) both; }
::view-transition-new(root) { animation: vt-slide-in-right 430ms cubic-bezier(0.45, 0, 0.55, 1) both; }
html[data-astro-transition="back"] ::view-transition-old(root) { animation: vt-slide-out-right 430ms cubic-bezier(0.45, 0, 0.55, 1) both; }
html[data-astro-transition="back"] ::view-transition-new(root) { animation: vt-slide-in-left 430ms cubic-bezier(0.45, 0, 0.55, 1) both; }

@media (max-width: 900px) {
  .proj-hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .proj-hero-art { order: -1; justify-items: start; }
  .proj-icon { width: 160px; border-radius: 32px; box-shadow: 8px 8px 0 var(--ink); }
  .proj-icon--txt { font-size: 3.4rem; }
}
@media (max-width: 600px) {
  .proj-hero { padding-top: 90px; }
  .proj-metrics strong { font-size: 2.3rem; }
  .scroll-dots { display: none; }
  .panel-card td:first-child { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .01ms !important; }
  .chunky, .proj-back-nav, .scroll-dots button { transition: none; }
}
