/* KC AI STUDIO portfolio: site styles, in the logo's colours (deep navy, cyan to blue to violet).
 * Colours and fonts are the shared design tokens. The floating cards copy kingdom.kinglepak.com's
 * .card.float3d exactly (perspective, floaty, sheen, accent top line, hover pause).
 */

:root {
  --bg: #08101E;   /* the logo file's own ground */
  --card-a: #101935;
  --card-b: #070C1D;
  --accent: #2ED3FF;    /* the logo's cyan */
  --accent-hi: #7DE6FF;
  --blue: #3D6BFF;
  --violet: #9B5CFF;
  --grad: linear-gradient(90deg, #1FD6FF 0%, #3D6BFF 55%, #9B5CFF 100%);
  --grad-btn: linear-gradient(90deg, #2EDCFF, #4C86FF); /* dark text stays readable across it */
  --text: #EEF1F8;
  --muted: #AEB6CC;
  --ink: #050814; /* text on the accent */
  --line: rgba(46, 211, 255, .18);
  --line-strong: rgba(46, 211, 255, .38);
  --wash: rgba(46, 211, 255, .05);
  --shade: rgba(8, 16, 30, .94); /* --bg, nearly opaque */

  --font-zh-serif: "Noto Serif SC", "Songti SC", serif;
  --font-body: "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Cinzel", "Noto Serif SC", serif;
  --font-label: "Orbitron", "Noto Sans SC", sans-serif;

  --gutter: clamp(16px, 4vw, 56px);
  --wrap: 1328px;
  --pad-x: max(var(--gutter), calc((100% - var(--wrap)) / 2));
  color-scheme: dark;
}

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
/* `hidden` always wins: the static hero picture must never show over the WebGL scene. */
[hidden] { display: none !important; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
html:has(#work-dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent-hi); }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 3px; }
h1, h2, h3 { margin: 0; font-family: var(--font-zh-serif); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
:lang(en) :is(h1, h2), :lang(ms) :is(h1, h2) { font-family: var(--font-display); letter-spacing: .02em; }
p, figure, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  max-width: 100%;
  padding: 12px 26px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s, box-shadow .2s;
}
.btn:hover { border-color: var(--accent-hi); color: var(--accent-hi); }
.btn-wa { background: var(--grad-btn); border-color: transparent; color: var(--ink); }
.btn-wa:hover { background: var(--grad-btn); border-color: transparent; color: var(--ink); filter: brightness(1.08); box-shadow: 0 0 26px rgba(46, 211, 255, .35), 0 0 40px rgba(155, 92, 255, .25); }
.btn-small { min-height: 38px; padding: 8px 16px; font-size: 13px; font-weight: 600; }

/* ------------------------------------------------------------ header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  padding: 18px var(--pad-x);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.logo { display: inline-flex; align-items: center; line-height: 0; text-decoration: none; }
/* the owner's logo (render.mjs logoImg, tools/brand-assets.py) */
.logo-img { display: block; width: auto; height: 64px; }
.logo:hover .logo-img { filter: brightness(1.12); }
.site-nav { display: flex; flex-wrap: wrap; gap: 6px 26px; margin-left: auto; }
.site-nav a { color: var(--muted); font-size: 15px; font-weight: 500; text-decoration: none; }
.site-nav a:hover { color: var(--accent-hi); }
.lang-switch {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font-label);
  font-size: 12px;
  font-weight: 700;
}
.page-privacy .lang-switch { margin-left: auto; }
.lang-switch a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: .06em;
}
.lang-switch a:hover { color: var(--accent-hi); }
.lang-switch a[aria-current="page"] { background: var(--accent); color: var(--ink); }
.header-wa { min-height: 42px; padding: 8px 20px; font-size: 14px; background: transparent; color: var(--accent); }
.header-wa:hover { background: var(--accent); color: var(--ink); }

/* ------------------------------------------------------------ hero
 * The canvas covers the whole hero; the frame (where the pictures assemble and where taps land)
 * is the right column on desktop and the top block on phones. A dark shade sits between the
 * canvas and the copy so the text stays readable over the stars and the glow.
 */
.hero {
  --frame-h: min(72vh, 640px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  align-items: center;
  gap: 48px;
  min-height: clamp(600px, calc(100vh - 78px), 900px);
  padding: 48px var(--pad-x) 72px;
  background: radial-gradient(ellipse 60% 75% at 74% 48%, var(--card-a) 0%, var(--bg) 72%);
}
@supports (height: 1svh) {
  .hero { --frame-h: min(72svh, 640px); min-height: clamp(600px, calc(100svh - 78px), 900px); }
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(90deg, var(--shade) 0%, rgba(8, 16, 30, .86) 32%, rgba(8, 16, 30, .5) 50%, rgba(8, 16, 30, 0) 64%);
}
.stars-canvas { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.stars-frame {
  position: relative;
  z-index: 2;
  grid-column: 2;
  grid-row: 1;
  height: var(--frame-h);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.stars-hint {
  position: relative;
  z-index: 3;
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: center;
  max-width: 100%;
  padding: 0 12px;
  font-family: var(--font-label);
  font-size: 14px;
  letter-spacing: .22em;
  line-height: 1.6;
  text-align: center;
  color: var(--accent-hi);
  text-shadow: 0 0 18px rgba(0, 0, 0, .9);
  pointer-events: none;
  transition: opacity .6s, color .6s;
}
.stars-fallback {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: center;
  width: auto;
  max-width: 100%;
  max-height: var(--frame-h);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 28px 60px rgba(0, 0, 0, .7), 0 0 34px rgba(46, 211, 255, .10);
  pointer-events: none;
}
/* The still picture is showing (reduced motion, no WebGL, no script): the frame takes no taps. */
.hero:has(.stars-fallback:not([hidden])) .stars-frame { cursor: default; }
/* No script, no particle scene: show the still picture in the frame instead of an empty box.
 * This is the one place [hidden] is overridden, and only where WebGL cannot run at all. */
@media (scripting: none) { .stars-fallback[hidden] { display: block !important; } }
.hero-copy { position: relative; z-index: 2; grid-column: 1; grid-row: 1; min-width: 0; }
.hero-eyebrow {
  margin-bottom: 18px;
  font-family: var(--font-label);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .2em;
  line-height: 1.7;
  color: var(--accent);
}
.hero h1 { font-size: clamp(38px, 4.8vw, 68px); line-height: 1.12; letter-spacing: .01em; color: var(--text); }
.hero h1 .hl { color: var(--accent); }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero h1 .hl { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
}
:lang(en) .hero h1, :lang(ms) .hero h1 { font-size: clamp(32px, 3.7vw, 54px); line-height: 1.16; }
.hero-lede { max-width: 32em; margin-top: 24px; font-size: 18px; line-height: 1.75; color: var(--muted); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }
.hero-cta .btn-wa::after { content: "→"; content: "→" / ""; }
.hero-cta .btn-ghost::after { content: "↓"; content: "↓" / ""; }
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 44px;
  margin-top: 40px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  list-style: none;
}
.hero-stats li { display: flex; flex-direction: column; max-width: 11em; }
.hero-stats strong { font-family: var(--font-display); font-size: 46px; font-weight: 500; line-height: 1.05; color: var(--accent); }
.hero-stats span { margin-top: 6px; font-size: 13px; line-height: 1.45; color: var(--muted); }

/* ------------------------------------------------------------ sections */
.section { padding: 96px var(--pad-x); }
main > section + section { border-top: 1px solid var(--line); }
.section > h2 { margin-bottom: 30px; font-size: clamp(32px, 3.6vw, 48px); }
.section > h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 2px;
  margin-top: 14px;
  background: linear-gradient(90deg, var(--accent-hi), transparent);
}

/* work: heading and tabs share a row on wide screens */
#work { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 24px; align-items: end; }
/* The float projects outer rows of a tall grid away from its perspective origin (eight rows of
 * two on a phone reach ~60px, five rows of three at 1024px ~55px), so the floating grids keep
 * extra room above and below. */
#work > h2 { grid-column: 1; margin-bottom: 60px; }
#work > .work-tabs { grid-column: 2; margin-bottom: 60px; }
#services > h2 { margin-bottom: 44px; }
#work > .work-panel { grid-column: 1 / -1; }
.work-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.work-tab {
  min-height: 42px;
  max-width: 100%;
  padding: 8px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s;
}
.work-tab:hover { border-color: var(--accent-hi); color: var(--accent-hi); }
.work-tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--ink); }

.work-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px 22px;
  list-style: none;
}

