/* Niblux portfolio, design iteration 6: a hero with a tilted, drifting wall of the captures over a gallery of identical tiles.
   Identity: Montserrat (400 display, 500 actions), ink #121826, blue #2f80ed, white ground, one blue->pink corner glow.
   Spacing: one scale on 4/8 steps (phone values here, larger widths below). Motion: transforms and
   opacity only; the hero copy and the wall arrive once on load, then the wall's columns drift slowly (pausable);
   the tiles rise once in a short stagger (portfolio.js), hover scrolls a capture a little and lifts its phone.
   Without JS there is no wall and every tile is a plain link; with reduced motion the wall stands still. */
:root {
  --ink: #121826; --soft: #5d6677; --muted: #8b93a3; --line: #e6e9ef; --blue: #2f80ed; --blue-soft: #eaf2fe; --blue-light: #7db2f9;
  --btn: #1f6fde; --btn-hover: #1b63cc; --btn-active: #1756b3;   /* filled buttons: white text 4.79 / 5.67 / 6.96:1 (#2f80ed is 3.87) */
  --ink-soft: #b4bac6; --wash: #f6f8fb;
  /* theme roles: page ground, dialog surface, footer block, phone bezels, blue as text/ring, shadow tint, glow stops */
  color-scheme: light;
  --bg: #fff; --surface: #fff; --foot: #121826; --on-foot: #fff; --bezel: #121826; --blue-text: var(--blue);
  --shade: 18, 24, 38; --scrim: rgba(18, 24, 38, .62);
  --glow-1: rgba(47, 128, 237, .24); --glow-2: rgba(140, 110, 230, .13); --glow-3: rgba(236, 72, 153, .08);
  --logo-light: block; --logo-dark: none;   /* which header logo shows */
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --r: 14px;

  --gut: 20px;            /* page side margin */
  --sp-tile: 16px;        /* capture -> its name */
  --sp-meta: 4px;         /* name -> trade */
  --sp-text: 16px;        /* h1 -> lead; dialog head gaps */
  --gap-x: 24px;          /* between gallery columns */
  --gap-y: 40px;          /* between gallery rows */
  --sp-row: 40px;         /* hero copy -> its wall strip; footer action -> its last row */
  --sp-section: 64px;     /* gallery -> footer, footer padding */
  --sp-break: 96px;       /* hero -> gallery: the gallery starts as its own block */
}
@media (min-width: 640px) { :root { --gut: 32px; --sp-text: 24px; --gap-y: 48px; --sp-row: 48px; --sp-section: 96px; --sp-break: 144px; } }
@media (min-width: 1100px) { :root { --gut: 48px; --gap-x: 32px; --gap-y: 64px; --sp-row: 64px; --sp-section: 128px; --sp-break: 192px; } }

