/* Jervil Angelo De Leon, portfolio. Shared by index.html and the case study pages. */

:root {
  --bg: #1c1c1c;
  --surface: #262626;
  --surface-2: #303030;
  --ink: #f1f1ef;
  --muted: #a3a49f;
  --accent: #8fa68e;
  --accent-strong: #a9bfa8;
  --accent-ink: #1c1c1c;
  --field: #c8c5ba;
  --field-ink: #1c1c1c;
  --field-muted: #4a4943;

  --strip-1: #c8c5ba;
  --strip-2: #8fa68e;
  --strip-3: #3a3a37;
  --strip-4: #e4e1d8;

  --font: "Clash Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem);
  --step-display: clamp(2.75rem, 1.2rem + 6vw, 7rem);

  --margin: 20px;
  --gap: 12px;
  --section: clamp(96px, 6rem + 5vw, 176px);
  --nav-h: 64px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
  --t-press: 140ms;
  --t-hover: 180ms;
  --t-ui: 240ms;
  --t-reveal: 800ms;
}

@media (max-width: 640px) {
  :root { --margin: 16px; --nav-h: 56px; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-body);
  font-weight: 400;
  line-height: 1.5;
  overflow-x: clip;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; line-height: 1; letter-spacing: -0.03em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
a { color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }

.skip {
  position: absolute; left: var(--margin); top: -100px; z-index: 100;
  background: var(--field); color: var(--field-ink); padding: 12px 16px; text-decoration: none;
}
.skip:focus { top: 12px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- shared pieces ---------- */
.frame { padding-inline: var(--margin); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); }
.section { padding-top: var(--section); }
.muted { color: var(--muted); }
.small { font-size: var(--step-small); }
.lead { font-size: var(--step-lead); line-height: 1.3; letter-spacing: -0.01em; }
.h2 { font-size: var(--step-head); }
.h3 { font-size: var(--step-lead); letter-spacing: -0.015em; line-height: 1.15; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  font: 500 var(--step-body)/1 var(--font);
  text-decoration: none; cursor: pointer; border: 0; border-radius: 0;
  background: var(--accent); color: var(--accent-ink);
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease;
}
.btn:active { transform: scale(0.97); }
.btn--ink { background: var(--ink); color: var(--bg); }
.btn--dark { background: var(--bg); color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--accent-strong); }
  .btn--ink:hover { background: #ffffff; }
  .btn--dark:hover { background: #333331; }
}
.btn--quiet { background: var(--surface-2); color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .btn--quiet:hover { background: #3c3c3a; } }
.btn .arrow { transition: transform var(--t-ui) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .btn:hover .arrow { transform: translateX(3px); } }

.link {
  text-decoration: underline;
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  transition: text-decoration-color var(--t-hover) ease, color var(--t-hover) ease;
}
@media (hover: hover) and (pointer: fine) {
  .link:hover { text-decoration-color: currentColor; color: var(--accent-strong); }
}
.ext::after { content: "\2009\2197"; }

code { font-family: inherit; font-size: inherit; font-weight: 500; background: var(--surface-2); padding: 0 5px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.tags li {
  font-size: var(--step-small); line-height: 1; padding: 8px 10px;
  background: var(--surface-2); color: var(--ink);
}

/* ---------- progress + navigation ---------- */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 60;
  background: var(--accent); transform-origin: 0 50%; transform: scaleX(0);
}
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h); background: var(--bg);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding-inline: var(--margin);
}
.wordmark {
  font-size: var(--step-body); font-weight: 500; letter-spacing: -0.01em;
  text-decoration: none; white-space: nowrap;
}
.nav-links { display: flex; align-items: center; gap: 28px; list-style: none; }
.nav-links a {
  font-size: var(--step-small); text-decoration: none; color: var(--ink);
  padding-block: 8px; position: relative;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform var(--t-ui) var(--ease-out);
}
.nav-links a[aria-current]::after { transform: scaleX(1); }
.nav .btn[aria-current] { background: var(--ink); color: var(--bg); }
@media (hover: hover) and (pointer: fine) { .nav-links a:hover::after { transform: scaleX(1); } }
.nav .btn { min-height: 40px; padding: 0 16px; font-size: var(--step-small); }
.nav-right { display: flex; align-items: center; gap: 28px; }
.menu-toggle {
  display: none; min-height: 44px; padding: 0 14px; border: 0; cursor: pointer;
  background: var(--surface-2); color: var(--ink); font: 500 var(--step-small)/1 var(--font);
}

@media (max-width: 900px) {
  .nav { gap: 12px; }
  .js .menu-toggle { display: inline-flex; align-items: center; }
  .js .nav-links {
    position: fixed; inset: var(--nav-h) 0 auto 0; z-index: 49;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); padding: 8px var(--margin) 24px;
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity var(--t-ui) var(--ease-out), transform var(--t-ui) var(--ease-out), visibility 0s linear var(--t-ui);
    box-shadow: 0 24px 40px rgba(0, 0, 0, 0.45); /* taste-skill-ignore: open dropdown menu is a real overlay */
  }
  .js .nav.is-open .nav-links {
    visibility: visible; opacity: 1; transform: none;
    transition: opacity var(--t-ui) var(--ease-out), transform var(--t-ui) var(--ease-out);
  }
  .js .nav-links a { display: block; font-size: var(--step-lead); padding: 14px 0; }
  .js .nav-links a::after { display: none; }
  html:not(.js) .nav { flex-wrap: wrap; height: auto; padding-block: 12px; }
  html:not(.js) .nav-links { gap: 16px; flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .nav .btn { padding: 0 12px; }
}

/* ---------- reveal motion (content stays visible without script) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] > * {
    opacity: 0; transform: translateY(24px);
    transition: opacity var(--t-reveal) var(--ease-out), transform var(--t-reveal) var(--ease-expo);
    transition-delay: calc(var(--i, 0) * 75ms);
  }
  .js [data-reveal].is-in > * { opacity: 1; transform: none; }

  .js .shutter { clip-path: inset(0 0 100% 0); transition: clip-path 1100ms var(--ease-in-out); }
  .js .shutter > img, .js .shutter > video { transform: scale(1.12); transition: transform 1500ms var(--ease-soft); }
  .js .shutter.is-in { clip-path: inset(0); }
  .js .shutter.is-in > img, .js .shutter.is-in > video { transform: none; }
}

/* ---------- footer: one quiet line ---------- */
.foot {
  margin-top: max(30svh, 200px);
  padding: 0 var(--margin) 30px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 24px;
  font-size: var(--step-small);
}
.foot .foot-links { display: flex; gap: 24px; list-style: none; flex-wrap: wrap; justify-content: center; }
.foot .foot-links a { color: var(--ink); }
.foot > :last-child { justify-self: end; }
@media (max-width: 720px) {
  .foot { margin-top: 20svh; grid-template-columns: 1fr; gap: 8px; padding-bottom: 24px; }
  .foot .foot-links { justify-content: flex-start; }
  .foot > :last-child { justify-self: start; }
}

/* ---------- shared: a scrollable run of frames ---------- */
.run {
  display: flex; align-items: flex-end; gap: 8px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent;
  padding-bottom: 14px;
}
.run figure { margin: 0; flex: none; scroll-snap-align: start; }
.run img, .run video { height: var(--run-h, 30vh); width: auto; max-width: none; object-fit: cover; background: var(--surface); }
.run figure.lifted img, .run figure.lifted video { height: var(--lift-h, 56vh); }
.run figcaption {
  display: flex; justify-content: space-between; gap: 16px; padding-top: 10px;
  font-size: var(--step-small);
}
.run figcaption span:last-child { color: var(--muted); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--step-body); }
.table th { text-align: left; font-weight: 500; font-size: var(--step-small); color: var(--muted); padding: 0 16px 12px; }
.table td { padding: 14px 16px; vertical-align: top; }
.table tbody tr:nth-child(odd) td { background: var(--surface); }
.table td:first-child, .table th:first-child { padding-left: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
