/* ============================================
   Decode — Editorial Medical Guide
   Fraunces + DM Sans · Purple accent system
   ============================================ */

/* --- Custom Properties --- */
:root {
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  --purple-50: #f5f3ff;
  --purple-100: #ede9fe;
  --purple-200: #ddd6fe;
  --purple-300: #c4b5fd;
  --purple-400: #a78bfa;
  --purple-500: #8b5cf6;
  --purple-600: #7c3aed;
  --purple-700: #6d28d9;
  --purple-800: #5b21b6;
  --purple-900: #4c1d95;

  --ink: #1a1035;
  --ink-light: #3d3558;
  --ink-muted: #6b6280;
  --ink-faint: #9e96b0;

  --surface: #fefcff;
  --surface-warm: #faf8fc;
  --surface-card: #ffffff;
  --surface-elevated: #ffffff;

  --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --accent-gradient-soft: linear-gradient(135deg, rgba(102,126,234,0.08) 0%, rgba(118,75,162,0.08) 100%);
  --accent-gradient-vivid: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #667eea 100%);

  --border: #e8e4ef;
  --border-light: #f0ecf5;

  --shadow-sm: 0 1px 2px rgba(26,16,53,0.04);
  --shadow-md: 0 4px 12px rgba(26,16,53,0.06), 0 1px 3px rgba(26,16,53,0.04);
  --shadow-lg: 0 12px 40px rgba(26,16,53,0.08), 0 4px 12px rgba(26,16,53,0.04);
  --shadow-glow: 0 0 40px rgba(124,58,237,0.12);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --reading-width: 720px;
  --content-width: 1080px;
  --wide-width: 1200px;

  --red-50: #fef2f2;
  --red-500: #ef4444;
  --amber-50: #fffbeb;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 1.1rem;
  line-height: 1.75;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
code { font-family: var(--font-mono); font-size: 0.9em; }

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: -0.01em;
}

h1 { font-size: 3.2rem; font-weight: 700; }
h2 { font-size: 2.2rem; margin-bottom: 1rem; }
h3 { font-size: 1.4rem; font-weight: 500; }
h4 { font-size: 1.15rem; font-weight: 600; }

p { margin-bottom: 1.25rem; color: var(--ink-light); }
p:last-child { margin-bottom: 0; }

strong { color: var(--ink); font-weight: 600; }

/* --- Layout --- */
.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 2rem;
}

.container--reading {
  max-width: var(--reading-width);
}

.container--wide {
  max-width: var(--wide-width);
}

.section {
  padding: 5rem 0;
}

.section--alt {
  background: var(--surface-warm);
}

.section--gradient {
  background: var(--accent-gradient);
  color: #fff;
}

/* --- Top Navigation --- */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(254,252,255,0.88);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border-light);
  padding: 0 2rem;
  transition: box-shadow 0.3s ease;
}

.top-nav.scrolled {
  box-shadow: var(--shadow-md);
}

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

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink);
}

.nav-logo svg {
  width: 28px;
  height: 28px;
  color: var(--purple-600);
}

.nav-logo-text {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Language Switcher */
.lang-switcher {
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-muted);
  transition: all 0.2s ease;
}

.lang-btn:hover {
  background: var(--purple-50);
  color: var(--ink);
}

.lang-btn .flag {
  font-size: 1.1rem;
  line-height: 1;
}

.lang-btn .chevron {
  width: 10px;
  height: 10px;
  transition: transform 0.2s ease;
  margin-left: 0.1rem;
}

.lang-switcher.open .lang-btn .chevron {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
}

.lang-switcher.open .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--ink-light);
  transition: all 0.15s ease;
}

.lang-option:hover {
  background: var(--purple-50);
  color: var(--ink);
}

.lang-option .flag {
  font-size: 1.15rem;
  line-height: 1;
}