/* dark: Niblux ink grounds in steps (page < dialog < footer < wash), near-white text, hairlines at low alpha, a lighter
   blue for text and rings (6.9:1 on the ground), a stronger glow. The <head> script sets data-theme before the first
   paint (saved choice, else the system's); the media copy below is the same palette for pages without JS. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8ebf2; --soft: #9aa3b4; --line: rgba(255, 255, 255, .1); --blue-text: #5c9cf5;
  --ink-soft: #9aa3b4; --wash: #1a2130;
  --bg: #0b0f19; --surface: #121826; --foot: #151c2b; --on-foot: #e8ebf2; --bezel: #2a3245;
  --shade: 0, 0, 0; --scrim: rgba(3, 5, 10, .72);
  --glow-1: rgba(47, 128, 237, .34); --glow-2: rgba(140, 110, 230, .2); --glow-3: rgba(236, 72, 153, .13);
  --logo-light: none; --logo-dark: block;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --ink: #e8ebf2; --soft: #9aa3b4; --line: rgba(255, 255, 255, .1); --blue-text: #5c9cf5;
    --ink-soft: #9aa3b4; --wash: #1a2130;
    --bg: #0b0f19; --surface: #121826; --foot: #151c2b; --on-foot: #e8ebf2; --bezel: #2a3245;
    --shade: 0, 0, 0; --scrim: rgba(3, 5, 10, .72);
    --glow-1: rgba(47, 128, 237, .34); --glow-2: rgba(140, 110, 230, .2); --glow-3: rgba(236, 72, 153, .13);
    --logo-light: none; --logo-dark: block;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
html:has(.preview[open]) { overflow: hidden; }   /* the page stays put behind the preview */
body { margin: 0; overflow-x: clip; background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 "Montserrat", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul { margin: 0; padding: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; touch-action: manipulation; }
button { font: inherit; color: inherit; touch-action: manipulation; }
::selection { background: var(--blue); color: #fff; }
:focus-visible { outline: 2px solid var(--blue-text); outline-offset: 4px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--gut); top: 8px; z-index: 10; padding: 8px 16px; border-radius: 8px; background: var(--ink); color: var(--bg);
  transform: translateY(-200%); }
.skip:focus-visible { transform: none; }
.wrap { width: 100%; max-width: 1440px; margin-inline: auto; padding-inline: var(--gut); }
.arrow { flex: none; width: .75em; height: .75em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
  transition: transform 200ms var(--ease-out); }

/* ---------------------------------------------------------------- header */
.top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; height: 72px; }
.top__logo img { height: 28px; width: auto; }
.top__logo .on-light { display: var(--logo-light); }
.top__logo .on-dark { display: var(--logo-dark); }
.top__end { display: flex; align-items: center; gap: 8px; }
.top__link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 500; font-size: 15px; }
@media (min-width: 640px) { .top__end { gap: 16px; } }
@media (min-width: 1100px) { .top { height: 96px; } .top__logo img { height: 32px; } }
/* the theme button: a sun (light) whose core grows and is cut into a moon while its rays turn away (dark) */
.theme { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer;
  transition: background-color 150ms ease; }
.theme[hidden] { display: none; }
.theme:focus-visible { outline-offset: 0; border-radius: 50%; }
.theme svg { width: 20px; height: 20px; overflow: visible; }
.theme__core { fill: currentColor; transform-origin: 12px 12px; }
.theme__rays { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; transform-origin: 12px 12px; }
.theme__cut { transform: translate(8px, -8px); }
[aria-pressed="true"] .theme__core { transform: scale(1.85); }
[aria-pressed="true"] .theme__cut { transform: none; }
[aria-pressed="true"] .theme__rays { opacity: 0; transform: rotate(90deg) scale(.5); }

/* ---------------------------------------------------------------- hero: the title beside a tilted, drifting wall of the captures
   Phones: the copy, then a short strip of the wall. From 900px: one screen tall at most, the copy on the left over the
   wall's faded edge. The wall only exists with JS (portfolio.js builds it); without it the hero is the copy alone. */
