/* ────────────────────────────────────────────────────────────────
   Ayush — personal portfolio
   Minimal editorial layout: fixed left text column, centered
   vertical media strip, clock top right, dark mode bottom left.
   ──────────────────────────────────────────────────────────────── */

/* ── Theme tokens ── */
:root {
  --bg: #ffffff;
  --fg: #27272a;
  --muted: #9f9f9f;
  --link: #9f9f9f;
  --rule: #e6e6e6;
  --home-intro-width: 540px;
  --home-grid-width: 640px;
  --media-radius: 18px;
  --media-corner-smoothing: 0.8;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --theme-wipe-x: 100vw;
  --theme-wipe-y: 0px;
  --theme-wipe-radius: 1600px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

html.dark {
  --bg: #0a0a0a;
  --fg: #f1f1f1;
  --muted: #9f9f9f;
  --link: #9f9f9f;
  --rule: #262626;
}

@property --theme-wipe-current-radius {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 480ms;
  animation-timing-function: var(--ease-out);
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  animation-name: theme-wipe-still;
}

::view-transition-new(root) {
  animation-name: theme-wipe-reveal;
  -webkit-mask-image: radial-gradient(
    circle at var(--theme-wipe-x) var(--theme-wipe-y),
    #000 0 var(--theme-wipe-current-radius),
    rgba(0, 0, 0, 0.72) calc(var(--theme-wipe-current-radius) + 36px),
    rgba(0, 0, 0, 0.32) calc(var(--theme-wipe-current-radius) + 82px),
    transparent calc(var(--theme-wipe-current-radius) + 128px)
  );
  mask-image: radial-gradient(
    circle at var(--theme-wipe-x) var(--theme-wipe-y),
    #000 0 var(--theme-wipe-current-radius),
    rgba(0, 0, 0, 0.72) calc(var(--theme-wipe-current-radius) + 36px),
    rgba(0, 0, 0, 0.32) calc(var(--theme-wipe-current-radius) + 82px),
    transparent calc(var(--theme-wipe-current-radius) + 128px)
  );
}

@keyframes theme-wipe-still {
  from,
  to {
    opacity: 1;
  }
}

@keyframes theme-wipe-reveal {
  from {
    --theme-wipe-current-radius: 0px;
  }
  to {
    --theme-wipe-current-radius: var(--theme-wipe-radius);
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 1ms;
  }
}

html.theme-wipe-active *,
html.theme-wipe-active *::before,
html.theme-wipe-active *::after {
  transition: none !important;
}

/* ── Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  padding: 48px 24px 40px;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 21px;
  text-transform: lowercase;
  color: var(--fg);
  background: var(--bg);
  transition: background-color 200ms ease, color 200ms ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  animation: page-fade 180ms var(--ease-out) both;
}

@keyframes page-fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    /* `none` — not translateY(0). A transform on body makes
       position:fixed descendants (cursor label, nav) track the
       body instead of the viewport, so they drift on scroll. */
    transform: none;
  }
}

/* Instant feedback while the next page is fetching (esp. mobile). */
html.is-navigating body {
  opacity: 0.7;
  transition: opacity 120ms var(--ease-out);
  pointer-events: none;
}

html.is-navigating::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10000;
  width: 100%;
  height: 2px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: left center;
  animation: nav-progress 900ms var(--ease-out) forwards;
}

@keyframes nav-progress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(0.82);
  }
}

.page-boot-pulse {
  width: 100%;
  max-width: 540px;
  margin: 48px auto 0;
  height: 2px;
  background: color-mix(in srgb, var(--fg) 18%, transparent);
  overflow: hidden;
  border-radius: 1px;
}

.page-boot-pulse::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  background: var(--fg);
  transform-origin: left center;
  animation: boot-pulse 700ms var(--ease-in-out) infinite alternate;
}

@keyframes boot-pulse {
  from {
    transform: translateX(0) scaleX(0.55);
  }
  to {
    transform: translateX(150%) scaleX(1);
  }
}

/* ── Links ── */
/* Underlined in-content links (bio, project list, socials) */
.text-link {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color 150ms ease;
}
.text-link:hover {
  color: var(--fg);
}

