*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #0e0e12;
  --mist: #f4f2ee;
  --warm: #e8e4dc;
  --gold: #c9a96e;
  --dim: #8a8480;
  --glass-border: rgba(255,255,255,0.45);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Instrument Sans', sans-serif;
  background: var(--mist);
  color: var(--ink);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── HERO ── */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 2rem;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #dde8f5 0%, #f4efe8 35%, #e8dff5 65%, #d5eae0 100%);
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.7;
  animation: drift 12s ease-in-out infinite;
}

.orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #a8c8f0 0%, #c5b8f0 60%, transparent 100%);
  top: -100px; left: -100px;
  animation-delay: 0s;
}
.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #f0c8a8 0%, #f0d8a0 60%, transparent 100%);
  bottom: -80px; right: -80px;
  animation-delay: -4s;
}
.orb-3 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #a8f0c8 0%, #b0e8d0 60%, transparent 100%);
  top: 50%; left: 60%;
  animation-delay: -8s;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-15px, 25px) scale(0.97); }
}

.bg-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -60%) rotate(0deg);
  font-family: 'DM Serif Display', serif;
  font-size: clamp(120px, 20vw, 220px);
  color: rgba(14,14,18,0.04);
  white-space: nowrap;
  pointer-events: none;
  letter-spacing: -0.02em;
  user-select: none;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 780px;
}

.hero-eyebrow {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.2s forwards;
}

.hero-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(52px, 9vw, 108px);
  line-height: 0.92;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeUp 0.9s ease 0.35s forwards;
}

.hero-title em {
  font-style: italic;
  color: var(--gold);
}

.hero-sub {
  font-size: 17px;
  font-weight: 300;
  color: var(--dim);
  line-height: 1.65;
  max-width: 480px;
  margin: 0 auto 3rem;
  opacity: 0;
  animation: fadeUp 0.9s ease 0.5s forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── HERO GLASS DEMO ── */
.hero-glass-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp 1s ease 0.65s forwards;
}

.hero-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 100px;
  border: 1px solid var(--glass-border);
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  cursor: default;
  transition: transform 0.2s ease;
}

.hero-pill:hover { transform: scale(1.03); }

.hero-pill .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

.scroll-hint {
  position: absolute;
  bottom: 0rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 2;
  opacity: 0;
  animation: fadeUp 1s ease 1.2s forwards;
}

.scroll-hint span {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--dim);
}

.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--dim), transparent);
  animation: scrollBob 2s ease-in-out infinite;
}

@keyframes scrollBob {
  0%, 100% { transform: scaleY(1); opacity: 0.5; }
  50% { transform: scaleY(0.6); opacity: 1; }
}

/* ── SECTION ── */
section {
  padding: 7rem 2rem;
  position: relative;
}

.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1rem;
  display: block;
}

.section-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.section-body {
  font-size: 16px;
  font-weight: 300;
  color: var(--dim);
  line-height: 1.75;
  max-width: 520px;
}

/* ── SHAPES SHOWCASE ── */
.shapes-section {
  background: var(--ink);
  color: var(--mist);
}

.shapes-section .section-body { color: rgba(244,242,238,0.5); }
.shapes-section .section-label { color: var(--gold); }

.shapes-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 70% 50%, rgba(201,169,110,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 40% 60% at 20% 80%, rgba(168,200,240,0.06) 0%, transparent 60%);
  pointer-events: none;
}

.shapes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-top: 4rem;
}

.shape-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2.5rem 1.5rem;
}

.shape-demo {
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.shape-demo::before {
  content: '';
  position: absolute;
  inset: -20px;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 18px,
      rgba(255,255,255,0.04) 18px,
      rgba(255,255,255,0.04) 19px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 18px,
      rgba(255,255,255,0.04) 18px,
      rgba(255,255,255,0.04) 19px
    );
  border-radius: 8px;
}

