:root {
    --dark: #0b2a4a;
    --dark-2: #04101e;
    --gold: #d4a373;
    --gold-2: #e8c9a3;
    --orange: #e8531f;
    --ink: #1c2733;
    --muted: #5d6b7a;
    --bg: #f3f5f9;
    --card: #ffffff;
    --gutter: clamp(16px, 5vw, 48px);
    --radius: 16px;
    --font-head: 'Poppins', system-ui, sans-serif;
    --font-body: 'Inter', "Segoe UI", system-ui, sans-serif;
    --ease: cubic-bezier(.2,.8,.2,1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-body); background: var(--bg); color: var(--ink); overflow-x: hidden; }
img { max-width: 100%; }
a { text-decoration: none; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-head); }

/* ================= Navbar ================= */
/* Sits over the top of the hero and scrolls away with the page (not sticky). */
.navbar { position: absolute; inset: 0 0 auto 0; z-index: 50; display: flex; align-items: center; justify-content: space-between;
    padding: 16px var(--gutter); background: transparent; }
.brand { display: flex; align-items: center; gap: 14px; color: #fff; font-family: var(--font-head); font-weight: 700; letter-spacing: .02em; }
.brand img { width: clamp(92px, 12vw, 170px); height: clamp(92px, 12vw, 170px); object-fit: contain; }
/* Pinned near the top (the big logo would otherwise centre them low) and
   grouped in a frosted-glass pill so they stay legible over the video. */
.nav-links {
    align-self: flex-start; margin-top: 10px;
    display: flex; gap: 4px; padding: 5px;
    background: rgba(6,22,40,.38); backdrop-filter: blur(12px) saturate(140%); -webkit-backdrop-filter: blur(12px) saturate(140%);
    border: 1px solid rgba(255,255,255,.14); border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.08);
}
.nav-links a {
    padding: 9px 22px; border-radius: 999px;
    color: #eef3f9; font-family: var(--font-head); font-size: .92rem; font-weight: 500; letter-spacing: .03em;
    transition: background .25s var(--ease), color .25s var(--ease);
}
.nav-links a:active { background: rgba(255,255,255,.18); }
.nav-cta { display: inline-block; padding: 9px 20px; border-radius: 999px; background: var(--gold); color: #1c1408; font-weight: 600; font-size: .9rem; transition: transform .25s var(--ease), box-shadow .25s var(--ease); }

/* "Welcome to HM Group" plus the tagline/description/Explore button that
   used to sit centered in the hero — all consolidated into one corner card
   pinned to the hero's bottom-right, so the photo stays clear in the middle.
   Scoped to .hero (not viewport-fixed) so it scrolls away with the hero
   instead of floating over the cards below. */
.corner-cta {
    position: absolute; right: var(--gutter); bottom: clamp(16px, 2.5vh, 24px); z-index: 2;
    display: flex; flex-direction: column; align-items: flex-start;
    width: min(330px, calc(100vw - 2 * var(--gutter)));
    padding: 20px 22px 18px; border-radius: 18px; text-align: left;
    background: linear-gradient(160deg, rgba(12,36,62,.80), rgba(4,14,28,.92));
    backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid rgba(255,255,255,.09);
    box-shadow: 0 24px 60px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.07);
}
/* brand accent bar along the card's top edge */
.corner-cta::before {
    content: ""; position: absolute; top: -1px; left: 22px; width: 48px; height: 3px;
    border-radius: 0 0 3px 3px; background: linear-gradient(90deg, var(--orange), var(--gold));
}
.corner-title { margin: 0; color: #fff; font-family: var(--font-head); font-weight: 700; font-size: clamp(1.05rem, 1.6vw, 1.3rem); line-height: 1.25; letter-spacing: .005em; }
.corner-title span { color: var(--gold); }
.corner-cta .nav-cta { margin-top: 16px; padding: 10px 22px; font-size: .88rem; letter-spacing: .02em; box-shadow: 0 8px 20px rgba(212,163,115,.26); }

/* ================= Hero ================= */
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: flex; align-items: center; justify-content: center; overflow: hidden; color: #fff; text-align: center; }
.hero-video, .hero-shade { position: absolute; inset: 0; }
.hero-video { width: 100%; height: 100%; object-fit: cover; object-position: center; z-index: 0; background: #0b2a4a; transition: opacity 1s linear; }
.hero-shade { z-index: 1; background: linear-gradient(180deg, rgba(4,16,30,.72) 0%, rgba(6,22,40,.38) 40%, rgba(6,22,40,.85) 100%); }
/* Two copies of the hero video take turns (see the crossfade script in
   index.html); the one coming in fades in on top of the one going out. */
.hero-video.is-front { z-index: 1; }
.hero-video.is-hidden { opacity: 0; }

/* Crisp "HM GREEN CITY" plaque laid over the tower sign, which the video
   renders blurry and misspelt. The box matches the video's cover-fit area
   (16:9, centred; the hero is one screen tall) so the plaque can be placed
   in the video's own 1280x720 pixel coordinates. --sx/--sy (video px) are
   driven from the video's currentTime to follow the slight camera drift. */
.hero-sign-box {
    position: absolute; left: 50%; top: 50%; z-index: 1; pointer-events: none;
    width: max(100%, 177.78vh); width: max(100%, 177.78svh); aspect-ratio: 16 / 9;
    transform: translate(-50%, -50%);
    container-type: inline-size; /* cqw below = 1% of the video's displayed width */
}
.hero-sign {
    --sx: 6; --sy: 1;
    position: absolute;
    left: calc((521 + var(--sx)) * 100% / 1280); top: calc((303 + var(--sy)) * 100% / 720);
    width: calc(97 * 100% / 1280); height: calc(16 * 100% / 720);
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(180deg, rgb(214,195,169), rgb(227,208,180));
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
    color: #5f5a30; font-family: var(--font-head); font-weight: 700; font-size: .84cqw;
    letter-spacing: .03em; line-height: 1; white-space: nowrap;
}

/* Small drifting motes — a light "pollen in the wind" cue over the hero,
   independent of the photo underneath it. */
.motes { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.motes span {
    position: absolute; bottom: -5%; border-radius: 50%;
    background: radial-gradient(circle, rgba(232,243,214,.95), rgba(232,243,214,0) 72%);
    opacity: 0; animation: drift linear infinite;
}
.motes span:nth-child(1) { left: 8%;  width: 5px; height: 5px; animation-delay: 0s;  animation-duration: 16s; }
.motes span:nth-child(2) { left: 24%; width: 7px; height: 7px; animation-delay: 3s;  animation-duration: 19s; }
.motes span:nth-child(3) { left: 41%; width: 4px; height: 4px; animation-delay: 6s;  animation-duration: 14s; }
.motes span:nth-child(4) { left: 63%; width: 6px; height: 6px; animation-delay: 2s;  animation-duration: 18s; }
.motes span:nth-child(5) { left: 79%; width: 5px; height: 5px; animation-delay: 8s;  animation-duration: 15s; }
.motes span:nth-child(6) { left: 92%; width: 7px; height: 7px; animation-delay: 5s;  animation-duration: 20s; }
@keyframes drift {
    0%   { transform: translate(0, 0) scale(1); opacity: 0; }
    12%  { opacity: .6; }
    50%  { transform: translate(24px, -52vh) scale(1.15); }
    88%  { opacity: .35; }
    100% { transform: translate(48px, -100vh) scale(.9); opacity: 0; }
}
.corner-eyebrow { display: flex; align-items: center; gap: 8px; margin: 7px 0 0; color: var(--gold); font-size: clamp(.6rem, 1vw, .68rem); font-weight: 600; letter-spacing: .26em; text-transform: uppercase; }
.corner-eyebrow::before { content: ""; width: 18px; height: 1.5px; background: var(--gold); opacity: .8; }
.corner-sub { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); color: rgba(231,237,245,.82); font-size: clamp(.8rem, 1.1vw, .86rem); line-height: 1.55; font-weight: 400; }

/* Liquid-glass sheen: a soft light spot that follows the cursor, layered over
   the button's own background. Built with plain CSS + a couple of custom
   properties (no external runtime) — see the JS mousemove handler. */
.liquid-btn { position: relative; overflow: hidden; isolation: isolate; }
.liquid-btn::before {
    content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: radial-gradient(90px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.55), rgba(255,255,255,0) 65%);
    opacity: 0; transition: opacity .35s var(--ease);
}
@media (hover: hover) and (pointer: fine) {
    .liquid-btn:hover::before { opacity: .8; }
}
/* keeps the label crisp above the glow layer */
.liquid-btn > span { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 8px; }

/* Auto-sweeping shine on the corner Explore button — runs on its own, on
   page load, on every device (not just on hover), so the "liquid" feel is
   visible the instant the page opens instead of only when a mouse finds it. */
.nav-cta.liquid-btn::after {
    content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; z-index: 1; pointer-events: none;
    background: linear-gradient(115deg, transparent, rgba(255,255,255,.75), transparent);
    transform: skewX(-18deg);
    animation: shine-sweep 3.4s ease-in-out infinite;
}
@keyframes shine-sweep {
    0%, 18% { left: -60%; }
    62%, 100% { left: 130%; }
}
@media (prefers-reduced-motion: reduce) {
    .nav-cta.liquid-btn::after { animation: none; display: none; }
}
.nav-cta:active { transform: scale(.96); }
.scroll-cue { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 2; color: #fff; opacity: .8; font-size: 1.3rem;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border: 1.5px solid rgba(255,255,255,.5); border-radius: 50%;
    animation: bob 2.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translate(-50%, 6px); } }

