/* ─── Fonts (Grilli Type, web licensed) ─────────────────────── */
@font-face {
  font-family: 'GT Mechanik';
  src: url('assets/fonts/GT-Mechanik-Semi-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal;
}
@font-face {
  font-family: 'GT Cinetype';
  src: url('assets/fonts/GT-Cinetype-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal;
}
@font-face {
  font-family: 'GT Cinetype Mono';
  src: url('assets/fonts/GT-Cinetype-Mono.woff2') format('woff2');
  font-weight: 400; font-style: normal;
}

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

/* Heading for search engines and screen readers; the logo carries it visually */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ─── Tokens ─────────────────────────────────────────────────── */
/* Desktop proportions come from the 2831 × 1721 Figma frame. Columns use vw
   (value / 2831 × 100vw); vertical spacing and type use --u, which is 1vw on
   screens shaped like the frame but follows the height on wider ones
   (ultrawide), so the top margin and footer don't balloon.
   Tablet and mobile override everything from their own Figma frames below. */
:root {
  --u:          min(1vw, 1.645vh);   /* 1.645 = 2831 / 1721 */
  --blue:       #27438D;
  --red:        #C61A18;
  --cyan:       #00ABE1;
  --cream:      #F7F3EC;
  --ink:        #31302F;
  --muted:      #655C5C;
  --gutter-l:   5.19vw;   /* left outer line   (147px)  */
  --col-l:      21.16vw;  /* left column edge  (599px)  */
  --col-r:      12.08vw;  /* right column edge (2489px), from the right */
  --gutter-r:   2.4vw;    /* right outer line  (2763px), from the right */
  --top:        calc(4.49 * var(--u));   /* top line (127px) */
  --footer-h:   max(44px, calc(4.2 * var(--u)));
  --footer-gap: 0px;      /* space between the footer-top line and the footer boxes */
  --bottom:     calc(3.43 * var(--u));   /* space under the footer */
  /* Helmet crown rises above the top line so the line tucks behind the head
     (Figma: crown at 66px vs line at 127px). */
  --head-top:   calc(2.33 * var(--u));
  /* The Figma frame is ~2× a 1440px screen, so its 1px lines read at half weight. */
  --grid-color: rgba(39, 67, 141, 0.5);
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);    /* long, soft landing */
  --ease-io:    cubic-bezier(0.65, 0, 0.35, 1);   /* drawing / wiping   */
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'GT Mechanik', sans-serif;
  background: var(--cream);
  color: var(--ink);
}

/* ─── Page ───────────────────────────────────────────────────── */
.page {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ─── Animations ─────────────────────────────────────────────── */
/* Intro timeline (s): grid draws 0 → logo swipe 0.2 → robot 0.35 → badge 0.5 →
   headline 0.7 → colored bars swipe 0.9 → labels 1.5 → eyes power on 1.7.
   It stays paused until the robot and fonts are ready (.is-ready, set by JS). */
@keyframes drawX  { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes drawY  { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes lineUp { from { transform: translateY(110%); } to { transform: translateY(0); } }

/* Swipe: a solid curtain sweeps across (first half), then slides off the far
   side revealing the block underneath (second half). Pair swipeIn* on the
   block with curtain* on its ::after. */
@keyframes swipeInR  { 0% { clip-path: inset(0 100% 0 0); } 50%, 100% { clip-path: inset(0 0 0 0); } }
@keyframes swipeInL  { 0% { clip-path: inset(0 0 0 100%); } 50%, 100% { clip-path: inset(0 0 0 0); } }
@keyframes curtainOut { 0%, 50% { transform: scaleX(1); } 100% { transform: scaleX(0); } }

@keyframes badgeIn {
  from { opacity: 0; translate: 0 10px; }
  to   { opacity: 1; translate: 0 0; }
}

/* No movement: the robot stays put and just comes into focus */
@keyframes robotIn {
  from { opacity: 0; filter: blur(14px); }
  to   { opacity: 1; filter: none; }
}

@keyframes eyeOn {
  0%   { opacity: 0; }
  25%  { opacity: 1; }
  40%  { opacity: 0.15; }
  55%  { opacity: 1; }
  100% { opacity: 0.4; }
}

/* While the window is being resized (class set by JS), skip transitions so
   properties that differ per breakpoint (e.g. the Contact us background)
   snap instead of fading through a state where the label is invisible. */
.is-resizing *,
.is-resizing *::before,
.is-resizing *::after {
  transition: none !important;
}

.js .page:not(.is-ready),
.js .page:not(.is-ready) *,
.js .page:not(.is-ready) *::after {
  animation-play-state: paused !important;
}

/* ─── Grid lines ─────────────────────────────────────────────── */
.grid-line {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  transform-origin: left top;
  animation: drawX 1.3s var(--ease-io) both;
}

.grid-line--gutter-l, .grid-line--col-l,
.grid-line--col-r, .grid-line--gutter-r { animation-name: drawY; }

.grid-line--gutter-l { animation-delay: 0s; }
.grid-line--col-l    { animation-delay: 0.08s; }
.grid-line--col-r    { animation-delay: 0.16s; }
.grid-line--gutter-r { animation-delay: 0.24s; }
.grid-line--h-top    { animation-delay: 0.1s; }
.grid-line--h        { animation-delay: 0.2s; }
.grid-line--h-bottom { animation-delay: 0.3s; transform-origin: right top; }
.grid-line--h-mid    { animation-delay: 0.36s; transform-origin: right top; }
.grid-line--gutter-b { animation-delay: 0.42s; transform-origin: right top; }

/* Vertical */
.grid-line--gutter-l  { top: 0; left: var(--gutter-l);  width: 0; height: 100%; border-left: 1px dashed var(--grid-color); }
.grid-line--col-l     { top: 0; left: var(--col-l);     width: 0; height: 100%; border-left: 1px dashed var(--grid-color); }
.grid-line--col-r     { top: 0; right: var(--col-r);    width: 0; height: 100%; border-left: 1px dashed var(--grid-color); }
.grid-line--gutter-r  { top: 0; right: var(--gutter-r); width: 0; height: 100%; border-left: 1px dashed var(--grid-color); }

/* Horizontal */
.grid-line--h-top     { top: var(--top);                                                        left: 0; right: 0; height: 0; border-top: 1px dashed var(--grid-color); }
.grid-line--h-bottom  { top: calc(100% - var(--bottom) - var(--footer-h) - var(--footer-gap));  left: 0; right: 0; height: 0; border-top: 1px dashed var(--grid-color); }
.grid-line--h-mid     { display: none; /* mobile only */                                        left: 0; right: 0; height: 0; border-top: 1px dashed var(--grid-color); }
.grid-line--gutter-b  { top: calc(100% - var(--bottom));                                        left: 0; right: 0; height: 0; border-top: 1px dashed var(--grid-color); }
.grid-line--h         { top: 0; /* set by JS */                                                 left: 0; right: 0; height: 0; border-top: 1px dashed var(--grid-color); }

/* ─── Badge ──────────────────────────────────────────────────── */
.badge {
  position: absolute;
  top: var(--top); /* JS overrides this to center between h-top and logo-bottom */
  right: calc(var(--col-r) + 1.8vw);
  z-index: 25;
  font-family: 'GT Cinetype', serif;
  font-size: max(9px, calc(0.85 * var(--u)));
  font-weight: 700;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: max(4px, calc(0.28 * var(--u)));
  color: var(--ink);
  transform: translateY(-50%);
  animation: badgeIn 1s var(--ease-out) 0.5s both;
  transition: opacity 0.2s;
}
.badge span { opacity: 0.67; }
.badge:hover { opacity: 0.65; }

.flag {
  width: max(10px, calc(0.85 * var(--u)));
  height: auto;
  display: block;
}

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: absolute;
  top: var(--top);
  left: 0;
  width: var(--col-l);
  height: calc(100% - var(--top) - var(--footer-h) - var(--footer-gap) - var(--bottom));
  padding-left: var(--gutter-l);
  display: flex;
  flex-direction: column;
  z-index: 23;
}

.logo-wrap {
  position: relative;
  width: 100%;
  animation: swipeInR 1.3s var(--ease-io) 0.2s both;
}

.logo-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--cyan);
  transform-origin: right center;
  animation: curtainOut 1.3s var(--ease-io) 0.2s both;
}

.logo {
  width: 100%;
  height: auto;
  display: block;
}

.headline {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}

.headline p {
  max-width: 100%;
  font-size: max(11px, calc(1.0 * var(--u)));  /* longest line ≈ 84% of the column */
  font-weight: 700;
  line-height: normal;
  text-align: center;
  text-transform: uppercase;
  color: var(--ink);
}

/* Always breaks as "From actuator to robot, / design to production".
   Each line rises out of its own mask; the mask clips only top and bottom,
   so a line wider than the column is never cut at the sides. */
.headline .line {
  display: block;
  white-space: nowrap;
  padding-bottom: 0.08em;
  clip-path: inset(0 -100vw);
}
.headline .line > span {
  display: block;
  animation: lineUp 1.2s var(--ease-out) 0.7s both;
}
.headline .line:nth-child(2) > span { animation-delay: 0.82s; }

/* ─── Robot ──────────────────────────────────────────────────── */
/* The helmet crown sits at --head-top and the image ends exactly on the bottom edge
   of the screen, at any size. --head-top scales with the width (through --u),
   so the robot does too. The opaque helmet starts 1.82% down the image
   (hence ÷ 0.9818); its crown sits 53.17% across. */
.robot-wrap {
  position: absolute;
  inset: 0;
  z-index: 22;
  pointer-events: none;
  animation: robotIn 1.6s var(--ease-out) 0.35s both;
}

.robot {
  position: absolute;
  top: var(--head-top);
  left: 52.5%;
  transform: translate(-53.17%, -1.82%);
  height: calc((100% - var(--head-top)) / 0.9818);
  width: auto;
  aspect-ratio: 2000 / 1647;
}

.robot__img {
  display: block;
  width: 100%;
  height: 100%;
}

/* Soft glow laid over the eyes: flickers on once after load, then rests dim.
   Hovering the face (.is-gazing, set by JS) lights them up and adds a glint. */
.robot__eye {
  position: absolute;
  top: 41.7%;
  width: 8.5%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(190, 222, 255, 0.95) 0%, rgba(120, 175, 255, 0.45) 38%, transparent 70%);
  mix-blend-mode: screen;
  opacity: 0.4;
  animation: eyeOn 1.1s linear 1.7s backwards;
  transition: opacity 0.5s var(--ease-out), scale 0.6s var(--ease-out);
}
.robot__eye--l { left: 39.6%; }
.robot__eye--r { left: 57.6%; }