/* Animated pink → blue text gradient (Berger Behance CTA) */
.text-link--gradient {
  color: transparent;
  background-image: linear-gradient(
    105deg,
    #ff6bb5 0%,
    #7aa7ff 40%,
    #ff6bb5 70%,
    #5ec8ff 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  text-decoration-color: color-mix(in srgb, #ff6bb5 55%, #7aa7ff);
  animation: text-link-gradient 5s var(--ease-in-out) infinite;
}

.text-link--gradient:hover {
  color: transparent;
  text-decoration-color: color-mix(in srgb, #ff6bb5 75%, #7aa7ff);
}

@keyframes text-link-gradient {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .text-link--gradient {
    animation: none;
    background-position: 40% 50%;
  }
}

/* Small chrome controls (clock nav, dark mode toggle, pager) */
.chrome-link {
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  transition: color 150ms ease;
}
.chrome-link:hover {
  color: var(--muted);
}

.text-link:focus-visible,
.chrome-link:focus-visible {
  outline: 1px solid var(--fg);
  outline-offset: 2px;
}

.clock {
  min-height: 21px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── Left text column ── */
.left-col {
  max-width: 400px;
  margin-bottom: 56px;
}
.left-col p {
  margin: 0;
}
.left-col > * + * {
  margin-top: var(--space-2);
}

.left-col p + p {
  margin-top: var(--space-1);
}

.muted {
  color: var(--muted);
}

.project-list {
  list-style: none;
  margin: var(--space-2) 0 0;
  padding: 0;
}
.project-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  transition: opacity 180ms ease;
}
.project-list li + li {
  margin-top: var(--space-1);
}

.project-list:hover li,
.project-list:focus-within li {
  opacity: 0.38;
}

.project-list li:hover,
.project-list li:focus-within {
  opacity: 1;
}
.project-list-title {
  min-width: 0;
}
.project-list-year {
  flex: 0 0 auto;
  text-align: right;
}

.signature {
  padding-top: var(--space-1);
}

/* First line of every page: lead text left, small controls right */
.intro-lead-row,
.project-chrome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.chrome-row-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Back / home nav: a row above the title on mobile; pinned to the page
   gutters beside the content column on wider screens. */
.project-page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: min(var(--home-intro-width), 100%);
  margin: 0 auto var(--space-3);
}

@media (min-width: 768px) {
  .project-page-nav {
    display: contents; /* children pin to the viewport; no row in the flow */
  }

  .project-nav-back,
  .project-nav-home {
    position: fixed;
    top: 48px; /* in line with the project title */
    z-index: 40;
  }

  .project-nav-back {
    left: max(24px, calc(50vw - 475px)); /* tracks the content column, clamped at small sizes */
  }

  .project-nav-home {
    right: max(24px, calc(50vw - 475px));
  }
}

.home-intro .intro-lead {
  color: var(--muted);
}

.home-intro .intro-lead-row + p {
  margin-top: var(--space-1); /* heading → copy: same 8px as the overview groups */
}

.home-intro .intro-links {
  margin-top: var(--space-2);
}

.home-page .intro-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.intro-contact {
  color: var(--fg);
}

.copy-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin: 0 2px;
  vertical-align: -2px;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: color 150ms ease;
}

.copy-button:hover,
.copy-button:has(:hover),
.copy-button:focus-visible,
.copy-button[data-state="copied"] {
  color: var(--fg);
}

.copy-button-icon {
  position: absolute;
  inset: 0;
  width: 14px;
  height: 14px;
  transition: opacity 150ms ease, transform 150ms ease;
}

.copy-button-icon--check,
.copy-button[data-state="copied"] .copy-button-icon--copy {
  opacity: 0;
  transform: scale(0.95);
}

.copy-button[data-state="copied"] .copy-button-icon--check {
  opacity: 1;
  transform: scale(1);
}

.home-intro .intro-links .text-link,
.home-intro .project-list .text-link,
.home-intro .intro-contact .text-link {
  color: var(--fg);
  text-decoration: none;
}

.home-intro .project-list .text-link,
.home-intro .intro-links .text-link,
.home-intro .intro-contact .text-link {
  position: relative;
  display: inline-block;
  transition: color 150ms ease;
}

.home-intro .project-list .text-link::after,
.home-intro .intro-links .text-link::after,
.home-intro .intro-contact .text-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.home-intro .project-list .text-link:hover,
.home-intro .project-list .text-link:focus-visible,
.home-intro .intro-links .text-link:hover,
.home-intro .intro-links .text-link:focus-visible,
.home-intro .intro-contact .text-link:hover,
.home-intro .intro-contact .text-link:focus-visible {
  color: var(--fg);
}

