/* =========================================================
   Roy Shpring portfolio
   Every size below is written in the same pixels as the Figma
   design ("N * var(--u)"). --u is one design pixel, so each
   layout scales smoothly with the window and keeps the exact
   proportions of the design it is based on:
     Mobile  < 600px   -> Figma "Mobile"  (375 wide)
     Tablet  600-1099  -> Figma "Tablet"  (800 wide)
     Laptop  1100-1719 -> Figma "Laptop"  (1280 wide)
     Desktop >= 1720   -> Figma "Desktop" (2160 wide)
   ========================================================= */

@font-face {
  font-family: "Royshp";
  src: url("../fonts/Royshp.otf") format("opentype");
  font-display: swap;
}

:root {
  --ink: #1e1e1e;
  --hand: "Royshp", "Marker Felt", "Chalkboard SE", "Comic Sans MS", cursive;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html { background: #f5f5f5; }

body {
  container-type: inline-size;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.page {
  --dw: 1280;
  --u: calc(100cqw / var(--dw));
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

/* ---------- Header ---------- */
.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(40 * var(--u)) calc(64 * var(--u)) calc(24 * var(--u));
}
.logo {
  font-family: var(--hand);
  font-size: calc(45 * var(--u));
  line-height: 1.1;
  letter-spacing: -0.06em;
  white-space: nowrap;
}
.nav-link {
  display: inline-flex;
  padding: calc(5 * var(--u)) calc(12 * var(--u));
  font-size: calc(20 * var(--u));
  line-height: 1;
  letter-spacing: -0.05em;
  white-space: nowrap;
}
.nav-link .short { display: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(90 * var(--u)) 0 calc(60 * var(--u));
}
.hero-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--hand);
  line-height: 1.1;
}
.hero-title { font-weight: 400; white-space: nowrap; }
.hero-sub { text-align: right; letter-spacing: 0.04em; }

/* ---------- Projects ---------- */
.projects {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding-top: calc(50 * var(--u));
}
.grid {
  display: grid;
  align-items: start;
}
.tile {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.tile > img, .tile > video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Temporary stand-ins until the real images / videos are added */
.placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: rgba(30, 30, 30, 0.12);
  border: 1px dashed rgba(30, 30, 30, 0.35);
  font-family: var(--sans);
  font-size: max(12px, calc(20 * var(--u)));
  color: rgba(30, 30, 30, 0.6);
  text-align: center;
}

/* Cat photo: decoration. Flipped horizontally like in the design. */
.cat img { transform: scaleX(-1); }
.cat--hero { display: none; }
.cat--grid { display: none; }

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
}
.footer-about, .footer-contact {
  display: flex;
  flex-direction: column;
  gap: calc(24 * var(--u));
}
.footer-title {
  font-family: var(--hand);
  font-weight: 400;
  font-size: calc(45 * var(--u));
  line-height: 1.2;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.footer-title .emoji { font-size: calc(60 * var(--u)); }
.footer-title .short { display: none; }
.footer-body {
  font-size: calc(20 * var(--u));
  line-height: 1.45;
  letter-spacing: -0.005em;
}
.social {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: calc(8 * var(--u));
}
.social a {
  padding: calc(4 * var(--u)) calc(12 * var(--u));
  font-size: calc(25 * var(--u));
  line-height: 1;
  letter-spacing: -0.05em;
  white-space: nowrap;
}


/* ---------- Shared: which Figma frame each screen width follows ---------- */
@container (min-width: 1720px) { .page { --dw: 2160; } .only-l, .only-t, .only-m { display: none !important; } }
@container (min-width: 1100px) and (max-width: 1719.98px) { .page { --dw: 1280; } .only-d, .only-t, .only-m { display: none !important; } }
@container (min-width: 600px) and (max-width: 1099.98px) { .page { --dw: 800; } .only-d, .only-l, .only-m { display: none !important; } }
@container (max-width: 599.98px) {
  .page { --dw: 375; } .only-d, .only-l, .only-t, .not-m { display: none !important; }
  .site-header { align-items: flex-start; padding: calc(40 * var(--u)) calc(27 * var(--u)) calc(24 * var(--u)) calc(25 * var(--u)); }
  .logo { font-size: calc(26 * var(--u)); }
  .nav-link { font-size: calc(16 * var(--u)); }
  .nav-link .long { display: none; }
  .nav-link .short { display: inline; }
}

/* =========================================================
   DESKTOP  (Figma "Desktop", 2160 wide)
   ========================================================= */
@container (min-width: 1720px) {
  .page-home .page {
    --dw: 2160;
    padding-bottom: calc(100 * var(--u));
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 2160 2760' xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none'><rect x='0' y='0' height='100%' width='100%' fill='url(%23grad)'/><defs><radialGradient id='grad' gradientUnits='userSpaceOnUse' cx='0' cy='0' r='10' gradientTransform='matrix(-62.15 146.75 -105.22 -77.623 1472.5 1380)'><stop stop-color='rgba(242,245,62,1)' offset='0'/><stop stop-color='rgba(202,204,83,1)' offset='0.51921'/><stop stop-color='rgba(210,212,122,1)' offset='0.61176'/><stop stop-color='rgba(219,220,160,1)' offset='0.70431'/><stop stop-color='rgba(237,237,237,1)' offset='0.88941'/><stop stop-color='rgba(245,245,245,1)' offset='1'/></radialGradient></defs></svg>");
  }
  .hero { padding-left: calc(120 * var(--u)); padding-right: calc(120 * var(--u)); }
  .hero-text { width: calc(1888 * var(--u)); gap: calc(107 * var(--u)); }
  .hero-title { font-size: calc(300 * var(--u)); }
  .hero-sub { font-size: calc(110 * var(--u)); width: calc(847 * var(--u)); }

  .projects { padding-bottom: calc(100 * var(--u)); }
  .grid {
    width: calc(1890 * var(--u));
    grid-template-columns: repeat(3, 1fr);
    column-gap: calc(25 * var(--u));
    row-gap: calc(30 * var(--u));
  }
  .t-wild { order: 1; } .t-love { order: 2; } .t-dna { order: 3; }
  .t-keyboard { order: 4; } .t-sinners { order: 5; } .t-technical { order: 6; }
  .t-absolution { order: 7; } .t-justice { order: 8; }
  .cat--grid {
    order: 9;
    display: block;
    justify-self: center;
    align-self: center;
    width: calc(236 * var(--u));
    height: calc(333 * var(--u));
  }

  .site-footer {
    gap: calc(180 * var(--u));
    min-height: calc(370 * var(--u));
    padding: calc(40 * var(--u)) calc(120 * var(--u)) calc(20 * var(--u)) calc(200 * var(--u));
  }
  .footer-body { width: calc(605 * var(--u)); }
}

/* =========================================================
   LAPTOP  (Figma "Laptop", 1280 wide)
   ========================================================= */
@container (min-width: 1100px) and (max-width: 1719.98px) {
  .page-home .page {
    --dw: 1280;
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 1280 2840' xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none'><rect x='0' y='0' height='100%' width='100%' fill='url(%23grad)'/><defs><radialGradient id='grad' gradientUnits='userSpaceOnUse' cx='0' cy='0' r='10' gradientTransform='matrix(-36.83 151 -62.354 -79.873 872.59 1420)'><stop stop-color='rgba(242,245,62,1)' offset='0'/><stop stop-color='rgba(202,204,83,1)' offset='0.51921'/><stop stop-color='rgba(210,212,122,1)' offset='0.61176'/><stop stop-color='rgba(219,220,160,1)' offset='0.70431'/><stop stop-color='rgba(237,237,237,1)' offset='0.88941'/><stop stop-color='rgba(245,245,245,1)' offset='1'/></radialGradient></defs></svg>");
  }
  .page-home main { width: calc(1152 * var(--u)); margin: 0 auto; }
  .hero-text { width: calc(1152 * var(--u)); gap: calc(10 * var(--u)); padding: 0 calc(20 * var(--u)); }
  .hero-title { font-size: calc(200 * var(--u)); }
  .hero-sub { font-size: calc(70 * var(--u)); width: calc(518 * var(--u)); }

  .projects { padding-bottom: calc(100 * var(--u)); }
  .grid {
    width: calc(1110 * var(--u));
    grid-template-columns: repeat(2, 1fr);
    column-gap: calc(25 * var(--u));
    row-gap: calc(30 * var(--u));
  }
  .t-wild { order: 1; } .t-love { order: 2; } .t-dna { order: 3; } .t-keyboard { order: 4; }
  .t-technical { order: 5; } .t-sinners { order: 6; } .t-justice { order: 7; } .t-absolution { order: 8; }

  .site-footer {
    gap: calc(140 * var(--u));
    min-height: calc(370 * var(--u));
    padding: calc(20 * var(--u)) calc(120 * var(--u)) calc(20 * var(--u)) calc(20 * var(--u));
  }
  .footer-body { width: calc(606 * var(--u)); }
}

/* =========================================================
   TABLET  (Figma "Tablet", 800 wide)
   ========================================================= */
@container (min-width: 600px) and (max-width: 1099.98px) {
  .page-home .page {
    --dw: 800;
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 800 6199' xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none'><rect x='0' y='0' height='100%' width='100%' fill='url(%23grad)'/><defs><radialGradient id='grad' gradientUnits='userSpaceOnUse' cx='0' cy='0' r='10' gradientTransform='matrix(-23.019 329.6 -38.971 -174.34 545.37 3099.5)'><stop stop-color='rgba(242,245,62,1)' offset='0'/><stop stop-color='rgba(202,204,83,1)' offset='0.51921'/><stop stop-color='rgba(210,212,122,1)' offset='0.61176'/><stop stop-color='rgba(219,220,160,1)' offset='0.70431'/><stop stop-color='rgba(237,237,237,1)' offset='0.88941'/><stop stop-color='rgba(245,245,245,1)' offset='1'/></radialGradient></defs></svg>");
  }
  .nav-link { font-weight: 600; }
  .hero { padding: calc(70 * var(--u)) calc(64 * var(--u)) calc(50 * var(--u)); }
  .hero-text { flex-direction: column; gap: calc(10 * var(--u)); text-align: center; }
  .hero-title { font-size: calc(160 * var(--u)); }
  .hero-sub { font-size: calc(65 * var(--u)); text-align: center; letter-spacing: 0; white-space: nowrap; }

  .projects { padding: calc(50 * var(--u)) calc(33 * var(--u)) 0; }
  .grid {
    width: 100%;
    grid-template-columns: 1fr;
    row-gap: calc(64 * var(--u));
    padding-bottom: calc(64 * var(--u));
  }
  .t-wild { order: 1; } .t-dna { order: 2; } .t-love { order: 3; } .t-keyboard { order: 4; }
  .t-technical { order: 5; } .t-sinners { order: 6; } .t-justice { order: 7; } .t-absolution { order: 8; }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: calc(60 * var(--u));
    padding: calc(20 * var(--u)) calc(80 * var(--u)) calc(60 * var(--u));
  }
  .footer-body { width: calc(608 * var(--u)); }
}