/* ================= Sections ================= */
.section { max-width: 1280px; margin: 0 auto; padding: clamp(48px, 8vw, 88px) var(--gutter); }
#sites {
    max-width: none; position: relative;
    background:
        radial-gradient(55% 60% at 12% 8%, rgba(212,163,115,.14), transparent 62%),
        radial-gradient(50% 55% at 100% 100%, rgba(11,42,74,.09), transparent 65%),
        var(--bg);
}
#sites > * { max-width: 1280px; margin-left: auto; margin-right: auto; }
.section-title { text-align: center; margin: 0; font-size: clamp(1.6rem, 5vw, 2.3rem); color: var(--dark); font-weight: 700; }
.section-title::after { content: ""; display: block; width: 64px; height: 4px; border-radius: 4px; margin: 14px auto 0; background: linear-gradient(90deg, var(--orange), var(--gold)); }
.section-sub { text-align: center; color: var(--muted); margin: 14px auto clamp(28px, 6vw, 48px); max-width: 560px; line-height: 1.6; }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.grid .card.reveal { transition-delay: calc(var(--i, 0) * 60ms); }
/* cards keep their own perspective/tilt transform once revealed, instead of
   the plain "transform: none" every other .reveal element gets */
.card.reveal.in { transform: perspective(900px) rotateX(var(--ry, 0deg)) rotateY(var(--rx, 0deg)) translateY(var(--lift, 0px)); }

