/* The hero: the text on the left, seven live tiles on the right (drawn by tiles.js onto #tiles). */
#tiles { position:absolute; inset:0; width:100%; height:100%; display:block; z-index:0; pointer-events:none; max-width:none; }
/* With cubes expected (.cubes) the canvas does not wait for .enhanced (GSAP, fonts): it shows as soon as the first frame is drawn. */
html:not(.cubes):not(.enhanced) #tiles, html.tiles-off #tiles { display:none; }
html:not(.enhanced) #tiles:not(.drawn) { visibility:hidden; }      /* tiles-boot.js is still placing it: an empty canvas that moves counts as a layout shift */
/* no live cubes on a wide screen (no WebGL2, reduced motion, no JS): a still picture of them in their place, so the right side
   is not empty. The picture loads only then. Remake it from the live cubes at 1440x900 (?motion=off) if they change. */
@media (min-width:821px) {
  html:not(.cubes) #hero::after, html.tiles-off #hero::after { content:''; position:absolute; z-index:0; pointer-events:none;
    right:clamp(20px,5vw,72px); top:50%; translate:0 -50%; width:min(40vw,64vh,600px); aspect-ratio:1116/1073;
    background:url(img/tiles-still.webp) center/contain no-repeat; }
}
/* wide screen, while the cubes' code loads: a picture of their first frame, exactly where the live ones will be drawn, until
   tiles-boot.js marks the page .cubes-drawn. The live view scales with the hero's height and is centred at 76% of its width,
   so the picture is placed in those terms (--hh is the hero's height, as below). A tall window has another view: no picture there.
   Remake img/tiles-first.webp (the canvas at ?t=0, transparent, cropped; the four numbers come from the crop) if the cubes change. */
@media (min-width:821px) and (min-aspect-ratio:1/1) {
  html.cubes #hero { overflow-x:clip; }      /* on a narrow window the picture's empty edge reaches past the hero: no sideways scroll */
  html.cubes:not(.cubes-drawn):not(.tiles-off) #hero::after { --hh:max(100vh,640px); content:''; position:absolute; z-index:0; pointer-events:none;
    left:calc(76% - var(--hh) * .34878); top:calc(var(--hh) * .16778); height:calc(var(--hh) * .59167); width:calc(var(--hh) * .59167 * 1241 / 1065);
    background:url(img/tiles-first.webp) center/100% 100% no-repeat; }
}
#hero { display:flex; flex-direction:column; justify-content:center; padding:0 clamp(20px,6vw,88px); }
/* wide screen: the hero has its finished height from the first paint, so the centred text does not move down when .enhanced
   arrives (before that, style.css gives every section 90vh and 80px of room at the foot) */
@media (min-width:821px) { html.cubes:not(.tiles-off) #hero { height:100vh; min-height:640px; padding-bottom:0; } }
#hero .copy, .enhanced #hero .copy { position:relative; z-index:2; width:auto; height:auto; margin:0; padding:0; overflow:visible; clip:auto; white-space:normal; max-width:min(50vw,780px); }
#hero .copy h1 { font-size:clamp(48px,6.4vw,104px); margin:0; }
#hero .copy p { margin:26px 0 0; font-size:20px; color:var(--muted); max-width:30em; }
#hero .ctas, .enhanced #hero .ctas { position:relative; z-index:2; left:auto; top:auto; margin:34px 0 0; transform:none !important; flex-wrap:wrap; }
@media (max-width:820px) {
  /* a phone: the heading and text, then the cubes as one row that flows past by itself, then the three buttons (tiles-boot.js) */
  #hero { justify-content:flex-start; padding-top:84px; padding-bottom:0; }
  #hero .copy, .enhanced #hero .copy { max-width:none; order:1; }
  #hero .copy h1 { font-size:38px; } #hero .copy p { font-size:15px; margin-top:12px; }
  #tiles { position:relative; inset:auto; order:2; flex:none; width:calc(100% + 2 * clamp(20px,6vw,88px)); max-width:none; height:300px; margin:0 calc(-1 * clamp(20px,6vw,88px));
    pointer-events:auto; touch-action:pan-y; z-index:1; }
  #hero .ctas, .enhanced #hero .ctas { order:3; margin-top:28px; }
  .cubes:not(.tiles-off) #hero .ctas { margin-top:-37px; }      /* the cube row has empty room under it: the buttons tuck into it */
  /* .cubes is set in the page's head, before the first paint, whenever cubes are expected: their room is held from the
     start, so the button does not jump when they arrive. .tiles-off (they failed) closes it and the button moves up. */
  #hero .btn { height:44px; padding:0 20px; font-size:14px; }
}
/* tall phones (from 740px high): bigger type, the cube row takes the space left, the button sits near the foot of the screen.
   The same condition is TALL in tiles-boot.js. */
