/* ============================================================================
   MIGOT STUDIO — COMING SOON
   Design system: "Zmysłowy Brutalizm" / Sensual Brutalism
   Palette (strict):
     --wegiel  #1A1C23   ground
     --kwarc   #F2F4F8   logo / primary type
     --cynk    #DFE3EA   rules, mesh, telemetry
     --uran    #CCFF00   accent — used twice, nowhere else

   Layer order, back to front:
     0  #bg-canvas      the membrane
     1  .logo__fallback the O, if WebGL never arrives
     2  .logo__letters  m i g t + studio, vector
     3  #o-canvas       the particle cloud — ABOVE the letters, additive,
                        so the grains actually throw light onto them
     9  .grain
   ========================================================================= */

/* ---------- 1. Fonts --------------------------------------------------- */

@font-face {
  font-family: "PP Fraktion Mono";
  src: url("../assets/fonts/PPFraktionMono-Light.woff2") format("woff2");
  font-weight: 300; font-style: normal; font-display: block;
}
@font-face {
  font-family: "PP Fraktion Mono";
  src: url("../assets/fonts/PPFraktionMono-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: block;
}
@font-face {
  font-family: "PP Fraktion Mono";
  src: url("../assets/fonts/PPFraktionMono-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: block;
}

/* ---------- 2. Tokens -------------------------------------------------- */

:root {
  --wegiel: #1A1C23;
  --kwarc:  #F2F4F8;
  --cynk:   #DFE3EA;
  --uran:   #CCFF00;

  --mono: "PP Fraktion Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Geometry measured off the source SVG, expressed as percentages so the
     cloud stays welded to the letter at every viewport size.
       wordmark bbox  x 270.86 → 2637.13   (w 2366.27)
                      y 604.01 → 1470.01   (h  866.00)
       letter "O"     circle cx 2036.66 cy 1014.57 r 232.54
     The canvas spans 2.6 × the O's diameter, centred on it: the cloud body
     sits on the original circle and the rest is room for the halo to fall
     across the neighbouring letters. */
  --lockup-ratio: 2.732413;
  --o-left:    49.072755%;
  --o-top:    -22.402317%;
  --o-size-x:  51.102090%;
  --o-size-y: 139.631414%;

  --edge: clamp(16px, 2.4vmin, 30px);
}

/* ---------- 3. Reset / page ------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  overflow: hidden;
}

body {
  background: var(--wegiel);
  color: var(--kwarc);
  font-family: var(--mono);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  overscroll-behavior: none;
  touch-action: none;
  cursor: crosshair;
}

/* ---------- 4. The membrane ------------------------------------------- */

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1800ms ease;
}
.is-ready #bg-canvas { opacity: 1; }

/* ---------- 5. Stage --------------------------------------------------- */

.stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
  z-index: 1;
  /* the room the lockup leans in */
  perspective: 1500px;
  perspective-origin: 50% 50%;
}

.lockup {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(26px, 5.2vh, 62px);
  opacity: 0;
  transition: opacity 1200ms cubic-bezier(.16,1,.3,1);
}
.is-ready .lockup { opacity: 1; }

/* ---------- 6. Lockup: SVG letters + particle "O" ---------------------- */

.logo {
  position: relative;
  width: min(60vw, 88vh);
  aspect-ratio: var(--lockup-ratio);
  will-change: transform;
  backface-visibility: hidden;
}

.logo__letters {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  display: block;
  color: var(--kwarc);
  z-index: 2;
  pointer-events: none;
}

/* The cloud sits ON TOP of the letters. Its canvas is transparent and every
   fragment is additive, so it can only add light — the vector edges stay as
   sharp as they were, and the grains bleed across them. */
.logo__o {
  position: absolute;
  left:   var(--o-left);
  top:    var(--o-top);
  width:  var(--o-size-x);
  height: var(--o-size-y);
  display: block;
  z-index: 3;
  pointer-events: none;
}

/* Safety net: the O as a plain Kwarc disc on the exact original geometry.
   Visible by default, removed once the cloud is confirmed running — so the
   wordmark is never short a letter, JS disabled included. */
.logo__fallback {
  position: absolute;
  left:   64.791800%;
  top:    20.556600%;
  width:  19.654650%;
  height: 53.704390%;
  border-radius: 50%;
  background: var(--kwarc);
  z-index: 1;
}
.has-webgl .logo__fallback { display: none; }