.hero { position: relative; overflow-x: clip; padding-top: 24px; padding-bottom: var(--sp-row); margin-bottom: var(--sp-break); }
/* only the text and the button take the pointer: the copy's empty box must not cover the wall beside it */
.hero__copy { position: relative; z-index: 2; pointer-events: none; }
.hero h1 span, .hero__lead, .hero .btn { pointer-events: auto; }
.hero h1 { font-size: clamp(40px, 12.4vw, 104px); font-weight: 600; line-height: .96; letter-spacing: -.035em; }
.hero h1 span { display: block; width: fit-content; }
.hero h1 span + span { color: var(--blue-text); }
.hero__lead { margin-top: var(--sp-text); max-width: 30ch; font-size: clamp(17px, 1.5vw, 20px); line-height: 1.45; color: var(--soft); text-wrap: pretty; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 10px;
  background: var(--btn); color: #fff; font-weight: 500; font-size: 15px; transition: transform 160ms var(--ease-out), background-color 150ms ease; }
.btn:active { transform: scale(.97); background: var(--btn-active); }
.hero .btn { margin-top: var(--sp-text); }
.glow { position: absolute; z-index: 0; right: 0; top: -96px; width: min(1100px, 100vw); height: calc(100% + 480px); pointer-events: none;
  transform-origin: 100% 0;
  background: radial-gradient(ellipse 70% 62% at 100% 0%, var(--glow-1) 0%, var(--glow-2) 44%, var(--glow-3) 70%, rgba(236, 72, 153, 0) 100%); }

/* the wall: a clipped window (fading at its edges) onto one plane, tilted as a whole, of columns that drift.
   The mask fades it out over --fade-l (left, toward the copy), --fade-t (top) and from --fade-b (bottom). */
.wall { --fade-l: 0%; --fade-t: 22%; --fade-b: 70%;
  position: relative; z-index: 1; overflow: clip; height: 300px; margin-top: var(--sp-row); margin-bottom: calc(-1 * var(--sp-row));
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade-l)), linear-gradient(to bottom, transparent, #000 var(--fade-t), #000 var(--fade-b), transparent);
          mask-image: linear-gradient(to right, transparent, #000 var(--fade-l)), linear-gradient(to bottom, transparent, #000 var(--fade-t), #000 var(--fade-b), transparent);
  -webkit-mask-composite: source-in; mask-composite: intersect; }
.wall:empty { display: none; }
/* a click shield over the faded bands: only captures at least 3/4 visible take the pointer (and show it), the rest is inert */
.wall::after { content: ""; position: absolute; inset: 0; z-index: 1;
  --hit-l: calc(var(--fade-l) * .75); --hit-t: calc(var(--fade-t) * .75); --hit-b: calc(var(--fade-b) + (100% - var(--fade-b)) * .25);
  clip-path: polygon(0 0, 100% 0, 100% var(--hit-t), var(--hit-l) var(--hit-t), var(--hit-l) var(--hit-b), 100% var(--hit-b), 100% 100%, 0 100%); }
.wall__plane { --tilt: perspective(1800px) rotateX(26deg) rotateY(8deg) rotateZ(-9deg);
  --gap: 10px; position: absolute; inset: -70% -45%; display: flex; align-items: flex-start; gap: var(--gap); transform: var(--tilt); transform-origin: 50% 45%; }
/* a column is as tall as its doubled list (not stretched to the plane: align-items above), so its -50% drift is exactly one list */
.wall__col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); transform: translateY(var(--rest, 0)); }
.wall__col:nth-child(n+4) { display: none; }   /* 3 columns, 4 from 1100px */
.wall__item { position: relative; display: block; flex: none; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 10px; background: var(--wash);
  box-shadow: 0 0 0 1.5px var(--line), 0 24px 40px -28px rgba(var(--shade), .5); cursor: pointer;
  transition: transform 250ms var(--ease-out), box-shadow 250ms var(--ease-out); }
.wall__item img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
/* shown by portfolio.js only while the columns can drift */
.wall__pause { position: absolute; z-index: 3; right: var(--gut); bottom: 4px; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--soft); font-size: 14px; cursor: pointer; transition: color 150ms ease; }
.wall__pause[hidden] { display: none; }
.wall__pause svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.is-paused .i-pause, .hero:not(.is-paused) .i-play { display: none; }

@media (min-width: 640px) { .wall { height: 380px; } .wall__plane { --gap: 12px; inset: -70% -40% -70% -20%; } }
@media (min-width: 900px) {
  .hero:has(.wall__plane) { display: grid; align-content: center; min-height: clamp(520px, calc(100svh - 96px - 120px), 760px); padding-block: 48px; }
  .hero h1 { font-size: min(6.6vw, 112px); }
  .hero__copy > * { max-width: 40%; }
  .hero__copy > h1 { max-width: none; }
  .wall { --fade-l: 34%; --fade-t: 24%; --fade-b: 72%; position: absolute; inset: 0 0 0 38%; height: auto; margin: 0; }
  .wall__plane { --gap: 14px; inset: -40% -24% -40% -4%; }
}
@media (min-width: 1100px) {
  .hero:has(.wall__plane) { min-height: clamp(560px, calc(100svh - 96px - 120px), 780px); }
  .hero__copy > * { max-width: 34%; }
  .wall { left: 40%; }
  .wall__col:nth-child(4) { display: flex; }
}
@media (min-width: 1440px) { .hero__copy > * { max-width: 30rem; } }

/* ---------------------------------------------------------------- gallery: one tile, 1 / 2 / 3 per row */
.gallery { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap-y) var(--gap-x); list-style: none; }
@media (min-width: 600px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.tile { display: block; border-radius: var(--r); }
.tile:focus-visible { outline-offset: 8px; border-radius: calc(var(--r) + 4px); }
/* the desktop capture, cropped to its top at 16:10, with the phone rising from the frame's lower edge */
.tile__shot { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--r); background: var(--wash);
  transition: transform 160ms var(--ease-out); }
