/* ============================================================
   Code Way Academy · shared design system
   Monochrome first. Sky blue, cobalt blue, magenta and red are accents.
   Motion is always on, by design.
   ============================================================ */

:root {
  color-scheme: dark;
  --bg: #08080a;
  --bg-deep: #050506;
  --bg-2: #0c0c0f;
  --bg-3: #111114;
  --surface: rgba(20, 20, 24, 0.68);
  --surface-2: rgba(255, 255, 255, 0.045);
  --surface-solid: #131317;
  --glass: rgba(17, 17, 21, 0.58);
  --glass-strong: rgba(22, 22, 27, 0.86);
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.17);
  --text: #f6f6f7;
  --muted: #b4b4bd;
  --faint: #7b7b87;
  --sky: #38bdf8;
  --sky-soft: rgba(56, 189, 248, 0.12);
  --blue: #3b82f6;
  --blue-soft: rgba(59, 130, 246, 0.12);
  --magenta: #e879f9;
  --magenta-soft: rgba(232, 121, 249, 0.12);
  --red: #fb7185;
  --red-soft: rgba(251, 113, 133, 0.12);
  --action-bg: linear-gradient(135deg, #ffffff, #dde0e5);
  --action-ink: #09090b;
  --accent: #ffffff;
  --edge: rgba(255, 255, 255, 0.1);
  --sheen: rgba(255, 255, 255, 0.1);
  --shadow: 0 34px 90px rgba(0, 0, 0, 0.52), 0 2px 10px rgba(0, 0, 0, 0.32);
  --font: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  --vt-x: 92%;
  --vt-y: 6%;
  --vt-r: 150vmax;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f7;
  --bg-deep: #eceff2;
  --bg-2: #e9edf1;
  --bg-3: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-2: rgba(255, 255, 255, 0.52);
  --surface-solid: #ffffff;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --line: rgba(12, 18, 28, 0.09);
  --line-strong: rgba(12, 18, 28, 0.17);
  --text: #0d0e12;
  --muted: #4a4d57;
  --faint: #737782;
  --sky: #0369a1;
  --sky-soft: rgba(3, 105, 161, 0.08);
  --blue: #1d4ed8;
  --blue-soft: rgba(29, 78, 216, 0.08);
  --magenta: #a21caf;
  --magenta-soft: rgba(162, 28, 175, 0.07);
  --red: #be123c;
  --red-soft: rgba(190, 18, 60, 0.07);
  --action-bg: linear-gradient(135deg, #17181c, #000000);
  --action-ink: #ffffff;
  --accent: #0b0b0d;
  --edge: rgba(255, 255, 255, 0.9);
  --sheen: rgba(29, 78, 216, 0.08);
  --shadow: 0 34px 80px rgba(24, 34, 52, 0.14), 0 2px 8px rgba(24, 34, 52, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

img,
svg {
  display: block;
  max-width: 100%;
}

p,
h1,
h2,
h3,
h4 {
  margin-top: 0;
}

::selection {
  background: var(--sky-soft);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-solid);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  opacity: 0;
  transform: translateY(-140%);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.skip-link:focus {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- ambient field ---------- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 76px 76px;
  opacity: 0.42;
  -webkit-mask-image: radial-gradient(ellipse 86% 64% at 50% 4%, #000 8%, transparent 78%);
  mask-image: radial-gradient(ellipse 86% 64% at 50% 4%, #000 8%, transparent 78%);
}

.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--grain);
  opacity: 0.045;
  mix-blend-mode: overlay;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(96px);
  opacity: 0.16;
  will-change: transform;
  animation: orb-drift 30s ease-in-out infinite;
}

.orb.o1 {
  top: -18%;
  right: -10%;
  width: 48vw;
  height: 48vw;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.38), transparent 68%);
}

.orb.o2 {
  top: 26%;
  left: -16%;
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, rgba(232, 121, 249, 0.26), transparent 68%);
  animation-delay: -11s;
  animation-duration: 38s;
}

.orb.o3 {
  bottom: -24%;
  left: 36%;
  width: 34vw;
  height: 34vw;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 70%);
  animation-delay: -19s;
  animation-duration: 44s;
}

[data-theme="light"] .orb {
  opacity: 0.3;
}

[data-theme="light"] .orb.o1 {
  background: radial-gradient(circle, rgba(37, 99, 235, 0.26), transparent 68%);
}

[data-theme="light"] .orb.o2 {
  background: radial-gradient(circle, rgba(162, 28, 175, 0.18), transparent 68%);
}

[data-theme="light"] .orb.o3 {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.7), transparent 70%);
}

@keyframes orb-drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-4%, 5%, 0) scale(1.12);
  }
}

/* ---------- glass surfaces ---------- */

.glass {
  position: relative;
  border: 1px solid var(--line);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012) 38%, transparent 68%),
    var(--glass);
  box-shadow: var(--shadow), inset 0 1px 0 var(--edge);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
}

.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 0%),
    var(--sheen),
    transparent 62%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s var(--ease);
}

.glass:hover::before,
.glass:focus-within::before {
  opacity: 1;
}

[data-theme="light"] .glass {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.28) 46%, transparent 78%),
    var(--glass);
  box-shadow: var(--shadow), inset 0 1px 0 var(--edge);
}

/* ---------- reveal motion ---------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.8s var(--ease),
    transform 0.8s var(--ease);
  transition-delay: var(--d, 0ms);
}

[data-reveal="left"] {
  transform: translateX(-26px);
}

[data-reveal="right"] {
  transform: translateX(26px);
}

[data-reveal="scale"] {
  transform: scale(0.96);
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

body.is-loaded [data-reveal="hero"] {
  opacity: 1;
  transform: none;
}

/* ---------- shared keys ---------- */

@keyframes float-y {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

@keyframes spin-slow {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-soft {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes caret-blink {
  0%,
  46% {
    opacity: 1;
  }
  47%,
  100% {
    opacity: 0;
  }
}

@keyframes sheen-text {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

/* ---------- theme change reveal ---------- */

::view-transition-old(root) {
  animation: none;
}

::view-transition-new(root) {
  animation: theme-circle 0.64s var(--ease);
}

@keyframes theme-circle {
  from {
    clip-path: circle(0 at var(--vt-x) var(--vt-y));
  }
  to {
    clip-path: circle(var(--vt-r) at var(--vt-x) var(--vt-y));
  }
}

/* ---------- scroll progress ---------- */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 120;
  width: 100%;
  height: 2px;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--text), var(--sky) 55%, var(--magenta));
  opacity: 0.8;
  pointer-events: none;
}

/* ---------- shared theme button ---------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  transition:
    transform 0.25s var(--ease-spring),
    background 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--surface-solid);
  color: var(--text);
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
}

.theme-toggle .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

@media (max-width: 760px) {
  .theme-toggle .theme-label {
    display: none;
  }

  .theme-toggle {
    width: 38px;
    padding: 0;
  }
}
