/* ==========================================================================
   Mamun — Motion Design Portfolio
   Plain CSS, no build step. Edit tokens below to restyle the whole site.
   ========================================================================== */

:root {
  --bg: #f4f4f2;
  --fg: #111111;
  --muted: #77776f;
  --line: #dcdcd6;
  --tile: #e4e4df;
  --overlay: rgba(10, 10, 10, 0.55);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --gutter: 16px;          /* page side padding */
  --gap: 12px;             /* grid gap */
  --header-h: 64px;
  --maxw: 1800px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

@media (min-width: 640px) {
  :root { --gutter: 24px; --gap: 16px; }
}
@media (min-width: 1024px) {
  :root { --gutter: 40px; --gap: 20px; --header-h: 80px; }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img, video, iframe { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
}
.site-header .wrap {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.logo span { color: var(--muted); font-weight: 400; }
.nav { display: flex; gap: 20px; }
.nav a {
  color: var(--muted);
  transition: color 150ms ease;
}
.nav a:hover,
.nav a[aria-current="page"] { color: var(--fg); }

@media (max-width: 479px) {
  .logo span { display: none; }  /* hide tagline on tiny screens */
}

/* ---------- Work grid ---------- */
main { padding-bottom: 64px; }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}
@media (min-width: 640px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.tile { display: block; position: relative; }
.tile-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--tile);
}
.tile-media img,
.tile-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile-media video { opacity: 0; transition: opacity 250ms ease; }
.tile.is-playing .tile-media video { opacity: 1; }

/* Title overlay — shown on hover (desktop) */
.tile-info {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  color: #fff;
  background: linear-gradient(to top, var(--overlay), transparent 70%);
  opacity: 0;
  transition: opacity 250ms var(--ease-out);
}
.tile-title { font-weight: 600; font-size: 16px; line-height: 1.25; }
.tile-meta { font-size: 13px; opacity: 0.8; }

@media (hover: hover) and (pointer: fine) {
  .tile:hover .tile-info,
  .tile:focus-visible .tile-info { opacity: 1; }
}

/* Touch devices: no hover, so show the title under the thumbnail */
@media (hover: none), (pointer: coarse) {
  .tile-info {
    position: static;
    opacity: 1;
    color: var(--fg);
    background: none;
    padding: 8px 0 4px;
  }
  .tile-meta { color: var(--muted); opacity: 1; }
}

.tile:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

/* Showreel badge on the first tile */
.tile-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg);
  color: var(--fg);
}

/* ---------- Placeholder media (dummy content) ---------- */
.ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(0, 0, 0, 0.35);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ph-block { position: relative; background: var(--tile); }

/* ---------- Project page ---------- */
.project-head {
  padding: 24px 0 24px;
  display: grid;
  gap: 16px;
}
.project-head h1 {
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.player {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}
.player iframe,
.player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.project-body {
  display: grid;
  gap: 32px;
  padding: 40px 0;
}
@media (min-width: 900px) {
  .project-body { grid-template-columns: 1fr 2fr; gap: 64px; padding: 64px 0; }
}

.facts { display: grid; gap: 14px; align-content: start; }
.facts dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.facts dd { margin: 0; }

.description { font-size: 17px; line-height: 1.6; max-width: 62ch; }
.description p + p { margin-top: 1em; }

.section-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 16px;
  margin-bottom: 20px;
  border-top: 1px solid var(--line);
}

/* Breakdowns: full-width items, or pairs side by side */
.breakdowns { display: grid; gap: var(--gap); }
@media (min-width: 640px) {
  .breakdowns { grid-template-columns: repeat(2, 1fr); }
  .bd.full { grid-column: 1 / -1; }
}
.bd figure { margin: 0; }
.bd-media { position: relative; aspect-ratio: var(--ar, 16 / 9); overflow: hidden; background: var(--tile); }
.bd-media img,
.bd-media video,
.bd-media iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.bd figcaption { font-size: 13px; color: var(--muted); padding-top: 8px; }
.bd-text { font-size: 17px; max-width: 62ch; padding: 24px 0; }