.robot__eye::after {
  content: '';
  position: absolute;
  left: 36%;
  top: 32%;
  width: 14%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  filter: blur(1px);
  opacity: 0;
  transition: opacity 0.4s ease, translate 0.6s var(--ease-out);
}

.robot.is-gazing .robot__eye        { opacity: 1; scale: 1.15; }
.robot.is-gazing .robot__eye::after { opacity: 0.9; translate: 10% 10%; }

/* ─── Footer ─────────────────────────────────────────────────── */
/* Sits on the bottom rule (grid-line--gutter-b).
   5 cells: [gutter-l] [coming-soon] [mid] [contact] [gutter-r] */
.footer {
  position: absolute;
  bottom: var(--bottom);
  left: 0;
  right: 0;
  height: var(--footer-h);
  display: grid;
  grid-template-columns:
    var(--gutter-l)
    calc(var(--col-l) - var(--gutter-l))
    1fr
    calc(var(--col-r) - var(--gutter-r))
    var(--gutter-r);
  z-index: 23;
  pointer-events: none;
}

.footer > * { pointer-events: auto; }
.footer__gutter-l,
.footer__gutter-r,
.footer__mid { visibility: hidden; }

/* Coming Soon – swipes in under a blue curtain, label rises and scrambles
   (and scrambles again on hover) */
