/* ============================================================
   QuickBild — Design System v2 "Paper & Ink"
   Warm editorial studio. Fraunces / Instrument Sans / Space Mono
   Paper, ink, one electric orange. Grain on everything.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;1,9..144,400;1,9..144,500;1,9..144,600&family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  /* surfaces — warm paper */
  --paper: #f5f0e6;
  --paper-2: #ece5d5;
  --paper-3: #e3dac6;
  --card: #fdfaf2;

  /* ink */
  --ink: #191510;
  --ink-2: #2c261e;
  --ink-soft: #564c3e;
  --ink-faint: #8a7d6a;

  /* accent */
  --orange: #ff4f00;
  --orange-deep: #e04400;
  --orange-soft: rgba(255, 79, 0, 0.09);
  --green: #1d6b4a;
  --yellow: #f5c843;

  /* lines */
  --line: rgba(25, 21, 16, 0.14);
  --line-strong: rgba(25, 21, 16, 0.34);
  --line-dark: rgba(245, 240, 230, 0.14);

  --radius-s: 8px;
  --radius: 14px;
  --radius-l: 22px;
  --radius-xl: 30px;

  --maxw: 1280px;
  --pad: clamp(20px, 5vw, 64px);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-snap: cubic-bezier(0.68, -0.4, 0.27, 1.3);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Instrument Sans', system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;

  --shadow-card: 0 1px 2px rgba(25,21,16,0.05), 0 10px 30px -12px rgba(25,21,16,0.18);
  --shadow-lift: 0 2px 4px rgba(25,21,16,0.06), 0 24px 50px -18px rgba(25,21,16,0.28);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

::selection { background: var(--orange); color: var(--paper); }

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ---------- film grain (injected by app.js) ---------- */
.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none;
  z-index: 2000;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 0.9s steps(4) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 1.6%); }
  50% { transform: translate(1.4%, -1.2%); }
  75% { transform: translate(-1%, -1.8%); }
  100% { transform: translate(0, 0); }
}

/* ---------- scroll progress (injected by app.js) ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 100%;
  z-index: 1600;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: var(--orange);
  pointer-events: none;
}

/* ---------- custom cursor (injected by app.js, desktop only) ---------- */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0;
  pointer-events: none;
  z-index: 3000;
  border-radius: 50%;
  will-change: transform;
}
.cursor-dot {
  width: 7px; height: 7px;
  background: var(--orange);
  transform: translate(-50%, -50%);
}
.cursor-ring {
  width: 34px; height: 34px;
  border: 1.5px solid rgba(255, 79, 0, 0.55);
  transform: translate(-50%, -50%);
  transition: width 0.25s var(--ease), height 0.25s var(--ease),
              border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.cursor-ring.is-hover {
  width: 56px; height: 56px;
  background: rgba(255, 79, 0, 0.08);
  border-color: var(--orange);
}
body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: none; }
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none !important; }
}

/* ---------- preloader ---------- */
.preloader {
  position: fixed; inset: 0;
  z-index: 4000;
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.7s var(--ease-out);
}
.preloader.is-done { transform: translateY(-101%); }
.preloader-inner { text-align: center; }
.preloader .blocks { width: 72px; height: 72px; margin: 0 auto 18px; }
.preloader .blk {
  fill: var(--paper);
  opacity: 0;
  transform: translateY(-26px);
  animation: blk-drop 0.5s var(--ease-snap) forwards;
}
.preloader .blk-2 { animation-delay: 0.16s; }
.preloader .blk-3 { fill: var(--orange); animation-delay: 0.32s; }
@keyframes blk-drop {
  to { opacity: 1; transform: translateY(0); }
}
.preloader-word {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: rgba(245, 240, 230, 0.55);
  animation: fade-in 0.6s 0.5s both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }
section { position: relative; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--orange);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "✳";
  font-size: 13px;
  animation: spin-slow 9s linear infinite;
}
@keyframes spin-slow { to { transform: rotate(360deg); } }
.eyebrow.center::before { display: inline; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.h-section {
  font-size: clamp(34px, 4.6vw, 60px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  text-wrap: balance;
  font-variation-settings: "opsz" 60;
}
.h-section em, h1 em {
  font-style: italic;
  font-weight: 500;
  color: var(--orange);
}
.lead {
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--ink-soft);
  max-width: 58ch;
  line-height: 1.65;
}

/* legacy alias — orange accent text */
.grad-text {
  color: var(--orange);
  font-style: italic;
}

/* hand-drawn underline accent */
.u-sketch { position: relative; white-space: nowrap; }
.u-sketch svg {
  position: absolute;
  left: -2%; bottom: -0.18em;
  width: 104%; height: 0.32em;
  overflow: visible;
}
.u-sketch path {
  fill: none;
  stroke: var(--orange);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
}
.is-in .u-sketch path, .u-sketch.is-in path {
  animation: sketch-draw 0.9s 0.45s var(--ease-out) forwards;
}
@keyframes sketch-draw { to { stroke-dashoffset: 0; } }

/* ---------- nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1500;
  transition: transform 0.45s var(--ease), background 0.3s, border-color 0.3s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(245, 240, 230, 0.86);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}
.nav.is-hidden { transform: translateY(-100%); }
.nav-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 76px;
}
.nav.is-scrolled .nav-inner { height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 11px; flex-shrink: 0; }
.brand .mark {
  width: 36px; height: 36px;
  transition: transform 0.45s var(--ease-snap);
}
.brand:hover .mark { transform: rotate(-8deg) scale(1.06); }
.wordmark {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.wordmark b {
  font-weight: 600;
  font-style: italic;
  color: var(--orange);
}

.nav-links {
  display: flex;
  gap: 4px;
  margin-inline: auto;
}
.nav-links a {
  position: relative;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 8px 13px;
  border-radius: 100px;
  transition: color 0.2s, background 0.2s;
}
.nav-links a:hover {
  color: var(--ink);
  background: rgba(25, 21, 16, 0.06);
}
.nav-cta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ---------- buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 13px 26px;
  border-radius: 100px;
  white-space: nowrap;
  overflow: hidden;
  transition: color 0.3s var(--ease), border-color 0.3s, transform 0.3s var(--ease), box-shadow 0.3s;
  will-change: transform;
}
.btn .arr { transition: transform 0.3s var(--ease); display: inline-block; }
.btn:hover .arr { transform: translateX(5px); }

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  z-index: 0;
}
.btn-primary::before {
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  background: var(--orange);
  border-radius: inherit;
  transform: translateY(102%);
  transition: transform 0.4s var(--ease);
}
.btn-primary:hover::before { transform: translateY(0); }
.btn-primary:hover { box-shadow: 0 10px 26px -10px rgba(255, 79, 0, 0.55); }

.btn-ghost {
  border: 1.5px solid var(--line-strong);
  color: var(--ink);
  background: transparent;
  z-index: 0;
}
.btn-ghost::before {
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  background: var(--ink);
  border-radius: inherit;
  transform: translateY(102%);
  transition: transform 0.4s var(--ease);
}
.btn-ghost:hover { color: var(--paper); border-color: var(--ink); }
.btn-ghost:hover::before { transform: translateY(0); }

/* ---------- reveal system ---------- */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.85s var(--ease-out), transform 0.85s var(--ease-out);
}
.reveal[data-d="1"] { transition-delay: 0.08s; }
.reveal[data-d="2"] { transition-delay: 0.16s; }
.reveal[data-d="3"] { transition-delay: 0.24s; }
.reveal[data-d="4"] { transition-delay: 0.32s; }
.reveal[data-d="5"] { transition-delay: 0.40s; }
.reveal.is-in { opacity: 1; transform: none; }

/* word-mask reveal for hero headline */
.wline { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.wline > span {
  display: inline-block;
  transform: translateY(115%) rotate(2deg);
  transform-origin: 0 100%;
  transition: transform 1s var(--ease-out);
}
.is-in .wline > span { transform: none; }
.wline:nth-child(2) > span { transition-delay: 0.1s; }
.wline:nth-child(3) > span { transition-delay: 0.2s; }

/* ---------- shared section rhythm ---------- */
.sec { padding: clamp(80px, 10vw, 150px) 0; }
.sec-head { max-width: 780px; margin-bottom: clamp(40px, 5vw, 72px); }
.sec-head .h-section { margin: 18px 0 18px; }
.sec-head.center { margin-inline: auto; text-align: center; }
.sec-head.center .lead { margin-inline: auto; }

/* section index numbers, editorial */
.sec-no {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
}

/* ---------- footer (shared) ---------- */
.footer {
  background: var(--ink);
  color: var(--paper);
  padding: clamp(60px, 7vw, 96px) 0 0;
  position: relative;
  overflow: hidden;
}
.footer a { transition: color 0.2s; }
.foot-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 56px;
  border-bottom: 1px solid var(--line-dark);
}
.foot-brand .wordmark { color: var(--paper); }
.foot-brand p {
  margin-top: 16px;
  font-size: 15px;
  color: rgba(245, 240, 230, 0.55);
  max-width: 30ch;
  line-height: 1.6;
}
.foot-col h4 {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(245, 240, 230, 0.45);
  margin-bottom: 18px;
}
.foot-col a {
  display: block;
  font-size: 15px;
  color: rgba(245, 240, 230, 0.78);
  padding: 5px 0;
}
.foot-col a:hover { color: var(--orange); }
.foot-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 26px 0;
  font-size: 13.5px;
  color: rgba(245, 240, 230, 0.45);
}
.foot-bottom a { color: rgba(245, 240, 230, 0.6); }
.foot-bottom a:hover { color: var(--orange); }
.foot-social { display: flex; gap: 10px; }
.foot-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-dark);
  font-size: 14px;
  color: rgba(245, 240, 230, 0.7);
  transition: background 0.25s, color 0.25s, transform 0.25s var(--ease-snap);
}
.foot-social a:hover {
  background: var(--orange);
  color: var(--ink);
  border-color: var(--orange);
  transform: rotate(-8deg) scale(1.08);
}

/* giant outline wordmark at page end */
.foot-giant {
  margin-top: 10px;
  overflow: hidden;
  line-height: 0.78;
  pointer-events: none;
  user-select: none;
}
.foot-giant span {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(80px, 16.5vw, 250px);
  letter-spacing: -0.03em;
  text-align: center;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(245, 240, 230, 0.16);
  transform: translateY(46%);
  transition: transform 1.2s var(--ease-out), -webkit-text-stroke-color 0.5s;
}
.foot-giant.is-in span { transform: translateY(28%); }
.foot-giant em {
  font-style: italic;
  -webkit-text-stroke-color: rgba(255, 79, 0, 0.4);
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  .reveal, .wline > span { opacity: 1; transform: none; }
  .grain { display: none; }
}