.credits { margin-top: 64px; display: grid; gap: 6px; font-size: 14px; }
.credits li { display: flex; gap: 12px; }
.credits li span:first-child { color: var(--muted); min-width: 140px; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 32px 0 0;
  margin-top: 64px;
  border-top: 1px solid var(--line);
}
.pager a { display: grid; gap: 2px; max-width: 48%; }
.pager a:last-child { text-align: right; margin-left: auto; }
.pager small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.pager strong { font-weight: 600; }
.pager a:hover strong { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Play page ---------- */
.page-intro { padding: 8px 0 32px; color: var(--muted); max-width: 60ch; }


/* Row-major grid so the order in data.js is the order people see. */
.play-grid { display: grid; grid-template-columns: 1fr; gap: var(--gap); align-items: start; }
@media (min-width: 640px)  { .play-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .play-grid { grid-template-columns: repeat(4, 1fr); } }
.play-item .bd-media { aspect-ratio: var(--ar, 1); }
.play-item p { font-size: 13px; color: var(--muted); padding-top: 6px; }

/* ---------- About page ---------- */
.about {
  display: grid;
  gap: 40px;
  padding: 24px 0 0;
}
@media (min-width: 900px) {
  .about { grid-template-columns: 1fr 1.4fr; gap: 80px; padding-top: 48px; }
}
.portrait { position: relative; aspect-ratio: 2 / 3; background: var(--tile); overflow: hidden; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }

.bio { font-size: clamp(18px, 2vw, 22px); line-height: 1.5; letter-spacing: -0.01em; }
.bio p + p { margin-top: 1em; }

.about-cols { display: grid; gap: 32px; margin-top: 48px; }
@media (min-width: 640px) { .about-cols { grid-template-columns: 1fr 1fr; } }
.about-cols h2 { font-size: 12px; font-weight: 400; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; }
.about-cols li { padding: 2px 0; }
.about-cols a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.about-cols a:hover { text-decoration-color: currentColor; }

/* ---------- Footer ---------- */
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding-top: 24px;
  padding-bottom: 32px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.site-footer a:hover { color: var(--fg); }
.site-footer .links { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.player .ph { color: rgba(255, 255, 255, 0.4); }
@media (max-width: 899px) { .portrait { max-width: 420px; } }

/* Desktop: crop the portrait a little tighter (more off the top than the
   bottom) and keep it above the fold. */
@media (min-width: 900px) {
  .portrait {
    aspect-ratio: 4 / 5;
    max-height: calc(100svh - var(--header-h) - 120px);
    align-self: start;
    position: sticky;
    top: calc(var(--header-h) + 24px);
  }
  .portrait img { object-position: 50% 80%; }
}


/* Play page loops: still first, video fades in once it's playing. */
.play-item .bd-media video[data-src] { opacity: 0; transition: opacity 250ms ease; }
.play-item.is-playing .bd-media video[data-src] { opacity: 1; }

/* ---------- Contact dropdown ---------- */
:root {
  --panel: #fbfbfa;
  --hover: rgba(17, 17, 17, 0.05);
}
.nav { align-items: center; }
@media (max-width: 479px) { .nav { gap: 14px; } }

.contact { position: relative; }
.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px 6px 14px;
  font: inherit;
  color: var(--bg);
  background: var(--fg);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 160ms var(--ease-out);
}
.contact-btn:active { transform: scale(0.97); }
.contact-btn:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.contact-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 260ms var(--ease-out);
}
.contact[data-open="true"] .contact-btn svg { transform: rotate(180deg); }