/* ================= Website cards ================= */
.grid { display: grid; gap: clamp(18px, 3vw, 30px); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: stretch; }
.card { --accent: var(--gold); position: relative; display: flex; flex-direction: column; background: var(--card); border-radius: 32px; overflow: hidden;
    box-shadow: 0 10px 30px rgba(11,42,74,.14); border-top: 6px solid var(--accent);
    transition: box-shadow .35s var(--ease);
    animation: cardFloat 6s ease-in-out infinite; }
.grid .card:nth-child(1) { animation-delay: 0s; }
.grid .card:nth-child(2) { animation-delay: .7s; }
.grid .card:nth-child(3) { animation-delay: 1.4s; }
/* The idle bob and the live mouse-tilt both drive `transform`, so the bob is
   written as a keyframe animation that keeps reading --rx/--ry/--lift live,
   instead of a plain translateY — that way a running tilt is never fought by
   the float, and dragging the cursor away still snaps back cleanly. */
@keyframes cardFloat {
    0%, 100% { transform: perspective(900px) rotateX(var(--ry, 0deg)) rotateY(var(--rx, 0deg)) translateY(calc(var(--lift, 0px) - 5px)); }
    50%      { transform: perspective(900px) rotateX(var(--ry, 0deg)) rotateY(var(--rx, 0deg)) translateY(calc(var(--lift, 0px) + 5px)); }
}
.card:active { transform: scale(.98); animation-play-state: paused; }
.card-img { position: relative; overflow: hidden; aspect-ratio: 16/10; background: #dde3ea; margin: 14px 14px 0; border-radius: 22px; }
.card-img img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform .7s ease, filter .4s; }
.card-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .35s;
    background: linear-gradient(180deg, rgba(6,22,40,.1), rgba(6,22,40,.55)); }
