/* ============================================
   Bourbaki Landing Page — Rosé Pine / Editorial
   ============================================ */

/* --- Rosé Pine (Dark) Palette --- */
:root {
  --base: #191724;
  --surface: #1f1d2e;
  --overlay: #26233a;
  --muted: #6e6a86;
  --subtle: #908caa;
  --text: #e0def4;
  --love: #eb6f92;
  --gold: #f6c177;
  --rose: #ebbcba;
  --pine: #31748f;
  --foam: #9ccfd8;
  --iris: #c4a7e7;
  --highlight-low: #21202e;
  --highlight-med: #403d52;
  --highlight-high: #524f67;

  /* Icon-specific colors (dark on gold diamond) */
  --icon-stroke: #26233a;
  --icon-post: #908caa;

  /* Nav backdrop */
  --nav-bg: rgba(25, 23, 36, 0.75);
  --card-shadow: rgba(0, 0, 0, 0.3);
  --btn-primary-shadow: rgba(196, 167, 231, 0.2);
}

/* --- Rosé Pine Dawn (Light) Palette --- */
:root[data-theme="light"] {
  --base: #faf4ed;
  --surface: #fffaf3;
  --overlay: #f2e9e1;
  --muted: #9893a5;
  --subtle: #797593;
  --text: #575279;
  --love: #b4637a;
  --gold: #ea9d34;
  --rose: #d7827e;
  --pine: #286983;
  --foam: #56949f;
  --iris: #907aa9;
  --highlight-low: #f4ede8;
  --highlight-med: #dfdad9;
  --highlight-high: #cecacd;

  --icon-stroke: #575279;
  --icon-post: #9893a5;

  --nav-bg: rgba(250, 244, 237, 0.8);
  --card-shadow: rgba(87, 82, 121, 0.08);
  --btn-primary-shadow: rgba(144, 122, 169, 0.15);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Spectral', Georgia, serif;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--base);
  overflow-x: hidden;
  position: relative;
}

/* --- Noise Texture Overlay --- */
.noise {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* --- Typography --- */
h1, h2, h3 {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(3rem, 7vw, 5.5rem); }
h2 { font-size: clamp(2rem, 4.5vw, 3.5rem); }
h3 { font-size: 1.4rem; }

em {
  font-style: italic;
  color: var(--rose);
}

a {
  color: var(--foam);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--iris);
}

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: var(--overlay);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--rose);
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 2rem;
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(110, 106, 134, 0.1);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.nav-logo:hover {
  color: var(--gold);
}

.nav-icon {
  width: 24px;
  height: 32px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-cta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border: 1px solid var(--highlight-med);
  border-radius: 6px;
  transition: all 0.2s;
}

.nav-cta:hover {
  border-color: var(--subtle);
  background: var(--highlight-low);
}

/* --- Theme Toggle --- */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--highlight-med);
  border-radius: 8px;
  background: transparent;
  color: var(--subtle);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--highlight-low);
}

/* In dark mode (default): show sun icon, hide moon */
.theme-icon--light { display: none; }
.theme-icon--dark { display: block; }

/* In light mode: show moon icon, hide sun */
:root[data-theme="light"] .theme-icon--light { display: block; }
:root[data-theme="light"] .theme-icon--dark { display: none; }

/* Smooth transition for all themed properties */
body,
.nav,
.feature-card,
.tool-card,
.keybindings,
.stack-card,
.start,
.code-block,
.code-header,
.footer,
kbd,
code,
.hero-badge,
.tool-badge {
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 8rem 2rem 4rem;
  overflow: hidden;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(110, 106, 134, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 106, 134, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 70%);
}

.hero-content {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--subtle);
  padding: 0.4rem 1rem;
  border: 1px solid var(--highlight-med);
  border-radius: 100px;
  margin-bottom: 2.5rem;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--foam);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.hero-line-1 {
  display: block;
  color: var(--subtle);
  font-size: 0.55em;
  letter-spacing: 0.02em;
  font-weight: 300;
}

.hero-line-2 {
  display: block;
}