/* The menu wrapper's top padding is an invisible hover bridge to the panel. */
.contact-menu {
  position: absolute;
  top: 100%;
  right: 0;
  padding-top: 10px;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear 160ms;
}
.contact[data-open="true"] .contact-menu {
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.contact-panel {
  width: 300px;
  max-width: calc(100vw - 2 * var(--gutter));
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 16px 40px -12px rgba(0, 0, 0, 0.22);
  transform-origin: top right;
  opacity: 0;
  transform: translateY(-6px) scale(0.96);
  /* closing: quick and quiet */
  transition: opacity 140ms ease, transform 160ms ease;
}
.contact[data-open="true"] .contact-panel {
  opacity: 1;
  transform: none;
  /* opening: fast start, soft landing */
  transition: opacity 180ms var(--ease-out), transform 320ms var(--ease-out);
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  font: inherit;
  text-align: left;
  color: var(--fg);
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-4px);
  transition: background-color 150ms ease, opacity 120ms ease, transform 120ms ease;
}
.contact[data-open="true"] .contact-item {
  opacity: 1;
  transform: none;
  transition: background-color 150ms ease, opacity 220ms var(--ease-out), transform 320ms var(--ease-out);
}
.contact[data-open="true"] .contact-item:nth-child(1) { transition-delay: 0s, 40ms, 40ms; }
.contact[data-open="true"] .contact-item:nth-child(2) { transition-delay: 0s, 80ms, 80ms; }
.contact-item:hover,
.contact-item:focus-visible { background: var(--hover); outline: none; }
.contact-item:active .ci-icon { transform: scale(0.94); }