.card-overlay span { padding: 10px 24px; border: 2px solid #fff; border-radius: 999px; color: #fff; font-weight: 600; transform: translateY(14px); transition: transform .35s; backdrop-filter: blur(3px); }
.badge { position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 8px; font-size: .72rem; font-weight: 600;
    letter-spacing: .03em; text-transform: uppercase; color: #fff; background: var(--accent); border-radius: 999px; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.badge svg { width: 15px; height: 15px; }
.index { position: absolute; bottom: 10px; right: 14px; font-family: var(--font-head); font-weight: 700; font-size: 1.6rem; color: rgba(255,255,255,.85); text-shadow: 0 2px 8px rgba(0,0,0,.5); }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 24px; }
.card-body h3 { margin: 0 0 4px; font-size: 1.25rem; color: var(--dark); font-weight: 700; }
.tag { color: var(--accent); filter: brightness(.8) saturate(1.3); font-weight: 600; font-size: .92rem; margin: 0 0 10px; }
.desc { margin: 0 0 18px; color: var(--muted); line-height: 1.55; flex: 1; font-size: .95rem; }
.btn { align-self: flex-start; display: inline-flex; gap: 8px; align-items: center; padding: 10px 22px; background: var(--dark); color: #fff; border-radius: 999px; font-weight: 600; font-size: .92rem; transition: background .3s, padding .3s; }
.btn b { transition: transform .3s; }

/* ================= Hover-capable devices only ================= */
@media (hover: hover) and (pointer: fine) {
    .nav-links a:hover { background: rgba(255,255,255,.12); color: var(--gold); }
    .nav-cta:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(212,163,115,.4); }
    .card:hover { --lift: -10px; box-shadow: 0 24px 46px rgba(0,0,0,.5); }
    .card:hover .card-img img { transform: scale(1.12); filter: brightness(.65); }
    .card:hover .card-overlay { opacity: 1; }
    .card:hover .card-overlay span { transform: none; }
    .card:hover .btn { background: var(--accent); padding-right: 30px; }
    .card:hover .btn b { transform: translateX(6px); }
    .footer-links a:hover { color: var(--gold); }
    .topbar nav a:hover { background: rgba(255,255,255,.18); }
}

/* ================= Footer ================= */
footer { background: var(--dark-2); color: #b8c6d8; padding: clamp(40px, 7vw, 64px) var(--gutter) calc(28px + env(safe-area-inset-bottom)); }
.footer-inner { max-width: 1100px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 40px; justify-content: space-between; padding-bottom: 28px; border-bottom: 1px solid rgba(255,255,255,.08); }
.footer-brand { display: flex; align-items: center; gap: 14px; max-width: 280px; }
.footer-brand img { width: 46px; }
.footer-brand p { margin: 0; font-family: var(--font-head); font-weight: 600; color: #fff; line-height: 1.4; }
.footer-brand span { display: block; font-family: var(--font-body); font-weight: 400; font-size: .8rem; color: var(--gold); letter-spacing: .04em; }
.footer-links { display: flex; flex-direction: column; gap: 10px; min-width: 140px; }
.footer-links h5 { margin: 0 0 4px; color: #fff; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; font-family: var(--font-head); }
.footer-links a { font-size: .92rem; transition: color .25s; }
.copy { text-align: center; margin: 24px 0 0; font-size: .85rem; }

/* ================= Site viewer page ================= */
body.viewer { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.topbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px var(--gutter); padding-top: calc(10px + env(safe-area-inset-top)); background: var(--dark); color: #fff; flex: 0 0 auto; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.topbar .back { display: flex; align-items: center; gap: 8px; font-weight: 600; flex: 0 0 auto; }
.topbar .back img { width: 26px; height: 26px; object-fit: contain; }
.topbar nav { display: flex; gap: 6px; overflow-x: auto; flex: 1 1 auto; min-width: 0; justify-content: center; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar a { padding: 8px 16px; border-radius: 999px; white-space: nowrap; font-size: .92rem; transition: background .25s; }
.topbar a:active { background: rgba(255,255,255,.25); }
.topbar nav a.active { background: var(--gold); color: #1c1408; font-weight: 700; }
.newtab { flex: 0 0 auto; border: 1px solid rgba(255,255,255,.4); font-size: .88rem; }
.frame-wrap { position: relative; flex: 1; min-height: 0; background: #fff; }
.frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.loader { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--bg); z-index: 2; transition: opacity .5s, visibility .5s; text-align: center; padding: 16px; }
.loader.done { opacity: 0; visibility: hidden; }
.spinner { width: 46px; height: 46px; border: 5px solid #d5dbe4; border-top-color: var(--orange); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loader p { margin: 0; color: var(--muted); font-size: .95rem; }

/* ================= Responsive ================= */
@media (max-width: 900px) {
    .nav-links { display: none; }
    .topbar a { padding: 7px 13px; font-size: .88rem; }
}
@media (max-width: 640px) {
    .corner-cta { padding: 22px 20px 20px; }
    .corner-cta::before { left: 20px; }
    .card-body { padding: 16px 18px 20px; }
    .card-body h3 { font-size: 1.12rem; }
    .btn { width: 100%; justify-content: center; }
    .footer-inner { flex-direction: column; gap: 28px; }
    .topbar { flex-wrap: wrap; row-gap: 6px; }
    .topbar .back span { display: none; }
    .topbar .newtab { margin-left: auto; padding: 7px 12px; font-size: .8rem; }
    .topbar nav { order: 3; flex: 1 1 100%; justify-content: flex-start; }
}
/* Portrait screens (phones, tablets held upright): a full-height hero would
   crop the 16:9 video down to just the tower and blow it up ~3.5x (blurry).
   Instead show the whole scene at its natural 16:9 shape, like on a laptop,
   with the welcome card sitting below it rather than covering it. */
@media (orientation: portrait) {
    .hero { display: block; min-height: 0; padding-top: 56.25vw; background: var(--dark-2); }
    .hero-video, .hero-shade, .motes { inset: 0 0 auto 0; height: 56.25vw; }
    .hero-shade { background: linear-gradient(180deg, rgba(4,16,30,.62) 0%, rgba(6,22,40,.2) 45%, rgba(6,22,40,.4) 100%); }
    .hero-sign-box { left: 0; top: 0; width: 100%; transform: none; }
    .navbar { padding: 10px 14px; }
    .brand img { width: clamp(56px, 16vw, 110px); height: clamp(56px, 16vw, 110px); }
    .corner-cta { position: relative; left: auto; right: auto; bottom: auto; width: auto; margin: 18px var(--gutter) 24px; }
    .scroll-cue { display: none; }
}
@media (min-width: 1600px) {
    .section { max-width: 1500px; }
    .card-body h3 { font-size: 1.5rem; }
    .desc { font-size: 1.02rem; }
}
@media (max-height: 480px) and (orientation: landscape) {
    .scroll-cue { display: none; }
    .brand img { width: 56px; height: 56px; }
    .corner-cta { left: auto; bottom: 16px; width: min(340px, 60vw); padding: 16px 20px; }
    .corner-sub { display: none; }
    .corner-cta .nav-cta { margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .scroll-cue, .card, .motes span { animation: none; }
    .motes { display: none; }
    .reveal { transition: none; opacity: 1; transform: none; }
}
