/* ==========================================================================
   Guilherme Eccel Superti — Portfolio
   Motion principles (modern-web-guidance):
   - only transform/opacity animate; spatial motion is opt-in via
     prefers-reduced-motion: no-preference, colour/opacity feedback stays on.
   - native scroll-snap carousels, <dialog> lightbox, scroll-driven CSS effects
     with @supports guards; anime.js handles choreography (see js/main.js).
   ========================================================================== */

:root {
  --bg: #2748D0;
  --bg-deep: #1A2F8F;
  --surface: #2140B8;
  --tint: #3A5BE0;
  --ink: #F5F3EE;
  --ink-soft: rgb(245 243 238 / .78);
  --line: rgb(245 243 238 / .26);
  --accent: #FF3B3B;        /* the red from the "S" symbol */
  --sky: #2FC9FF;           /* the cyan from the "S" symbol */
  --ease: cubic-bezier(.22, .8, .24, 1);
  --pad: clamp(1.25rem, 4vw, 3.5rem);
  --radius: 10px;
  --sans: "Plus Jakarta Sans", "Noto Sans JP", system-ui, sans-serif;
  --stroke: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 16' preserveAspectRatio='none'%3E%3Cpath fill='%23F5F3EE' d='M0 7.2C80 4.4 160 5.6 240 4.1S400 4.5 480 3.1 640 4.6 720 5.2s160-2.4 240-2.4 160 2.5 240 4.4V8.8c-80 3.1-160 4.2-240 2.8s-160-1.5-240-.7-160 1-240 1.1-160-1.7-240-1.6-160 2.1-240 2.1-80-2.3-240-3.1Z'/%3E%3C/svg%3E");
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }
/* Native smooth anchor scrolling only when motion is welcome (Lenis takes over when it loads). */
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
main section[tabindex="-1"]:focus { outline: none; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
:lang(ja) { line-height: 1.9; letter-spacing: .03em; font-feature-settings: "palt"; word-break: auto-phrase; line-break: strict; }
/* Long JA/EN headings: scale down so nothing overflows its column */
:lang(ja) .contact h2 { font-size: clamp(2.4rem, 7vw, 6.2rem); }
:lang(ja) .head h2, :lang(ja) .about h2 { font-size: clamp(2.2rem, 6vw, 5rem); }
:lang(ja) .hero-row p, :lang(ja) .about .lead { letter-spacing: .02em; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-weight: 800; line-height: 1; letter-spacing: -.035em; text-wrap: balance; }
:lang(ja) :is(h1, h2, h3) { font-weight: 900; line-height: 1.3; letter-spacing: 0; }
p { text-wrap: pretty; }
::selection { background: var(--ink); color: var(--bg); }

:where(a, button, [tabindex], summary):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: fixed; left: 1rem; top: -4rem; z-index: 100; background: var(--ink); color: var(--bg);
  padding: .6rem 1rem; border-radius: 99px; text-decoration: none; font-weight: 700; transition: top .3s var(--ease);
}
.skip:focus { top: 1rem; }

/* ---------- Preloader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 90; background: var(--bg-deep);
  display: grid; place-items: center; gap: 1rem; align-content: center;
}
.loader[hidden] { display: none; }
.loader-logo { width: 84px; height: 84px; }
.loader-count { font-weight: 800; font-size: .9rem; letter-spacing: .2em; font-variant-numeric: tabular-nums; opacity: .8; }
html:not(.js) .loader, .reduced .loader { display: none; }
/* Failsafe: if a script fails, never leave the page covered */
.loader { animation: loader-failsafe 0s 6s forwards; }
@keyframes loader-failsafe { to { visibility: hidden; opacity: 0; } }

/* ---------- Scroll progress (CSS scroll-driven, decorative → no fallback) ---------- */
.progress {
  position: fixed; inset: 0 0 auto; height: 3px; z-index: 40; background: var(--ink);
  transform-origin: 0 50%; scale: 0 1; pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .progress { animation: grow-x linear both; animation-timeline: scroll(root); }
  }
}
@keyframes grow-x { to { scale: 1 1; } }