.lang-option .lang-code {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* --- Hero --- */
.hero {
  padding: 7rem 0 5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 900px;
  background: radial-gradient(circle, rgba(124,58,237,0.06) 0%, rgba(124,58,237,0) 70%);
  pointer-events: none;
}

.hero h1 {
  max-width: 700px;
  margin: 0 auto 1.5rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  max-width: 620px;
  margin: 0 auto 1.5rem;
  font-size: 1.25rem;
  color: var(--ink-light);
  line-height: 1.7;
}

.hero-note {
  display: inline-block;
  font-size: 0.95rem;
  color: var(--purple-600);
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  background: var(--purple-50);
  border-radius: 100px;
  border: 1px solid var(--purple-100);
}

/* --- Feature Grid --- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.feature-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: all 0.25s ease;
}

.feature-card:hover {
  border-color: var(--purple-200);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  transform: translateY(-2px);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-gradient-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  font-size: 1.3rem;
}

.feature-card h3 {
  margin-bottom: 0.5rem;
  color: var(--ink);
}

.feature-card p {
  font-size: 0.95rem;
  color: var(--ink-muted);
  line-height: 1.6;
}

/* --- Content Card --- */
.content-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
}

.content-card h3 {
  margin-bottom: 0.75rem;
}

.content-card p {
  font-size: 1rem;
}

.privacy-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

.privacy-item {
  display: flex;
  gap: 1rem;
}

.privacy-item .icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--purple-50);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.privacy-item h4 {
  margin-bottom: 0.3rem;
}

.privacy-item p {
  font-size: 0.92rem;
  color: var(--ink-muted);
  margin-bottom: 0;
}

/* --- Steps --- */
.steps-container {
  position: relative;
}

.step {
  position: relative;
  padding-left: 5rem;
  padding-bottom: 4rem;
}

.step:last-child {
  padding-bottom: 0;
}

/* Connecting line */
.step::before {
  content: '';
  position: absolute;
  left: 23px;
  top: 52px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--purple-200), var(--border-light));
}

.step:last-child::before {
  display: none;
}

.step-number {
  position: absolute;
  left: 0;
  top: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(124,58,237,0.25);
  z-index: 1;
}

.step-header {
  margin-bottom: 1.5rem;
}

.step-title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.step-time {
  font-size: 0.9rem;
  color: var(--purple-600);
  font-weight: 500;
}

.step-content p {
  max-width: var(--reading-width);
}

.step-content ol,
.step-content ul {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.step-content ol { list-style: decimal; }
.step-content ul { list-style: disc; }

.step-content li {
  margin-bottom: 0.5rem;
  color: var(--ink-light);
}

.step-content li strong {
  color: var(--ink);
}

/* --- Prompt Box --- */
.prompt-box {
  position: relative;
  background: #13111c;
  border-radius: var(--radius-md);
  padding: 1.75rem 2rem;
  margin: 1.25rem 0;
  overflow: hidden;
}

.prompt-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient-vivid);
}

.prompt-box pre {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.7;
  color: #e2ddf5;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.prompt-box .copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #a09cb5;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.2s ease;
  cursor: pointer;
}

.prompt-box .copy-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #e2ddf5;
}

.prompt-box .copy-btn.copied {
  color: #86efac;
  background: rgba(134,239,172,0.1);
  border-color: rgba(134,239,172,0.2);
}

.prompt-box .copy-btn svg {
  width: 14px;
  height: 14px;
}