.home-intro .project-list .text-link:hover::after,
.home-intro .project-list .text-link:focus-visible::after,
.home-intro .intro-links .text-link:hover::after,
.home-intro .intro-links .text-link:focus-visible::after,
.home-intro .intro-contact .text-link:hover::after,
.home-intro .intro-contact .text-link:focus-visible::after {
  transform: scaleX(1);
}

.home-intro .intro-kicker {
  margin-top: var(--space-3);
}

.home-intro .project-index-label {
  padding-top: var(--space-1);
  border-top: 1px solid var(--rule);
  color: var(--muted);
}

.home-page .project-list {
  margin-top: var(--space-1); /* "projects" heading → list: same 8px rhythm */
}

.home-page .project-list li + li {
  margin-top: 4px;
}

.home-page .project-list-year {
  color: var(--muted);
}

.home-intro .intro-note {
  margin-top: var(--space-2);
}

/* ── Center media strip ── */
.strip-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project {
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-margin-top: 12px;
}

.home-page .project-tile {
  transition: opacity 160ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .home-page .strip-col:hover .project-tile,
  .home-page .strip-col:focus-within .project-tile {
    opacity: 0.55;
  }

  .home-page .strip-col .project-tile:hover,
  .home-page .strip-col .project-tile:focus-within {
    opacity: 1;
  }
}

.chrome-link,
.text-link,
.copy-button,
.theme-toggle {
  transition: color 150ms ease, transform 140ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .chrome-link:active,
  .text-link:active,
  .copy-button:active,
  .theme-toggle:active,
  .project-tile-link:active {
    transform: scale(0.97);
  }
}

/* Black title cards */
.media-card {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--media-radius);
  background: #27272a;
  color: #fff;
}
html.dark .media-card {
  border: 1px solid var(--rule); /* keep an edge on dark background */
}
.media-card--display {
  aspect-ratio: 4 / 3;
}

.media-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.project-tile-link {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  border-radius: var(--media-radius);
  background: transparent;
  outline: none;
  /* Fallback until @lisse/core sets path() squircle clip-path */
  -webkit-clip-path: inset(0 round var(--media-radius));
  clip-path: inset(0 round var(--media-radius));
}

.project-tile-link[data-smooth-corners='true'],
.project-media-section[data-smooth-corners='true'],
.project-reel-block[data-smooth-corners='true'],
.media-image[data-smooth-corners='true'],
simple-player[data-smooth-corners='true'],
.media-video[data-smooth-corners='true'] {
  border-radius: 0;
}

/* Parent clips the radius — nested media must not re-round or Chrome
   paints a light/dark AA fringe on the curve (same fix as project pages). */
.project-tile-link > .media-video,
.project-tile-link > .media-preview-video,
.project-tile-link > .media-image,
.project-tile-link > .media-poster-lcp,
.project-tile-link > simple-player {
  border-radius: 0 !important;
  -webkit-clip-path: none !important;
  clip-path: none !important;
}

.media-poster-lcp {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  border-radius: 0;
  transform: scale(1.04);
  transform-origin: center center;
  backface-visibility: hidden;
}

.project-tile-link > .media-preview-video {
  position: relative;
  z-index: 1;
}

.project-tile-link.media-card,
.project-tile-link[class*="aspect-"] {
  aspect-ratio: auto;
}

.project-tile-link > .media-image,
.project-tile-link > .media-card,
.project-tile-link > simple-player {
  width: 100%;
  height: 100%;
}

.project-tile-link > .media-image,
.project-tile-link > .media-card {
  aspect-ratio: auto;
}

.wordmark {
  font-size: inherit;
  font-weight: 500;
  letter-spacing: 0;
}
.display-type {
  padding: 0 24px;
  font-size: inherit;
  font-weight: 500;
  letter-spacing: 0;
  line-height: inherit;
  text-align: center;
}

/* Image blocks */
.media-image {
  margin: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--media-radius);
  background: transparent;
  -webkit-clip-path: inset(0 round var(--media-radius));
  clip-path: inset(0 round var(--media-radius));
}
.media-image.r34 {
  aspect-ratio: 3 / 4;
}
.aspect-21 {
  aspect-ratio: 2 / 1;
}
.aspect-169 {
  aspect-ratio: 16 / 9;
}
.aspect-43 {
  aspect-ratio: 4 / 3;
}
.aspect-34 {
  aspect-ratio: 3 / 4;
}
.aspect-11 {
  aspect-ratio: 1 / 1;
}
.aspect-31 {
  aspect-ratio: 3 / 1;
}
.aspect-916 {
  aspect-ratio: 9 / 16;
}
.aspect-45 {
  aspect-ratio: 4 / 5;
}
.media-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
  transform-origin: center center;
  backface-visibility: hidden;
}

