@property --brand-min-h { syntax: '<length>'; inherits: true; initial-value: 72px; }

@font-face {
  font-family: "Switzer Fallback";
  src: local("Arial");
  ascent-override: 96.67%;
  descent-override: 24.66%;
  line-gap-override: 8.88%;
  size-adjust: 101.38%;
}

@layer orla.reset, orla.tokens, orla.base, orla.layout, orla.components, orla.motion, orla.utilities;

/* ───────────────────────── reset ───────────────────────── */
@layer orla.reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body, h1, h2, h3, p, ul, figure { margin: 0; }
  h1, h2, h3 { font-family: inherit; letter-spacing: inherit; font-weight: inherit; }
  ul { padding: 0; list-style: none; }
  img, video, canvas { display: block; max-width: 100%; }
  a { color: inherit; text-decoration: none; }
  button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
}

/* ───────────────────────── tokens ───────────────────────── */
@layer orla.tokens {
  :root {
    --ink: #24363f;
    --bg: #fff;
    --ghost: #ededed;
    --ink-88: color-mix(in srgb, var(--ink) 88%, transparent);
    --ink-64: color-mix(in srgb, var(--ink) 64%, transparent);
    --ink-48: color-mix(in srgb, var(--ink) 48%, transparent);
    --ink-32: color-mix(in srgb, var(--ink) 32%, transparent);
    --ink-24: color-mix(in srgb, var(--ink) 24%, transparent);
    --ink-08: color-mix(in srgb, var(--ink) 8%, transparent);

    --pad-x: max(16px, 2.7211vw);
    --pad-y: max(16px, 2.1769vw);
    --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);

    --in-y: 12px; --in-blur: 8px; --out-y: 12px; --out-blur: 8px;
    --hero-runway: 80svh;
    --sec2-runway: 220svh;
    --mat-max: 180px; --mat-travel: 520px; --mat-rot: 4deg;
    --measure-lead: 480px; --measure-body: 420px; --measure-h1: 580px;

    --orla-font: 'Switzer', 'Switzer Fallback', 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;

    --fs-display: clamp(80px, 16.667vw, 240px);  --lh-display: .92;  --ls-display: -.055em;
    --fs-h1: clamp(40px, 3.333vw, 48px);         --lh-h1: 1.125;     --ls-h1: -.04em;
    --fs-h2: clamp(24px, 4.667vw, 56px);         --lh-h2: 1.15;      --ls-h2: -.025em;
    --fs-figure: clamp(32px, 3.333vw, 48px);     --lh-figure: 1.15;  --ls-figure: -.06em;
    --fs-lead: clamp(20px, 2.222vw, 32px);       --lh-lead: 1.3;     --ls-lead: -.025em;
    --fs-body-lg: clamp(18px, 2vw, 24px);        --lh-body-lg: 1.33; --ls-body-lg: -.03em;
    --fs-body: clamp(16px, 1.667vw, 20px);       --lh-body: 1.45;    --ls-body: -.02em;
    --fs-small: 14px;                            --lh-small: 1.7;    --ls-small: -.01em;
    --fs-ui: 14px;                               --lh-ui: 1.7;       --ls-ui: 0;
    --fs-title: 16px;                            --lh-title: 1.4;    --ls-title: -.01em;

    --brand-min-h: calc(3 * var(--fs-ui) * var(--lh-ui));
    --fs-brand: min(var(--fs-display), 26svh);
    --shrink-end: .32;
  }
  @media (pointer: coarse) {
    :root { --fs-ui: 16px; }
  }
}