.shape-el {
  width: 120px;
  height: 120px;
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.shape-el.is-circle   { border-radius: 50%; }
.shape-el.is-squircle { border-radius: 28px; }
.shape-el.is-lip      { border-radius: 28px; }
.shape-el.is-concave  { border-radius: 28px; }

.shape-icon {
  font-size: 28px;
  position: relative;
  z-index: 2;
}

.shape-name {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
}

.shape-desc {
  font-size: 13px;
  font-weight: 300;
  color: rgba(244,242,238,0.45);
  text-align: center;
  line-height: 1.6;
}

/* ── INTERACTIVE PANEL ── */
.panel-section {
  background: var(--warm);
  overflow: hidden;
}

.panel-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 80% at 80% 20%, rgba(201,169,110,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 10% 90%, rgba(168,200,240,0.1) 0%, transparent 60%);
}

.panel-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5rem;
  align-items: stretch;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
}

@media (max-width: 768px) {
  .panel-layout { grid-template-columns: 1fr; gap: 3rem; }
}

.panel-controls {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ctrl-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ctrl-label span:first-child {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

.ctrl-val {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--gold);
  font-weight: 400;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 2px;
  background: rgba(14,14,18,0.12);
  border-radius: 1px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--gold);
  cursor: pointer;
  transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

.ctrl-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 5px 14px;
  border-radius: 100px;
  border: 1px solid rgba(14,14,18,0.15);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
  color: var(--dim);
}

.chip:hover { border-color: var(--gold); color: var(--ink); }
.chip.active { background: var(--ink); color: var(--mist); border-color: var(--ink); }

/* Panel preview area */
.panel-section .section-body { margin-bottom: 3rem; }
.code-section .section-title  { color: var(--mist); }

.panel-preview {
  position: relative;
  min-height: 460px;
  height: auto;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(135deg, #c8d8f0 0%, #f0d0b8 40%, #c8f0d8 80%, #d8c8f0 100%);
}

.preview-content {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.preview-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(30px);
}

.preview-blob:nth-child(1) {
  width: 200px; height: 200px;
  background: #7eb8f5;
  top: 20px; left: 30px;
}

.preview-blob:nth-child(2) {
  width: 160px; height: 160px;
  background: #f5b87e;
  bottom: 40px; right: 20px;
}

.preview-blob:nth-child(3) {
  width: 140px; height: 140px;
  background: #8ef5b0;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

.preview-stripes {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 20px,
    rgba(255,255,255,0.15) 20px,
    rgba(255,255,255,0.15) 21px
  );
}

#live-glass {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  border-radius: 98px;
  border: 1px solid rgba(255,255,255,0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(14,14,18,0.7);
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 1.5rem;
  cursor: grab;
  user-select: none;
}

#live-glass:active { cursor: grabbing; }

#live-glass .glass-icon { font-size: 24px; }
#live-glass .glass-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.6;
}

/* ── CARDS ROW ── */
.cards-section {
  background: var(--mist);
}

.cards-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(168,200,240,0.12) 0%, transparent 60%);
}

.cards-layout {
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
}

.cards-header {
  margin-bottom: 4rem;
}

.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.card-wrap {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  height: 320px;
}

.card-bg {
  position: absolute;
  inset: 0;
}