/* =========================================================
   MOBILE  (Figma "Mobile", 375 wide)
   ========================================================= */
@container (max-width: 599.98px) {
  .page-home .page {
    --dw: 375;
    padding-bottom: calc(50 * var(--u));
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 375 4229' xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none'><rect x='0' y='0' height='100%' width='100%' fill='url(%23grad)'/><defs><radialGradient id='grad' gradientUnits='userSpaceOnUse' cx='0' cy='0' r='10' gradientTransform='matrix(57.15 201.75 -222.59 57.792 -64.5 2114)'><stop stop-color='rgba(242,245,62,1)' offset='0'/><stop stop-color='rgba(233,232,91,1)' offset='0.10963'/><stop stop-color='rgba(223,219,119,1)' offset='0.21926'/><stop stop-color='rgba(230,228,178,1)' offset='0.50045'/><stop stop-color='rgba(237,237,237,1)' offset='0.78165'/><stop stop-color='rgba(245,245,245,1)' offset='1'/></radialGradient></defs></svg>");
  }
  .site-header { align-items: flex-start; padding: calc(40 * var(--u)) calc(27 * var(--u)) calc(24 * var(--u)) calc(25 * var(--u)); }
  .logo { font-size: calc(26 * var(--u)); }
  .nav-link { font-size: calc(16 * var(--u)); }
  .nav-link .long { display: none; }
  .nav-link .short { display: inline; }

  .hero { padding: calc(55 * var(--u)) calc(24 * var(--u)) calc(40 * var(--u)); gap: calc(12 * var(--u)); }
  .cat--hero { display: block; width: calc(245 * var(--u)); height: calc(345 * var(--u)); }
  .hero-text {
    flex-direction: column;
    gap: calc(12 * var(--u));
    padding-top: calc(50 * var(--u));
    width: calc(327 * var(--u));
    text-align: center;
  }
  .hero-title { font-size: calc(100 * var(--u)); }
  .hero-sub { font-size: calc(65 * var(--u)); text-align: center; letter-spacing: 0; }
  .hero-sub .arrow { display: block; font-size: calc(150 * var(--u)); line-height: 1.1; }

  .projects { padding: calc(12 * var(--u)) 0 calc(32 * var(--u)); }
  .grid { width: 100%; grid-template-columns: 1fr; }
  .t-wild { order: 1; } .t-dna { order: 2; } .t-love { order: 3; } .t-keyboard { order: 4; }
  .t-sinners { order: 5; } .t-technical { order: 6; } .t-absolution { order: 7; } .t-justice { order: 8; }

  .site-footer {
    flex-direction: column;
    gap: calc(40 * var(--u));
    padding: calc(40 * var(--u)) 0 calc(20 * var(--u));
    text-align: center;
  }
  .footer-about { width: calc(315 * var(--u)); align-items: center; }
  .footer-contact { gap: calc(12 * var(--u)); align-items: center; }
  .footer-title { font-size: calc(40 * var(--u)); letter-spacing: 0.04em; }
  .footer-about .footer-title { font-size: calc(50 * var(--u)); }
  .footer-title .emoji { font-size: calc(50 * var(--u)); }
  .footer-title .long { display: none; }
  .footer-title .short { display: inline; }
  .footer-body { font-size: calc(16 * var(--u)); }
  .social { align-items: center; }
  .social a { font-size: calc(20 * var(--u)); }
}

