/* =============================================================
   Vii Studio — Foundations
   Reset · tokens · base elements · utilities · motion · overlays
   ============================================================= */

/* ---- Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Smooth colour transitions across the whole UI */
*,
*::before,
*::after {
  transition: color .35s ease,
              background-color .35s ease,
              border-color .35s ease,
              fill .35s ease;
}

/* ---- Design tokens ---- */
:root {
  /* Surfaces */
  --paper:  #f3f1ea;
  --paper2: #ffffff;

  /* Ink */
  --ink:   #16140d;
  --ink-2: #6a6357;
  --ink3:  #a9a294;

  /* Accent */
  --acc:  #2b39ff;
  --acc2: #1a26d1;
  --soft: #e6e8ff;

  /* Hairlines */
  --line:  rgba(22, 20, 13, .15);
  --line2: rgba(22, 20, 13, .07);

  /* Type */
  --disp: 'Unbounded', sans-serif;
  --sans: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Layout */
  --pad: clamp(18px, 4.5vw, 64px);
  /* Max content width; on ultra-wide screens the side gutter grows to centre
     content at --maxw while section backgrounds stay full-bleed. Below ~1628px
     it collapses to --pad, so normal screens are unchanged. */
  --maxw: 1500px;
  --gut: max(var(--pad), calc((100% - var(--maxw)) / 2));
  /* Viewport-based gutter — for full-bleed children whose own parent is already
     capped (so `100%` would be 1500, not the viewport). Centres content at --maxw. */
  --gutvw: max(var(--pad), calc(50vw - var(--maxw) / 2));
}

/* ---- Base elements ---- */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* Clip transient horizontal overflow (reveal translateX, 3D transforms) at the
     root — iOS Safari ignores body-only overflow-x:hidden, which caused a blank
     strip on the right while scrolling. `clip` avoids the scroll-container side
     effects of `hidden` (won't break sticky / smooth-scroll). */
  overflow-x: clip;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a   { color: inherit; text-decoration: none; }

::selection { background: var(--acc); color: #fff; }

::-webkit-scrollbar       { width: 9px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: var(--ink); }

/* ---- Layout helpers ---- */
#smooth { position: relative; z-index: 2; }

.wrap { padding: clamp(64px, 10vh, 140px) var(--gut); }

/* ---- Section headings ---- */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.eyebrow b { color: var(--acc); font-weight: 600; }

.sec-h {
  font-family: var(--disp);
  font-weight: 800;
  font-size: clamp(32px, 6vw, 80px);
  line-height: .98;
  letter-spacing: -.04em;
}
.sec-h em { font-style: normal; color: var(--acc); }

.sec-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  flex-wrap: wrap;
  margin-bottom: clamp(36px, 5vh, 60px);
}
.sec-top .eyebrow { margin-bottom: 16px; }

.sec-intro {
  max-width: 380px;
  font-size: clamp(14px, 1.5vw, 17px);
  line-height: 1.6;
  color: var(--ink-2);
}

/* ---- Buttons ---- */
.btn,
.btn-out {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 17px 30px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
}

.btn {
  color: #fff;
  background: var(--ink);
  border: none;
  transition: background .25s, transform .2s;
}
.btn:hover { background: var(--acc); transform: translateY(-2px); }
.btn span { transition: transform .25s; }
.btn:hover span { transform: translate(3px, -3px); }

.btn-out {
  padding: 17px 26px;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  transition: background .25s, color .25s;
}
.btn-out:hover { background: var(--ink); color: #fff; }

/* ---- Decorative overlays ---- */
.noise {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .03;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.prog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--acc);
  transform: scaleX(0);
  transform-origin: 0 50%;
  z-index: 400;
  pointer-events: none;
}

/* ---- Cursor ring (native cursor kept) ---- */
.cur-r {
  position: fixed;
  z-index: 9998;
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  opacity: .4;
  transform: translate(-50%, -50%);
  transition: width .3s, height .3s, border-color .3s;
  pointer-events: none;
}
.cur-r.big { width: 78px; height: 78px; border-color: var(--acc); opacity: .9; }

@media (hover: none) {
  .cur-r { display: none; }
}

/* ---- Preloader ---- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  transition: transform .85s cubic-bezier(.76, 0, .24, 1);
}
.loader.hide { transform: translateY(-100%); }

.ld-c { text-align: center; }
.ld-glyph {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(44px, 9vw, 76px);
  line-height: 1;
  color: var(--acc);
  animation: ld-pulse 1.2s ease-in-out infinite;
}
.ld-name {
  margin: 24px 0 18px;
  font-family: var(--disp);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .32em;
  color: var(--paper);
}
.ld-bar {
  width: 200px;
  height: 2px;
  margin: 0 auto;
  background: rgba(255, 255, 255, .16);
  overflow: hidden;
}
.ld-bar i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--acc);
  transition: width .2s linear;
}
.ld-pct {
  margin-top: 13px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  color: rgba(255, 255, 255, .55);
}

@keyframes ld-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .45; transform: scale(.9); }
}

/* ---- Scroll-reveal system ---- */
.rv {
  opacity: 0;
  transform: translateY(32px);
  clip-path: inset(0 0 0 0);
  filter: blur(0);
  transition: opacity .85s ease,
              transform 1s cubic-bezier(.16, 1, .3, 1),
              filter .85s ease,
              clip-path 1s cubic-bezier(.16, 1, .3, 1);
}
.rv.on { opacity: 1; transform: none; clip-path: inset(0 0 0 0); filter: blur(0); }

.rv-left  { transform: translateX(-70px); }
.rv-right { transform: translateX(70px); }
.rv-zoom  { transform: scale(.84); }
.rv-blur  { transform: translateY(14px); filter: blur(18px); }
.rv-clip  { transform: translateY(14px); clip-path: inset(0 0 100% 0); }
.rv-rot   { transform: perspective(1200px) rotateX(22deg) translateY(44px); transform-origin: 50% 0; }

.stagger > * {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .6s ease, transform .7s cubic-bezier(.16, 1, .3, 1);
}
.stagger.on > * { opacity: 1; transform: none; }
.stagger.on > *:nth-child(1) { transition-delay: .04s; }
.stagger.on > *:nth-child(2) { transition-delay: .09s; }
.stagger.on > *:nth-child(3) { transition-delay: .14s; }
.stagger.on > *:nth-child(4) { transition-delay: .19s; }
.stagger.on > *:nth-child(5) { transition-delay: .24s; }
.stagger.on > *:nth-child(6) { transition-delay: .29s; }
.stagger.on > *:nth-child(7) { transition-delay: .34s; }
.stagger.on > *:nth-child(8) { transition-delay: .39s; }

.stagger-zoom  > * { transform: scale(.86); }
.stagger-left  > * { transform: translateX(-44px); }
.stagger-right > * { transform: translateX(44px); }
.stagger-rot { perspective: 1200px; }
.stagger-rot > * { transform: rotateX(26deg) translateY(30px); transform-origin: 50% 0; }

/* Hero entrance (plays once the page is revealed) */
@keyframes hero-clip {
  from { clip-path: inset(0 0 118% 0); transform: translateY(26px); }
  to   { clip-path: inset(-15% 0 -15% 0); transform: none; }
}
@keyframes hero-fade {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}

/* Smooth-scroll engine hook */
.smooth-on { scroll-behavior: auto; }
.smooth-on #smooth {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 2;
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
  .rv, .stagger > * { transition: opacity .4s; }
}