/* ---------- Scrollbar ---------- */
html { scrollbar-color: var(--ink) var(--bg-deep); }
@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar { width: 12px; }
  ::-webkit-scrollbar-track { background: var(--bg-deep); }
  ::-webkit-scrollbar-thumb { background: var(--ink); border-radius: 99px; border: 3px solid var(--bg-deep); }
}
.skill-modal, .skill-body { scrollbar-color: var(--ink) transparent; scrollbar-width: thin; }

/* ---------- Custom cursor: dot + blinking eye over images (fine pointers only) ---------- */
.cursor-dot, .cursor-eye { display: none; }
@media (hover: hover) and (pointer: fine) {
  .cursor-dot, .cursor-eye { display: block; position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none; opacity: 0; }
  .cursor-dot {
    width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
    background: var(--ink); box-shadow: 0 0 0 2px rgb(26 47 143 / .55);
    transition: opacity .25s, background-color .25s, box-shadow .25s;
  }
  /* Over links/buttons the dot becomes a hollow ring so it never hides the label */
  .cursor-dot.ring { background: transparent; box-shadow: inset 0 0 0 1px var(--ink), 0 0 0 1px rgb(26 47 143 / .35); }
  .cursor-dot.on { opacity: 1; }
  /* initial scale values are set from JS (anime composes `transform`) */
  .cursor-eye { width: 84px; height: 84px; margin: -42px 0 0 -42px; filter: drop-shadow(0 10px 20px rgb(0 0 0 / .35)); }
  .cursor-eye svg { display: block; }
  .cursor-eye .eye-lid { transform-box: fill-box; transform-origin: 50% 0; }
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 2rem var(--pad);
  transition: padding .6s var(--ease), background-color .5s var(--ease);
}
.site-header.stuck {
  padding-block: .6rem;
  background: rgb(39 72 208 / .9);
  backdrop-filter: blur(12px);
}
.site-header::after {
  content: ""; position: absolute; inset: auto 0 0; height: 6px; background: var(--stroke) 0 0 / 100% 100% no-repeat;
  opacity: 0; transition: opacity .5s var(--ease);
}
.site-header.stuck::after { opacity: 1; }

.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.brand-logo { width: 48px; height: 48px; flex: none; transition: rotate .6s var(--ease); }
.brand:hover .brand-logo { rotate: -10deg; }
.brand-name { font-weight: 800; font-size: clamp(1rem, 1.6vw, 1.3rem); letter-spacing: -.02em; white-space: nowrap; }
.site-header.stuck .brand-logo { width: 38px; height: 38px; }

.nav ul { display: flex; gap: clamp(1rem, 2.4vw, 2.2rem); list-style: none; padding: 0; }
.nav a {
  position: relative; display: inline-block; text-decoration: none; font-weight: 700; font-size: .95rem; padding: .35rem 0;
  overflow: hidden;
}
/* Rolling text hover: the label slides up and a copy rolls in from below. */
.nav a .roll { display: block; transition: translate .5s var(--ease); }
.nav a .roll::after { content: attr(data-text); position: absolute; left: 0; top: 100%; }
@media (prefers-reduced-motion: no-preference) {
  .nav a:hover .roll { translate: 0 -100%; }
}
.nav a::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: currentColor;
  scale: 0 1; transform-origin: right; transition: scale .5s var(--ease);
}
.nav a[aria-current="true"]::before, .nav a:hover::before { scale: 1 1; transform-origin: left; }

.tools { display: flex; align-items: center; gap: .6rem; }
.lang { display: flex; border: 1.5px solid var(--ink); border-radius: 99px; padding: 2px; }
.lang button {
  border: 0; background: none; padding: .35rem .7rem; border-radius: 99px; cursor: pointer;
  font-weight: 700; font-size: .78rem; transition: background-color .3s var(--ease), color .3s var(--ease);
}
.lang button:hover { background: rgb(245 243 238 / .15); }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.burger {
  display: none; width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--ink); background: none; cursor: pointer;
}
.burger span, .burger span::before {
  display: block; width: 18px; height: 2px; margin: auto; background: currentColor; border-radius: 2px;
  transition: rotate .4s var(--ease), translate .4s var(--ease);
}
.burger span { translate: 0 -3px; }
.burger span::before { content: ""; translate: 0 6px; }
.burger[aria-expanded="true"] span { translate: 0; rotate: 45deg; }
.burger[aria-expanded="true"] span::before { translate: 0; rotate: -90deg; }