.tile__shot::after { content: ""; position: absolute; inset: 0; z-index: 2; border: 1.5px solid var(--line); border-radius: inherit; pointer-events: none; }
.tile__shot img { width: 100%; transition: transform 1.2s var(--ease-in-out); }
/* a background keeps Chrome from drawing the moving capture as a bare GPU texture (sampled without mipmaps, so its
   thin light lines flashed during the hover scroll); the layer is painted like the still image instead */
.tile__shot img:first-child { background: var(--wash); }
.tile__shot img + img { position: absolute; z-index: 1; right: 6%; top: 34%; width: 22%; height: auto; aspect-ratio: 390 / 844;
  border: 3px solid var(--bezel); border-radius: 12px; background: #fff; object-fit: cover; object-position: top;
  box-shadow: 0 16px 32px -16px rgba(var(--shade), .55); transition: transform 600ms var(--ease-out); }
.tile h3 { margin-top: var(--sp-tile); font-size: 20px; font-weight: 400; line-height: 1.3; letter-spacing: -.01em; text-wrap: balance; }
.tile p { margin-top: var(--sp-meta); font-size: 15px; color: var(--soft); }
.tile:active .tile__shot { transform: scale(.98); }

/* hover (fine pointers) and keyboard focus: the capture scrolls a little, the phone lifts */
.tile:focus-visible .tile__shot img:first-child { transform: translateY(-12%); }
.tile:focus-visible .tile__shot img + img { transform: translateY(-10%); }
@media (hover: hover) and (pointer: fine) {
  .tile:hover .tile__shot img:first-child { transform: translateY(-12%); }
  .tile:hover .tile__shot img + img { transform: translateY(-10%); }
  .tile:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
  .top__link:hover .arrow, .foot__cta:hover .arrow, .preview__visit:hover .arrow { transform: translate(2px, -2px); }
  .btn:hover { background: var(--btn-hover); }
  .btn:active { background: var(--btn-active); }
  .btn:hover .arrow--down { transform: translateY(2px); }
  .wall__col:hover { animation-play-state: paused; }
  .wall__item:hover { transform: scale(1.04); box-shadow: 0 0 0 2px var(--blue-text), 0 32px 48px -28px rgba(var(--shade), .6); }
  .wall__pause:hover { color: var(--ink); }
  .preview__close:hover, .theme:hover { background: var(--line); }
}

/* ---------------------------------------------------------------- preview: one native dialog, filled from the tile */
.preview { width: min(1200px, calc(100% - 24px)); max-width: none; max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: var(--r);
  background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); overflow: auto; overscroll-behavior: contain; }
.preview::backdrop { background: var(--scrim); }
.preview__head { position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--sp-text);
  padding: 16px 16px 16px 20px; background: var(--surface); }
.preview__title { grid-column: 1; grid-row: 1; min-width: 0; }
.preview h2 { font-size: clamp(22px, 2.4vw, 32px); font-weight: 400; line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; }
.preview__visit { grid-column: 1; grid-row: 2; justify-self: start; }
.preview form { grid-column: 2; grid-row: 1; align-self: start; }
.preview__trade { margin-top: var(--sp-meta); font-size: 15px; color: var(--soft); }
.preview__close { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--wash); cursor: pointer;
  transition: background-color 150ms ease; }
.preview__close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.preview__media { display: grid; gap: 24px; padding: 0 20px 20px; }
.preview__desk { overflow: hidden; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--wash); }
.preview__desk img { width: 100%; }
.preview__phone { width: min(56%, 220px); border: 4px solid var(--bezel); border-radius: 20px; background: #fff; }
@media (min-width: 760px) {
  .preview { width: min(1200px, calc(100% - 2 * var(--gut))); max-height: calc(100dvh - 2 * var(--gut)); }
  .preview__head { grid-template-columns: minmax(0, 1fr) auto auto; padding: 24px 24px 24px 32px; }
  .preview__visit { grid-column: 2; grid-row: 1; }
  .preview form { grid-column: 3; align-self: center; }
  /* the desktop capture large, the phone at its side and kept in view while the capture scrolls */
  .preview__media { grid-template-columns: minmax(0, 1fr) clamp(160px, 18%, 220px); gap: 32px; align-items: start; padding: 0 32px 32px; }
  .preview__phone { position: sticky; top: calc(74.5px + 1.15 * clamp(22px, 2.4vw, 32px)); width: 100%; }   /* the sticky head: 24 + name + 4 + trade (22.5) + 24 */
}

/* ---------------------------------------------------------------- footer: one action on ink */
.foot { margin-top: var(--sp-section); padding: var(--sp-section) 0 calc(var(--sp-section) / 2); background: var(--foot); color: var(--on-foot); }
.foot__cta { display: inline-block; font-size: clamp(34px, 6vw, 96px); font-weight: 400; line-height: 1; letter-spacing: -.035em; }
.foot__cta .arrow { display: inline-block; width: .5em; height: .5em; margin-left: .2em; vertical-align: .05em; stroke-width: 1; }
.foot__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-text) 32px; margin-top: var(--sp-row);
  padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, .14); font-size: 15px; color: var(--ink-soft); }
