/* KV World entrance: "Two Worlds, One Hub".
   Wide screens: the approved composition, scaled as one scene; every overlay is positioned in scene
   percentages and sized in container units, so it stays registered with the artwork at any size.
   Narrow or portrait screens: the two worlds become stacked (or side-by-side) cards. */

html, body { margin: 0; min-height: 100%; background: var(--kvds-midnight-900); color: var(--kvds-text); }
body.kvd { font-family: var(--kvds-font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.kvd *, .kvd *::before, .kvd *::after { box-sizing: border-box; }

.kvd-skip {
  position: fixed; left: 16px; top: -60px; z-index: 50; padding: 10px 16px; border-radius: var(--kvds-radius-pill);
  background: var(--kvds-champagne); color: #1d1405; font-weight: 600; text-decoration: none;
}
.kvd-skip:focus { top: 16px; }

.kvd-noscript { position: fixed; bottom: 48px; left: 0; right: 0; text-align: center; color: var(--kvds-text); }

/* ---------- Header ---------- */
.kvd-bar {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, 1.9vw) max(16px, 3.7vw) 0;
  pointer-events: none;
}
.kvd-bar > * { pointer-events: auto; }
.kvd-brand { display: inline-flex; align-items: baseline; gap: 0.42em; color: var(--kvds-text); text-decoration: none; font-size: clamp(20px, 1.95vw, 46px); line-height: 1; }
.kvd-brand__kv { font-weight: 800; letter-spacing: -0.02em; background: linear-gradient(180deg, #fff6e2, #e9cf9c 60%, #c99a52); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kvd-brand__world { font-weight: 300; letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.86em; }
.kvd-brand:focus-visible { outline: none; box-shadow: var(--kvds-focus-ring); border-radius: 8px; }

.kvd-signin, .kvd-me {
  display: inline-flex; align-items: center; gap: 0.6em; min-height: 44px;
  padding: 0.25em 0.3em; border: 0; border-radius: var(--kvds-radius-pill); background: transparent; color: var(--kvds-text);
  font: 500 clamp(15px, 1.08vw, 26px)/1 var(--kvds-font); letter-spacing: 0.02em; cursor: pointer;
  transition: background var(--kvds-dur-2) var(--kvds-ease);
}
.kvd-signin svg { width: 2.2em; height: 2.2em; fill: none; stroke: currentColor; stroke-width: 1.3; }
.kvd-signin:hover, .kvd-me:hover { background: rgba(255, 255, 255, 0.07); }
.kvd-signin:focus-visible, .kvd-me:focus-visible { outline: none; box-shadow: var(--kvds-focus-ring); }
.kvd-me .kvx-avatar { width: 2.2em; height: 2.2em; font-size: 0.9em; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5); }
.kvd-me__name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Hero ---------- */
.kvd-hero { text-align: center; }
.kvd-tagline { margin: 0; font-weight: 400; text-transform: uppercase; letter-spacing: 0.42em; color: #e8ecf6; }
.kvd-rule { display: block; margin-left: auto; margin-right: auto; height: 2px; background: linear-gradient(90deg, transparent, var(--kvds-champagne) 20%, var(--kvds-champagne) 80%, transparent); }
.kvd-logo { margin: 0; display: flex; flex-direction: column; align-items: center; font-weight: 400; }
.kvd-logo__kv {
  font-weight: 800; letter-spacing: -0.03em; line-height: 0.8;
  background: var(--kvds-gold-text); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0.02em 0.04em rgba(0, 0, 0, 0.45));
}
.kvd-logo__world { font-weight: 300; text-transform: uppercase; letter-spacing: 0.19em; color: #f4f4f6; line-height: 1; padding-left: 0.19em; }

/* ---------- Panels ---------- */
.kvd-panel {
  position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; isolation: isolate;
  -webkit-backdrop-filter: blur(10px) saturate(1.25); backdrop-filter: blur(10px) saturate(1.25);
  transition: transform var(--kvds-dur-3) var(--kvds-ease-out), box-shadow var(--kvds-dur-3) var(--kvds-ease-out);
  animation: kvd-rise 900ms var(--kvds-ease-out) both;
}
.kvd-panel--family { animation-delay: 120ms; }
@keyframes kvd-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.kvd-panel__icon { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.kvd-panel__title { margin: 0; font-weight: 400; text-transform: uppercase; letter-spacing: 0.035em; line-height: 1.05; }
.kvd-panel__kv { font-weight: 800; letter-spacing: -0.01em; }
.kvd-panel__sub { margin: 0; font-weight: 500; letter-spacing: 0.13em; }
.kvd-enter {
  position: relative; display: grid; place-items: center; border-radius: 50%;
  color: #fff; text-decoration: none;
  transition: transform var(--kvds-dur-2) var(--kvds-ease), box-shadow var(--kvds-dur-2) var(--kvds-ease);
}
.kvd-enter svg { width: 46%; height: 46%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
/* The whole panel is the hit area: the link's overlay is clipped to the panel by overflow. */
.kvd-panel .kvd-enter::after { content: ""; position: absolute; inset: -999px; }
.kvd-panel { overflow: hidden; }
.kvd-enter:focus-visible { outline: none; }
.kvd-panel:has(.kvd-enter:focus-visible) { box-shadow: 0 0 0 4px var(--kvds-midnight-900), 0 0 0 7px var(--kvds-academy-cyan), var(--kvd-panel-glow); }
.kvd-panel--family:has(.kvd-enter:focus-visible) { box-shadow: 0 0 0 4px var(--kvds-midnight-900), 0 0 0 7px var(--kvds-family-coral), var(--kvd-panel-glow); }
.kvd-panel:hover .kvd-enter, .kvd-enter:focus-visible { transform: scale(1.07); }
.kvd-panel.is-busy .kvd-enter svg { opacity: 0.25; }

.kvd-panel--academy {
  --kvd-panel-glow: 0 0 46px rgba(110, 196, 255, 0.42), 0 26px 60px rgba(4, 20, 50, 0.32);
  background: linear-gradient(180deg, rgba(251, 253, 255, 0.84), rgba(224, 239, 255, 0.7));
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--kvd-panel-glow);
  color: var(--kvds-ink);
}
.kvd-panel--academy .kvd-panel__icon { stroke: #102446; }
.kvd-panel--academy .kvd-panel__sub { color: #1b2b48; }
.kvd-panel--academy .kvd-enter {
  background: radial-gradient(circle at 34% 28%, #4b9bff 0%, #1b56b8 52%, #0f3170 100%);
  box-shadow: 0 0 0 2px rgba(170, 220, 255, 0.85), 0 0 22px rgba(70, 160, 255, 0.65);
}

.kvd-panel--family {
  --kvd-panel-glow: 0 0 52px rgba(255, 54, 80, 0.48), 0 26px 60px rgba(30, 0, 8, 0.4);
  background: linear-gradient(180deg, rgba(158, 32, 52, 0.66), rgba(98, 12, 32, 0.72));
  border: 1px solid rgba(255, 150, 150, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 190, 190, 0.35), var(--kvd-panel-glow);
  color: #fff;
}
.kvd-panel--family .kvd-panel__icon { stroke: #ff6e6e; }
.kvd-panel--family .kvd-panel__sub { color: #ffe9ea; }
.kvd-panel--family .kvd-enter {
  background: radial-gradient(circle at 34% 28%, #5b1424 0%, #2b0610 60%, #1a0309 100%);
  box-shadow: 0 0 0 2px rgba(255, 120, 120, 0.85), 0 0 22px rgba(255, 70, 90, 0.6);
}
.kvd-panel:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), var(--kvd-panel-glow), 0 0 80px rgba(255, 255, 255, 0.08); }

/* ---------- Toast and footer ---------- */
.kvd-toast {
  position: fixed; z-index: 30; left: 50%; top: max(78px, 7.5vw); transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px));
}
.kvd-foot {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: max(8px, env(safe-area-inset-bottom));
  display: flex; justify-content: center; gap: 0.6em; align-items: center;
  font: 500 12px/1 var(--kvds-font); color: rgba(230, 236, 250, 0.55);
}
.kvd-foot a, .kvd-foot button { color: inherit; text-decoration: none; background: none; border: 0; font: inherit; padding: 8px 4px; cursor: pointer; }
.kvd-foot a:hover, .kvd-foot button:hover { color: var(--kvds-text); }
.kvd-foot a:focus-visible, .kvd-foot button:focus-visible { outline: none; box-shadow: var(--kvds-focus-ring); border-radius: 6px; }

/* =====================================================================================
   Wide layout: one scene, registered overlays
   ===================================================================================== */
@media (min-width: 600px) and (min-aspect-ratio: 3/4) {
  body.kvd { overflow: hidden; }
  .kvd-backdrop {
    position: fixed; inset: -6%; z-index: 0;
    background: var(--kvd-scene-1280) center / cover no-repeat;
    filter: blur(42px) brightness(0.55) saturate(1.1);
  }
  .kvd-stage { position: fixed; inset: 0; z-index: 1; overflow: hidden; }
  .kvd-scene {
    /* cover, allowing up to 20% horizontal crop (panels start 9.45% in) on squarer screens and capping very wide screens */
    --sw: min(max(100vw, min(177.68vh, 120vw)), 220vh);
    --sh: calc(var(--sw) / 1.7768);
    position: absolute; left: 50%; width: var(--sw); height: var(--sh);
    top: calc(50vh - var(--sh) / 2 + max(0px, var(--sh) - 100vh) * 0.2);
    transform: translateX(-50%);
    container-type: size;
    background-image: var(--kvd-scene-1672);
    background-image: image-set(var(--kvd-scene-1280) 1x, var(--kvd-scene-2560) 2x);
    background-size: 100% 100%;
  }
  @supports (height: 100dvh) {
    .kvd-scene {
      --sw: min(max(100vw, min(177.68dvh, 120vw)), 220dvh);
      top: calc(50dvh - var(--sh) / 2 + max(0px, var(--sh) - 100dvh) * 0.2);
    }
  }
  @media (min-width: 1500px) {
    .kvd-scene { background-image: image-set(var(--kvd-scene-1672) 1x, var(--kvd-scene-2560) 2x); }
  }
  @media (min-width: 2000px) {
    .kvd-scene { background-image: var(--kvd-scene-2560); }
  }
  @media (max-aspect-ratio: 17/10) {
    .kvd-scene { -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 5%, #000 95%, transparent 100%); mask-image: linear-gradient(180deg, transparent 0, #000 5%, #000 95%, transparent 100%); }
  }
  @media (min-aspect-ratio: 11/5) {
    .kvd-scene { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%); }
  }

  .kvd-hero { position: absolute; left: 25%; right: 25%; top: 11.1%; }
  .kvd-tagline { font-size: max(1.16cqw, 10px); }
  .kvd-rule { width: 3.7cqw; margin-top: 1.25cqw; margin-bottom: 1.45cqw; }
  .kvd-logo__kv { font-size: 9.6cqw; }
  .kvd-logo__world { font-size: 3.45cqw; margin-top: 0.85cqw; }

  .kvd-worlds { position: absolute; inset: 0; }
  .kvd-world { position: absolute; top: 0; height: 100%; width: 50%; }
  .kvd-world--academy { left: 0; }
  .kvd-world--family { left: 50%; }
  .kvd-world__art { display: none; }
  .kvd-panel { top: 50.75%; min-height: 30.2%; width: 62.75%; border-radius: 1.95cqw; gap: 0.25cqw; padding: 1.2cqw 1.4cqw; }
  .kvd-world--academy .kvd-panel { left: 18.95%; }
  .kvd-world--family .kvd-panel { left: 18.7%; }
  .kvd-panel__icon { width: max(4.3cqw, 28px); height: max(4.3cqw, 28px); margin-bottom: 0.5cqw; }
  .kvd-panel__title { font-size: max(2.62cqw, 17px); }
  .kvd-panel__sub { font-size: max(1.08cqw, 11px); margin-top: 0.75cqw; margin-bottom: 1.5cqw; text-wrap: balance; }
  .kvd-enter { width: 4.25cqw; height: 4.25cqw; min-width: 44px; min-height: 44px; }
  .kvd-panel:hover { transform: translateY(-0.35cqw); }
}

/* =====================================================================================
   Narrow and portrait layout: the two worlds as cards
   ===================================================================================== */
@media (max-width: 599.98px), (max-aspect-ratio: 2999/4000) {
  .kvd-backdrop {
    position: fixed; inset: 0; z-index: 0;
    background:
      radial-gradient(120% 60% at 0% 40%, rgba(47, 134, 255, 0.22), transparent 60%),
      radial-gradient(120% 60% at 100% 70%, rgba(255, 68, 89, 0.2), transparent 60%),
      linear-gradient(180deg, #0b1430, var(--kvds-midnight-900) 60%);
  }
  .kvd-bar {
    position: sticky; padding: 12px 16px;
    background: rgba(7, 11, 23, 0.78); -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
    border-bottom: 1px solid rgba(196, 210, 240, 0.08);
  }
  .kvd-stage { position: relative; z-index: 1; padding: 4px 16px 64px; }
  .kvd-scene { max-width: 980px; margin: 0 auto; }
  .kvd-hero { padding: 10px 0 26px; }
  .kvd-tagline { font-size: clamp(11px, 3.1vw, 15px); letter-spacing: 0.34em; }
  .kvd-rule { width: 48px; margin-top: 14px; margin-bottom: 16px; }
  .kvd-logo__kv { font-size: clamp(76px, 25vw, 150px); }
  .kvd-logo__world { font-size: clamp(24px, 8.4vw, 50px); margin-top: 8px; }
  .kvd-worlds { display: grid; gap: 18px; }
  .kvd-world {
    position: relative; aspect-ratio: 1280 / 1440; border-radius: 28px; overflow: hidden;
    container-type: inline-size; box-shadow: var(--kvds-shadow-2);
  }
  .kvd-world--academy { outline: 1px solid rgba(140, 205, 255, 0.35); outline-offset: -1px; }
  .kvd-world--family { outline: 1px solid rgba(255, 140, 140, 0.35); outline-offset: -1px; }
  .kvd-world__art { position: absolute; inset: 0; background-size: cover; background-position: 50% 0; }
  .kvd-world--academy .kvd-world__art { background-image: var(--kvd-academy-800); background-image: image-set(var(--kvd-academy-800) 1x, var(--kvd-academy-1280) 2x); }
  .kvd-world--family .kvd-world__art { background-image: var(--kvd-family-800); background-image: image-set(var(--kvd-family-800) 1x, var(--kvd-family-1280) 2x); }
  .kvd-panel { left: 5%; right: 5%; top: 49%; bottom: 5%; border-radius: 6.5cqw; gap: 0; padding: 3cqw 4cqw; }
  .kvd-panel__icon { width: 11cqw; height: 11cqw; margin-bottom: 1.6cqw; }
  .kvd-panel__title { font-size: 8.4cqw; }
  .kvd-panel__sub { font-size: 3.55cqw; margin: 2cqw 0 3.6cqw; letter-spacing: 0.08em; text-wrap: balance; line-height: 1.5; }
  .kvd-enter { width: 14.5cqw; height: 14.5cqw; min-width: 48px; min-height: 48px; }
  .kvd-foot { position: static; padding: 0 0 22px; }
}
@media (min-width: 600px) and (max-aspect-ratio: 2999/4000) {
  .kvd-worlds { grid-template-columns: 1fr 1fr; }
}
@media (max-aspect-ratio: 2999/4000) and (min-width: 600px) and (min-height: 900px) {
  .kvd-hero { padding: 6vh 0 5vh; }
}

@media (prefers-reduced-motion: reduce) {
  .kvd-panel { animation: none; }
  .kvd-panel:hover { transform: none; }
}
@media (forced-colors: active) {
  .kvd-panel { border: 2px solid CanvasText; }
  .kvd-logo__kv, .kvd-brand__kv { color: CanvasText; background: none; }
}