/* ───────────────────────── base ───────────────────────── */
@layer orla.base {
  html {
    overscroll-behavior: none;
    overflow-x: clip;
    background: var(--bg);
  }
  body {
    overscroll-behavior: none;
    overflow-x: clip;
    min-height: 100svh;
    font-family: var(--orla-font);
    font-weight: 300;
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    letter-spacing: var(--ls-body);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  a, button { touch-action: manipulation; }
  :focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
  :focus:not(:focus-visible) { outline: none; }

  .t-display  { font-size: var(--fs-display);  line-height: var(--lh-display);  letter-spacing: var(--ls-display);  font-weight: 300; }
  .t-h1       { font-size: var(--fs-h1);       line-height: var(--lh-h1);       letter-spacing: var(--ls-h1);       font-weight: 300; }
  .t-h2       { font-size: var(--fs-h2);       line-height: var(--lh-h2);       letter-spacing: var(--ls-h2);       font-weight: 300; }
  .t-figure   { font-size: var(--fs-figure);   line-height: var(--lh-figure);   letter-spacing: var(--ls-figure);   font-weight: 300; }
  .t-lead     { font-size: var(--fs-lead);     line-height: var(--lh-lead);     letter-spacing: var(--ls-lead);     font-weight: 300; }
  .t-body-lg  { font-size: var(--fs-body-lg);  line-height: var(--lh-body-lg);  letter-spacing: var(--ls-body-lg);  font-weight: 300; }
  .t-body     { font-size: var(--fs-body);     line-height: var(--lh-body);     letter-spacing: var(--ls-body);     font-weight: 300; }
  .t-title    { font-size: var(--fs-title);    line-height: var(--lh-title);    letter-spacing: var(--ls-title);    font-weight: 400; }
  .t-small    { font-size: var(--fs-small);    line-height: var(--lh-small);    letter-spacing: var(--ls-small);    font-weight: 400; }
  .t-ui       { font-size: var(--fs-ui);       line-height: var(--lh-ui);       letter-spacing: var(--ls-ui);       font-weight: 500; }

  .is-ghost   { color: var(--ghost); }
  .is-demoted { color: var(--ink-64); }
  .is-muted   { color: var(--ink-32); }
}

/* ───────────────────────── layout ───────────────────────── */
@layer orla.layout {
  /* fixed stage behind everything */
  .stage {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: var(--bg);
    pointer-events: none;
    opacity: calc(1 - var(--stage-out, 0));
    &.is-blurring { filter: blur(calc(var(--stage-out, 0) * 24px)); }
    &.is-covered { visibility: hidden; }
  }
  .stage__layer { position: absolute; inset: 0; }
  .stage__b { opacity: var(--x2, 0); }
  .stage video, .stage canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    @media (max-aspect-ratio: 3/4) {
      object-fit: contain;
      object-position: center 92%;
    }
  }
  .stage canvas.plate {
    opacity: 0;
    transition: opacity 240ms linear;
    &.is-live { opacity: 1; }
  }

  /* fixed chrome */
  .chrome {
    position: fixed;
    inset: 0;
    z-index: 5;
    padding: var(--pad-y) var(--pad-x);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
  }

  .orla-main { position: relative; z-index: 1; }

  /* hero */
  .hero { position: relative; height: calc(100svh + var(--hero-runway)); }
  .hero__stage {
    position: sticky;
    top: 0;
    min-height: 100svh;
    padding: var(--pad-y) var(--pad-x);
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
    grid-template-rows: 38svh 1fr auto;
  }
  .hero__nav {
    grid-row: 1; grid-column: 2;
    display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start;
    align-self: start;
  }
  .hero__lede { grid-row: 2; grid-column: 1; max-width: var(--measure-body); align-self: end; }
  .hero__cta  { grid-row: 3; grid-column: 1; justify-self: start; margin-top: 24px; }

  /* craft */
  .sec2 { position: relative; height: calc(100svh + var(--sec2-runway)); }
  .sec2__stage {
    position: sticky;
    top: 0;
    height: 100svh;
    padding: var(--pad-y) var(--pad-x);
    display: grid;
    grid-template-columns: 3fr 2fr;
    grid-template-rows: 1fr auto;
  }
  .sec2__statement {
    grid-row: 1; grid-column: 1;
    align-self: center;
    position: relative;
    z-index: 2;
    max-width: var(--measure-h1);
    padding-top: calc(var(--brand-min-h) + var(--pad-y));
  }
  .specs {
    grid-row: 2; grid-column: 2;
    justify-self: end;
    width: min(100%, 480px);
    position: relative;
    z-index: 2;
  }
  .mats { position: absolute; inset: 0; pointer-events: none; }

  /* shop */
  .shop {
    position: relative;
    background: var(--bg);
    padding: calc(var(--pad-y) * 4) var(--pad-x);
  }
  .shop__head {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
    align-items: end;
    margin-bottom: 64px;
  }
  .shop__title { margin-left: -.04em; }
  .shop__lede  { max-width: var(--measure-lead); }
  .shop__grid {
    display: grid;
    grid-template-columns: repeat(16, minmax(0, 1fr));
    column-gap: 24px;
    row-gap: clamp(64px, 9vw, 136px);
    align-items: start;
  }
  .a1 { grid-column: 1 / span 3;  grid-row: 1; }
  .a2 { grid-column: 4 / span 3;  grid-row: 1; }
  .a3 { grid-column: 9 / span 8;  grid-row: 1; }
  .b1 { grid-column: 1 / span 3;  grid-row: 2; }
  .b2 { grid-column: 6 / span 3;  grid-row: 2; }
  .b3 { grid-column: 9 / span 3;  grid-row: 2; }
}

