:root,
[data-theme="light"] {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.05rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.35rem);
  --text-xl: clamp(1.45rem, 1.2rem + 1.1vw, 2rem);
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --color-bg: #f7f6f2;
  --color-surface: #fcfbf8;
  --color-surface-2: #f1eee8;
  --color-border: #dad5cb;
  --color-text: #23201a;
  --color-text-muted: #6e685f;
  --color-primary: #0f686d;
  --color-primary-hover: #0b4f54;
  --color-primary-soft: #d8e6e4;
  --color-text-inverse: #f9f8f5;
  --shadow-sm: 0 8px 24px rgba(25, 22, 16, 0.06);
  --shadow-md: 0 22px 52px rgba(25, 22, 16, 0.12);
  --radius-md: 0.95rem;
  --radius-lg: 1.35rem;
  --radius-full: 999px;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --transition: 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --color-bg: #161513;
  --color-surface: #1c1a18;
  --color-surface-2: #24211f;
  --color-border: #3a3631;
  --color-text: #ece7df;
  --color-text-muted: #b4aca1;
  --color-primary: #79b2b8;
  --color-primary-hover: #9bcbcf;
  --color-primary-soft: #213336;
  --color-text-inverse: #171512;
  --shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 24px 56px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  background: radial-gradient(circle at top left, color-mix(in srgb, var(--color-primary) 8%, transparent), transparent 34%), var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
p, h1, h2, h3 { margin: 0; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--space-3);
}
.skip-link:focus {
  left: var(--space-3);
  z-index: 100;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border-radius: var(--radius-md);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: var(--space-4);
  gap: var(--space-4);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}

.brand,
.topbar-title,
.eyebrow,
.hub-label,
.card-kicker,
.stack-item span {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.06em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar-title { color: var(--color-text-muted); }

.theme-toggle,
.back-link,
.hub-card {
  transition: transform var(--transition), border-color var(--transition), background var(--transition), color var(--transition), box-shadow var(--transition);
}

.theme-toggle,
.back-link {
  min-height: 44px;
  border-radius: var(--radius-full);
  border: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0 var(--space-4);
  cursor: pointer;
}

.stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: start;
  justify-items: center;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-2) 0 var(--space-3);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.99);
  transition: opacity var(--transition), transform var(--transition);
}

.view-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.hero-block,
.panel {
  width: min(100%, 1120px);
}

.view > * {
  width: min(100%, 1120px);
}

.hero-block {
  display: grid;
  gap: var(--space-4);
  justify-items: center;
  text-align: center;
  margin-bottom: var(--space-8);
}

.hero-block h1,
.panel h2 {
  font-family: var(--font-display);
  font-weight: 400;
}

.hero-block h1 {
  font-size: clamp(2rem, 3vw, 2.8rem);
  max-width: 26ch;
}

.hero-copy {
  max-width: 76ch;
  color: var(--color-text-muted);
}

.card-hub,
.panel-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-4);
}

.hub-card,
.info-card,
.panel,
.stack-item {
  border: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  box-shadow: var(--shadow-sm);
}

.hub-card {
  min-height: 11rem;
  padding: var(--space-5);
  border-radius: 1.5rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
}

.hub-card strong {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.2;
}

.hub-card:hover,
.hub-card:focus-visible {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
  box-shadow: var(--shadow-md);
}

.panel {
  border-radius: 1.6rem;
  padding: var(--space-6);
  display: grid;
  gap: var(--space-5);
}

.panel-narrow {
  width: min(100%, 840px);
}

.panel-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: var(--space-4);
}

.panel h2 {
  font-size: clamp(1.7rem, 2.5vw, 2.5rem);
  max-width: 20ch;
  margin-top: var(--space-2);
}

.panel-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel-grid-tight .feature-card {
  grid-column: span 3;
  background: linear-gradient(135deg, var(--color-surface), var(--color-primary-soft));
}

.info-card {
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: grid;
  gap: var(--space-3);
}

.info-card h3,
.stack-item h3 {
  font-size: var(--text-base);
  line-height: 1.3;
}

.info-card p,
.stack-item p,
.prose-block p,
.contact-list {
  color: var(--color-text-muted);
}

.stack-list {
  display: grid;
  gap: var(--space-3);
}

.stack-item {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: var(--space-4);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}

.prose-block {
  display: grid;
  gap: var(--space-4);
  max-width: 70ch;
}

.contact-list {
  display: grid;
  gap: var(--space-3);
}

.contact-list a:hover { color: var(--color-primary); }

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

@media (max-width: 1100px) {
  body { overflow: auto; }
  .app-shell { min-height: auto; }
  .stage { position: static; }
  .view {
    position: static;
    display: none;
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }
  .view-active { display: block; }
  .card-hub { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid-tight .feature-card { grid-column: auto; }
}

@media (max-width: 720px) {
  .topbar,
  .panel-top,
  .stack-item {
    grid-template-columns: 1fr;
    display: grid;
  }
  .topbar-actions {
    justify-content: space-between;
    width: 100%;
  }
  .card-hub,
  .panel-grid {
    grid-template-columns: 1fr;
  }
  .hero-block {
    text-align: left;
    justify-items: start;
  }
  .hero-block h1 { max-width: 14ch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

[data-theme="dark"] .hub-card {
  color: #f5f5f5;
}

[data-theme="dark"] .hub-card strong {
  color: #ffffff;
}

[data-theme="dark"] .hub-card .hub-label {
  color: rgba(255, 255, 255, 0.78);
}