.card-bg-1 { background: linear-gradient(145deg, #7eb8f5, #b87ef5); }
.card-bg-2 { background: linear-gradient(145deg, #f5b87e, #f57eb8); }
.card-bg-3 { background: linear-gradient(145deg, #7ef5b0, #7eb8f5); }

.card-shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.5;
}

.card-bg-1 .card-shape { width: 160px; height: 160px; background: rgba(255,255,255,0.2); top: -30px; right: -30px; }
.card-bg-2 .card-shape { width: 200px; height: 200px; background: rgba(255,255,255,0.15); bottom: -60px; left: -60px; }
.card-bg-3 .card-shape { width: 140px; height: 140px; background: rgba(255,255,255,0.2); top: 30px; left: 50%; transform: translateX(-50%); }

.card-text-bg {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  font-family: 'DM Serif Display', serif;
  font-size: 52px;
  color: rgba(255,255,255,0.12);
  line-height: 1;
  letter-spacing: -0.03em;
  user-select: none;
}

.card-glass {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.45);
  padding: 1.25rem 1.5rem;
}

.card-glass-title {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  color: rgba(255,255,255,0.9);
  margin-bottom: 0.35rem;
  text-shadow: 0 1px 8px rgba(0,0,0,0.1);
}

.card-glass-sub {
  font-size: 12px;
  font-weight: 300;
  color: rgba(255,255,255,0.65);
  line-height: 1.5;
}

.card-badge {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(255,255,255,0.2);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.8);
}

/* ── CODE BLOCK ── */
.code-section {
  background: var(--ink);
  color: var(--mist);
}

.code-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 60% at 100% 0%, rgba(201,169,110,0.06) 0%, transparent 50%);
}

.code-layout {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

.code-header { margin-bottom: 3rem; }
.code-section .section-body { color: rgba(244,242,238,0.45); }

.code-block {
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  overflow: hidden;
}

.code-titlebar {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-dot { width: 10px; height: 10px; border-radius: 50%; }
.code-dot.red   { background: #ff5f57; }
.code-dot.amber { background: #febc2e; }
.code-dot.green { background: #28c840; }

.code-filename {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: rgba(244,242,238,0.3);
  margin-left: 0.5rem;
  letter-spacing: 0.05em;
}

pre {
  padding: 1.75rem 1.5rem;
  overflow-x: auto;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  line-height: 1.75;
  color: rgba(244,242,238,0.75);
}

.tok-comment { color: rgba(244,242,238,0.25); }
.tok-tag     { color: #7eb8f5; }
.tok-attr    { color: #f5b87e; }
.tok-val     { color: #8ef5b0; }
.tok-kw      { color: #d8c8f0; }
.tok-fn      { color: var(--gold); }
.tok-str     { color: #f5c87e; }
.tok-num     { color: #8ef5b0; }

/* ── PHYSICS EXPLAINER ── */
.physics-section {
  background: var(--warm);
  overflow: hidden;
}

.physics-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 40% 60% at 0% 50%, rgba(168,200,240,0.12) 0%, transparent 55%);
}

.physics-layout {
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
}

.physics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2px;
  margin-top: 4rem;
  border: 1px solid rgba(14,14,18,0.08);
  border-radius: 20px;
  overflow: hidden;
}

.physics-cell {
  padding: 2.5rem 2rem;
  background: var(--warm);
  transition: background 0.2s;
}

.physics-cell:hover { background: rgba(255,255,255,0.6); }

.physics-num {
  font-family: 'DM Serif Display', serif;
  font-size: 48px;
  color: rgba(14,14,18,0.07);
  line-height: 1;
  margin-bottom: 1rem;
}

.physics-formula {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--gold);
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
}

.physics-name {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  margin-bottom: 0.5rem;
}

.physics-desc {
  font-size: 13px;
  font-weight: 300;
  color: var(--dim);
  line-height: 1.6;
}

/* ── FOOTER ── */
footer {
  background: var(--ink);
  padding: 4rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.footer-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 80% at 50% 100%, rgba(201,169,110,0.05) 0%, transparent 60%);
}

.footer-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 42px;
  color: rgba(244,242,238,0.08);
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  position: relative;
}

.footer-links {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  position: relative;
}

.footer-links a {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(244,242,238,0.3);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--gold); }

.footer-copy {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: rgba(244,242,238,0.15);
  letter-spacing: 0.05em;
  position: relative;
}

/* ── DRAGGABLE GLASS UTIL ── */
#drag-hint {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(244,242,238,0.5);
  background: rgba(14,14,18,0.7);
  backdrop-filter: blur(8px);
  padding: 8px 14px;
  border-radius: 100px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
  z-index: 100;
}

#drag-hint.show { opacity: 1; }

/* Utility */
.max-w { max-width: 1100px; margin: 0 auto; }

/* Glass outline ring */
.glass {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.4),
    0 8px 32px rgba(0,0,0,0.08),
    0 2px 8px rgba(0,0,0,0.04);
}