@media (max-width: 900px) {
  .burger { display: block; }
  .brand-name { display: none; }
  .nav {
    position: fixed; inset: 0; z-index: -1; background: var(--bg-deep);
    display: grid; align-content: center; padding: var(--pad);
    clip-path: circle(0 at calc(100% - 2.5rem) 2.5rem);
    visibility: hidden;
    transition: clip-path .7s var(--ease), visibility 0s .7s;
  }
  .nav.open { clip-path: circle(150% at calc(100% - 2.5rem) 2.5rem); visibility: visible; transition: clip-path .7s var(--ease); }
  .nav ul { flex-direction: column; gap: .2rem; }
  .nav a { font-size: clamp(2.2rem, 11vw, 3.6rem); font-weight: 800; letter-spacing: -.04em; }
}

/* ---------- Buttons (hover / press / focus are distinct states) ---------- */
.btn {
  --sk: var(--ink);
  position: relative; display: inline-flex; align-items: center; gap: .6rem; isolation: isolate; overflow: hidden;
  padding: .9rem 1.5rem; border-radius: 99px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--ink); color: var(--bg); font-weight: 700;
  transition: box-shadow .3s var(--ease), scale .15s ease-out, color .35s var(--ease);
  touch-action: manipulation;
}
.btn::before { /* fill that wipes in on hover */
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--accent);
  translate: -101% 0; transition: translate .5s var(--ease);
}
.btn:hover { box-shadow: 0 10px 30px -10px rgb(0 0 0 / .45); color: var(--ink); }
.btn:hover::before { translate: 0 0; }
.btn:active { scale: .96; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn.ghost::before { background: var(--ink); }
.btn.ghost:hover { color: var(--bg); }
.btn .arrow { transition: translate .4s var(--ease); }
.btn:hover .arrow { translate: 4px 0; }

/* Click burst particles (anime.js) */
.burst { position: fixed; left: 0; top: 0; z-index: 85; pointer-events: none; width: 8px; height: 8px; border-radius: 50%; }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100svh; display: grid; align-content: end; gap: 2rem;
  padding: 9rem var(--pad) 3rem;
}
.hero-title { display: flex; align-items: flex-end; flex-wrap: wrap; gap: clamp(1rem, 3vw, 2.5rem); }
.hero h1 { font-size: clamp(3rem, 11vw, 10.5rem); line-height: .9; letter-spacing: -.055em; }
/* Clip box gets breathing room so tight letter-spacing never shaves glyph edges */
.hero h1 .line { display: block; overflow: clip; padding: 0 .12em .08em; margin: 0 -.12em; }
.hero h1 .char { display: inline-block; will-change: transform; }
.hero-mascot {
  width: clamp(64px, 8vw, 120px); aspect-ratio: 1; border-radius: 50%; background: var(--tint);
  display: grid; place-items: center; padding: 0; cursor: pointer; border: 0; flex: none; margin-bottom: 1.2vw;
  transition: background-color .3s var(--ease);
}
.hero-mascot img { width: 72%; height: auto; }
.hero-mascot:hover { background: var(--accent); }
.hero-row {
  position: relative; display: flex; justify-content: space-between; align-items: end; gap: 2rem; flex-wrap: wrap; padding-top: 1.4rem;
}
.hero-row::before, .about dl::before, .head::before, .foot::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 8px; background: var(--stroke) 0 0 / 100% 100% no-repeat;
}
.hero-row p { max-width: 36ch; font-size: clamp(1.05rem, 1.6vw, 1.3rem); font-weight: 500; }

