/* ==========================================================
   malkhatib.com — 2026 redesign
   Trends applied: dynamic theming, variable type, kinetic
   headline, micro-interactions, organic shapes, light 3D tilt,
   accessibility-first, performance (no framework, lazy media)
   ========================================================== */

/* Brand palette from the MK logo: navy → sky (M) and orange → yellow (K) */
:root {
  --navy: #022f84;
  --blue: #0b5fb0;
  --sky: #5fbff2;
  --orange: #ff7b00;
  --amber: #f7a531;
  --yellow: #f5f27a;
  --grad-blue: linear-gradient(160deg, var(--navy), #2f8fd8 60%, var(--sky));
  --grad-orange: linear-gradient(135deg, var(--orange), var(--amber) 60%, #f6d258);

  --bg: #f5f7fb;
  --bg-alt: #e9eef7;
  --surface: #ffffff;
  --text: #0d1630;
  --muted: #4c586e;
  --line: #d5ddea;
  --accent: #0b4fb3;        /* 7:1 on --bg */
  --accent-2: #b35400;      /* orange text that passes 4.5:1 on light */
  --accent-soft: #dbe8fb;
  --cta-ink: #1c0e00;
  --blob-a: #9cd3f7;
  --blob-b: #ffc98f;
  --term-bg: #0b1226;
  --term-text: #d6e0f0;
  --shadow: 0 1px 2px rgb(2 47 132 / .06), 0 14px 34px -14px rgb(2 47 132 / .25);
  --radius: 22px;
  --font: "Readex Pro", system-ui, "Segoe UI", Tahoma, sans-serif;
  --font-display: "Changa", "Readex Pro", system-ui, sans-serif;
  --font-wordmark: "Saira Stencil One", "Changa", sans-serif;
  --wordmark: #6b6b6b;      /* grey of the logo wordmark */
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f1e;
    --bg-alt: #0f1629;
    --surface: #141d35;
    --text: #eaf0fa;
    --muted: #a3aec4;
    --line: #233050;
    --accent: #5fbff2;
    --accent-2: #ff9a2e;
    --wordmark: #a3a3a3;
    --accent-soft: #10264a;
    --blob-a: #0b3f8f;
    --blob-b: #7a3d00;
    --term-bg: #060a16;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 20px 40px -16px rgb(0 0 0 / .65);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0f1e;
  --bg-alt: #0f1629;
  --surface: #141d35;
  --text: #eaf0fa;
  --muted: #a3aec4;
  --line: #233050;
  --accent: #5fbff2;
  --accent-2: #ff9a2e;
  --wordmark: #a3a3a3;
  --accent-soft: #10264a;
  --blob-a: #0b3f8f;
  --blob-b: #7a3d00;
  --term-bg: #060a16;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 20px 40px -16px rgb(0 0 0 / .65);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 340;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  overflow-x: clip; /* clip (not hidden) keeps the sticky nav working */
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
img { max-width: 100%; display: block; }
a { color: inherit; }
svg { fill: currentColor; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.25; margin: 0; }

.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }

/* ---------- Accessibility ---------- */
.skip {
  position: absolute; inset-inline-start: 16px; top: -60px; z-index: 100;
  background: var(--orange); color: var(--cta-ink);
  padding: 10px 16px; border-radius: 10px; font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.nav.is-scrolled { border-color: var(--line); }
.nav__inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; text-decoration: none; font-size: 1.1rem; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.wordmark { font-family: var(--font-wordmark); font-weight: 400; letter-spacing: .14em; color: var(--wordmark); font-size: .62rem; text-align: right; }
.footer__brand .wordmark { font-size: .95rem; }
.brand__logo { width: 56px; height: auto; flex: none; overflow: visible; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.mk-stroke:nth-child(1) { --d: 0; } .mk-stroke:nth-child(2) { --d: 4; } .mk-stroke:nth-child(3) { --d: 1; }
.mk-stroke:nth-child(4) { --d: 2; } .mk-stroke:nth-child(5) { --d: 3; }
.mk-stroke { stroke-dasharray: 1; animation: mk-draw 1.1s var(--ease) both; animation-delay: calc(var(--d, 0) * 110ms + 150ms); }
@keyframes mk-draw { from { stroke-dashoffset: 1; } }
.nav__links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav__links a {
  display: block; padding: 8px 12px; border-radius: 10px;
  text-decoration: none; color: var(--muted); font-size: .95rem;
  transition: color .2s, background-color .2s;
}
.nav__links a:hover, .nav__links a.is-active { color: var(--text); background: var(--bg-alt); }
nav { margin-inline-start: auto; }
.nav__actions { display: flex; gap: 8px; }

.icon-btn {
  display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--text); cursor: pointer; font: inherit; font-size: .9rem;
  transition: transform .2s var(--ease), border-color .2s;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.menu-btn { display: none; }

/* ---------- Greeting (personalization) ---------- */
.greet {
  margin-top: 16px; padding: 12px 18px; border-radius: 14px;
  background: var(--accent-soft); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  font-size: .95rem; animation: drop .6s var(--ease) both;
}
.greet a { color: var(--accent); font-weight: 600; }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- Hero ---------- */
.hero { position: relative; padding: clamp(40px, 7vw, 96px) 0 120px; isolation: isolate; overflow: clip; }
.blob {
  position: absolute; z-index: -1; filter: blur(60px); opacity: .55;
  border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%;
  animation: morph 18s ease-in-out infinite alternate;
}
.blob--a { width: 460px; height: 460px; background: var(--blob-a); top: -80px; inset-inline-end: -120px; }
.blob--b { width: 380px; height: 380px; background: var(--blob-b); bottom: 0; inset-inline-start: -100px; animation-delay: -6s; }
@keyframes morph {
  50% { border-radius: 63% 37% 38% 62% / 55% 61% 39% 45%; transform: translate(30px, 20px) rotate(20deg); }
  100% { border-radius: 38% 62% 50% 50% / 60% 40% 60% 40%; transform: translate(-20px, 30px) rotate(-10deg); }
}

.hero__grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(32px, 5vw, 72px); align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 20px;
  padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); font-size: .875rem; color: var(--muted);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 0 var(--orange); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.hero__title { font-size: clamp(2.3rem, 5.6vw, 4.4rem); font-weight: 700; letter-spacing: -.01em; }
.hero__title > span { display: block; }
.kinetic { font-variation-settings: "wght" 700; }
.kinetic--soft { font-weight: 300; color: var(--muted); font-size: .72em; margin-top: .15em; }
/* Kinetic reveal: each word rises in and its weight settles (variable font axis) */
.kinetic .w {
  display: inline-block; opacity: 0; transform: translateY(.5em);
  font-variation-settings: "wght" 200;
  animation: rise .9s var(--ease) forwards;
  animation-delay: calc(var(--i) * 90ms + 100ms);
}
.kinetic--soft .w { animation-name: rise-soft; }
@keyframes rise { to { opacity: 1; transform: none; font-variation-settings: "wght" 700; } }
@keyframes rise-soft { to { opacity: 1; transform: none; font-variation-settings: "wght" 300; } }

.rotator { position: relative; color: var(--accent); min-height: 1.3em; }
.rotator__word { display: inline-block; transition: opacity .35s var(--ease), transform .35s var(--ease), filter .35s; }
.rotator__word.is-out { opacity: 0; transform: translateY(-.35em); filter: blur(6px); }
.rotator__word.is-in { opacity: 0; transform: translateY(.35em); filter: blur(6px); }
.rotator::after {
  content: ""; position: absolute; inset-inline: 0; bottom: .05em; height: .14em; max-width: 4.5em;
  background: var(--grad-orange); border-radius: 99px; opacity: .7;
}

.hero__lead { max-width: 56ch; color: var(--muted); font-size: 1.125rem; margin: 24px 0 32px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  font-family: var(--font-display);
  display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 24px;
  border-radius: 14px; font-weight: 500; text-decoration: none; font-size: 1rem;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-color .25s;
  will-change: transform;
}
.btn svg { width: 22px; height: 22px; }
.btn--primary { background: var(--grad-orange); color: var(--cta-ink); font-weight: 600; box-shadow: 0 8px 24px -10px var(--orange); }
.btn--primary:hover { box-shadow: 0 14px 30px -10px var(--orange); }
.btn--ghost { border: 1px solid var(--line); background: var(--surface); }
.btn--ghost:hover { border-color: var(--text); }
.btn:active { transform: translateY(0) scale(.97); }
.arrow { display: inline-block; transition: transform .25s var(--ease); }
.btn:hover .arrow, .link:hover span { transform: translateX(-4px); }

.stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: clamp(20px, 4vw, 48px); margin: 44px 0 0; }
.stat { margin: 0; }
.stat dt { font-size: .85rem; color: var(--muted); order: 2; }
.stat { display: flex; flex-direction: column; }
.stat dd { margin: 0; font-family: var(--font-display); font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr; text-align: right; }

.hero__visual { position: relative; perspective: 1000px; margin-bottom: 72px; }
.portrait {
  position: relative; margin: 0; aspect-ratio: 3 / 4; max-width: 400px; margin-inline: auto;
  border-radius: 28px; overflow: hidden; background: #000;
  box-shadow: 0 30px 70px -30px rgb(2 47 132 / .7), 0 0 0 1px rgb(255 255 255 / .06);
}
/* Crop the wide stage shot around the subject (he stands at ~75% of the frame) */
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 95% 50%; transform: scale(1.04); }
/* Brand light spill: tints the B&W stage in the logo's navy and orange */
.portrait::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to top, rgb(2 47 132 / .55), transparent 45%),
    radial-gradient(120% 60% at 100% 0%, rgb(255 123 0 / .22), transparent 60%);
  mix-blend-mode: screen;
}