/* ---------- Custom cursor (Figma "Mouse") ---------- */
/* (see "Pixel-hand cursor" below) */

/* ---------- Media inside tiles / slots ---------- */
.tile { position: relative; }
.tile > video, .tile > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.cat img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* ---------- Before / after comparison ---------- */
.compare { --pos: 50%; position: relative; overflow: hidden; aspect-ratio: var(--r, 16 / 9); background: #fff; user-select: none; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.compare .c-before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare .c-line {
  position: absolute; top: 0; bottom: 0; left: var(--pos); width: 6px; transform: translateX(-50%);
  background: repeating-linear-gradient(180deg, #ffd400 0 14px, #1e1e1e 14px 28px);
  pointer-events: none;
}
.compare .c-handle {
  position: absolute; top: 50%; left: var(--pos); width: 44px; height: 40px; transform: translate(-50%, -55%);
  pointer-events: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}
.compare .c-range {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0;
  cursor: ew-resize; touch-action: pan-y; -webkit-appearance: none; appearance: none;
}
.compare .c-range::-webkit-slider-thumb { -webkit-appearance: none; width: 60px; height: 100vh; }
.compare .c-range::-moz-range-thumb { width: 60px; height: 100vh; border: 0; }
.compare .c-range:focus-visible + .c-line { outline: 2px solid #4d49fc; }

/* ---------- Home: blurred plant photo behind the bottom of the page ---------- */
.plant { position: absolute; z-index: 0; pointer-events: none; left: 50%; transform: translateX(-50%); }
.plant img { width: 100%; height: 100%; object-fit: cover; display: block; }
@container (min-width: 1720px) { .plant { width: calc(4094 * var(--u)); height: calc(4094 * var(--u)); top: calc(1439 * var(--u)); filter: blur(calc(10 * var(--u))); mix-blend-mode: overlay; } }
@container (min-width: 1100px) and (max-width: 1719.98px) { .plant { width: calc(2947 * var(--u)); height: calc(2947 * var(--u)); top: calc(1769 * var(--u)); filter: blur(calc(10 * var(--u))); mix-blend-mode: overlay; } }
@container (min-width: 600px) and (max-width: 1099.98px) { .plant { width: calc(1765 * var(--u)); height: calc(1318 * var(--u)); top: calc(-346 * var(--u)); margin-left: calc(21.5 * var(--u)); filter: blur(calc(3.85 * var(--u))); mix-blend-mode: overlay; } .plant img { object-position: top; } }
@container (max-width: 599.98px) { .plant { width: calc(966 * var(--u)); height: calc(966 * var(--u)); top: auto; bottom: calc(-566 * var(--u)); margin-left: calc(6.5 * var(--u)); mix-blend-mode: color-burn; } }

/* ---------- Hover states (Figma variants + Roy's screen recordings) ----------
   Colour and type change at once; size and tilt move on a soft spring
   (a small overshoot that settles in about 0.65s). */
:root {
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --spring-time: .45s;
}
@supports (transition-timing-function: linear(0, 1)) {
  :root { --spring: linear(0.0, 0.045, 0.16, 0.315, 0.487, 0.655, 0.808, 0.935, 1.034, 1.102, 1.144, 1.161, 1.161, 1.146, 1.123, 1.096, 1.068, 1.042, 1.019, 1.001, 0.988, 0.979, 0.975, 0.973, 0.975, 0.978, 0.982, 0.987, 0.991, 0.995, 0.999, 1.001, 1.003, 1.004, 1.004, 1.004, 1); }
}
.nav-link, .social a, .lets-talk-line, .more-title { border-radius: calc(10 * var(--u)); }
.social a { display: inline-block; }
.nav-link, .social a, .tile, .more-card, .tag { transition: transform var(--spring-time) var(--spring); }
.more-title { transition: letter-spacing var(--spring-time) var(--spring), transform var(--spring-time) var(--spring); }
.nav-link:hover, .social a:hover {
  background: #aff53e; font-style: italic;
  transform: rotate(-3deg) scale(1.1);
}
.lets-talk-line:hover { font-style: italic; }
.more-title:hover { font-weight: 500; font-style: italic; letter-spacing: 0.15em; }
.tag:hover { font-weight: 500; font-style: italic; transform: rotate(-3deg) scale(1.1); }
.logo { display: inline-block; transform-origin: center; }
.logo .lt { display: inline-block; transition: transform var(--spring-time) var(--spring); }
@media (hover: hover) { .logo:hover .lt { transform: rotate(-7deg); } }

/* Tiles fan outward: left column leans left, right column leans right (fixed per project) */
.tile { --tilt: 3deg; }
.t-wild, .t-dna, .t-technical, .t-justice { --tilt: -3deg; }
.more-card { --tilt: 1.5deg; }
@media (hover: hover) {
  .tile:hover, .more-card:hover { transform: rotate(var(--tilt)) scale(1.04); z-index: 3; }
}

/* ---------- Title types itself in, letter by letter ---------- */
.type-loop .ch { opacity: 0; }
.type-loop .ch.on { opacity: 1; }
.type-loop { display: inline-block; }
.type-loop.bounce { animation: hello-bounce .55s cubic-bezier(.45,0,.35,1); }
@keyframes hello-bounce {
  0% { transform: translateX(0); }
  38% { transform: translateX(-0.13em); }
  72% { transform: translateX(0.03em); }
  88% { transform: translateX(-0.006em); }
  100% { transform: translateX(0); }
}
.typing .ch { opacity: 0; animation: type-in 0s linear forwards; animation-delay: calc(var(--i) * 50ms + 150ms); }
@keyframes type-in { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing .ch { animation: none; opacity: 1; } }

/* ---------- Pixel-hand cursor that follows the mouse ---------- */
.cursor-hand {
  position: fixed; left: 0; top: 0; z-index: 9999; width: 62px; height: 62px;
  pointer-events: none; image-rendering: pixelated; display: none;
}
html.has-hand, html.has-hand a, html.has-hand button { cursor: none; }
html.has-hand .social a, html.has-hand .nav-link, html.has-hand .logo { cursor: pointer; }
html.has-hand .cursor-hand { display: block; }
html.has-hand .compare .c-range { cursor: move; }
html.hand-hidden .cursor-hand { display: none; }

/* Phone home grid: edge-to-edge 16:9 tiles with thin gaps */
@container (max-width: 599.98px) {
  .page-home .grid { row-gap: calc(9 * var(--u)); }
  .page-home .tile { aspect-ratio: 16 / 9; width: 100%; }
}

/* ---------- Magnifying glass over the Absolution research board ---------- */
.zoomable { cursor: none; }
.loupe {
  position: absolute; z-index: 4; width: 240px; height: 240px; border-radius: 50%;
  pointer-events: none; display: none; transform: translate(-50%, -50%);
  border: 4px solid #1e1e1e; box-shadow: 0 6px 18px rgba(0,0,0,.35);
  background-repeat: no-repeat; background-color: #000;
}
.zoomable:hover .loupe { display: block; }
@media (hover: none) { .loupe { display: none !important; } }

/* ---------- Cat frame falls into the footer (desktop layout) ---------- */
.cat--grid { position: relative; z-index: 5; transform-origin: 50% 50%; will-change: transform; }

/* Phone: the cat frame turns around itself */
.cat--hero { perspective: 900px; }
.cat--hero img { animation: cat-spin 5s cubic-bezier(.45,0,.55,1) infinite; transform-style: preserve-3d; }
@keyframes cat-spin { from { transform: scaleX(-1) rotateY(0deg); } to { transform: scaleX(-1) rotateY(360deg); } }
@media (prefers-reduced-motion: reduce) { .cat--hero img { animation: none; } }

/* Home title letters lean slightly on their axis under the mouse */
.hero-title .lt { display: inline-block; transition: transform var(--spring-time) var(--spring); }
@media (hover: hover) { .hero-title .lt:hover { transform: rotate(-7deg); } }