/* ───────────────────────── components ───────────────────────── */
@layer orla.components {
  .brand {
    display: block;
    pointer-events: auto;
    font-size: var(--fs-brand);
    line-height: var(--lh-display);
    letter-spacing: var(--ls-display);
    font-weight: 300;
    color: var(--ink);
    transform: scale(var(--shrink, 1));
    transform-origin: 0 0;
    will-change: transform;
    white-space: nowrap;
    --in-y: 0px; --in-blur: 14px;
  }
  .brand__initial {
    display: inline-block;
    font-family: 'Playball', cursive;
    font-weight: 400;
    letter-spacing: 0;
    font-size: 1.04em;
    line-height: 0;
    margin-right: -.06em;
    translate: 0 -.01em;
  }

  .burger {
    pointer-events: auto;
    width: 44px; height: 44px;
    display: flex; flex-direction: column; align-items: flex-end; justify-content: center;
    gap: 8px;
    flex: none;
    & span { display: block; width: 36px; height: 1.5px; background: var(--ink); }
  }

  .hero__nav a {
    color: var(--ink);
    transition: color 300ms var(--ease-expo);
    @media (hover: hover) and (pointer: fine) {
      &:hover { color: var(--ink-64); }
    }
  }

  .btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px;
    padding: 10px 24px;
    background: var(--ink-08);
    color: var(--ink);
    border-radius: 4px;
    transition: background-color 300ms var(--ease-expo), color 300ms var(--ease-expo), transform 300ms var(--ease-expo);
    @media (hover: hover) and (pointer: fine) {
      &:hover { background: var(--ink); color: var(--bg); }
    }
    &:active { transform: scale(.97); }
  }

  .word { display: inline-block; }

  .specs__row {
    display: flex; justify-content: space-between; align-items: baseline; gap: 24px;
    padding: 12px 0;
    border-top: 1px solid var(--ink-24);
    &:last-child { border-bottom: 1px solid var(--ink-24); }
    & span:last-child { text-align: right; }
  }

  /* materials collage */
  [data-mat] {
    position: absolute;
    left: var(--x); top: var(--y);
    width: var(--w);
    height: auto;
    max-width: none;
    user-select: none;
    -webkit-user-drag: none;
    --out-blur: 0px;
  }
  [data-mat].is-front { z-index: 3; }
  [data-mat].is-back  { z-index: 1; }
  [data-mat=driftwood]   { --x: 4%;  --y: 74%; --w: 180px; }
  [data-mat=cotton]      { --x: 27%; --y: 6%;  --w: 170px; }
  [data-mat=driftwood-2] { --x: 84%; --y: 30%; --w: 180px; transform: scale(-1, -1); }
  [data-mat=fern]        { --x: 66%; --y: 40%; --w: 135px; transform: scaleX(-1); }
  [data-mat=granite]     { --x: 76%; --y: 5%;  --w: 160px; }

  /* cards */
  .card {
    display: block;
    transition: transform 400ms var(--ease-expo);
    --in-y: 40px; --in-blur: 12px;
    &:active { transform: scale(.985); }
  }
  .card__media {
    aspect-ratio: 1 / 1;
    background: var(--ink-08);
    overflow: hidden;
    &.is-tall { aspect-ratio: 2 / 3; }
    & img {
      width: 100%; height: 100%;
      object-fit: cover;
      transition: transform 700ms var(--ease-expo);
    }
    @media (hover: hover) and (pointer: fine) {
      .card:hover & img { transform: scale(1.03); }
    }
  }
  .card__title {
    display: flex; justify-content: space-between; gap: 16px;
    margin-top: 16px;
    --in-y: 24px; --in-blur: 14px;
  }
  .card__tag { display: block; }
}