/* Floating featured works around the hero (parallax follows the pointer) */
.hero-float { position: absolute; inset: 0; pointer-events: none; z-index: -1; }
.hero-float img {
  position: absolute; width: clamp(120px, 15vw, 240px); aspect-ratio: 4 / 5; object-fit: cover;
  border-radius: var(--radius); box-shadow: 0 30px 60px -20px rgb(0 0 0 / .5);
}
.hero-float img:nth-child(1) { right: 8%; top: 16%; rotate: 6deg; }
.hero-float img:nth-child(2) { right: 26%; top: 30%; rotate: -5deg; width: clamp(100px, 11vw, 180px); }
.hero-float img:nth-child(3) { right: 4%; top: 52%; rotate: -3deg; width: clamp(90px, 10vw, 160px); }
@media (max-width: 800px) {
  .hero { align-content: center; padding-top: 7rem; }
  .hero-float { display: none; }
}

.scroll-hint {
  position: absolute; left: 50%; bottom: 1.2rem; translate: -50% 0; width: 26px; height: 42px; border-radius: 99px;
  border: 1.5px solid var(--ink); opacity: .7;
}
.scroll-hint::after {
  content: ""; position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 4px; background: var(--ink);
}
@media (prefers-reduced-motion: no-preference) {
  .scroll-hint::after { animation: hint 1.8s var(--ease) infinite; }
}
@keyframes hint { 0% { translate: 0 0; opacity: 1; } 80% { translate: 0 14px; opacity: 0; } 100% { opacity: 0; } }

/* ---------- Marquee (scroll-linked, not auto-playing → no pause control needed) ---------- */
.marquee {
  overflow: clip; border-block: 1.5px solid var(--line); padding-block: 1.1rem; background: var(--bg-deep);
}
.marquee-track { display: flex; gap: 2.5rem; width: max-content; will-change: transform; }
.marquee-track span { font-size: clamp(1.6rem, 4vw, 3.2rem); font-weight: 800; letter-spacing: -.03em; white-space: nowrap; display: flex; align-items: center; gap: 2.5rem; }
.marquee-track span::after { content: "✦"; font-size: .6em; color: var(--sky); }

/* ---------- Sections ---------- */
section { padding: clamp(4.5rem, 10vw, 9rem) var(--pad); }
.surface { background: var(--surface); }
.dark { background: var(--bg-deep); }
.head {
  position: relative; display: flex; justify-content: space-between; align-items: end; gap: 2rem; flex-wrap: wrap;
  padding-top: 1.4rem; margin-bottom: clamp(2rem, 4vw, 3.5rem);
}
.head h2 { font-size: clamp(2.6rem, 7vw, 6rem); letter-spacing: -.045em; }
.head h2 .n { font-size: .3em; vertical-align: top; letter-spacing: 0; opacity: .6; margin-left: .3em; }
.head p { max-width: 38ch; color: var(--ink-soft); }
.peek { width: 34px; height: 34px; flex: none; }

/* Reveal hooks — content is visible by default; main.js adds .anim only when it will animate. */
.anim [data-reveal] { opacity: 0; }

