/* ==========================================================================
   Qoscreative.co — Coming Soon
   Measurements come from the Figma frame "Desktop - 3" (1440 × 1024).
   ========================================================================== */

@font-face {
  font-family: "Nimbus Sans L";
  src: url("assets/NimbusSanL-Regu.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Colours sampled from the design */
  --c-bg: #ffffff;
  --c-text: #000000;
  --c-ticker: #ff0000;
  --c-button-line: #8fa4ae;

  /* Ticker — unitless numbers so the loop duration can be derived in CSS.
     --ticker-speed is overwritten by CONFIG.TICKER_SPEED in script.js. */
  --ticker-fs: 12;            /* px */
  --ticker-speed: 80;         /* px per second */
  --ticker-start: 3.333vw;    /* first "UNDER RENOVATION" sits 48px from the left at 1440 */
  --ticker-y: 60.71%;         /* centre line of the lowercase letters: pixel rows 4–12 of 14 */

  /* Layout */
  --logo-w: min(44.72vw, 80vh);          /* 644px at 1440 */
  --gap-logo-text: clamp(48px, 14.6vh, 190px); /* 150px at 1024 high */
  --gap-text-button: 32px;
  --gap-button-icon: 14px;
  --text-fs: 12px;
  --text-lh: 14px;
  --button-w: 136px;
  --button-h: 39px;
  --button-pad: 28px;   /* CONTACT US: 79px text + 2 × 28px ≈ 136px, as in Figma */
  --gap-buttons: 10px;

  /* Lower content reveal */
  --reveal-duration: 900ms;
  --reveal-blur: 6px;
  --reveal-shift: 6px;
}

@supports (height: 1dvh) {
  :root {
    --logo-w: min(44.72vw, 80dvh);
    --gap-logo-text: clamp(48px, 14.6dvh, 190px);
  }
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  overflow-x: hidden;
}

body {
  font-family: "Nimbus Sans L", "Nimbus Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

/* --------------------------------------------------------------------------
   Stage: logo sits on the vertical centre line (slightly above, as in the
   reference), lower content hangs below it.
   -------------------------------------------------------------------------- */
.stage {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  justify-items: center;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
  overflow: hidden;
}

@supports (height: 1dvh) {
  .stage { min-height: 100dvh; }
}

/* --------------------------------------------------------------------------
   Logo
   -------------------------------------------------------------------------- */
.logo {
  grid-row: 2;
  position: relative;
  width: var(--logo-w);
  aspect-ratio: 1061.86 / 170.82;
}

.logo__title {
  margin: 0;
  width: 100%;
  height: 100%;
  font-size: inherit;
}

.logo__img,
.logo__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  z-index: 1;
  user-select: none;
  -webkit-user-drag: none;
}

.logo__canvas { z-index: 2; pointer-events: none; }

/* With JS the logo is revealed by the canvas; the <img> is shown at the end. */
.js .logo__img { visibility: hidden; }
.js .logo.is-revealed .logo__img { visibility: visible; }
.logo.is-revealed .logo__canvas { display: none; }

/* --------------------------------------------------------------------------
   Ticker — full-bleed, in front of the logo, moves left → right forever.
   Each phrase box has a fixed width (text + 140px gap, from Figma), so one
   set is exactly 41.25em and the loop never depends on font loading.
   -------------------------------------------------------------------------- */
.ticker {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: var(--ticker-y);
  width: 100vw;
  /* -0.0094em: puts the centre of the capitals (not of the line box) on the line */
  transform: translate(-50%, calc(-50% - 0.0094em));
  overflow: hidden;
  pointer-events: none;
  color: var(--c-ticker);
  font-size: calc(var(--ticker-fs) * 1px);
  line-height: 1.2;
  white-space: nowrap;
}

.ticker__track {
  display: flex;
  width: max-content;
  /* Start one set to the left so the left edge is always covered. */
  margin-left: calc(var(--ticker-start) - 41.25em);
  /* 8 sets × 41.25em travel per loop → duration = distance / speed */
  animation: ticker calc(330s * var(--ticker-fs) / var(--ticker-speed)) linear infinite;
  will-change: transform;
}

.ticker__item { flex: 0 0 auto; display: block; }
.ticker__item--a { width: 22.1667em; } /* 126 + 140 = 266px @12px */
.ticker__item--b { width: 19.0833em; } /*  89 + 140 = 229px @12px */

@keyframes ticker {
  from { transform: translate3d(-50%, 0, 0); }
  to   { transform: translate3d(0, 0, 0); }
}

/* --------------------------------------------------------------------------
   Lower content
   -------------------------------------------------------------------------- */
.lower {
  grid-row: 3;
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: var(--gap-logo-text);
  padding-bottom: 16px;
}

.lower__text {
  margin: 0;
  font-size: var(--text-fs);
  line-height: var(--text-lh);
  text-align: center;
  letter-spacing: 0;
}

.buttons {
  display: flex;
  flex-direction: column;   /* DOWNLOAD PORTFOLIO above CONTACT US */
  align-items: stretch;     /* both buttons take the width of the wider one */
  width: max-content;
  gap: var(--gap-buttons);
  margin-top: var(--gap-text-button);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--button-w);
  height: var(--button-h);
  padding: 1px var(--button-pad) 0;
  white-space: nowrap;
  background: var(--c-bg);
  border: 1px solid var(--c-button-line);
  color: var(--c-text);
  font-size: var(--text-fs);
  line-height: 1;
  text-decoration: none;
}

