/* ============================================================
   PICAR STUDIO — Design System
   Single family: IBM Plex Sans · Logo: Bespoke Serif (SVG)
   ============================================================ */

:root {
  /* — Color (brand-reconciled) — */
  --base:        #F5F3EE;   /* crema — primary surface */
  --base-warm:   #EFECE5;   /* a touch deeper, for quiet panels */
  --ink:         #2B2B2B;   /* nero — primary text */
  --ink-soft:    #4A4945;   /* secondary prose on light */
  --mid:         #8C8880;   /* warm grey — labels, captions, dividers */
  --line:        rgba(140,136,128,0.28);
  --line-soft:   rgba(140,136,128,0.16);
  --accent-green:#4A5C4E;   /* oxidized green — interaction, active tags */
  --accent-blue: #3D4A54;   /* mineral blue-grey — categorical differentiation */
  --on-dark:     #EFECE5;   /* text on graphite */
  --on-dark-mid: #9B978F;

  /* — Spacing tokens (no arbitrary values) — */
  --space-xs: 16px;
  --space-sm: 32px;
  --space-md: 64px;
  --space-lg: 120px;
  --space-xl: 200px;

  /* — Structure — */
  --measure: 1320px;
  --gutter: clamp(24px, 5vw, 96px);
  --nav-h: 76px;

  /* — Type scale (fluid) — */
  --display:   clamp(46px, 6.6vw, 94px);
  --headline:  clamp(33px, 4.2vw, 56px);
  --subhead:   clamp(21px, 2.4vw, 31px);
  --body:      clamp(16px, 1.05vw, 18px);
  --label:     11.5px;
  --caption:   13px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Reset ---------- */
*,*::before,*::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--base);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-weight: 400;
  font-size: var(--body);
  line-height: 1.65;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1,h2,h3,p { margin: 0; }
figure { margin: 0; }

/* Material grain — max ~3% opacity, warmth signal not decoration */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Layout primitives ---------- */
.wrap { width: 100%; max-width: var(--measure); margin: 0 auto; padding-inline: var(--gutter); }
.section { padding-block: var(--space-lg); }

/* ---------- Type roles ---------- */
.display {
  font-size: var(--display);
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: 0.01em;
  text-wrap: balance;
}
.headline {
  font-size: var(--headline);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: 0.005em;
  text-wrap: balance;
}
.subhead {
  font-size: var(--subhead);
  font-weight: 400;
  line-height: 1.25;
}
.body { font-size: var(--body); line-height: 1.68; color: var(--ink-soft); max-width: 62ch; }
.body--wide { max-width: 70ch; }

.label {
  font-size: var(--label);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--mid);
  line-height: 1;
}
.caption {
  font-size: var(--caption);
  color: var(--mid);
  letter-spacing: 0.01em;
}
.mono {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--mid);
}

/* index marker e.g. 01 / 08 */
.index {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--label);
  letter-spacing: 0.12em;
  color: var(--mid);
}

.tag {
  display: inline-flex;
  align-items: center;
  font-size: var(--label);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--mid);
}
.tag--green { color: var(--accent-green); }
.tag--blue  { color: var(--accent-blue); }

/* ---------- Image placeholder slots ---------- */
.slot {
  position: relative;
  background-color: var(--base-warm);
  background-image:
    repeating-linear-gradient(135deg,
      transparent 0, transparent 11px,
      var(--line-soft) 11px, var(--line-soft) 12px);
  overflow: hidden;
}
.slot--dark {
  background-color: #262625;
  background-image:
    repeating-linear-gradient(135deg,
      transparent 0, transparent 11px,
      rgba(239,236,229,0.06) 11px, rgba(239,236,229,0.06) 12px);
}
.slot__tag {
  position: absolute;
  left: var(--space-sm);
  bottom: var(--space-sm);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--mid);
  display: flex;
  gap: 10px;
  align-items: baseline;
  white-space: nowrap;
}
.slot--dark .slot__tag { color: var(--on-dark-mid); }
.slot__tag b { font-weight: 400; color: inherit; opacity: 0.7; }

/* ---------- Links ---------- */
.link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: var(--body);
  color: var(--ink);
  white-space: nowrap;
  transition: opacity .3s var(--ease), color .3s var(--ease);
}
.link__arrow { transition: transform .4s var(--ease); }
.link:hover { color: var(--accent-green); }
.link:hover .link__arrow { transform: translateX(6px); }
.link--ondark { color: var(--on-dark); }
.link--ondark:hover { color: #fff; opacity: 0.85; }

/* ============================================================
   MOTION — entrance reveals (Family A: fade-rise, B: image scale)
   Pre-hidden state is scoped to .has-js, which JS sets synchronously in
   <head> BEFORE first paint — so above-the-fold content never flashes
   visible→hidden, and below-the-fold content is already hidden before it
   scrolls into view (no flicker on entry). Without JS the .has-js scope
   never matches, so everything renders at its visible base. JS adds .is-in
   once, per element, to play the entrance — a single IntersectionObserver,
   no per-frame scroll measurement.
   ============================================================ */
.has-js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: calc(var(--i, 0) * 80ms);
}
.has-js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* Family B — atmospheric continuity (image scale on enter) */
[data-reveal-scale] { overflow: hidden; }
[data-reveal-scale] > .scaler { transform: none; }
.has-js [data-reveal-scale] > .scaler {
  transform: scale(1.045);
  transition: transform 1s var(--ease);
}
.has-js [data-reveal-scale].is-in > .scaler { transform: scale(1); }

@media (prefers-reduced-motion: reduce) {
  .has-js [data-reveal],
  .has-js [data-reveal].is-in { opacity: 1; transform: none; transition: none; }
  .has-js [data-reveal-scale] > .scaler { transform: none; transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