/* ---------- Banner (CSS view-timeline parallax) ---------- */
.banner { padding-block: 0 clamp(3rem, 7vw, 6rem); }
.banner figure { overflow: clip; border-radius: var(--radius); aspect-ratio: 3 / 1; background: var(--tint); }
.banner img { width: 100%; height: 100%; object-fit: cover; scale: 1.15; }
@media (max-width: 700px) { .banner figure { aspect-ratio: 16 / 10; } }
@supports ((animation-timeline: view()) and (animation-range: entry)) {
  @media (prefers-reduced-motion: no-preference) {
    .banner img { animation: parallax linear both; animation-timeline: view(); }
  }
}
@keyframes parallax { from { translate: 0 -7%; } to { translate: 0 7%; } }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(2rem, 6vw, 6rem); align-items: start; }
.portrait {
  position: relative; border-radius: var(--radius); overflow: clip; aspect-ratio: 4 / 5; background: var(--tint);
  transform-style: preserve-3d; transition: box-shadow .5s var(--ease);
}
.portrait { overflow: visible; background: none; perspective: 900px; }
.markers { order: -1; }
.photo-stack { position: relative; display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.photo-stack .stack-item {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius);
  background: var(--tint); box-shadow: 0 24px 50px -24px rgb(0 0 0 / .6);
}
.photo-stack .stack-item:nth-child(2) { rotate: 4deg; }
.photo-stack .stack-item:nth-child(3) { rotate: -5deg; }
.photo-stack .stack-item:nth-child(4) { rotate: 2deg; }
.photo-stack:focus-visible { outline-offset: 8px; }
.portrait figcaption {
  position: absolute; left: 1rem; bottom: 1rem; padding: .35rem .8rem; border-radius: 99px;
  background: var(--ink); color: var(--bg); font-weight: 700; font-size: .8rem;
}
.about h2 { font-size: clamp(2.6rem, 7vw, 6rem); letter-spacing: -.045em; margin-bottom: 1.6rem; }
.about .lead { font-weight: 700; font-size: clamp(1.4rem, 2.6vw, 2.2rem); line-height: 1.25; letter-spacing: -.02em; }
:lang(ja) .about .lead { line-height: 1.7; }
.about p + p { margin-top: 1rem; }
.about .body { margin-top: 1.6rem; color: var(--ink-soft); }
.about dl { position: relative; margin-top: 2.2rem; padding-top: .6rem; }
.about dl div { position: relative; display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding: .85rem 0; }
.about dl div::after { content: ""; position: absolute; inset: auto 0 0; height: 5px; background: var(--stroke) 0 0 / 100% 100% no-repeat; opacity: .5; }
.about dt { color: var(--ink-soft); font-size: .92rem; }
.chips-hint { margin-top: 1.8rem; font-size: .88rem; color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; list-style: none; padding: 0; }
.chip {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1.5px solid var(--ink); border-radius: 99px; padding: .4rem .55rem .4rem .95rem; font-size: .88rem; font-weight: 700;
  background: none; cursor: pointer; touch-action: manipulation;
  transition: background-color .3s var(--ease), color .3s var(--ease), box-shadow .3s var(--ease);
}
.chip-n {
  min-width: 1.45rem; height: 1.45rem; padding-inline: .3rem; border-radius: 99px; display: grid; place-items: center;
  background: var(--ink); color: var(--bg); font-size: .72rem; transition: background-color .3s var(--ease), color .3s var(--ease);
}
.chip:hover { background: var(--ink); color: var(--bg); box-shadow: 0 8px 20px -10px rgb(0 0 0 / .5); }
.chip:hover .chip-n { background: var(--accent); color: var(--ink); }
.chip:active { scale: .95; }
.about-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; }
  .portrait { max-width: 420px; }
}

/* ---------- Works ---------- */
.work { margin-bottom: clamp(4rem, 8vw, 7rem); }
.work-top { display: grid; grid-template-columns: 1.2fr 1fr; gap: 2rem; margin-bottom: 1.4rem; align-items: end; }
.work-index { font-weight: 800; font-size: .85rem; letter-spacing: .15em; opacity: .6; }
.work h3 { font-size: clamp(2rem, 4.6vw, 4rem); margin-top: .3rem; }
.work .meta { color: var(--ink-soft); font-size: .92rem; margin-top: .5rem; }
@media (max-width: 800px) { .work-top { grid-template-columns: 1fr; gap: .8rem; } }

/* Other projects list with a pointer-following preview */
.more h3 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1rem; }
.more ul { list-style: none; padding: 0; border-top: 1.5px solid var(--line); }
.more li { border-bottom: 1.5px solid var(--line); }
.more button {
  width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: baseline;
  padding: 1.2rem .2rem; background: none; border: 0; text-align: left; cursor: pointer;
  transition: padding-left .5s var(--ease), color .3s var(--ease);
}
.more button strong { font-size: clamp(1.3rem, 3vw, 2.2rem); letter-spacing: -.03em; }
.more button span { color: var(--ink-soft); font-size: .9rem; }
.more button:hover, .more button:focus-visible { padding-left: 1.2rem; }
.preview {
  position: fixed; left: 0; top: 0; z-index: 25; width: 280px; aspect-ratio: 4 / 3; border-radius: var(--radius);
  overflow: hidden; pointer-events: none; opacity: 0; scale: .6; background: var(--tint);
  box-shadow: 0 30px 60px -20px rgb(0 0 0 / .6);
}
.preview img { width: 100%; height: 100%; object-fit: cover; }
@media (hover: none) { .preview { display: none; } }