/* ------------------------------------------------------------ floating cards (kingdom .card.float3d) */
.work-grid, .service-grid { perspective: 1100px; }
.work-card, .service-card {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(46, 211, 255, .38);
  background: linear-gradient(155deg, var(--card-a) 0%, var(--card-b) 60%, #0A1024 100%);
  box-shadow: 0 28px 60px rgba(0, 0, 0, .7), 0 0 34px rgba(46, 211, 255, .10), inset 0 1px 0 rgba(190, 235, 255, .18);
  transform-style: preserve-3d;
  animation: floaty 8s ease-in-out infinite;
  will-change: transform;
  transition: box-shadow .3s;
}
.work-card:nth-child(2n), .service-card:nth-child(2n) { animation-delay: -2.6s; }
.work-card:nth-child(3n), .service-card:nth-child(3n) { animation-delay: -5.2s; }
.work-card:hover, .service-card:hover, .work-card:focus-within, .service-card:focus-within {
  animation-play-state: paused;
  box-shadow: 0 36px 70px rgba(0, 0, 0, .75), 0 0 54px rgba(46, 211, 255, .28), inset 0 1px 0 rgba(190, 235, 255, .3);
}
.work-card::before, .service-card::before {
  content: "";
  position: absolute;
  inset: -40% -60%;
  background: linear-gradient(115deg, transparent 42%, rgba(190, 230, 255, .16) 50%, transparent 58%);
  animation: sheen 6.5s ease-in-out infinite;
  pointer-events: none;
}
.work-card::after, .service-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-hi), transparent);
  opacity: .8;
  pointer-events: none;
}
@keyframes floaty {
  0%, 100% { transform: rotateX(7deg) rotateY(-7deg) translateY(0) translateZ(0); }
  50% { transform: rotateX(-4deg) rotateY(6deg) translateY(-12px) translateZ(18px); }
}
@keyframes sheen {
  0%, 100% { transform: translateX(-30%); }
  50% { transform: translateX(30%); }
}