.button:hover { border-color: var(--c-text); }

.button:focus-visible,
.instagram:focus-visible {
  outline: 1px solid var(--c-text);
  outline-offset: 3px;
}

.instagram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: var(--gap-button-icon);
  padding: 8px; /* comfortable hit area around the 18px glyph */
  color: #1d1d1d;
}

.instagram:hover { color: #000; }
.instagram svg { display: block; }

/* Reveal states (only when JS runs; without JS everything is simply visible). */
.reveal {
  transition: opacity var(--reveal-duration) ease, filter var(--reveal-duration) ease,
              transform var(--reveal-duration) cubic-bezier(.2, .7, .2, 1),
              border-color 240ms ease, color 240ms ease;
}
.js .reveal:not(.is-visible) {
  opacity: 0;
  filter: blur(var(--reveal-blur));
  transform: translateY(var(--reveal-shift));
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

/* Large screens */
@media (min-width: 1800px) and (min-height: 900px) {
  :root { --ticker-fs: 13; --text-fs: 13px; --text-lh: 15px; --button-w: 147px; --button-h: 42px; }
}

/* Tablet */
@media (max-width: 900px) {
  :root { --logo-w: min(64vw, 520px); --ticker-start: 16px; }
}

/* Phone portrait */
@media (max-width: 600px) {
  :root {
    --logo-w: min(86vw, 380px);
    --ticker-fs: 11;
    --text-fs: 11px;
    --text-lh: 14px;
    --gap-logo-text: clamp(32px, 9vh, 100px);
    --gap-text-button: 24px;
    --gap-button-icon: 12px;
    --button-h: 42px;
    --button-w: 112px;
    --button-pad: 18px;
    --gap-buttons: 8px;
  }
  @supports (height: 1dvh) {
    :root { --gap-logo-text: clamp(32px, 9dvh, 100px); }
  }
}

/* Very narrow phones (≤ 360px) */
@media (max-width: 360px) {
  :root { --ticker-fs: 10; --text-fs: 10px; --text-lh: 13px; --button-w: 96px; --button-pad: 14px; --gap-buttons: 8px; }
}

/* Short phones (e.g. 320 × 568) */
@media (max-width: 600px) and (max-height: 640px) {
  :root { --button-h: 40px; --gap-text-button: 20px; }
}

/* Short viewports (landscape phones) */
@media (max-height: 500px) {
  .lower { padding-bottom: 0; }
  .instagram { padding: 6px; }
  :root {
    --logo-w: min(46vw, 58vh * 6.216, 420px);
    --gap-logo-text: clamp(10px, 3.5vh, 32px);
    --gap-text-button: 10px;
    --gap-button-icon: 2px;
    --gap-buttons: 6px;
    --button-h: 32px;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion: everything is shown in its final, stable state.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .ticker__track { animation: none; margin-left: var(--ticker-start); }
  .js .logo__img { visibility: visible; }
  .logo__canvas { display: none; }
  .js .reveal:not(.is-visible) { opacity: 1; filter: none; transform: none; }
  .reveal, .button, .instagram { transition: none; }
}
