/* =========================================================
   Portfolio — global styles
   Breakpoints:  mobile  < 640px
                 tablet  640px – 1023px
                 desktop ≥ 1024px
   ========================================================= */

:root {
  --bg: #0a0a0a;
  --bg-elev: #141414;
  --fg: #ededed;
  --fg-muted: #9a9a9a;
  --line: #262626;
  --accent: #ffffff;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --container: 1200px;
  --container-narrow: 720px;
  --gutter: clamp(16px, 4vw, 40px);
  --section-gap: clamp(56px, 10vw, 128px);

  /* hand-drawn cursors (hotspot = leaf tip / fingertip), embedded as data URIs so they're
     available the moment the stylesheet is parsed — a separate image request would show the
     system cursor for a moment on every page change. Sources: leaf_cursor_01.png (90% opacity, 22x32),
     hand_cursor_01.png (inverted, 80% opacity, 29x40) downscaled with ffmpeg lanczos, then base64. */
  --cursor-arrow: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAgCAYAAAAWl4iLAAAACXBIWXMAAA4oAAAOZQA0tmjcAAAFaUlEQVR4nK1WfUiVdxS+15ta4vf8ZM4wRXGxQMVW/qGZOHAq9ofTaAmKjWD/6D/OStxi+JFBIobiBypKTdExV6KwErSQFCFTUXOoW/ree0jFym9Ly53n8L7u1lysmvDz/u57399znvOc55z31a2trWU+f/48cnt7W8fLUv384KVbXl6uXlhYGN7a2nJVLxp47eGl/1DgUgamlZWVfr5wZHNzU/fq1SvtBgSweC/gubm5a0NDQ3T//n0aHBwkvtjC6yvOwPLly5fajfp3zUL3+PHjjlOnTgF4xtfX13T69Gm6d+8eMXAv3/Adr0/fJwsdy9BjY2NDNTU1xvr6etLpdIqVlZVy/Phxqq6upqmpKWTRwSudg31klsVbM9ARUZ+TkxPp9XojtI6NjQU4paenG/lzxsHBgRITE6m9vR11GOVDP3AGrmYZGHYFVhSl38fHh/bu3WuMi4sjgAO4pKSEwsLCZG8wGCRIcHAwNTQ0ENtzhA9/wwH0Zuz/IUWvm5sb5eXlGU+ePEnl5e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GSqbWCD+kFbwk0S0qpWlpaXMqPactSRtU1MTSVvB930aKGfrjcE1iH0U+yliia1Il6ysLAJNs3WgL2Wo7U1ycjIzbA4q/EkFBgsNgRpWhCj912nQ5VRVVdVHMnOWCg7AaG9HaV1WCkpDx4HXYYvT0dXVxYCpcdMebeR3XFa7lJZ0qUPPf/UZMJqHqCcmqcWvvZcvX8r+/v6AgIli/WqA0rDnORyJadF38uRJ8etuGDtIys0/HR0dhbSr978LiTNGRl/iZ+OWLVtYt0EnEr6MqEKrxnIBMPvzr+9CcP7k5uZ2Cu9d+feM5T8ONrF1asg6lwAAAABJRU5ErkJggg==") 1 1, pointer;
}

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

html {
  cursor: var(--cursor-arrow);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  line-height: 1.6;
}

img, video { display: block; max-width: 100%; }

a, button, [role="button"] { cursor: var(--cursor-hand); }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.2em; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: var(--container-narrow); }

/* =========================================================
   1. Entry page
   ========================================================= */