.footer__coming-soon {
  background: var(--red);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: default;
  transition: background-color 0.3s ease;
  animation: swipeInR 1.2s var(--ease-io) 0.9s both;
}

.footer__coming-soon::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  background: var(--blue);
  transform-origin: right center;
  animation: curtainOut 1.2s var(--ease-io) 0.9s both;
}

.footer__coming-soon span {
  position: relative;
  z-index: 1;
  font-family: 'GT Cinetype', serif;
  font-size: max(11px, calc(0.954 * var(--u)));
  font-weight: 700;
  white-space: nowrap;
  display: inline-block;
  animation: lineUp 0.9s var(--ease-out) 1.5s both;
}

.footer__coming-soon:hover { background-color: #A91614; }

/* Contact us – right-aligned label in the cyan cell */
.footer__contact {
  background: var(--cyan);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 2.26vw;
  font-size: max(11px, calc(0.954 * var(--u)));
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  transition: background-color 0.3s ease;
  animation: swipeInL 1.2s var(--ease-io) 1s both;
}

/* Swipes in from the right under a red curtain */
.footer__contact::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--red);
  transform-origin: left center;
  pointer-events: none;
  animation: curtainOut 1.2s var(--ease-io) 1s both;
}

.footer__contact:hover { background-color: #0096C7; }

/* Rolling label: the text slides up and a copy rolls in from below */
.roll {
  position: relative;
  display: inline-block;
  overflow: hidden;
  line-height: 1.25;
  animation: lineUp 0.9s var(--ease-out) 1.6s both;
}
.roll > span,
.roll::after {
  display: block;
  transition: transform 0.6s var(--ease-out);
}
.roll::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 100%;
}
.footer__contact:hover .roll > span,
.footer__contact:hover .roll::after,
.footer__contact:focus-visible .roll > span,
.footer__contact:focus-visible .roll::after { transform: translateY(-100%); }

