@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,400;0,500;1,400&family=EB+Garamond:ital,wght@0,400;0,500;1,400;1,500&display=swap');

:root {
  --bg: #F5F0E8;
  --text: #1C3A2B;
  --accent: #C4856A;
  --card-bg: #FAF7F2;
  --font-body: 'EB Garamond', serif;
  --font-mono: 'DM Mono', monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Base reset & Typography */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.8;
  overflow-x: hidden;
}

/* Grain Noise Overlay */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Layout Elements */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 40px;
}

section {
  padding: 160px 0;
}

/* Nav */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 32px) calc(env(safe-area-inset-right, 0px) + 48px) 32px calc(env(safe-area-inset-left, 0px) + 48px);
  z-index: 1000;
  background: rgba(245, 240, 232, 0.95);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(-100%);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
  pointer-events: none;
}

nav.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-left {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 26px;
  text-decoration: none;
  color: var(--text);
  transition: color 0.6s var(--ease), letter-spacing 0.6s var(--ease), transform 0.6s var(--ease), opacity 0.6s var(--ease);
  display: inline-block;
}

.nav-left:hover { 
  color: var(--accent);
  letter-spacing: 0.04em;
  transform: translateY(-1px);
}

.nav-right {
  display: flex;
  gap: 32px;
  align-items: center;
}

.nav-right a {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: lowercase;
  font-variant: small-caps;
  text-decoration: none;
  color: var(--text);
  letter-spacing: 0.08em;
  transition: color 0.6s var(--ease), opacity 0.6s var(--ease);
}

.nav-right a:hover { color: var(--accent); }

.nav-right a.active {
  opacity: 0.4;
  pointer-events: none;
}

/* Titles */
h1 {
  font-size: 72px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: lowercase;
  font-variant: small-caps;
  color: var(--accent);
  margin-bottom: 24px;
  letter-spacing: 0.15em;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  text-transform: lowercase;
  font-variant: small-caps;
  letter-spacing: 0.2em;
  margin-bottom: 56px;
  font-weight: normal;
}

/* Animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1200ms var(--ease), transform 1200ms var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.stagger-1 { transition-delay: 100ms; }
.stagger-2 { transition-delay: 200ms; }
.stagger-3 { transition-delay: 300ms; }
.stagger-4 { transition-delay: 400ms; }
.stagger-5 { transition-delay: 500ms; }

/* Cover Section */
.cover {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  background-color: var(--bg);
  z-index: 10;
}

/* Internal pages "peak" style */
body:not(.home) .cover {
  min-height: 60vh;
  height: auto;
  padding: 160px 0 160px;
}

body:not(.home) .scroll-guide {
  display: none;
}

.hero {
  padding: 100px 0;
  display: block;
}

body:not(.home) .hero {
  padding-top: 100px;
}

.cover-title {
  font-size: 18vw;
  font-style: italic;
  font-weight: 400;
  line-height: 1;
  margin-bottom: 24px;
  letter-spacing: -0.04em;
}

.cover-title.reveal {
  transition: opacity 2.5s var(--ease), transform 2.5s var(--ease);
}

.cover-subtitle {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 24px;
  color: var(--accent);
}

.cover-subtitle.reveal {
  transition: opacity 2s var(--ease) 0.4s, transform 2s var(--ease) 0.4s;
}

.scroll-guide {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 60px;
  background: linear-gradient(to bottom, var(--accent), transparent);
}

.scroll-guide.reveal {
  transition: opacity 2s var(--ease) 0.8s;
}

/* Cards & Components */
.card {
  background-color: var(--card-bg);
  border: 1px solid rgba(28, 58, 43, 0.08);
  border-radius: 2px;
  padding: 40px;
  transition: border-color 0.8s var(--ease), transform 0.8s var(--ease);
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}

.terminal-card {
  background-color: var(--text);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 24px;
  border-radius: 2px;
  line-height: 1.6;
}

/* Footer redesign */
footer {
  padding: 120px 0 80px 0;
  border-top: 1px solid rgba(28, 58, 43, 0.05);
  margin-top: 80px;
  font-size: 16px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 80px;
  margin-bottom: 80px;
}

.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: lowercase;
  font-variant: small-caps;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 24px;
  font-weight: normal;
}

.footer-col a {
  display: block;
  font-family: var(--font-body);
  color: var(--text);
  text-decoration: none;
  margin-bottom: 12px;
  opacity: 0.7;
  transition: opacity 0.6s var(--ease);
}

.footer-col a:hover { opacity: 1; color: var(--accent); }

.footer-logo {
  font-style: italic;
  font-size: 24px !important;
  opacity: 1 !important;
  margin-bottom: 16px !important;
}

.footer-tagline {
  font-size: 15px;
  opacity: 0.6;
  max-width: 240px;
}

.footer-bottom {
  text-align: center;
  font-style: italic;
  opacity: 0.4;
  font-size: 14px;
  border-top: 1px solid rgba(28, 58, 43, 0.03);
  padding-top: 40px;
}

/* Responsive */
@media (max-width: 768px) {
  h1 { font-size: 48px; }
  section { padding: 80px 0; }
  .footer-grid { grid-template-columns: 1fr; gap: 40px; }
  nav { 
    padding: calc(env(safe-area-inset-top, 0px) + 24px) 24px 24px 24px; 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 24px; 
  }
  .nav-right { gap: 16px; flex-wrap: wrap; }
}

.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Version States */
body:not(.version-salience) .salience-only {
  display: none !important;
}

body.version-salience .base-only {
  display: none !important;
}

.version-dropdown {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: lowercase;
  font-variant: small-caps;
  color: var(--text);
  letter-spacing: 0.08em;
  margin-right: 16px;
  border-right: 1px solid rgba(28, 58, 43, 0.1);
  padding-right: 24px;
}

@media (max-width: 768px) {
  .version-dropdown {
    margin-right: 8px;
    padding-right: 12px;
  }
}

.version-dropdown span.label {
  opacity: 0.5;
}

.version-custom-select {
  position: relative;
  cursor: pointer;
  color: var(--accent);
  padding-right: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 24 24' fill='none' stroke='%23C4856A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  padding-bottom: 24px; /* padding for the hover bridge */
  margin-bottom: -24px;
}

.version-current {
  transition: opacity 0.3s var(--ease);
}

.version-custom-select:hover .version-current {
  opacity: 0.8;
}

.version-options {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg);
  border: 1px solid rgba(28, 58, 43, 0.1);
  border-radius: 2px;
  padding: 8px 0;
  min-width: 140px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(28, 58, 43, 0.05);
  margin-top: -8px; /* overlap to bridge the gap with padding-bottom */
}

.version-custom-select:hover .version-options,
.version-custom-select.open .version-options {
  display: block;
  animation: fadeIn 0.2s var(--ease);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.version-option {
  padding: 6px 16px;
  color: var(--text);
  transition: color 0.3s var(--ease), background 0.3s var(--ease);
}

.version-option:hover {
  color: var(--accent);
  background: rgba(28, 58, 43, 0.03);
}

.salience-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(196, 133, 106, 0.08);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  vertical-align: middle;
  margin-left: 12px;
  border: 1px solid rgba(196, 133, 106, 0.2);
}