.ci-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--line);
  transition: transform 160ms var(--ease-out);
}
.ci-icon svg { width: 18px; height: 18px; }
.ci-text { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.ci-label { font-weight: 600; font-size: 14px; position: relative; }
.ci-value { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ci-action {
  flex: none;
  position: relative;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: color 150ms ease, transform 200ms var(--ease-out);
}
.ci-action svg { width: 18px; height: 18px; display: block; }
.contact-item:hover .ci-action { color: var(--fg); }
a.contact-item:hover .ci-action { transform: translate(2px, -2px); }

/* Copy → check swap */
.ci-copy, .ci-check { position: absolute; inset: 0; transition: opacity 160ms ease, transform 260ms var(--ease-out); }
.ci-check { opacity: 0; transform: scale(0.5); color: #1a7f37; }
.is-copied .ci-copy { opacity: 0; transform: scale(0.5); }
.is-copied .ci-check { opacity: 1; transform: none; }

.ci-l1, .ci-l2 { transition: opacity 160ms ease, transform 220ms var(--ease-out); }
.ci-l2 { position: absolute; left: 0; top: 0; opacity: 0; transform: translateY(4px); color: #1a7f37; }
.is-copied .ci-l1 { opacity: 0; transform: translateY(-4px); }
.is-copied .ci-l2 { opacity: 1; transform: none; }

/* ---------- Footer social icons ---------- */
.site-footer .social { gap: 6px; align-items: center; }
.site-footer .social a {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--muted);
  transition: color 150ms ease, background-color 150ms ease, transform 160ms var(--ease-out);
}
.site-footer .social a:hover { color: var(--fg); background: var(--hover); }
.site-footer .social a:active { transform: scale(0.94); }
.site-footer .social svg { width: 17px; height: 17px; }
.site-footer .wrap { align-items: center; }
/* Very small phones (e.g. 320px): keep the header on one line. */
@media (max-width: 359px) {
  .nav { gap: 10px; font-size: 14px; }
  .contact-btn { padding: 5px 11px; }
  .contact-btn svg { display: none; }
}

/* Space between page content and the footer (".wrap" was overriding main's
   padding-bottom, leaving the last row sitting on the footer line). */
main.wrap { padding-bottom: 48px; }
@media (min-width: 1024px) { main.wrap { padding-bottom: 56px; } }

/* Footer divider spans the content width only, aligned with the grid. */
.site-footer .wrap {
  border-top: 0;
  background: linear-gradient(var(--line), var(--line)) center top / calc(100% - 2 * var(--gutter)) 1px no-repeat;
}

/* Featured Play pieces (Vimeo, with sound): normal grid tiles; black behind
   the player so the letterbox padding matches the dark loops. */
.play-item--feature .bd-media { background: #000; }

/* ---------- Hobby hover cards (About bio) ---------- */
.hobby { position: relative; display: inline-block; }
.hobby-link {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  transition: text-decoration-color 150ms ease;
  cursor: pointer;
}
.hobby-link:hover,
.hobby.is-open .hobby-link { text-decoration-color: currentColor; }
.hobby-link:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 2px; }

.peek {
  --dx: 0px;
  --tilt: -2deg;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  z-index: 20;
  display: block;
  width: 252px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: 0;
  text-align: left;
  color: var(--fg);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 18px 44px -14px rgba(0, 0, 0, 0.28);
  transform-origin: 50% 100%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(calc(-50% + var(--dx)), 8px) rotate(0deg) scale(0.92);
  /* closing: quick, no bounce */
  transition: opacity 140ms ease, transform 180ms ease, visibility 0s linear 180ms;
}
.peek--photowalks { --tilt: 1.75deg; }
.peek--running { --tilt: -1.25deg; }
.hobby.is-open .peek {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(calc(-50% + var(--dx)), 0) rotate(var(--tilt)) scale(1);
  /* opening: springy, like a card slid out of a pocket */
  transition: opacity 160ms ease-out, transform 460ms cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0s;
}
/* No room above the word: open below it. */
.hobby.peek-below .peek { bottom: auto; top: calc(100% + 12px); transform-origin: 50% 0; }
.hobby.peek-below:not(.is-open) .peek { transform: translate(calc(-50% + var(--dx)), -8px) scale(0.92); }
/* Invisible bridge so the pointer can travel from the word into the card. */
.peek::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 14px; }
.hobby.peek-below .peek::after { top: auto; bottom: 100%; }

.peek-body { display: grid; gap: 1px; min-width: 0; }
.peek-kicker { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.peek-title { font-weight: 600; font-size: 15px; }
.peek-meta { font-size: 13px; }
.peek-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
}
.peek-arrow { display: inline-flex; width: 16px; height: 16px; transition: transform 200ms var(--ease-out); }
.peek-arrow svg { width: 16px; height: 16px; }
.peek:hover .peek-arrow,
.peek-foot:hover .peek-arrow { transform: translate(2px, -2px); }
a.peek { color: var(--fg); text-decoration: none; cursor: pointer; }

/* Reading: a little fan of book covers */
.peek-covers { position: relative; display: block; height: 118px; margin-bottom: 12px; }
.peek-covers img {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 74px;
  height: 112px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%) rotate(0deg);
  transition: transform 200ms ease;
}
.peek-covers img:nth-child(1) { z-index: 3; }
.peek-covers img:nth-child(2) { z-index: 2; }
.peek-covers img:nth-child(3) { z-index: 1; }
.hobby.is-open .peek-covers img { transition: transform 520ms cubic-bezier(0.34, 1.56, 0.64, 1) 70ms; }
.hobby.is-open .peek-covers img:nth-child(2) { transform: translateX(calc(-50% - 52px)) rotate(-9deg); }
.hobby.is-open .peek-covers img:nth-child(3) { transform: translateX(calc(-50% + 52px)) rotate(9deg); }

/* Photowalks: two rows of photos at their original shapes; each row's height
   is set in main.js so the photos fill the card's width exactly. */
.peek--photowalks:has(.peek-grid) { width: min(320px, calc(100vw - 24px)); }
.peek-grid { display: flex; flex-direction: column; gap: 4px; }
.peek-grid-row { display: flex; justify-content: center; gap: 4px; }
.peek-grid img {
  display: block;
  flex: none;
  object-fit: cover;
  border-radius: 4px;
  background: var(--tile);
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 120ms ease, transform 120ms ease;
}
.hobby.is-open .peek-grid img {
  opacity: 1;
  transform: none;
  transition: opacity 260ms ease-out calc(60ms + var(--i) * 35ms), transform 420ms var(--ease-out) calc(60ms + var(--i) * 35ms);
}

/* Instagram / Strava link cards */
.peek-row { display: flex; align-items: center; gap: 12px; }
.peek-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(45deg, #f9ce34, #ee2a7b 50%, #6228d7);
}
.peek-badge svg { width: 22px; height: 22px; }
.peek-badge--strava { background: #fc4c02; }
/* Running: profile picture with a small Strava badge */
.peek-avatar-wrap { position: relative; flex: none; width: 52px; height: 52px; }
.peek-avatar { display: block; width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: var(--tile); }
.peek-avatar-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  background: #fc4c02;
  border: 2px solid var(--panel);
}
.peek-avatar-badge svg { width: 11px; height: 11px; }