/* ─── Blueprint cursor ───────────────────────────────────────── */
/* Faint crosshair that tracks the mouse across the grid, with a mono
   coordinate readout (or the email when over Contact us). */
.cursor {
  position: fixed;
  inset: 0;
  z-index: 26;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  --x: -100px;
  --y: -100px;
}
.cursor.is-on { opacity: 1; }

.cursor__x,
.cursor__y {
  position: absolute;
  border: 0 solid rgba(39, 67, 141, 0.2);
}
.cursor__x { left: 0; right: 0; top: 0; border-top-width: 1px; transform: translateY(var(--y)); }
.cursor__y { top: 0; bottom: 0; left: 0; border-left-width: 1px; transform: translateX(var(--x)); }

.cursor__dot {
  position: absolute;
  width: 5px;
  height: 5px;
  background: var(--blue);
  transform: translate(calc(var(--x) - 2px), calc(var(--y) - 2px));
}

.cursor__label {
  position: absolute;
  font-family: 'GT Cinetype Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--blue);
  background: var(--cream);
  padding: 3px 6px;
  white-space: nowrap;
  transform: translate(calc(var(--x) + 10px), calc(var(--y) + 10px));
}

.corner { display: none; }

/* ─── Stacked layout: tablet portrait + mobile ──────────────── */
/* Logo and badge on top, headline under them, robot standing on a full-width
   Coming Soon bar, Contact Us below it. Sizes come from the two Figma frames:
   "iPad Pro 11" - 1" (834 × 1194) and "iPhone 18 Pro - 1" (402 × 874). */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  :root {
    --gutter-l:      66px;
    --gutter-r:      66px;
    --top:           38px;
    --logo-w:        242px;
    --headline-gap:  47px;
    --headline-size: 32px;
    --headline-w:    456px;
    --badge-size:    14px;
    --badge-right:   92px;
    --row-1:         72px;   /* Coming Soon */
    --row-2:         68px;   /* Contact Us  */
    --bottom:        52px;
    --footer-text:   18px;
    --robot-h:       85.25vw;  /* 711 / 834 */
    --robot-x:       48.55%;   /* helmet crown */
    --robot-clear:   270px;    /* robot never rises above this */
  }
}