.media-video,
simple-player {
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: var(--media-radius);
  background: transparent;
  -webkit-clip-path: inset(0 round var(--media-radius));
  clip-path: inset(0 round var(--media-radius));
}

.media-preview-video {
  height: 100%;
  width: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  border-radius: 0;
  background: transparent;
  transform: scale(1.04);
  transform-origin: center center;
  backface-visibility: hidden;
}

.media-video {
  --overlay-soft: rgb(0 0 0 / 0.42);
  --overlay-blur: 0px;
  --sp-glass-surface: rgb(255 255 255 / 0.04);
  --sp-control-glass-surface: rgb(255 255 255 / 0.12);
  --sp-control-hover-surface: rgb(255 255 255 / 0.14);
}
/* add class="media-image grayscale" to desaturate a color photo */
.media-image.grayscale img {
  filter: grayscale(1);
}

/* ── Bottom bar: identical on every page — clock left, back-to-top right ── */
.chrome-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: min(var(--home-intro-width), calc(100vw - 48px));
  margin: 24px auto 0;
  color: var(--muted);
}

.chrome-bottom .clock {
  order: 1;
  text-align: left;
}

.chrome-bottom .js-back-to-top,
.chrome-bottom .chrome-copyright {
  order: 2;
  margin-left: auto;
  text-align: right;
}

.chrome-bottom .chrome-copyright {
  color: var(--muted);
  user-select: none;
}

.chrome-bottom .js-back-to-top[hidden],
.chrome-bottom .chrome-copyright[hidden] {
  display: none;
}

/* Project pages: same content → footer gap as long pages (Dropbox, etc.) */
.project-detail-page .chrome-bottom.project-bottom {
  margin-top: 24px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 767px) {
  .home-page .left-col {
    max-width: none;
    margin-bottom: 72px;
  }

  /* Reels layout tightens the media gap to 10px; keep text rhythm at 24px. */
  .project-visuals--reels > .project-article-rule {
    margin-top: 14px;
    margin-bottom: 14px;
  }

  .project-visuals--reels > .project-copy-section {
    margin-bottom: 38px;
  }

  /* Mobile: every tile runs full width — keep each video's own ratio. */
  .home-page .strip-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .home-page .project {
    display: block;
    gap: 0;
  }

  .home-page .project-tile {
    grid-column: 1 / -1;
    min-width: 0;
    min-height: 0;
    aspect-ratio: var(--tile-aspect, 16 / 9);
  }

  .home-page .project-tile--half {
    aspect-ratio: 3 / 4;
  }

  .home-page .project-tile--wide {
    aspect-ratio: 16 / 9;
  }
}

/* ── Project detail page ── */
.project-title {
  margin: 0;
  font: inherit;
  color: var(--muted);
}

.project-short,
.project-meta,
.project-overview {
  margin: 0;
  white-space: pre-line;
}

.project-info > * + * {
  margin-top: var(--space-2);
}

.project-index-nav {
  display: none;
  flex-direction: column;
  gap: var(--space-1);
}

.project-index-nav .chrome-link {
  color: var(--muted);
  text-align: left;
}

.project-index-nav .chrome-link:hover,
.project-index-nav .chrome-link.is-active {
  color: var(--fg);
}

.project-title + .project-short,
.project-overview-group .project-meta-label + .project-overview,
.project-overview-group .project-meta-label + .project-credit {
  margin-top: var(--space-1);
}

.project-overview-group .project-meta-label + .project-testimonial {
  margin-top: var(--space-1);
}

.project-testimonial,
.project-testimonial-author,
.project-testimonial-note {
  margin: 0;
}

.project-testimonial-author {
  margin-top: var(--space-1);
  color: var(--muted);
  text-align: right;
}

.project-testimonial-note {
  margin-top: var(--space-2);
  white-space: pre-line;
}

.project-testimonial-section {
  padding: var(--space-2);
  border: 1px solid var(--rule);
  border-radius: var(--media-radius);
  background: color-mix(in srgb, var(--fg) 4%, var(--bg));
}

.project-visuals--reels > .project-testimonial-section {
  margin-bottom: 0;
}

.project-credit {
  margin: 0;
}