/* Prompt box label */
.prompt-label {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

/* --- Highlight Box --- */
.highlight-box {
  background: var(--purple-50);
  border: 1px solid var(--purple-100);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  font-size: 0.95rem;
  color: var(--purple-800);
  line-height: 1.65;
}

.highlight-box p { color: var(--purple-800); margin-bottom: 0; }

/* --- Warning Box --- */
.warning-box {
  background: var(--amber-50);
  border-left: 4px solid var(--amber-500);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.5rem 1.75rem;
  margin: 1.5rem 0;
}

.warning-box p {
  color: var(--ink-light);
  font-size: 0.98rem;
  margin-bottom: 0;
}

.warning-box strong {
  color: var(--ink);
}

/* --- Disclaimer --- */
.disclaimer-box {
  background: var(--red-50);
  border-left: 4px solid var(--red-500);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.75rem 2rem;
  margin: 0 auto;
  max-width: var(--reading-width);
}

.disclaimer-box p {
  color: var(--ink-light);
  font-size: 1rem;
  margin-bottom: 0;
}

/* --- Benefits Grid --- */
.benefits-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.benefit-card {
  background: var(--accent-gradient);
  border-radius: var(--radius-lg);
  padding: 2rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.benefit-card::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}

.benefit-card h4 {
  color: #fff;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.benefit-card p {
  color: rgba(255,255,255,0.85);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* Alternate gradient for variety */
.benefit-card:nth-child(2) { background: linear-gradient(135deg, #764ba2 0%, #667eea 100%); }
.benefit-card:nth-child(3) { background: linear-gradient(135deg, #6d28d9 0%, #8b5cf6 100%); }
.benefit-card:nth-child(4) { background: linear-gradient(135deg, #8b5cf6 0%, #667eea 100%); }
.benefit-card:nth-child(5) { background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%); }

/* --- Prompts Section --- */
.prompts-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* --- Section Headers --- */
.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header h2 {
  margin-bottom: 0.75rem;
}

.section-header p {
  max-width: 560px;
  margin: 0 auto;
  color: var(--ink-muted);
}

.section-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--purple-600);
  margin-bottom: 0.75rem;
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0;
  text-align: center;
}

.footer-tagline {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
}

.footer-credit {
  font-size: 0.85rem;
  color: var(--ink-faint);
}

.footer-credit a {
  color: var(--purple-600);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }

/* --- Responsive: Tablet --- */
@media (max-width: 768px) {
  body { font-size: 1rem; }

  h1 { font-size: 2.4rem; }
  h2 { font-size: 1.75rem; }

  .section { padding: 3.5rem 0; }

  .hero { padding: 5rem 0 3.5rem; }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .benefits-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .step {
    padding-left: 4rem;
    padding-bottom: 3rem;
  }

  .step-number {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .step::before {
    left: 19px;
    top: 44px;
  }

  .step-title { font-size: 1.4rem; }

  .content-card { padding: 2rem; }
  .prompt-box { padding: 1.5rem; }
}

/* --- Responsive: Mobile --- */
@media (max-width: 480px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }

  .container { padding: 0 1.25rem; }

  .hero { padding: 3.5rem 0 2.5rem; }
  .hero-subtitle { font-size: 1.1rem; }
  .hero-note { font-size: 0.85rem; padding: 0.4rem 1rem; }

  .section { padding: 2.5rem 0; }

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

  .step {
    padding-left: 3.5rem;
    padding-bottom: 2.5rem;
  }

  .step-number {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .step::before {
    left: 17px;
    top: 40px;
  }

  .step-title { font-size: 1.25rem; }

  .content-card { padding: 1.5rem; }
  .prompt-box { padding: 1.25rem 1rem; }
  .prompt-box pre { font-size: 0.82rem; }
  .prompt-box .copy-btn { top: 8px; right: 8px; padding: 0.3rem 0.6rem; font-size: 0.72rem; }

  .nav-inner { height: 56px; }
  .nav-logo-text { font-size: 1.15rem; }
}

/* --- RTL Support --- */
[dir='rtl'] {
  direction: rtl;
  text-align: right;
}

[dir='rtl'] .step {
  padding-left: 0;
  padding-right: 5rem;
}

[dir='rtl'] .step-number {
  left: auto;
  right: 0;
}

[dir='rtl'] .step::before {
  left: auto;
  right: 23px;
}

[dir='rtl'] .step-content ol,
[dir='rtl'] .step-content ul {
  padding-left: 0;
  padding-right: 1.5rem;
}

[dir='rtl'] .prompt-box .copy-btn {
  right: auto;
  left: 12px;
}

[dir='rtl'] .warning-box,
[dir='rtl'] .disclaimer-box {
  border-left: none;
  border-right: 4px solid;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

[dir='rtl'] .warning-box { border-right-color: var(--amber-500); }
[dir='rtl'] .disclaimer-box { border-right-color: var(--red-500); }

[dir='rtl'] .lang-dropdown {
  right: auto;
  left: 0;
}

[dir='rtl'] .lang-option .lang-code {
  margin-left: 0;
  margin-right: auto;
}

@media (max-width: 768px) {
  [dir='rtl'] .step {
    padding-right: 4rem;
  }
  [dir='rtl'] .step::before {
    right: 19px;
  }
}

@media (max-width: 480px) {
  [dir='rtl'] .step {
    padding-right: 3.5rem;
  }
  [dir='rtl'] .step::before {
    right: 17px;
  }
}