body.entry {
  background: #000;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
/* hide scrollbar — the page scrolls, but nothing should show */
body.entry { scrollbar-width: none; }
body.entry::-webkit-scrollbar { display: none; }

.scrub-track {
  /* scroll distance available for scrubbing */
  height: 500vh;
  height: 500svh;
}

/* touch devices: no scroll scrub — the animation autoplays instead (see js/site.js) */
@media (hover: none) and (pointer: coarse) {
  .scrub-track {
    height: 100vh;
    height: 100svh;
  }
}

.scrub-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  width: 100%;
  overflow: hidden;
  background: #000;
  outline: none;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.scrub-stage.is-ready { opacity: 1; }

.scrub-video {
  /* whole frame shown, fitted inside a centred box half the viewport size */
  position: absolute;
  top: 25%;
  left: 25%;
  width: 50%;
  height: 50%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
}

/* part 1 (scrub) on top by default; part 2 (loop) revealed while idle */
.scrub-video--intro { z-index: 2; }
.scrub-video--loop  { z-index: 1; }
.scrub-stage.is-idle .scrub-video--intro { visibility: hidden; }

/* small screens: the half-size box is too small — let the animation fill the viewport */
@media (max-width: 639px) {
  .scrub-video {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}

body.entry.is-leaving .scrub-stage {
  opacity: 0;
  transition: opacity 0.35s ease;
}

@media (prefers-reduced-motion: reduce) {
  .scrub-stage { transition: none; }
}

/* view transitions entry ⇄ cv (same document; body class is swapped by js/site.js) */
body.cv {
  opacity: 1;
  animation: cv-fade-in 0.5s ease;
  transition: opacity 0.35s ease;
}
body.cv.is-leaving { opacity: 0; }
@keyframes cv-fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  body.cv { animation: none; transition: none; }
}

/* =========================================================
   2. CV page
   ========================================================= */

/* --- hero / portrait --- */
.hero {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding-block: clamp(1.5rem, 5vh, 4rem);
  background: #000;
}

.hero-video {
  /* portrait at 30% of the page width, whole frame visible (no cropping) */
  width: 30%;
  min-width: 180px;
  max-width: 100%;
  height: auto;
  max-height: 70svh;
  object-fit: contain;
  display: block;
}

/* --- intro --- */
.intro {
  padding-block: var(--section-gap);
}

.intro-name {
  margin: 0 0 0.25em;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.intro-role {
  margin: 0 0 2rem;
  color: var(--fg-muted);
  font-size: clamp(1rem, 1.8vw, 1.25rem);
}

.intro-text {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  line-height: 1.7;
}
.intro-text p { margin: 0 0 1.2em; }

.intro-heading,
.section-heading {
  margin: 2.5rem 0 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.skills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.skills li {
  padding: 0.4em 0.9em;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.95rem;
  color: var(--fg);
  background: var(--bg-elev);
}

/* --- showcase --- */
.showcase {
  padding-block: 0 var(--section-gap);
}
.showcase .section-heading { margin-top: 0; margin-bottom: 1.5rem; }
.showcase-more {
  margin: 2rem 0 0;
  text-align: center;
  font-size: 1.05rem;
}
.showcase-more a {
  display: inline-block;
  padding: 0.55em 1.2em;
  border: 1px solid var(--fg-muted);
  border-radius: 999px;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease;
}
.showcase-more a:hover { background: var(--fg); color: var(--bg); text-decoration: none; }

.grid {
  display: grid;
  grid-template-columns: 1fr;           /* mobile: single column, tablet+: 2 × 2 */
  gap: clamp(20px, 3vw, 36px);
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #000;
  overflow: hidden;
}
/* aspect-ratio fallback for older browsers */
@supports not (aspect-ratio: 1) {
  .card-media { height: 0; padding-bottom: 62.5%; }
  .card-media > * { position: absolute; inset: 0; }
}

.card-video,
.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.card-image--contain { object-fit: contain; }

.card-body {
  padding: 1rem 1.1rem 1.25rem;
}

.card-tag {
  margin: 0 0 0.4em;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.card-title {
  margin: 0 0 0.35em;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-text {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* --- expand button over card media --- */
.card-expand {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: var(--cursor-hand);
  -webkit-tap-highlight-color: transparent;
}
.card-expand::before {
  /* play glyph, shown on hover / focus */
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'><path d='M8 5v14l11-7z'/></svg>") center / 26px no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.35);
  opacity: 0;
  transition: opacity 0.2s ease;
}
/* images get a zoom glyph instead of play */
.card-expand--image::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/></svg>");
  background-size: 22px;
}
.card:hover .card-expand::before,
.card-expand:focus-visible::before { opacity: 1; }
@media (hover: none) {
  .card-expand::before { opacity: 0.85; }   /* no hover on touch — keep the hint visible */
}

/* --- lightbox --- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 32px);
  background: rgba(0, 0, 0, 0.92);
  animation: cv-fade-in 0.25s ease;
}
.lightbox[hidden],
.lightbox-video[hidden],
.lightbox-image[hidden] { display: none; }   /* explicit display above would otherwise override the hidden attribute */
.lightbox-video,
.lightbox-image {
  /* original ratio, whole frame visible, as large as the viewport allows */
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  max-height: calc(100svh - 2 * clamp(12px, 3vw, 32px));
  object-fit: contain;
  background: #000;
  outline: none;
}
.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
  font-size: 28px;
  line-height: 1;
  cursor: var(--cursor-hand);
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }
body.lightbox-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .lightbox { animation: none; }
}

/* =========================================================
   3. Footer
   ========================================================= */

.footer {
  border-top: 1px solid var(--line);
  padding-block: clamp(32px, 5vw, 56px);
  font-size: 0.95rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;       /* mobile: stacked */
  gap: 1.75rem;
}

.footer-name {
  margin: 0 0 0.5em;
  font-weight: 600;
  color: var(--fg);
}
.footer-line {
  margin: 0 0 0.5em;
  color: var(--fg-muted);
  line-height: 1.5;
}
.footer-line a { color: var(--fg-muted); }

/* deer, purely decorative, centred between the two columns */
.footer-logo {
  display: flex;
  justify-content: center;
  align-self: center;
}
.footer-logo img {
  width: 96px;
  height: auto;
  /* dark ink on transparent — invert to light for the dark background */
  filter: invert(1) brightness(0.92);
  opacity: 0.85;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}
.footer-links a {
  display: inline-block;
  padding-block: 0.25em;        /* comfortable tap target */
  color: var(--fg);
}
.footer-links a.is-copied {
  color: var(--fg-muted);
  text-decoration: none;
}

/* =========================================================
   Breakpoints
   ========================================================= */

/* phone: deer sits beside the address, links form a centered row underneath */
@media (max-width: 639px) {
  .footer-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "contact logo"
      "links   links";
    align-items: center;
    column-gap: 1.25rem;
    row-gap: 1.5rem;
  }
  .footer-logo { grid-area: logo; justify-content: flex-end; }
  .footer-contact { grid-area: contact; }
  .footer-links { grid-area: links; justify-content: center; text-align: center; }
}

/* tablet */
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(4, 1fr); }   /* 4 tracks: cards span 2, so an odd last card can sit centred */
  .card { grid-column: span 2; }
  .card:last-child:nth-child(odd) { grid-column: 2 / span 2; }

  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
  /* equal-width side columns keep the logo in the exact middle */
  .footer-contact,
  .footer-links { flex: 1 1 0; }
  .footer-logo { margin-top: -1.5rem; }   /* sit a little higher than the side columns */
  .footer-links { flex-direction: column; gap: 0.5rem; text-align: right; }
}

/* short landscape phones: keep the portrait from eating the whole screen */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-video { max-height: 80svh; }
}