@media (max-width:500px) and (min-height:740px) {
  #hero .copy h1 { font-size:min(11.8vw,6.6svh); line-height:1; letter-spacing:-.045em; }
  #hero .copy p { font-size:19px; line-height:1.45; margin-top:18px; }
  .cubes:not(.tiles-off) #hero { height:auto; min-height:100svh; }
  .cubes:not(.tiles-off) #tiles { flex:1 1 0; height:0; min-height:300px; }
  html.cubes:not(.tiles-off) #hero .ctas { margin:12px 0 calc(32px + env(safe-area-inset-bottom)); }
  #hero .btn { display:inline-flex; align-items:center; height:52px; padding:0 28px; font-size:16px; }
}
/* shorter phones: the type stays, the button goes to the foot of the screen. Below 640px high nothing changes. */
@media (max-width:500px) and (min-height:640px) and (max-height:739px) {
  .cubes:not(.tiles-off) #hero { height:auto; min-height:100svh; }
  .cubes:not(.tiles-off) #tiles { flex:1 1 0; height:0; min-height:250px; }
  html.cubes:not(.tiles-off) #hero .ctas { margin:auto 0 calc(24px + env(safe-area-inset-bottom)); padding-top:8px; }
}
/* the ?perf panel: only added to the page when the address has ?perf */
.tiles-perf { position:fixed; right:12px; bottom:12px; z-index:2147483000; background:rgba(11,11,12,.9); color:#e8e8ec; font:12px/1.5 ui-monospace,Menlo,monospace; padding:10px 12px; border-radius:8px; white-space:pre; pointer-events:auto; }
.tiles-perf button { font:inherit; margin-top:6px; padding:3px 10px; border-radius:999px; border:1px solid #444; background:#1b1c20; color:#fff; cursor:pointer; }

/* The hero's third level: two cards, "our products" or "a custom system" (sketch 2026-11-26-website-home-hero-copy, Light tints).
   The cubes do not react to them. */
#hero .paths { display:grid; grid-template-columns:1fr 1fr; gap:12px; max-width:min(50vw,700px); }
#hero .path { position:relative; display:flex; flex-direction:column; gap:6px; padding:18px 48px 18px 20px; border:1px solid #e6e6e3; border-radius:16px;
  background:rgba(255,255,255,.9); color:#0B0B0C; text-decoration:none; transition:border-color .3s, box-shadow .3s, transform .3s, background .3s; }
#hero .path:hover { border-color:#c8c8c4; box-shadow:0 14px 30px -18px rgba(0,0,0,.3); transform:translateY(-2px); }
#hero .path.dark { background:#2A2A2F; border-color:#2A2A2F; color:#fff; }
#hero .path.dark:hover { border-color:#2A2A2F; }
#hero .path-k { font-size:12px; font-weight:600; letter-spacing:.1em; text-transform:uppercase; color:#8b8c90; }
#hero .path.dark .path-k { color:#9d9ea4; }
#hero .path-t { font-size:19px; font-weight:600; letter-spacing:-.015em; line-height:1.2; }
#hero .path-s { margin-top:auto; padding-top:6px; font-size:14px; color:#b9bac0; }
#hero .path-names { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
#hero .path-ic { position:absolute; right:16px; top:16px; width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; transition:transform .3s; }
#hero .path:hover .path-ic { transform:translate(2px,-2px); }
/* the product names: light tints of each product's colour */
.path-names span { font-size:13px; font-weight:600; line-height:1.55; padding:3px 10px; border-radius:999px; white-space:nowrap; }
.nm-va { background:#F1ECFE; color:#6A3BD9; } .nm-at { background:#EAF3DC; color:#2F6A2A; } .nm-tw { background:#FCEFDD; color:#B4690E; }
@media (max-width:820px) {
  #hero .paths { grid-template-columns:1fr; max-width:none; }
  .cubes:not(.tiles-off) #hero .paths { margin-top:-22px; }
}
@media (max-width:500px) and (min-height:640px) {
  html.cubes:not(.tiles-off) #hero .paths { gap:8px; }
  #hero .path { padding:14px 44px 14px 16px; }
  #hero .path-t { font-size:17px; }
}