@media (max-width: 767px) {
  :root {
    --gutter-l:      18px;
    --gutter-r:      24px;
    --top:           20px;
    --logo-w:        160px;
    --headline-gap:  42px;
    --headline-size: min(24px, 6vw);  /* keeps "From actuator to robot," inside 360px phones */
    --headline-w:    333px;
    --badge-size:    12px;
    --badge-right:   35px;
    --row-1:         60px;
    --row-2:         62px;
    --bottom:        27px;
    --footer-text:   18px;
    --robot-h:       121.1vw;  /* 487 / 402 */
    --robot-x:       52.2%;
    --robot-clear:   205px;
  }

  /* The badge wraps to two lines, so the flag stands upright beside it. */
  .badge span { max-width: 101px; }
  .flag { transform: rotate(90deg); }
}

@media (max-width: 767px), (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  :root {
    --footer-h:   calc(var(--row-1) + var(--row-2));
    --footer-gap: 0px;
    --grid-color: var(--blue);
  }

  .grid-line--col-l,
  .grid-line--col-r { display: none; }
  .grid-line--h-mid { display: block; top: calc(100% - var(--bottom) - var(--row-2)); }

  .badge {
    right: var(--badge-right);
    font-size: var(--badge-size);
    gap: 7px;
    color: var(--muted);
    text-align: right;
  }
  .badge span { opacity: 1; }
  .flag { width: 24px; }

  .sidebar {
    left: 0;
    right: 0;
    width: auto;
    height: auto;
    padding: 0 var(--gutter-r) 0 var(--gutter-l);
  }

  .logo-wrap { width: var(--logo-w); }

  .headline {
    flex: none;
    padding: var(--headline-gap) 0 0;
  }

  .headline p {
    max-width: var(--headline-w);
    font-size: var(--headline-size);
  }

  /* Stands on the Coming Soon bar and scales with the width; only shrinks
     on unusually short screens so it never reaches the headline. */
  .robot {
    top: auto;
    left: var(--robot-x);
    transform: translateX(-53.17%);
    bottom: calc(var(--bottom) + var(--footer-h));
    height: min(var(--robot-h), calc(100% - var(--bottom) - var(--footer-h) - var(--robot-clear)));
  }

  .footer {
    left: var(--gutter-l);
    right: var(--gutter-r);
    display: flex;
    flex-direction: column;
  }

  .footer__gutter-l,
  .footer__gutter-r,
  .footer__mid { display: none; }

  .footer__coming-soon { flex: 0 0 var(--row-1); }
  .footer__coming-soon span { font-size: var(--footer-text); }

  .footer__contact {
    flex: 1;
    background: transparent;
    color: #000;
    font-family: 'GT Cinetype', serif;
    font-size: var(--footer-text);
    text-transform: capitalize;
    justify-content: center;
    padding-right: 0;
    text-underline-offset: 4px;
  }
  .footer__contact:hover { background: transparent; text-decoration: underline; }

  /* Cyan block in the bottom-right corner, outside the grid */
  .corner {
    display: block;
    position: absolute;
    right: 0;
    bottom: 0;
    width: var(--gutter-r);
    height: var(--bottom);
    background: var(--cyan);
    z-index: 20;
    animation: swipeInR 1.2s var(--ease-io) 1.1s both;
  }
}

/* ─── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .cursor { display: none; }
}