/* ---------- Carousel (native scroll-snap + HTML controls) ---------- */
.carousel { position: relative; display: flex; flex-direction: column; }
.carousel .bar { order: 2; } /* controls come first in DOM order (guide), shown below the track */
.carousel .track { order: 1; }
.carousel .slide.contain { background: var(--bg-deep); }
.track {
  display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; border-radius: var(--radius); touch-action: pan-x pan-y pinch-zoom;
}
.track::-webkit-scrollbar { display: none; }
@media (prefers-reduced-motion: no-preference) { .track { scroll-behavior: smooth; } }
.track.dragging { scroll-snap-type: none; scroll-behavior: auto; cursor: grabbing; }
@media (pointer: fine) { .track { cursor: grab; } }
.slide {
  flex: 0 0 100%; scroll-snap-align: center; border-radius: var(--radius); overflow: clip;
  background: var(--tint); position: relative;
}
.carousel.peek-layout .slide { flex-basis: min(78%, 900px); }
.carousel.cards .slide { flex-basis: min(46%, 560px); }
@media (max-width: 700px) { .carousel.cards .slide, .carousel.peek-layout .slide { flex-basis: 86%; } }
.slide button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.slide img {
  width: 100%; aspect-ratio: var(--r, 16 / 10); object-fit: var(--fit, cover); pointer-events: none; user-select: none;
  -webkit-user-drag: none; transition: scale 1.2s var(--ease);
}
.slide.contain img { --fit: contain; padding: 4%; }
@media (hover: hover) { .slide:hover img { scale: 1.03; } }
.slide .zoom {
  position: absolute; right: .8rem; bottom: .8rem; width: 40px; height: 40px; border-radius: 50%;
  background: var(--ink); color: var(--bg); display: grid; place-items: center; opacity: 0; scale: .7;
  transition: opacity .3s var(--ease), scale .4s var(--ease); pointer-events: none;
}
.slide:hover .zoom, .slide:focus-within .zoom { opacity: 1; scale: 1; }
@media (hover: none) { .slide .zoom { opacity: 1; scale: 1; } }

/* Snapped-slide emphasis (scroll-driven, decorative) */
@supports ((animation-timeline: view()) and (animation-range: entry)) {
  @media (prefers-reduced-motion: no-preference) {
    .carousel.cards .slide, .carousel.peek-layout .slide {
      animation: slide-fx linear both; animation-timeline: view(inline);
    }
  }
}
@keyframes slide-fx {
  entry 0% { opacity: .45; scale: .92; }
  entry 100%, exit 0% { opacity: 1; scale: 1; }
  exit 100% { opacity: .45; scale: .92; }
}

.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.markers { display: flex; flex-wrap: wrap; gap: .3rem; }
.markers button {
  width: 36px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center;
}
.markers button::before {
  content: ""; width: 24px; height: 6px; border-radius: 9px; background: var(--ink); opacity: .28;
  transition: opacity .4s var(--ease), width .5s var(--ease);
}
.markers button:hover::before { opacity: .6; }
.markers button[aria-current="true"]::before { opacity: 1; width: 34px; }
.arrows { display: flex; align-items: center; gap: .5rem; }
.count { font-variant-numeric: tabular-nums; font-size: .9rem; opacity: .75; margin-right: .4rem; }
.arrows button {
  width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--ink); background: none; cursor: pointer;
  display: grid; place-items: center; touch-action: manipulation;
  transition: background-color .3s var(--ease), color .3s var(--ease), scale .15s ease-out;
}
.arrows button:hover { background: var(--ink); color: var(--bg); }
.arrows button:active { scale: .9; }