/* Optional: drop the "studio" line — set data-sub="off" on <body> */
body[data-sub="off"] .logo__letters .sub { display: none; }

/* ---------- 7. COMING SOON -------------------------------------------- */

.status {
  display: flex;
  align-items: center;
  gap: 0.7em;
  font-size: clamp(10px, 1.15vw, 14px);
  font-weight: 400;
  letter-spacing: 0.62em;
  text-indent: 0.62em;
  text-transform: uppercase;
  color: var(--uran);
  white-space: nowrap;
  will-change: transform;
}

.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: -0.32em;
  background: var(--uran);
  animation: blink 1100ms steps(1, end) infinite;
}
@keyframes blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }

/* ---------- 7b. Motion chip (iOS only) --------------------------------- */

/* The one control on the page. Uran is the studio's button colour in the
   brand system, so the accent earns its third appearance here — and only on
   the handsets that refuse to report attitude without a tap. */
.motion {
  appearance: none;
  -webkit-appearance: none;
  margin-top: -8px;
  padding: 9px 15px;
  background: transparent;
  border: 1px solid var(--uran);
  border-radius: 0;
  color: var(--uran);
  font-family: inherit;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 240ms ease;
}
.motion:hover, .motion:focus-visible { opacity: 1; }
.motion:focus-visible { outline: 1px solid var(--uran); outline-offset: 3px; }
.motion[hidden] { display: none; }

/* ---------- 8. Telemetry ---------------------------------------------- */

.tel {
  position: fixed;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
  line-height: 1.35;
  font-weight: 300;
  letter-spacing: 0.09em;
  color: var(--cynk);
  opacity: 0;
  z-index: 4;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  transition: opacity 1400ms 400ms ease;
}
.is-ready .tel { opacity: 0.42; }

/* β and γ are notation, not shouting — keep this line out of the uppercase */
#t-mot { text-transform: none; }

.tel--tl { top: var(--edge); left:  var(--edge); }
.tel--tr { top: var(--edge); right: var(--edge); text-align: right; align-items: flex-end; }
.tel--bl { bottom: var(--edge); left:  var(--edge); }
.tel--br { bottom: var(--edge); right: var(--edge); text-align: right; align-items: flex-end; }

/* ---------- 9. Frame --------------------------------------------------- */

.frame {
  position: fixed;
  inset: calc(var(--edge) - 8px);
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1400ms 600ms ease;
}
.is-ready .frame { opacity: 0.22; }

.frame i { position: absolute; width: 14px; height: 14px; border: 0 solid var(--cynk); }
.frame i:nth-child(1) { top: 0;    left: 0;  border-top-width: 1px;    border-left-width: 1px; }
.frame i:nth-child(2) { top: 0;    right: 0; border-top-width: 1px;    border-right-width: 1px; }
.frame i:nth-child(3) { bottom: 0; left: 0;  border-bottom-width: 1px; border-left-width: 1px; }
.frame i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }

/* ---------- 10. Grain -------------------------------------------------- */

.grain {
  position: fixed;
  inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none;
  z-index: 9;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
  will-change: transform;
  animation: grainshift 900ms steps(1, end) infinite;
}
@keyframes grainshift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-7px, 4px); }
  50%  { transform: translate(5px, -6px); }
  75%  { transform: translate(-3px, -3px); }
  100% { transform: translate(0, 0); }
}

/* ---------- 11. Responsive --------------------------------------------- */

@media (max-aspect-ratio: 1/1) {
  .logo { width: min(88vw, 64vh); }
  .lockup { gap: clamp(22px, 4.2vh, 44px); }
  .status { letter-spacing: 0.46em; text-indent: 0.46em; font-size: clamp(9px, 2.7vw, 12px); }
}

@media (max-width: 520px) {
  :root { --edge: 14px; }
  .tel { font-size: 9px; letter-spacing: 0.06em; }
  .tel--tr, .tel--br { display: none; }
  .tel--bl { gap: 3px; }
}

@media (max-height: 420px) {
  .logo { width: min(58vw, 96vh); }
  .lockup { gap: 18px; }
}

/* ---------- 12. Accessibility ------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .caret, .grain { animation: none; }
  .lockup, .tel, .frame, #bg-canvas { transition-duration: 1ms; }
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