.project-credit + .project-credit {
  margin-top: 2px;
}

.project-meta-label {
  margin: 0 0 2px;
  color: var(--muted);
}

.project-meta-value {
  margin: 0;
}

.project-meta--inline {
  display: flex;
  gap: 4px;
}

.project-meta--inline .project-meta-label,
.project-meta--inline .project-meta-value {
  margin: 0;
}

.project-facts {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.project-link-list {
  margin: 0;
}

.project-visuals {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.project-visuals--reels {
  gap: 10px;
}

.project-visual {
  width: 100%;
}

.project-article-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: min(var(--home-intro-width), 100%);
  margin: 0 auto;
  scroll-margin-top: 64px;
}

/* Title row → description follows the flex gap: the same 8px heading → copy
   rhythm as the overview groups and the homepage lead. */

.project-article-meta {
  margin: 0;
  color: var(--muted);
}

.project-article-rule {
  width: min(var(--home-intro-width), 100%);
  margin: 0 auto;
  border-top: 1px solid var(--rule);
}

.project-copy-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(var(--home-intro-width), 100%);
  margin: 0 auto var(--space-3); /* + column gap = clear break before the first visual */
}

.project-copy-section .text-link {
  position: relative;
  display: inline-block;
  color: var(--link);
  text-decoration: none;
  transition: color 150ms ease;
}

.project-copy-section .text-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.project-copy-section .text-link:hover,
.project-copy-section .text-link:focus-visible {
  color: var(--fg);
}

.project-copy-section .text-link--gradient,
.project-copy-section .text-link--gradient:hover,
.project-copy-section .text-link--gradient:focus-visible {
  color: transparent;
  transition: none;
}

.project-copy-section .text-link--gradient::after {
  background: linear-gradient(90deg, #ff6bb5, #7aa7ff);
}

.project-copy-section .text-link:hover::after,
.project-copy-section .text-link:focus-visible::after {
  transform: scaleX(1);
}

.project-media-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 100%;
  scroll-margin-top: 64px;
  overflow: hidden;
  border-radius: var(--media-radius);
  background: transparent;
  -webkit-clip-path: inset(0 round var(--media-radius));
  clip-path: inset(0 round var(--media-radius));
}

/* One clip surface only — nested radius/clip creates AA fringe on dark bg. */
.project-media-section > simple-player,
.project-media-section > .media-video,
.project-media-section > .media-image {
  border-radius: 0 !important;
  overflow: hidden;
  background: transparent;
  -webkit-clip-path: none !important;
  clip-path: none !important;
}

.project-section-title {
  margin: 0;
  color: var(--muted);
}

.project-text-visual {
  margin: 0;
}

.project-placeholder {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule);
  border-radius: var(--media-radius);
  background: color-mix(in srgb, var(--fg) 7%, var(--bg));
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.project-visuals--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
}

/* Grid layouts collapse the column gap to 10px for the media mosaic;
   restore the 24px editorial rhythm around the text sections. */
.project-visuals--grid > .project-article-rule {
  margin-top: 14px;
  margin-bottom: 14px;
}

.project-visuals--grid > .project-copy-section {
  margin-bottom: 38px; /* + 10px grid gap = 48px break before the first visual */
}

.project-visuals--grid > .project-article-header,
.project-visuals--grid > .project-article-rule,
.project-visuals--grid > .project-copy-section,
.project-visuals--grid > .project-media-section--full {
  grid-column: 1 / -1;
}

.project-visuals--grid .project-placeholder {
  min-height: 0;
}

.project-visuals--grid .project-media-section--half {
  grid-column: span 1;
}