/* ------------------------------------------------------------ work cards */
.work-card { display: flex; flex-direction: column; gap: 10px; padding: 12px 12px 16px; }
.work-open {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.work-card img, .dialog-shot img {
  width: 100%;
  border: 1px solid rgba(46, 211, 255, .25);
  border-radius: 10px;
  background: var(--card-b);
  object-fit: cover;
  object-position: top;
}
.work-open img { aspect-ratio: 16 / 10; margin-bottom: 11px; }
.work-name { font-size: 17px; font-weight: 700; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.work-industry { font-size: 13.5px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.work-meta { font-size: 12.5px; line-height: 1.5; color: var(--accent); overflow-wrap: anywhere; }
/* a real client's live site */
.work-client, .dialog-client {
  align-self: flex-start;
  padding: 3px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(46, 211, 255, .1);
  color: var(--accent-hi);
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  line-height: 1.5;
}
.work-action { align-self: flex-start; margin-top: auto; }

.video-link, .design-link { display: flex; flex-direction: column; gap: 3px; color: inherit; text-decoration: none; }
.video-link img, .design-link img { margin-bottom: 11px; }
.video-card.portrait img { aspect-ratio: 9 / 16; }
.video-card.landscape img { aspect-ratio: 16 / 9; }
.video-grid .landscape { grid-column: span 2; }
/* designs come in any shape: a fixed 4:5 box (width/height in the markup) with the whole picture in it */
.design-link img { aspect-ratio: 4 / 5; object-fit: contain; }
.video-platform { font-family: var(--font-label); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.video-link[data-embed] .video-platform::before { content: "▶ "; content: "▶ " / ""; }
.video-title, .design-title { font-size: 16px; font-weight: 700; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }

.showroom-note, .empty-category {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin-top: 48px;
  padding: 22px 26px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--wash);
}
.empty-category { justify-content: center; margin-top: 0; padding: 40px 26px; text-align: center; flex-direction: column; }
.showroom-note p, .empty-category p { color: var(--muted); }

/* ------------------------------------------------------------ services, process, about, contact */
.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.service-card { display: flex; flex-direction: column; gap: 18px; padding: 30px; }
.service-card h3 { font-size: 22px; color: var(--accent-hi); }
:lang(en) .service-card h3, :lang(ms) .service-card h3 { font-family: var(--font-display); letter-spacing: .02em; }
.service-card ul { display: flex; flex-direction: column; gap: 10px; list-style: none; color: var(--muted); }
.service-card li { position: relative; padding-left: 18px; }
.service-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .68em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.service-card .btn { align-self: flex-start; margin-top: auto; }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; list-style: none; counter-reset: step; }
.steps li {
  counter-increment: step;
  padding: 22px;
  border: 1px solid rgba(46, 211, 255, .28);
  border-radius: 14px;
  background: var(--wash);
  font-weight: 500;
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-label);
  font-size: 15px;
  letter-spacing: .1em;
  color: var(--accent-hi);
}

/* terms under the steps: small accent squares, like the hero's particles */
.terms-box { margin-top: 28px; padding: 24px 26px; border: 1px solid var(--line); border-radius: 14px; background: var(--wash); }
.terms-title { margin-bottom: 14px; font-size: 19px; color: var(--accent-hi); }
:lang(en) .terms-title, :lang(ms) .terms-title { font-family: var(--font-display); letter-spacing: .02em; }
.terms { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 10px 32px; list-style: none; color: var(--muted); }
.terms li { position: relative; padding-left: 20px; }
.terms li::before { content: ""; position: absolute; left: 0; top: .66em; width: 7px; height: 7px; background: var(--accent); }

.about-text { max-width: 40em; font-size: 18px; line-height: 1.8; color: var(--muted); }
.about-facts { display: grid; gap: 10px; max-width: 46em; margin-top: 22px; }
.about-facts div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px; }
.about-facts dt { flex: none; min-width: 7.5em; font-family: var(--font-label); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.about-facts dd { min-width: 0; color: var(--text); }
.social-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; list-style: none; }
.social-links a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 6px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  transition: border-color .2s, color .2s;
}
.social-links a:hover { border-color: var(--accent-hi); color: var(--accent-hi); }