.foot__row img { height: 24px; width: auto; margin-right: auto; }
.foot__row a { display: inline-flex; align-items: center; min-height: 44px; color: var(--on-foot); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .3); text-underline-offset: .2em; }
.foot :focus-visible { outline-color: var(--blue-light); }

/* ---------------------------------------------------------------- motion */
.preview, .preview::backdrop { transition: opacity 200ms var(--ease-out), overlay 200ms allow-discrete, display 200ms allow-discrete; }
.preview:not([open]), .preview:not([open])::backdrop { opacity: 0; }
@starting-style { .preview[open], .preview[open]::backdrop { opacity: 0; } }

@media (prefers-reduced-motion: no-preference) {
  .glow { animation: glow-in 1.6s var(--ease-out) both; }
  html { scroll-behavior: smooth; }
  .hero h1 span, .hero__lead, .hero .btn { animation: rise 800ms var(--ease-out) both; }
  .hero h1 span + span { animation-delay: 100ms; }
  .hero__lead { animation-delay: 200ms; }
  .hero .btn { animation-delay: 300ms; }
  /* the wall swings up into its tilt once, then each column drifts for good, every other one the other way;
     a column stops under the pointer, and all stop with the pause button or once the hero is off screen */
  .wall__plane { animation: wall-in 1.6s var(--ease-out) 150ms both; }
  .wall__col { animation: drift var(--dur, 90s) linear var(--delay, 0s) infinite; }
  .wall__col:nth-child(even) { animation-direction: reverse; }
  .is-paused .wall__col, .is-offscreen .wall__col { animation-play-state: paused; }
  /* portfolio.js adds .reveal to <html>, then .in (with a short per-row stagger) to each tile as it enters */
  .reveal .tile { transition: opacity 600ms var(--ease-out), transform 700ms var(--ease-out); }
  .reveal .tile:not(.in) { opacity: 0; transform: translateY(16px); }
  /* the preview also rises a little as it opens */
  .preview { transition-property: opacity, transform, overlay, display; transition-duration: 250ms; }
  .preview:not([open]) { transform: translateY(12px) scale(.98); }
  @starting-style { .preview[open] { transform: translateY(12px) scale(.98); } }
  /* the theme icon morphs while the new theme opens as a circle from the button (portfolio.js, View Transitions) */
  .theme__core, .theme__cut { transition: transform 600ms var(--ease-out); }
  .theme__rays { transition: transform 600ms var(--ease-out), opacity 300ms var(--ease-out); }
}
/* the reveal is one clip-path animation on the new snapshot (portfolio.js), over the old one left as it is */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
@keyframes glow-in { from { opacity: 0; transform: scale(.85); } }
@keyframes wall-in { from { opacity: 0; transform: perspective(1800px) rotateX(52deg) rotateY(8deg) rotateZ(-4deg) translateY(16%); } }
@keyframes drift { from { transform: translateY(0); } to { transform: translateY(calc(-50% - var(--gap) / 2)); } }   /* the list is doubled */
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  /* no displacement: hover and focus keep only the focus ring and the underline; the preview only fades */
  .tile .tile__shot, .tile .tile__shot img, .arrow, .wall__item { transform: none !important; }
  /* the wall stays: tilted and still, each column at its own resting offset, and it only fades in */
  .wall__plane { animation: fade 600ms ease both; }
}