.hero-sub {
  margin-top: 1.5rem;
  font-size: 1.15rem;
  color: var(--subtle);
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  font-weight: 300;
  line-height: 1.8;
}

.hero-actions {
  margin-top: 2.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: var(--iris);
  color: var(--base);
  font-weight: 500;
}

.btn-primary:hover {
  background: var(--rose);
  color: var(--base);
  transform: translateY(-1px);
  box-shadow: 0 8px 30px var(--btn-primary-shadow);
}

.btn-ghost {
  color: var(--subtle);
  border: 1px solid var(--highlight-med);
}

.btn-ghost:hover {
  border-color: var(--subtle);
  color: var(--text);
  background: var(--highlight-low);
}

.hero-quote {
  margin-top: 4rem;
  position: relative;
}

.hero-quote blockquote {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-style: italic;
  color: var(--muted);
  position: relative;
  padding: 0 1.5rem;
}

.hero-quote blockquote::before {
  content: '❝';
  position: absolute;
  left: -0.5rem;
  top: -0.8rem;
  font-size: 2.5rem;
  color: var(--highlight-med);
  font-style: normal;
}

/* Hero ornament */
.hero-ornament {
  position: absolute;
  right: -2%;
  top: 50%;
  transform: translateY(-50%);
  width: 500px;
  height: 500px;
  opacity: 0.5;
  z-index: 1;
  pointer-events: none;
}

@media (max-width: 900px) {
  .hero-ornament {
    display: none;
  }
}

.ornament-rotate {
  animation: slow-rotate 60s linear infinite;
  transform-origin: center;
}

.spin-slow {
  animation: slow-rotate 80s linear infinite;
  transform-origin: 200px 200px;
}

.spin-slow-reverse {
  animation: slow-rotate-reverse 100s linear infinite;
  transform-origin: 200px 200px;
}

@keyframes slow-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes slow-rotate-reverse {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

/* --- Section shared --- */
.section-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-bottom: 1rem;
}

.section-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 4rem;
}

.section-desc {
  margin-top: 1rem;
  color: var(--subtle);
  font-size: 1.05rem;
  font-weight: 300;
}

/* --- Features --- */
.features {
  padding: 8rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--highlight-low);
  border-radius: 12px;
  padding: 2rem;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--iris), transparent);
  opacity: 0;
  transition: opacity 0.35s;
}

.feature-card:hover {
  border-color: var(--highlight-med);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px var(--card-shadow);
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-card--large {
  grid-column: span 1;
}

.feature-icon {
  width: 40px;
  height: 40px;
  color: var(--iris);
  margin-bottom: 1.2rem;
}

.feature-card h3 {
  font-size: 1.3rem;
  margin-bottom: 0.6rem;
  color: var(--text);
}

.feature-card p {
  color: var(--subtle);
  font-size: 0.95rem;
  line-height: 1.7;
  font-weight: 300;
}

/* --- Keybindings --- */
.keybindings {
  padding: 6rem 2rem;
  background: var(--surface);
  border-top: 1px solid var(--highlight-low);
  border-bottom: 1px solid var(--highlight-low);
}

.keybindings-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.keybindings-text p {
  color: var(--subtle);
  margin-top: 1rem;
  font-weight: 300;
  max-width: 360px;
}

.keybindings-table {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.kb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--highlight-low);
}

.kb-row:last-child {
  border-bottom: none;
}

.kb-action {
  font-family: 'Spectral', serif;
  font-size: 0.95rem;
  color: var(--subtle);
  font-weight: 300;
}

kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text);
  background: var(--overlay);
  border: 1px solid var(--highlight-med);
  border-bottom-width: 2px;
  padding: 0.25rem 0.55rem;
  border-radius: 5px;
  white-space: nowrap;
}

/* --- Tools (swappable slots) --- */
.tools {
  padding: 8rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.tools .section-desc kbd {
  font-size: 0.75em;
  vertical-align: 0.05em;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.tool-card {
  display: block;
  text-decoration: none;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--highlight-low);
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0;
  transition: opacity 0.35s;
}

.tool-card:hover {
  border-color: var(--highlight-med);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px var(--card-shadow);
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-card:hover .tool-name {
  color: var(--gold);
}

.tool-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.6rem;
}

.tool-default {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.tool-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  color: var(--text);
  transition: color 0.3s;
  line-height: 1.2;
}

.tool-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--foam);
  background: rgba(156, 207, 216, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(156, 207, 216, 0.15);
}