.contact-actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* ------------------------------------------------------------ footer */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  padding: 36px var(--pad-x) 48px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent-hi); }

/* ------------------------------------------------------------ page bottom: the DNA loop
 * The owner's DNA helix (assets/video/dna.mp4, golden; a hue turn makes it the logo's blue-violet) floats behind the contact section and the
 * footer. site.js loads it near the bottom of the page; until then, and under reduced motion or
 * Save-Data, the poster shows. The top fades in from --bg so it blends into the section above, and
 * a dark scrim sits between the picture and the text.
 */
.page-bottom { position: relative; isolation: isolate; overflow: hidden; border-top: 1px solid var(--line); }
.dna-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: var(--bg); }
.dna-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .55;
  filter: hue-rotate(190deg) saturate(1.2);
  transform: translateY(-5px) scale(1.03);
  animation: dna-float 12s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes dna-float {
  from { transform: translateY(-5px) scale(1.03); }
  to { transform: translateY(5px) scale(1.05); }
}
.dna-bg::before, .dna-bg::after { content: ""; position: absolute; z-index: 1; pointer-events: none; }
.dna-bg::before { inset: 0 0 auto; height: 42%; background: linear-gradient(180deg, var(--bg) 0%, rgba(8, 16, 30, .6) 45%, rgba(8, 16, 30, 0) 100%); }
.dna-bg::after {
  inset: 0;
  background:
    linear-gradient(0deg, rgba(5, 8, 20, .82) 0, rgba(5, 8, 20, 0) 38%),
    linear-gradient(90deg, rgba(5, 8, 20, .62) 0%, rgba(5, 8, 20, .3) 48%, rgba(5, 8, 20, .08) 100%);
}
.page-bottom #contact { padding-top: 128px; padding-bottom: 136px; }
/* over the helix the footer sits on its own dark band, in the text colour */
.page-bottom .site-footer { background: linear-gradient(180deg, rgba(5, 8, 20, .62) 0%, rgba(5, 8, 20, .86) 100%); color: var(--text); }
.page-bottom .site-footer a { color: var(--text); }
.page-bottom .site-footer a:hover { color: var(--accent-hi); }
/* the outline buttons get a dark fill so their text holds its contrast over the helix */
.page-bottom .btn-ghost { background: rgba(5, 8, 20, .78); }
.page-bottom .btn-ghost:hover { background: rgba(5, 8, 20, .9); }
@media (prefers-reduced-motion: reduce) { .dna-video { animation: none; transform: none; } }
@media print { .dna-bg { display: none !important; } }