.term {
  position: absolute; bottom: -88px; inset-inline-end: -28px; width: min(310px, 88%);
  background: var(--term-bg); color: var(--term-text); border-radius: 16px;
  border: 1px solid rgb(255 255 255 / .08); box-shadow: 0 30px 60px -20px rgb(0 0 0 / .55);
  direction: ltr; text-align: left; font-family: var(--mono); font-size: .78rem; line-height: 1.6;
  transform-style: preserve-3d; transition: transform .15s ease-out;
}
.term__bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid rgb(255 255 255 / .06); }
.term__bar i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.term__bar i:nth-child(2) { background: #febc2e; }
.term__bar i:nth-child(3) { background: #28c840; }
.term__bar span { margin-left: 8px; color: #7b8698; font-size: .72rem; }
.term__body { padding: 14px 16px 18px; min-height: 150px; max-height: 260px; overflow-y: auto; overscroll-behavior: contain; cursor: text; scrollbar-width: thin; }
.term__out { margin: 0; white-space: pre-wrap; font: inherit; display: inline; }
.term__out a { color: #ffa53d; }
.term__line { display: flex; gap: 8px; align-items: center; }
.term__prompt { color: #5fbff2; }
.term__input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--term-text); font: inherit; caret-color: #ff9a2e; padding: 2px 0; }
.term__input::placeholder { color: #4a5568; }
.term:focus-within { box-shadow: 0 0 0 2px #5fbff2, 0 30px 60px -20px rgb(0 0 0 / .55); }
.term .caret[hidden], #termCaret[hidden] { display: none; }
.term__body .p { color: #5fbff2; }
.term__body .o { color: #ffa53d; }
.term__body .ok { color: #7ee787; }
.term__body .dim { color: #7b8698; }
.caret { display: inline-block; width: 8px; height: 1em; background: #ff9a2e; vertical-align: -2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.divider { position: absolute; bottom: -1px; left: 0; width: 100%; height: 90px; fill: var(--bg-alt); }

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 9vw, 120px) 0; }
.section--alt { background: var(--bg-alt); }
.kicker { margin: 0 0 8px; color: var(--accent-2); font-weight: 500; font-size: .95rem; }
.h2 { font-size: clamp(1.8rem, 3.6vw, 2.8rem); font-weight: 650; margin-bottom: 40px; }
.section__head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.link { color: var(--accent); font-weight: 500; text-decoration: none; margin-bottom: 40px; }
.link span { display: inline-block; transition: transform .25s var(--ease); }

/* About */
.about { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(24px, 5vw, 80px); }
.about .h2 { margin: 0; }
.about__body p { margin: 0 0 18px; font-size: 1.1rem; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 24px 0 0; }
.pills li { padding: 6px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: .9rem; }

/* Bento */
.bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  position: relative; padding: 28px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .35s var(--ease), border-color .35s, box-shadow .35s;
  overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%);
  transition: opacity .3s;
}
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: var(--shadow); }
.card:hover::before { opacity: 1; }
.card > * { position: relative; }
.card--lg { grid-row: span 2; display: flex; flex-direction: column; justify-content: end; min-height: 340px;
  background: linear-gradient(160deg, var(--accent-soft), var(--surface) 70%); }
.card--lg h3 { font-size: 1.8rem; }
.card__icon { font-size: 1.8rem; display: block; margin-bottom: 14px; }
.card h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 8px; }
.card p { margin: 0 0 16px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; direction: ltr; justify-content: flex-end; }
.tags span { font-family: var(--mono); font-size: .75rem; padding: 3px 10px; border-radius: 8px; background: var(--bg-alt); color: var(--muted); }

/* Series */
.series { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.serie {
  display: flex; flex-direction: column; text-decoration: none; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); overflow: hidden;
  transition: transform .35s var(--ease), box-shadow .35s;
}
.serie img { aspect-ratio: 16 / 9; width: 100%; object-fit: cover; transition: transform .6s var(--ease); background: var(--bg-alt); }
.serie:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.serie:hover img { transform: scale(1.05); }
.serie__body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.serie h3 { font-size: 1.125rem; font-weight: 600; }
.serie p { margin: 0; color: var(--muted); font-size: .95rem; flex: 1; }
.meta { font-size: .85rem; color: var(--accent-2); font-weight: 500; margin-top: 8px; }
.badge { align-self: flex-start; font-size: .75rem; padding: 2px 10px; border-radius: 99px; background: var(--bg-alt); color: var(--muted); }
.badge--new { background: var(--grad-orange); color: var(--cta-ink); font-weight: 600; }

/* Videos */
.videos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.video { text-decoration: none; display: block; }
.video__thumb { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--bg-alt); }
.video__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.video__thumb::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; border-radius: 50%;
  background: rgb(0 0 0 / .55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E") center / 26px no-repeat;
  opacity: 0; transform: scale(.8); transition: opacity .3s, transform .3s var(--ease);
}
.video:hover .video__thumb img { transform: scale(1.06); }
.video:hover .video__thumb::after { opacity: 1; transform: scale(1); }
.video__dur { position: absolute; bottom: 8px; left: 8px; z-index: 1; font-family: var(--mono); font-size: .72rem; background: rgb(0 0 0 / .75); color: #fff; padding: 1px 6px; border-radius: 6px; }
.video h3 { font-size: 1rem; font-weight: 500; margin: 12px 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video small { color: var(--muted); font-size: .85rem; }

/* Community */
.community { display: grid; grid-template-columns: 1.3fr .7fr; gap: 20px; }
.community__main {
  padding: clamp(28px, 5vw, 56px); border-radius: 28px; color: #e9edf3;
  background:
    radial-gradient(600px 300px at 0% 100%, rgb(255 123 0 / .35), transparent 60%),
    radial-gradient(500px 340px at 100% 0%, rgb(95 191 242 / .45), transparent 60%),
    linear-gradient(160deg, #022f84, #061a45);
}
.community__main .kicker { color: #ffb45c; }
.community__main .h2 { margin-bottom: 16px; }
.community__main p { color: #c3d2ea; margin: 0 0 28px; }
.community__side { display: grid; gap: 20px; }
.chan {
  display: flex; align-items: center; gap: 16px; padding: 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); text-decoration: none;
  transition: transform .3s var(--ease), border-color .3s;
}
.chan:hover { transform: translateX(-4px); border-color: var(--accent); }
.chan strong { display: block; font-weight: 600; }
.chan small { color: var(--muted); }
.chan__icon { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 14px; color: #fff; }
.chan__icon svg { width: 26px; height: 26px; }
.chan__icon--discord { background: #5865f2; }
.chan__icon--tg { background: #229ed9; }

/* Contact */
.contact { text-align: center; }
.contact__title { font-size: clamp(2rem, 5vw, 3.6rem); }
.email {
  display: inline-flex; flex-direction: column; align-items: center; gap: 4px;
  border: 0; background: none; cursor: pointer; color: var(--text); font: inherit; padding: 8px 16px;
}
.email__addr {
  font-size: clamp(1.4rem, 4.5vw, 2.6rem); font-weight: 600;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent;
  border-bottom: 2px dashed var(--line); transition: border-color .3s;
}
.email:hover .email__addr { border-color: var(--accent); }
.email__hint { font-size: .85rem; color: var(--muted); }
.email.is-copied .email__hint { color: var(--accent); }
.socials { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; list-style: none; padding: 0; margin: 40px 0 0; }
.socials a {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .3s var(--ease), color .3s, border-color .3s;
}
.socials a:hover { transform: translateY(-4px) rotate(-6deg); color: var(--accent); border-color: var(--accent); }
.socials svg { width: 22px; height: 22px; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: .9rem; }
.footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer p { margin: 0; }
.footer__mono { font-family: var(--mono); font-size: .8rem; }

/* ---------- 3D network canvas (Three.js, progressive enhancement) ---------- */
/* Fixed layer shared by the hero and the brand moment; sections with a
   background paint over it, and JS hides it once both are off screen. */
.scene3d { position: fixed; inset: 0; z-index: -1; opacity: 0; transition: opacity 1.2s var(--ease); pointer-events: none; }
.scene3d.is-ready { opacity: 1; }
.scene3d.is-away { visibility: hidden; }
.scene3d canvas { width: 100% !important; height: 100% !important; display: block; }
.has-3d .blob { opacity: .28; }

/* ---------- Scroll progress ---------- */
.progress { position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 60; background: var(--grad-orange);
  transform-origin: right; transform: scaleX(0); }

/* ---------- Custom cursor (pointer devices only) ---------- */
.cursor { position: fixed; top: 0; left: 0; z-index: 90; pointer-events: none; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 1.5px solid var(--accent); border-radius: 50%; opacity: 0; transition: width .25s var(--ease), height .25s var(--ease), margin .25s var(--ease), background-color .25s, opacity .3s; }
.cursor.is-on { opacity: .9; }
.cursor.is-hover { width: 64px; height: 64px; margin: -32px 0 0 -32px; background: color-mix(in srgb, var(--accent) 14%, transparent); }
.cursor__dot { position: fixed; top: 0; left: 0; z-index: 91; pointer-events: none; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--orange); opacity: 0; }
.cursor.is-on + .cursor__dot { opacity: 1; }
@media (hover: none) { .cursor, .cursor__dot { display: none; } }

/* ---------- Horizontal series track (desktop, GSAP pinned) ---------- */
.series.is-track { display: flex; gap: 24px; width: max-content; }
.series.is-track .serie { width: 380px; flex: none; }
.series-pin { overflow: hidden; }

/* ---------- Footer logo ---------- */
.footer__brand { display: flex; align-items: center; gap: 12px; }
.footer__brand svg { width: 44px; height: auto; }

/* ---------- Stage curtain (spotlight intro) ---------- */
.curtain {
  position: absolute; inset: 0; z-index: 5; pointer-events: none; display: none;
  background: #04060c;
  -webkit-mask-image: radial-gradient(circle var(--r, 170px) at var(--sx, 50%) var(--sy, 40%), transparent 0, transparent 55%, #000 100%);
          mask-image: radial-gradient(circle var(--r, 170px) at var(--sx, 50%) var(--sy, 40%), transparent 0, transparent 55%, #000 100%);
}
.curtain.is-on { display: block; }
.curtain.is-off { opacity: 0; transition: opacity .9s var(--ease) .5s; }
.curtain__hint {
  position: absolute; bottom: 140px; inset-inline: 0; margin: 0; text-align: center;
  color: #8a96ad; font-size: .95rem; letter-spacing: .02em; animation: hint 2.4s ease-in-out infinite;
}
@keyframes hint { 50% { opacity: .35; } }
.curtain__btn {
  position: absolute; z-index: 6; bottom: 80px; left: 50%; transform: translateX(-50%);
  min-height: 44px; padding: 0 18px; border-radius: 99px; border: 1px solid #2a3550;
  background: #0b1226; color: #eaf0fa; font: inherit; cursor: pointer;
}
.curtain__btn:hover { border-color: #ff9a2e; }
.stage-dark .kinetic .w { animation-play-state: paused; }

/* ---------- Brand moment ---------- */
.brand-moment { position: relative; height: 230vh; }
.brand-moment__sticky { position: sticky; top: 0; height: 100vh; display: grid; place-items: center; overflow: hidden; }
.brand-moment__fallback { width: min(560px, 70vw); height: auto; opacity: 0; transition: opacity .6s; }
:root:not(.has-3d) .brand-moment__fallback { opacity: 1; }
:root:not(.has-3d) .brand-moment { height: auto; }
:root:not(.has-3d) .brand-moment__sticky { position: static; height: auto; padding: 80px 16px; gap: 24px; }
.brand-moment__line {
  position: absolute; bottom: 12vh; inset-inline: 16px; margin: 0; text-align: center;
  font-family: var(--font-display); font-size: clamp(1.3rem, 3vw, 2.2rem); color: var(--muted);
  opacity: var(--line-o, 0); transform: translateY(calc((1 - var(--line-o, 0)) * 20px));
}
.brand-moment__line strong { color: var(--text); font-weight: 700; }
:root:not(.has-3d) .brand-moment__line { position: static; --line-o: 1; }

/* ---------- Journey timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; --p: 0; }
.timeline::before, .timeline::after {
  content: ""; position: absolute; top: 0; bottom: 0; inset-inline-start: 50%; width: 3px; margin-inline-start: -1.5px; border-radius: 3px;
}
.timeline::before { background: var(--line); }
.timeline::after { background: linear-gradient(to bottom, var(--navy), var(--sky), var(--orange)); transform-origin: top; transform: scaleY(var(--p)); }
.tl { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; padding: 28px 0; }
.tl::before {
  content: ""; position: absolute; inset-inline-start: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; z-index: 1;
  border-radius: 50%; background: var(--bg); border: 3px solid var(--line); transition: border-color .4s, background-color .4s, box-shadow .4s;
}
[dir="rtl"] .tl::before { margin: -9px -9px 0 0; }
.tl.is-lit::before { border-color: var(--orange); background: var(--orange); box-shadow: 0 0 0 6px color-mix(in srgb, var(--orange) 22%, transparent); }
.tl__year {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(3rem, 8vw, 6.5rem); line-height: 1; letter-spacing: -.02em;
  color: transparent; -webkit-text-stroke: 1.5px var(--line); text-align: end; transition: -webkit-text-stroke-color .5s, color .5s;
  font-variant-numeric: tabular-nums;
}
.tl.is-lit .tl__year { -webkit-text-stroke-color: transparent; color: var(--accent); }
.tl__card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 26px; transition: border-color .4s, box-shadow .4s; }
.tl.is-lit .tl__card { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: var(--shadow); }
.tl:nth-child(even) .tl__year { order: 2; text-align: start; }
.tl__card time { font-size: .85rem; color: var(--accent-2); font-weight: 500; }
.tl__card h3 { font-size: 1.3rem; font-weight: 700; margin: 4px 0 8px; }
.tl__card p { margin: 0; color: var(--muted); }
.tl__link { display: inline-block; margin-top: 12px; color: var(--accent); font-weight: 500; text-decoration: none; }
.tl__link span { display: inline-block; transition: transform .25s var(--ease); }
.tl__link:hover span { transform: translateX(-4px); }
.tl--now.is-lit .tl__year { background: var(--grad-orange); -webkit-background-clip: text; background-clip: text; color: transparent; }
.timeline__next { text-align: center; font-family: var(--font-display); font-size: 1.4rem; color: var(--muted); margin: 32px 0 0; }
.timeline__next .caret { background: var(--orange); margin-inline-start: 6px; }

/* ---------- Status dashboard (Grafana-ish) ---------- */
.status__updated { display: flex; align-items: center; gap: 8px; margin: 0 0 40px; font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.led { width: 9px; height: 9px; border-radius: 50%; background: #2ecc71; box-shadow: 0 0 0 0 #2ecc71; animation: pulse 2s infinite; }
.dash { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.panel {
  position: relative; background: var(--term-bg); color: var(--term-text); border: 1px solid rgb(255 255 255 / .06);
  border-radius: 16px; padding: 18px 20px; text-decoration: none; overflow: hidden; min-width: 0;
}
.panel__title { font-family: var(--mono); font-size: .75rem; font-weight: 400; color: #7b8698; text-transform: lowercase; margin: 0 0 10px; text-align: left; direction: ltr; }
.panel__big { margin: 0; font-family: var(--mono); font-weight: 600; font-size: clamp(1.5rem, 2.6vw, 2.1rem); color: #5fbff2; text-align: left; font-variant-numeric: tabular-nums; }
.panel--uptime .panel__big { color: #7ee787; }
.panel__sub { margin: 6px 0 0; font-size: .85rem; color: #94a0b6; }
.gauge { height: 6px; border-radius: 6px; background: #1c2742; margin-top: 12px; overflow: hidden; }
.gauge span { display: block; height: 100%; width: calc(var(--v, 0) * 100%); background: var(--grad-orange); border-radius: 6px; transition: width 1.2s var(--ease); }
.panel--latest { grid-column: span 2; transition: border-color .3s; }
.panel--latest:hover { border-color: #5fbff2; }
.latest { display: flex; gap: 14px; align-items: center; }
.latest img { width: 140px; aspect-ratio: 16 / 9; height: auto; object-fit: cover; border-radius: 10px; flex: none; }
.latest__title { margin: 0; color: #eaf0fa; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.panel--bars { grid-column: span 2; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: .82rem; }
.bars a { color: #c9d4e6; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; padding: 3px 8px; border-radius: 6px; isolation: isolate; }
.bars a::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 6px; width: calc(var(--v) * 100%);
  background: linear-gradient(90deg, rgb(95 191 242 / .35), rgb(2 47 132 / .5)); }
.bars a:hover { color: #fff; }
.bars span { font-family: var(--mono); color: #7b8698; text-align: left; direction: ltr; font-size: .78rem; }

/* ---------- Assistant (floating) ---------- */
.as-fab {
  position: fixed; z-index: 70; bottom: 20px; inset-inline-end: 20px;
  display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 20px 0 16px;
  border: 0; border-radius: 99px; cursor: pointer; font: inherit; font-family: var(--font-display); font-weight: 600;
  background: var(--grad-orange); color: var(--cta-ink); box-shadow: 0 12px 30px -10px var(--orange);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.as-fab:hover { transform: translateY(-2px); box-shadow: 0 16px 34px -10px var(--orange); }
.as-fab svg { width: 22px; height: 22px; }
.as-fab__pulse { position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 0 color-mix(in srgb, var(--orange) 60%, transparent); animation: fab-pulse 2.6s infinite; pointer-events: none; }
@keyframes fab-pulse { 70% { box-shadow: 0 0 0 14px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.as-fab[aria-expanded="true"] .as-fab__pulse { animation: none; }

.as-panel {
  position: fixed; z-index: 71; bottom: 86px; inset-inline-end: 20px; width: min(380px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 110px)); display: flex; flex-direction: column;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(12px) scale(.98); transform-origin: bottom left;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.as-panel.is-open { opacity: 1; transform: none; }
.as-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 22px 22px 0 0;
  background: linear-gradient(160deg, var(--navy), #0a2a6b); color: #eaf0fa; }
.as-head__logo { width: 44px; height: auto; flex: none; }
.as-head h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.as-head p { margin: 0; font-size: .82rem; color: #b9c8e4; }
.as-close { margin-inline-start: auto; width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgb(255 255 255 / .2);
  background: none; color: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.as-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.as-lead { margin: 0; color: var(--muted); font-size: .95rem; }
.as-options { display: grid; gap: 10px; margin-top: 4px; }
.as-field { display: grid; gap: 6px; margin-top: 10px; font-size: .88rem; }
.as-field small { color: var(--muted); font-size: .78rem; }
.as-field input { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; text-align: left; }
.as-field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.as-field input[aria-invalid="true"] { border-color: #d64545; }
.as-opt { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; cursor: pointer; text-align: start;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; transition: border-color .2s, transform .2s var(--ease); }
.as-opt:hover { border-color: var(--accent); transform: translateY(-2px); }
.as-opt:disabled { opacity: .6; cursor: progress; }
.as-opt[hidden] { display: none; }
.as-opt__icon { font-size: 1.5rem; }
.as-opt strong { display: block; font-family: var(--font-display); }
.as-opt small { color: var(--muted); }

#asVoice { display: grid; justify-items: center; gap: 12px; padding: 12px 0; }
#asVoice[hidden], #asChat[hidden], #asChoose[hidden] { display: none; }
.as-wave { display: flex; align-items: center; gap: 6px; height: 64px; }
.as-wave i { width: 6px; height: 14px; border-radius: 6px; background: var(--grad-orange); transition: height .3s; }
#asVoice[data-state="connecting"] .as-wave i { animation: wave 1.2s ease-in-out infinite; opacity: .5; }
#asVoice[data-state="live"] .as-wave i { animation: wave .9s ease-in-out infinite; }
.as-wave i:nth-child(2) { animation-delay: -.8s !important; } .as-wave i:nth-child(3) { animation-delay: -.6s !important; }
.as-wave i:nth-child(4) { animation-delay: -.4s !important; } .as-wave i:nth-child(5) { animation-delay: -.2s !important; }
.as-wave i:nth-child(6) { animation-delay: -.5s !important; } .as-wave i:nth-child(7) { animation-delay: -.3s !important; }
@keyframes wave { 50% { height: 56px; } }
.as-timer { margin: 0; font-family: var(--mono); color: var(--muted); }
.as-end { min-height: 44px; padding: 0 22px; border-radius: 99px; border: 0; background: #d64545; color: #fff; font: inherit; font-weight: 600; cursor: pointer; }

.as-msgs { display: flex; flex-direction: column; gap: 8px; min-height: 180px; max-height: 320px; overflow-y: auto; }
.as-msg { margin: 0; padding: 10px 14px; border-radius: 16px; max-width: 85%; white-space: pre-wrap; font-size: .95rem; }
.as-msg--bot { align-self: flex-start; background: var(--bg-alt); border-end-start-radius: 4px; }
.as-msg--me { align-self: flex-end; background: var(--accent); color: var(--bg); border-end-end-radius: 4px; }
.as-form { display: flex; gap: 8px; }
.as-form input { flex: 1; min-width: 0; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.as-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.as-form button { width: 44px; border-radius: 12px; border: 0; background: var(--grad-orange); color: var(--cta-ink); font-size: 1.2rem; font-weight: 700; cursor: pointer; }

.as-status { margin: 0; min-height: 1.2em; font-size: .88rem; color: var(--muted); }
.as-status[data-tone="ok"] { color: var(--accent); }
.as-status[data-tone="err"] { color: #d64545; }
.as-turnstile:empty { display: none; }
.as-note { margin: 0; font-size: .75rem; color: var(--muted); }
@media (max-width: 760px) {
  .as-fab { bottom: 14px; inset-inline-end: 14px; }
  .as-panel { bottom: 78px; inset-inline-end: 12px; width: calc(100vw - 24px); }
}
.reduce-motion .as-fab__pulse, .reduce-motion .as-wave i { animation: none !important; }

/* Scroll reveal */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero__grid, .about, .community { grid-template-columns: 1fr; }
  .hero__visual { max-width: 420px; margin-inline: auto; width: 100%; }
  .bento, .series { grid-template-columns: repeat(2, 1fr); }
  .card--lg { grid-column: span 2; grid-row: auto; min-height: 260px; }
  .videos { grid-template-columns: repeat(2, 1fr); }
  .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .menu-btn { display: inline-grid; }
  nav { position: static; }
  .nav__links {
    position: absolute; top: 68px; inset-inline: 0; flex-direction: column; padding: 12px 16px 20px;
    background: var(--bg); border-bottom: 1px solid var(--line);
    transform: translateY(-8px); opacity: 0; pointer-events: none; visibility: hidden;
    transition: opacity .25s, transform .25s var(--ease), visibility .25s;
  }
  .nav__links.is-open { opacity: 1; transform: none; pointer-events: auto; visibility: visible; }
  .nav__links a { padding: 12px; font-size: 1.05rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .bento, .series, .videos { grid-template-columns: 1fr; }
  .dash { grid-template-columns: 1fr; }
  .panel--latest, .panel--bars { grid-column: auto; }
  .latest img { width: 110px; }
  /* Timeline collapses to one column with the line on the start edge */
  .timeline::before, .timeline::after { inset-inline-start: 9px; }
  .tl { grid-template-columns: 1fr; gap: 6px; padding: 18px 0 18px 0; padding-inline-start: 40px; }
  .tl::before { inset-inline-start: 9px; top: 34px; }
  .tl__year, .tl:nth-child(even) .tl__year { order: 0; text-align: start; font-size: 2.6rem; }
  .brand-moment { height: 180vh; }
  .card--lg { grid-column: auto; }
  .term { inset-inline-end: 0; font-size: .72rem; }
  .footer__inner { justify-content: center; text-align: center; }
  .hero__cta .btn { flex: 1 1 100%; justify-content: center; }
  .term { bottom: -72px; width: 92%; }
  .section__head .link { margin-bottom: 24px; }
}

/* ---------- Reduced motion (OS setting or footer toggle) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
}
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
.reduce-motion .reveal { opacity: 1; transform: none; }
.reduce-motion .term { transform: none !important; }
.reduce-motion .cursor, .reduce-motion .cursor__dot, .reduce-motion .scene3d, .reduce-motion .curtain, .reduce-motion .curtain__btn { display: none; }
.reduce-motion .brand-moment__fallback { opacity: 1; }
.reduce-motion .brand-moment__line { --line-o: 1; }
@media (prefers-reduced-motion: reduce) { .cursor, .cursor__dot, .scene3d, .curtain { display: none; } }