/* ───────────────────────── motion (reveal contract) ───────────────────────── */
@layer orla.motion {
  [data-reveal] {
    --in: 1; --out: 0;
    opacity: calc(var(--in) * (1 - var(--out)));
    translate: 0 calc((1 - var(--in)) * var(--in-y) - var(--out) * var(--out-y));
    &.is-anim { filter: blur(calc((1 - var(--in)) * var(--in-blur) + var(--out) * var(--out-blur))); }
    &.is-hidden { visibility: hidden; }
  }
  .js [data-reveal] { --in: 0; }
  [data-reveal=mat] { translate: none; }

  @media (prefers-reduced-motion: reduce) {
    [data-reveal] { translate: none !important; filter: none !important; }
    .btn, .hero__nav a, .card, .card__media img { transition: none; }
  }
}

/* ───────────────────────── utilities ───────────────────────── */
@layer orla.utilities {
  .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .is-covered { visibility: hidden; }
}

/* ───────────────────────── mobile ───────────────────────── */
@media (max-width: 767px) {
  @layer orla.layout {
    .hero__stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: 30svh 1fr auto; }
    .hero__nav { display: none; }

    .shop__head { grid-template-columns: minmax(0, 1fr); gap: 24px; margin-bottom: 40px; }
    .shop__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 16px; }
    .a1, .a2, .b1, .b2, .b3 { grid-column: span 1; grid-row: auto; }
    .a3 { grid-column: 1 / -1; grid-row: auto; }

    .sec2 { height: auto; }
    .sec2__stage {
      position: relative;
      height: auto;
      grid-template-columns: minmax(0, 1fr);
      grid-template-rows: auto 220px auto;
      padding-top: calc(var(--pad-y) * 3);
      padding-bottom: calc(var(--pad-y) * 3);
    }
    .sec2__statement { grid-row: 1; grid-column: 1; align-self: start; padding-top: 0; }
    .mats {
      position: relative; inset: auto;
      grid-row: 2; grid-column: 1;
      height: 220px;
      overflow: clip;
      margin-inline: calc(-1 * var(--pad-x));
    }
    .specs { grid-row: 3; grid-column: 1; justify-self: stretch; width: 100%; }
  }
  @layer orla.components {
    [data-mat] { width: calc(var(--w) * .66); }
    [data-mat=driftwood]   { --x: -4%; --y: 58%; }
    [data-mat=granite]     { --x: 34%; --y: 4%; }
    [data-mat=fern]        { --x: 26%; --y: 42%; }
    [data-mat=cotton]      { --x: 64%; --y: 50%; }
    [data-mat=driftwood-2] { --x: 62%; --y: 0%; }
  }
}