/* ---------- Masonry gallery ---------- */
.gallery { columns: 4 220px; column-gap: 1rem; margin-top: clamp(2.5rem, 5vw, 4rem); }
.gallery button {
  display: block; width: 100%; margin-bottom: 1rem; padding: 0; border: 0; background: var(--tint);
  border-radius: var(--radius); overflow: clip; cursor: zoom-in; break-inside: avoid; position: relative;
}
.gallery img { width: 100%; transition: scale 1s var(--ease), filter .5s var(--ease); }
.gallery button:hover img { scale: 1.05; }
.gallery button::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 0 var(--ink);
  transition: box-shadow .35s var(--ease);
}
.gallery button:hover::after, .gallery button:focus-visible::after { box-shadow: inset 0 0 0 3px var(--ink); }
.gallery-toggle { margin-top: 2rem; }

/* ---------- Contact ---------- */
.contact { position: relative; overflow: clip; }
.contact-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 3rem; align-items: center; }
.contact h2 { font-size: clamp(3rem, 10vw, 9rem); letter-spacing: -.05em; margin: 1.2rem 0 2rem; }
.mail-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.mail {
  font-weight: 700; letter-spacing: -.03em; font-size: clamp(1.4rem, 4vw, 3.2rem); text-decoration: none; overflow-wrap: anywhere;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 2px no-repeat;
  transition: background-size .5s var(--ease);
}
.mail:hover { background-size: 0 2px; background-position: 100% 100%; }
.copy {
  position: relative; border: 1.5px solid var(--ink); background: none; border-radius: 99px; padding: .45rem .9rem;
  cursor: pointer; font-weight: 700; font-size: .85rem;
  transition: background-color .3s var(--ease), color .3s var(--ease), scale .15s ease-out;
}
.copy:hover { background: var(--ink); color: var(--bg-deep); }
.copy:active { scale: .94; }
.links { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 2.4rem; }
.contact-art { justify-self: center; width: min(100%, 420px); }
.contact-art img { width: 100%; border-radius: 50%; aspect-ratio: 1; object-fit: cover; background: var(--sky); }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } .contact-art { width: min(70%, 320px); } }
.foot {
  position: relative; display: flex; justify-content: space-between; align-items: end; gap: 1rem;
  margin-top: 4rem; padding-top: 1.4rem; font-size: .9rem;
}
.to-top {
  display: inline-flex; align-items: center; gap: .5rem; background: none; border: 0; cursor: pointer; font-weight: 700;
}
.to-top img { width: 44px; height: 44px; transition: rotate .6s var(--ease); }
.to-top:hover img { rotate: -14deg; }

/* ---------- Lightbox (<dialog>, top-layer entry/exit) ---------- */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; padding: 0; border: 0;
  background: transparent; color: var(--ink); overflow: hidden;
  overscroll-behavior: contain;
  opacity: 0;
  transition-property: opacity, display, overlay;
  transition-duration: .35s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}
:is(.lightbox[open]):where(:not([data-closing])) {
  opacity: 1;
  @starting-style { opacity: 0; }
}
.lightbox::backdrop {
  background-color: rgb(10 20 70 / 0); overflow: hidden; overscroll-behavior: contain;
  backdrop-filter: blur(0px);
  transition-property: background-color, backdrop-filter, display, overlay;
  transition-duration: .35s;
  transition-behavior: allow-discrete;
}
:is(.lightbox[open]):where(:not([data-closing]))::backdrop {
  background-color: rgb(10 20 70 / .88); backdrop-filter: blur(8px);
  @starting-style { background-color: rgb(10 20 70 / 0); backdrop-filter: blur(0px); }
}
@media (prefers-reduced-motion: reduce) { .lightbox, .lightbox::backdrop { transition-duration: .1s; } }
.lb-stage { position: absolute; inset: 4.5rem 5rem 4.5rem; display: flex; align-items: center; justify-content: center; }
.lb-stage img {
  max-width: 100%; max-height: calc(100dvh - 9rem); width: auto; height: auto; object-fit: contain;
  border-radius: 6px; box-shadow: 0 40px 80px -30px rgb(0 0 0 / .7);
}
.lb-btn {
  position: absolute; width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid var(--ink); background: rgb(10 20 70 / .4);
  cursor: pointer; display: grid; place-items: center; touch-action: manipulation;
  transition: background-color .3s var(--ease), color .3s var(--ease), scale .15s ease-out;
}
.lb-btn:hover { background: var(--ink); color: var(--bg-deep); }
.lb-btn:active { scale: .9; }
.lb-close { right: 1rem; top: 1rem; }
.lb-prev { left: 1rem; top: 50%; translate: 0 -50%; }
.lb-next { right: 1rem; top: 50%; translate: 0 -50%; }
.lb-caption { position: absolute; left: 0; right: 0; bottom: 1.4rem; text-align: center; font-size: .92rem; padding-inline: 5rem; }
.lb-caption b { font-variant-numeric: tabular-nums; margin-right: .6rem; }
@media (max-width: 700px) {
  .lb-stage { inset: 4rem .8rem 6rem; }
  .lb-prev, .lb-next { top: auto; bottom: 1rem; translate: none; }
  .lb-caption { bottom: 5rem; padding-inline: 1rem; }
}