/* ------------------------------------------------------------ floating WhatsApp (phones) */
.wa-float { display: none; }
@media (max-width: 700px) {
  .wa-float {
    position: fixed;
    right: calc(16px + env(safe-area-inset-right, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 30;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border: 1.5px solid var(--accent-hi);
    border-radius: 50%;
    background: rgba(5, 8, 20, .92);
    color: var(--accent-hi);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .5), 0 0 18px rgba(46, 211, 255, .25);
    -webkit-tap-highlight-color: transparent;
    /* site.js adds .is-shown once the hero heading has scrolled up off the screen (the hero has
     * its own WhatsApp button); without script it stays hidden and the contact section carries WhatsApp */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity .25s, transform .25s, visibility .25s, background-color .2s, color .2s;
  }
  .wa-float.is-shown { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
  .wa-float:hover, .wa-float:active { background: var(--accent); color: var(--ink); }
  /* room under the footer text so the button never covers it at the end of the page */
  .page-home .site-footer { padding-bottom: calc(48px + 72px + env(safe-area-inset-bottom, 0px)); }
}
html:has(#work-dialog[open]) .wa-float { display: none; }
@media (prefers-reduced-motion: reduce) { .wa-float { transform: none; transition: none; } }
@media print { .wa-float { display: none !important; } }

/* ------------------------------------------------------------ work dialog */
#work-dialog {
  width: min(1040px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: linear-gradient(155deg, var(--card-a) 0%, var(--card-b) 60%, #0A1024 100%);
  color: var(--text);
  box-shadow: 0 40px 100px rgba(0, 0, 0, .8), 0 0 60px rgba(46, 211, 255, .14);
}
#work-dialog::backdrop { background: rgba(5, 8, 20, .82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: calc(100vh - 34px);
  padding: 36px 40px 40px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
@supports (height: 1svh) {
  #work-dialog { max-height: calc(100svh - 32px); }
  .dialog-body { max-height: calc(100svh - 34px); }
}
.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(5, 8, 20, .88);
  color: var(--accent-hi);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.dialog-close:hover { border-color: var(--accent-hi); color: var(--text); }
.dialog-title { padding-right: 52px; font-size: clamp(24px, 3vw, 34px); }
:lang(en) .dialog-title, :lang(ms) .dialog-title { font-family: var(--font-display); letter-spacing: .02em; }
.dialog-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dialog-meta div { min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--wash); }
.dialog-meta dt, .dialog-shot figcaption {
  font-family: var(--font-label);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}
.dialog-meta dt { margin-bottom: 4px; }
.dialog-meta dd { font-size: 15px; line-height: 1.5; }
.dialog-highlight { font-size: 17px; line-height: 1.75; color: var(--muted); }
/* 1280×800 and 600×1298 screenshots at the same height */
.dialog-shots { display: grid; grid-template-columns: minmax(0, 3.46fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dialog-shot { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dialog-shot figcaption { color: var(--muted); }
.dialog-desktop img { aspect-ratio: 1280 / 800; }
.dialog-mobile img { aspect-ratio: 600 / 1298; }
#work-dialog[data-mode="design"] .dialog-shots { grid-template-columns: minmax(0, 1fr); }
#work-dialog[data-mode="design"] .dialog-desktop img { aspect-ratio: auto; max-height: 72vh; object-fit: contain; }
.dialog-player { width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; background: #000; }
.dialog-player[data-orientation="portrait"] { width: auto; height: min(72vh, 720px); max-width: 100%; aspect-ratio: 9 / 16; margin-inline: auto; }
.dialog-player iframe { display: block; width: 100%; height: 100%; border: 0; }
.dialog-action { align-self: flex-start; }
@media (prefers-reduced-motion: no-preference) {
  #work-dialog[open] { animation: dialog-in .28s ease-out; }
  #work-dialog[open]::backdrop { animation: fade-in .28s ease-out; }
}
@keyframes dialog-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------ privacy and 404 */
.privacy { max-width: calc(800px + 2 * var(--gutter)); margin: 0 auto; padding: 72px var(--gutter) 88px; }
.privacy h1 { margin-bottom: 28px; font-size: clamp(30px, 4vw, 44px); }
.privacy-list { display: flex; flex-direction: column; gap: 12px; list-style: none; }
.privacy-list li { padding: 16px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--wash); color: var(--muted); }
.privacy > p { margin-top: 32px; }
.page-404 { display: grid; min-height: 100vh; place-items: center; }
.not-found { display: flex; flex-direction: column; align-items: center; gap: 28px; width: 100%; max-width: 760px; padding: 56px var(--gutter); text-align: center; }
.not-found .logo-img { height: 104px; }
.nf-block { width: 100%; padding: 26px 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--wash); }
.nf-block h2 { margin-bottom: 8px; font-size: 26px; color: var(--accent-hi); }
.nf-block p { color: var(--muted); }
.nf-block .btn { margin-top: 14px; }

/* ------------------------------------------------------------ narrower screens */
@media (max-width: 1100px) {
  .work-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 20px; }
  .hero-stats li { max-width: none; }
}
/* the header WhatsApp button is a desktop extra; the hero and contact buttons stay */
@media (max-width: 1000px) {
  .header-wa { display: none; }
}
@media (max-width: 900px) {
  .service-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  .site-header { gap: 12px; padding-top: 14px; padding-bottom: 14px; }
  .logo-img { height: 48px; }
  .lang-switch { order: 2; margin-left: auto; }
  .site-nav { order: 3; flex-basis: 100%; gap: 4px 16px; margin-left: 0; }
  .site-nav a { font-size: 13.5px; }

  /* phone hero: the frame first, the copy below; the shade darkens downward from the frame */
  .hero {
    --frame-h: min(32vh, 280px);
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    min-height: 0;
    padding: 12px var(--gutter) 52px;
  }
  .hero::before {
    background: linear-gradient(180deg, rgba(8, 16, 30, 0) 0, rgba(8, 16, 30, 0) calc(var(--frame-h) * .7),
      rgba(8, 16, 30, .86) calc(var(--frame-h) + 36px), var(--shade) 100%);
  }
  .stars-frame, .stars-hint, .stars-fallback { grid-column: 1; grid-row: 1; }
  .hero-copy { grid-column: 1; grid-row: 2; }
  .stars-hint { font-size: 12.5px; letter-spacing: .18em; }
  .hero-eyebrow { font-size: 11.5px; letter-spacing: .14em; margin-bottom: 10px; }
  .hero-lede { font-size: 16px; margin-top: 14px; }
  .hero-cta { flex-wrap: nowrap; gap: 10px; margin-top: 18px; }
  .hero-cta .btn { flex: 1 1 0; min-width: 0; width: auto; padding: 12px 12px; font-size: 15px; }
  .hero-stats { gap: 14px; margin-top: 32px; }
  .hero-stats strong { font-size: 36px; }
  .hero-stats span { font-size: 12px; }

  .section { padding-top: 64px; padding-bottom: 64px; }
  .section > h2 { margin-bottom: 22px; }
  #work { grid-template-columns: minmax(0, 1fr); }
  #work > h2 { margin-bottom: 22px; }
  #work > .work-tabs { grid-column: 1; margin-bottom: 64px; }
  #services > h2 { margin-bottom: 48px; }
  .work-tab { min-height: 40px; padding: 7px 16px; font-size: 14px; }

  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .work-card { gap: 8px; padding: 9px 9px 12px; border-radius: 14px; }
  .work-open img { margin-bottom: 8px; border-radius: 8px; }
  .work-name { font-size: 14.5px; }
  .work-industry { font-size: 12px; }
  .work-meta { font-size: 11.5px; }
  /* the required demo disclosure: full size, full colour, a touch heavier so it survives the 3D layer */
  /* ten identical showroom links: on a phone they are a light text link, the note below has the button */
  .work-card .work-action {
    min-height: 32px;
    padding: 4px 0;
    border: 0;
    border-radius: 0;
    justify-content: flex-start;
    text-align: left;
    color: var(--accent-hi);
    font-size: 12px;
    line-height: 1.35;
    text-decoration: underline;
    text-decoration-color: var(--line-strong);
    text-underline-offset: 3px;
  }
  .work-card .work-action:hover { color: var(--text); box-shadow: none; }
  .video-title, .design-title { font-size: 14.5px; }

  .showroom-note { flex-direction: column; align-items: stretch; margin-top: 64px; padding: 20px; text-align: center; }
  .showroom-note .btn, .empty-category .btn { width: 100%; }

  .service-card { padding: 24px 22px; }
  .service-card .btn { align-self: stretch; }
  .steps li { padding: 18px; }
  .terms-box { padding: 20px 18px; }
  .about-text { font-size: 16px; }
  .page-bottom #contact { padding-top: 88px; padding-bottom: 96px; }
  .about-facts dd { font-size: 15px; }
  .contact-actions { flex-direction: column; }
  .contact-actions .btn { width: 100%; }

  .dialog-body { padding: 60px 18px 24px; gap: 16px; }
  .dialog-title { padding-right: 0; }
  .dialog-meta { display: block; border: 1px solid var(--line); border-radius: 12px; background: var(--wash); }
  .dialog-meta div { display: flex; gap: 12px; align-items: baseline; padding: 10px 14px; border: 0; border-radius: 0; background: none; }
  .dialog-meta div + div { border-top: 1px solid var(--line); }
  .dialog-meta dt { flex: 0 0 34%; margin: 0; }
  .dialog-shots { grid-template-columns: minmax(0, 1fr); }
  .dialog-mobile { width: 62%; justify-self: center; }
  .dialog-action { align-self: stretch; }
  .privacy { padding-top: 48px; }
}
@supports (height: 1svh) {
  @media (max-width: 700px) { .hero { --frame-h: min(32svh, 280px); } }
}
@media (max-width: 480px) {
  .steps { grid-template-columns: minmax(0, 1fr); }
}
/* the smallest phones: the logo and the language switch still share the first header row */
@media (max-width: 380px) {
  .site-header { column-gap: 10px; }
  .logo-img { height: 42px; }
  .lang-switch a { padding: 0 9px; }
}

/* ------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  .work-card, .service-card, .work-card::before, .service-card::before { animation: none; }
}