/* Mobile: the media grid collapses to a single full-width column. */
@media (max-width: 767px) {
  .project-visuals--grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.project-reel-block {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  border-radius: var(--media-radius);
  border: 1px solid var(--rule);
  background: var(--bg);
  /* One clipped shell — avoids hairline gaps between title + media radii */
  transform: translateZ(0);
}

.project-reel-title {
  min-height: 38px;
  margin: 0;
  padding: 7px 16px 8px;
  display: flex;
  align-items: center;
  color: var(--fg);
  background: var(--bg);
  border: 0;
  border-radius: 0;
}

.project-reel-video,
.project-reel-block > simple-player,
.project-reel-block > .media-video,
.project-reel-block > .media-image {
  display: block;
  margin: 0;
  border-radius: 0 !important;
  -webkit-clip-path: none !important;
  clip-path: none !important;
}

.project-detail-page[data-project-slug="animated-reels"] .project-section-title {
  display: none;
}

.project-bottom .pager,
.js-project-nav {
  display: none;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Desktop layout ── */
@media (min-width: 768px) {
  body {
    padding: 48px 24px 28px; /* same page frame on home and project pages */
  }

  .home-page .left-col {
    width: min(var(--home-intro-width), 100%);
    max-width: none;
    margin: 0 auto 64px;
  }

  .home-page .strip-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: dense;
    gap: 10px;
    width: min(var(--home-grid-width), calc(100vw - 48px));
    max-width: none;
    margin: 0 auto;
    padding: 0 0 24px;
  }

  .home-page .project {
    display: block;
    gap: 0;
    scroll-margin-top: 48px;
  }

  /* Layout follows media aspect: wide = full 16:9 row, half = one of two columns. */
  .home-page .project-tile {
    min-width: 0;
    min-height: 0;
  }

  .home-page .project-tile--wide {
    grid-column: 1 / -1;
    aspect-ratio: 16 / 9;
  }

  .home-page .project-tile--half {
    grid-column: span 1;
    aspect-ratio: 1 / 1;
  }

  .home-page .project-tile-link,
  .home-page .project-tile-link > .media-preview-video,
  .home-page .project-tile-link > .media-image,
  .home-page .project-tile-link > .media-image img {
    width: 100%;
    height: 100%;
  }

  .home-page .project-tile-link > .media-preview-video,
  .home-page .project-tile-link > .media-image img {
    object-fit: cover;
    object-position: center;
  }

}

@media (min-width: 768px) {
  .project-visuals {
    width: min(var(--home-grid-width), 100%);
    margin: 0 auto;
    padding: 0;
  }

  /* Single-media projects (Showreel, Space, Berger…): 16:9 spans back ↔ home (950px). */
  .project-detail-page[data-single-media] .project-visuals {
    width: min(950px, calc(100vw - 48px));
  }

  .project-detail-page[data-single-media] .project-article-header,
  .project-detail-page[data-single-media] .project-article-rule,
  .project-detail-page[data-single-media] .project-copy-section {
    width: min(var(--home-intro-width), 100%);
    margin-left: auto;
    margin-right: auto;
  }

  .project-detail-page[data-single-media] .project-media-section {
    width: 100%;
  }

  .project-detail-page[data-project-slug="animated-reels"] .project-visuals--reels,
  .project-detail-page[data-project-slug="cred"] .project-visuals--reels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3) 10px;
    width: min(var(--home-grid-width), 100%);
  }

  .project-detail-page[data-project-slug="animated-reels"] .project-visuals--reels > .media-image,
  .project-detail-page[data-project-slug="cred"] .project-visuals--reels > .media-image {
    grid-column: 1 / -1;
  }

  .project-detail-page[data-project-slug="animated-reels"] .project-visuals--reels > .project-article-header,
  .project-detail-page[data-project-slug="animated-reels"] .project-visuals--reels > .project-article-rule,
  .project-detail-page[data-project-slug="animated-reels"] .project-visuals--reels > .project-copy-section,
  .project-detail-page[data-project-slug="cred"] .project-visuals--reels > .project-article-header,
  .project-detail-page[data-project-slug="cred"] .project-visuals--reels > .project-article-rule,
  .project-detail-page[data-project-slug="cred"] .project-visuals--reels > .project-copy-section {
    grid-column: 1 / -1;
  }
}

/* ── Theme toggle icon ── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px;   /* comfortable hit area… */
  margin: -12px;   /* …without shifting the layout */
}
.theme-icon {
  display: block;
  width: 15px;
  height: 15px;
  transition: transform 180ms var(--ease-out);
}
html.dark .theme-icon {
  transform: rotate(180deg); /* flip the filled half to hint current state */
}

/* ── Cursor label ──
   Small tooltip beside the native cursor while hovering project media.
   Mounted on <html> for correct fixed positioning; type is set
   explicitly because body styles don't inherit there. */
.cursor-label {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  padding: 4px 6px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  font-style: normal;
  font-synthesis: none;
  font-variation-settings: "wght" 400, "opsz" 14;
  line-height: 1;
  text-transform: lowercase;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  will-change: transform;
  transition: opacity 120ms ease;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

.cursor-label--visible {
  opacity: 1;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  html.is-navigating body {
    opacity: 1;
  }
  html.is-navigating::before {
    display: none;
  }
}