/* ---------- Skill modal (<dialog>, top-layer entry/exit) ---------- */
.skill-modal {
  /* margin:auto re-centres the modal (the global `* { margin: 0 }` reset removes the UA default) */
  margin: auto; width: min(1100px, calc(100vw - 2rem)); max-height: min(88dvh, 900px); padding: 0; border: 0; border-radius: 18px;
  background: var(--bg-deep); color: var(--ink); overflow: hidden; overscroll-behavior: contain;
  box-shadow: 0 50px 100px -30px rgb(0 0 0 / .7);
  opacity: 0;
  transition-property: opacity, translate, display, overlay;
  transition-duration: .35s; transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
  @media (prefers-reduced-motion: no-preference) { translate: 0 30px; }
}
:is(.skill-modal[open]):where(:not([data-closing])) {
  display: flex; flex-direction: column;
  opacity: 1;
  @starting-style { opacity: 0; }
  @media (prefers-reduced-motion: no-preference) { translate: 0 0; @starting-style { translate: 0 30px; } }
}
.skill-modal::backdrop {
  background-color: rgb(10 20 70 / 0); overflow: hidden; overscroll-behavior: contain;
  transition-property: background-color, display, overlay; transition-duration: .35s; transition-behavior: allow-discrete;
}
:is(.skill-modal[open]):where(:not([data-closing]))::backdrop {
  background-color: rgb(10 20 70 / .75);
  @starting-style { background-color: rgb(10 20 70 / 0); }
}
@media (prefers-reduced-motion: reduce) { .skill-modal, .skill-modal::backdrop { transition-duration: .1s; } }
.skill-head {
  position: relative; display: flex; justify-content: space-between; align-items: start; gap: 1rem;
  padding: 1.6rem clamp(1.2rem, 3vw, 2.2rem) 1.2rem; border-bottom: 1.5px solid var(--line);
}
.skill-kicker { font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
.skill-head h2 { font-size: clamp(2rem, 5vw, 3.6rem); margin-top: .3rem; letter-spacing: -.04em; }
.skill-count { margin-top: .4rem; color: var(--ink-soft); font-size: .9rem; }
.skill-close { position: static; flex: none; }
.skill-body { overflow-y: auto; padding: clamp(1.2rem, 3vw, 2.2rem); }
.skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 42vw), 1fr)); gap: .9rem; }
.skill-item {
  position: relative; padding: 0; border: 0; border-radius: var(--radius); overflow: clip; aspect-ratio: 1; cursor: zoom-in;
  background: var(--surface);
}
.skill-item img { width: 100%; height: 100%; object-fit: cover; transition: scale .8s var(--ease); }
.skill-item.contain img { object-fit: contain; padding: 8%; }
.skill-item::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 0 var(--ink); transition: box-shadow .3s var(--ease); }
.skill-item:hover img { scale: 1.06; }
.skill-item:hover::after, .skill-item:focus-visible::after { box-shadow: inset 0 0 0 3px var(--ink); }
.skill-video { margin-bottom: 1.2rem; }
.skill-video iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); background: #000; }
.skill-video p { margin-top: .5rem; font-size: .88rem; color: var(--ink-soft); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; z-index: 95; translate: -50% 0; padding: .7rem 1.2rem; border-radius: 99px;
  background: var(--ink); color: var(--bg-deep); font-weight: 700; opacity: 0; pointer-events: none;
}