.tool-role {
  font-size: 0.9rem;
  color: var(--subtle);
  font-weight: 300;
  line-height: 1.6;
  margin-bottom: 0.8rem;
}

.tool-alts {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 300;
  line-height: 1.6;
  padding-top: 0.8rem;
  border-top: 1px solid var(--highlight-low);
}

.tool-alts strong {
  color: var(--subtle);
  font-weight: 400;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
}

/* --- Stack (tech foundation) --- */
.stack {
  padding: 8rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.stack-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  max-width: 700px;
  margin: 0 auto;
}

.stack-card {
  display: block;
  text-decoration: none;
  padding: 2rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--highlight-low);
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.stack-card:hover {
  border-color: var(--highlight-med);
  transform: translateY(-2px);
  background: var(--overlay);
}

.stack-card:hover .stack-name {
  color: var(--gold);
}

.stack-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  color: var(--text);
  margin-bottom: 0.5rem;
  transition: color 0.3s;
}

.stack-role {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 300;
}

.stack-card--native {
  border-style: dashed;
}

/* --- Get Started --- */
.start {
  padding: 8rem 2rem;
  background: var(--surface);
  border-top: 1px solid var(--highlight-low);
}

.start-content {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.start-content p {
  color: var(--subtle);
  margin-top: 1rem;
  font-weight: 300;
  font-size: 1.05rem;
}

.code-block {
  margin-top: 2.5rem;
  background: var(--base);
  border: 1px solid var(--highlight-low);
  border-radius: 12px;
  overflow: hidden;
  text-align: left;
}

.code-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.2rem;
  background: var(--overlay);
  border-bottom: 1px solid var(--highlight-low);
}

.code-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.code-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--muted);
  margin-left: auto;
  letter-spacing: 0.05em;
}

.code-block pre {
  padding: 1.5rem;
  overflow-x: auto;
}

.code-block code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  line-height: 1.9;
  color: var(--text);
  background: none;
  padding: 0;
  border-radius: 0;
}

.code-comment {
  color: var(--muted);
  font-style: italic;
}

.code-cmd {
  color: var(--iris);
}

/* --- Footer --- */
.footer {
  padding: 3rem 2rem 2rem;
  border-top: 1px solid var(--highlight-low);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-left {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
}

.footer-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.footer-note {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 300;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.footer-flourish {
  text-align: center;
  padding: 3rem 0 1rem;
  color: var(--highlight-med);
  font-size: 1.2rem;
  letter-spacing: 0.5em;
}

/* --- Animations --- */
[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
[data-delay="0"] { transition-delay: 0ms; }
[data-delay="1"] { transition-delay: 80ms; }
[data-delay="2"] { transition-delay: 160ms; }
[data-delay="3"] { transition-delay: 240ms; }
[data-delay="4"] { transition-delay: 320ms; }
[data-delay="5"] { transition-delay: 400ms; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-links a:not(.nav-cta) {
    display: none;
  }

  .hero {
    padding: 7rem 1.5rem 3rem;
  }

  .hero-content {
    text-align: center;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .feature-card--large {
    grid-column: span 1;
  }

  .keybindings-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .stack-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .footer-left {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 16px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
}

/* --- Light theme adjustments --- */
:root[data-theme="light"] .noise {
  opacity: 0.02;
}

:root[data-theme="light"] .hero-grid {
  background-image:
    linear-gradient(rgba(87, 82, 121, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(87, 82, 121, 0.06) 1px, transparent 1px);
}

:root[data-theme="light"] .hero-ornament {
  opacity: 0.35;
}

/* --- Selection --- */
::selection {
  background: var(--iris);
  color: var(--base);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--base);
}

::-webkit-scrollbar-thumb {
  background: var(--highlight-med);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--highlight-high);
}
