/* ==========================================================================
   CALCTOTUS Design System
   Inspired by Atria Dashboard & Branding Guide:
   - Typography: DM Serif Display (Headings & Large Numbers) + Plus Jakarta Sans
   - Palette: #151515 (Dark Charcoal), #F8F9F6 (Warm Cream), #A4D7FD (Pastel Sky Blue), #C8F26B (Lime/Chartreuse)
   - Layout: Modern Bento Grid with Rounded Bezel, Circular Arrow Buttons (↗), and Smooth Gradients
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Canvas & Outer Container */
  --canvas-bg: #DDEAF8; /* Soft airy sky background surrounding the app frame */
  --frame-bg: #151515;  /* Sleek tablet/app bezel frame */
  --bg: #F8F9F6;        /* Warm soft off-white surface */
  --bg-elevated: #FFFFFF;
  --card-bg: #FFFFFF;
  --card-cream: #F8F9F6;
  --card-border: rgba(21, 21, 21, 0.08);
  --card-border-hover: rgba(21, 21, 21, 0.18);

  /* Exact Branding Palette */
  --color-dark: #151515;
  --color-cream: #F8F9F6;
  --color-blue: #A4D7FD;
  --color-blue-deep: #2563EB;
  --color-lime: #C8F26B;
  --color-lime-dark: #2F4D08;

  /* Signature Gradient: Sky Blue to Lime */
  --brand-gradient: linear-gradient(135deg, #A4D7FD 0%, #C8F26B 100%);
  --brand-gradient-soft: linear-gradient(135deg, rgba(164, 215, 253, 0.3) 0%, rgba(200, 242, 107, 0.3) 100%);

  /* Typography */
  --font-serif: 'DM Serif Display', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --text-primary: #151515;
  --text-secondary: #4A4D53;
  --text-muted: #7E828A;

  /* Functional Accents */
  --accent-blue: #151515;
  --accent-cyan: #151515;
  --accent-emerald: #C8F26B;
  --accent-amber: #F59E0B;
  --accent-red: #EF4444;
  --spotlight-glow: rgba(164, 215, 253, 0.15);

  --input-bg: #FFFFFF;
  --input-border: #E2E8F0;
  --input-border-focus: #151515;

  --ad-bg: #F8F9F6;
  --ad-border: #E2E8F0;

  /* Radii (Smooth Atria Curves) */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(21, 21, 21, 0.04);
  --shadow-md: 0 8px 24px rgba(21, 21, 21, 0.06);
  --shadow-lg: 0 20px 48px rgba(21, 21, 21, 0.08);
  --shadow-bezel: 0 25px 65px -12px rgba(15, 23, 42, 0.25);
}

/* Optional Dark Mode */
[data-theme="dark"] {
  --canvas-bg: #09090B;
  --frame-bg: #000000;
  --bg: #151515;
  --bg-elevated: #1F1F1F;
  --card-bg: #1C1C1E;
  --card-cream: #18181A;
  --card-border: rgba(255, 255, 255, 0.1);
  --card-border-hover: rgba(255, 255, 255, 0.25);

  --text-primary: #FFFFFF;
  --text-secondary: #D1D5DB;
  --text-muted: #9CA3AF;

  --input-bg: #151515;
  --input-border: rgba(255, 255, 255, 0.15);
  --input-border-focus: #A4D7FD;

  --ad-bg: rgba(255, 255, 255, 0.03);
  --ad-border: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--canvas-bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  padding: 1.5rem 1rem;
}

@media (max-width: 640px) {
  body {
    padding: 0.5rem 0.25rem;
  }
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

a:hover {
  color: var(--color-blue-deep);
}

img, svg {
  display: block;
  max-width: 100%;
}

code, kbd, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ==========================================================================
   The App Board Bezel (Atria Dashboard Frame)
   ========================================================================== */

.app-frame {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  background: var(--frame-bg);
  border-radius: 36px;
  padding: 14px;
  box-shadow: var(--shadow-bezel);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (max-width: 768px) {
  .app-frame {
    border-radius: 20px;
    padding: 8px;
    gap: 8px;
  }
}

/* ==========================================================================
   Header Navigation Bar (Atria Top Bar Style)
   ========================================================================== */

.site-header {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  z-index: 50;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-dark);
  text-decoration: none !important;
}

.brand-pill {
  background: var(--color-dark);
  color: #FFFFFF;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.nav-pill-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
}

.nav-pill {
  padding: 0.5rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
  text-decoration: none !important;
}

.nav-pill:hover {
  color: var(--text-primary);
  background: rgba(21, 21, 21, 0.05);
}

/* Active Pill: Atria Sky Blue #A4D7FD */
.nav-pill.active {
  background: var(--color-blue);
  color: var(--color-dark);
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Search Trigger Button */
.search-trigger-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--card-cream);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-trigger-btn:hover {
  background: #EEF2F7;
  color: var(--text-primary);
}

.kbd-badge {
  background: var(--bg-elevated);
  border: 1px solid var(--input-border);
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--card-cream);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background: var(--color-lime);
  color: var(--color-dark);
  border-color: var(--color-lime);
}

/* Profile / Status Badge in Header */
.header-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #F1F5F9;
  padding: 0.35rem 0.85rem 0.35rem 0.45rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.header-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--color-dark);
}

/* ==========================================================================
   Main Content Area (Atria Dashboard Bento Architecture)
   ========================================================================== */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.container {
  width: 100%;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--card-bg);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
}

.breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--color-dark);
  text-decoration: underline;
}

/* ==========================================================================
   Typography: DM Serif Display Headings
   ========================================================================== */

h1, h2, h3, .heading-serif {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.page-header {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.75rem;
}

.page-header h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.page-header .lede {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 75ch;
  line-height: 1.6;
}

/* Hero Section (Atria Dashboard style) */
.hero {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.1;
  margin-bottom: 1.25rem;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto 2rem;
}

/* Hero Badge */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  background: var(--color-lime);
  color: var(--color-dark);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}

.badge-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ==========================================================================
   Atria Signature Cards & Bento Grid Components
   ========================================================================== */

/* 1. The Gradient Hero / Result Card (#A4D7FD -> #C8F26B) */
.card-gradient-hero {
  background: var(--brand-gradient);
  border-radius: var(--radius-lg);
  padding: 2rem;
  color: var(--color-dark);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-gradient-hero .card-label {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--color-dark);
  margin-bottom: 0.5rem;
}

.card-gradient-hero .big-number {
  font-family: var(--font-serif);
  font-size: clamp(3.5rem, 7vw, 5.5rem);
  line-height: 0.95;
  font-weight: 400;
  color: var(--color-dark);
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

/* Pill badge in the gradient card (Atria "This week v" style) */
.pill-dropdown-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-dark);
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

/* 2. Standard Bento Cards (#FFFFFF / #F8F9F6) */
.spotlight-card, .bento-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
  border: 2.5px solid var(--color-lime);
}

.spotlight-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-blue);
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  line-height: 1.2;
}

.card-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.card-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

/* Atria Circular Action Arrow Button (↗) */
.btn-circle-arrow {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--color-dark);
  color: #FFFFFF !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  transition: transform 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

.bento-card-link:hover .btn-circle-arrow, .btn-circle-arrow:hover {
  transform: rotate(45deg) scale(1.05);
  background: var(--color-blue-deep);
}

/* Growth / Unit Pills (e.g. ↑14%) */
.pill-badge-green {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: var(--color-lime);
  color: var(--color-dark);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 800;
}

.pill-badge-blue {
  display: inline-flex;
  align-items: center;
  background: var(--color-blue);
  color: var(--color-dark);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 800;
}

/* ==========================================================================
   Calculator Layout & Controls
   ========================================================================== */

.calculator-layout-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 14px;
  align-items: start;
}

@media (max-width: 980px) {
  .calculator-layout-grid {
    grid-template-columns: 1fr;
  }
}

.calc-panel {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

/* Smooth Tab Switcher */
.tab-switch {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--card-cream);
  padding: 0.4rem;
  border-radius: var(--radius-full);
  margin-bottom: 1.75rem;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  text-align: center;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--bg-elevated);
  color: var(--color-dark);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Form Inputs */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.label-hint {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input, .form-select {
  width: 100%;
  background: #FFFFFF;
  border: 1.5px solid var(--input-border);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.2s ease;
  font-variant-numeric: tabular-nums;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--color-dark);
  box-shadow: 0 0 0 3px rgba(21, 21, 21, 0.1);
}

.input-suffix {
  position: absolute;
  right: 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}

.form-input.has-suffix {
  padding-right: 3rem;
}

/* Buttons (Atria Black Pill Buttons) */
.calc-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--card-border);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--color-dark);
  border: none;
  color: #FFFFFF !important;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(21, 21, 21, 0.2);
  text-decoration: none !important;
}

.btn-primary:hover {
  background: #2D2D2D;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(21, 21, 21, 0.3);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--card-cream);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 0.8rem 1.3rem;
  border-radius: var(--radius-full);
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none !important;
}

.btn-secondary:hover {
  background: #E2E8F0;
}

/* ==========================================================================
   Result Readout Panel (Styled with Atria Signature Gradient)
   ========================================================================== */

.calc-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-card {
  background: var(--brand-gradient);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  color: var(--color-dark);
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.result-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--color-dark);
}

.copy-btn {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  color: var(--color-dark);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: #FFFFFF;
  transform: translateY(-1px);
}

.copy-btn.copied {
  background: var(--color-dark);
  color: #FFFFFF;
}

.result-primary {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 4.5vw, 3.4rem);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--color-dark);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 0.4rem;
  word-break: break-word;
}

.result-sub {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-dark);
  opacity: 0.85;
  margin-bottom: 1.5rem;
}

.result-breakdown {
  border-top: 1.5px solid rgba(21, 21, 21, 0.15);
  padding-top: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

.breakdown-label {
  color: var(--color-dark);
  font-weight: 600;
  opacity: 0.8;
}

.breakdown-val {
  font-weight: 800;
  color: var(--color-dark);
  font-variant-numeric: tabular-nums;
}

/* Ad Slot Container (0 CLS Reservation) */
.ad-slot-reserved {
  background: var(--card-bg);
  border: 2px dashed rgba(21, 21, 21, 0.12);
  border-radius: var(--radius-lg);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
}

/* ==========================================================================
   Supporting Content Sections
   ========================================================================== */

.content-section {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Step list */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  background: var(--card-cream);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.step-num {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--color-dark);
  color: #FFFFFF;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-text b {
  font-size: 1rem;
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.25rem;
}

.step-text p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 0;
}

/* Formula Card with Atria Pastel Styling */
.formula-card {
  background: var(--card-cream);
  border-radius: var(--radius-md);
  padding: 1.75rem;
}

.formula-math {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-dark);
  background: #FFFFFF;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border: 1px solid var(--card-border);
  overflow-x: auto;
}

/* Worked Example Card */
.example-card {
  background: var(--card-cream);
  border-radius: var(--radius-md);
  padding: 1.75rem;
}

.example-card h4, .example-card h3 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
  color: var(--color-dark);
}

/* Diagram Box */
.diagram-container {
  background: var(--card-cream);
  border-radius: var(--radius-md);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.diagram-container img, .diagram-container svg {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.diagram-caption {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 1rem;
  text-align: center;
}

/* FAQ Accordion */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.faq-item {
  background: var(--card-cream);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.2s ease;
}

.faq-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.faq-chevron {
  transition: transform 0.25s ease;
  color: var(--text-muted);
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
  color: var(--color-dark);
}

.faq-content {
  display: none;
  padding: 0 1.5rem 1.35rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.faq-item.open .faq-content {
  display: block;
}

/* Related Calculators Grid with Circular Arrows */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.related-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--card-cream);
  border-radius: var(--radius-md);
  text-decoration: none !important;
  color: inherit;
  transition: all 0.2s ease;
}

.related-card:hover {
  background: #EAF3FD;
}

.related-card b {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.2rem;
}

.related-card span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Verification Footer */
.page-verify-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 1rem 0.5rem 0;
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--color-dark);
}

/* ==========================================================================
   Command / Search Modal
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(21, 21, 21, 0.6);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 1.25rem 2rem;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  width: 100%;
  max-width: 600px;
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-input-wrap {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--card-border);
  gap: 0.85rem;
}

.modal-search-input {
  flex: 1;
  background: none;
  border: none;
  font-size: 1.1rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
}

.modal-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 0.75rem;
}

.search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none !important;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.search-item:hover, .search-item.selected {
  background: var(--color-blue);
  color: var(--color-dark);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--card-cream);
  border-top: 1px solid var(--card-border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  pointer-events: none;
}

.toast {
  background: var(--color-dark);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem 2rem;
  margin-top: auto;
  font-size: 0.9rem;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .nav-pill-group {
    display: none;
  }
}

.footer-brand h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
}

.footer-brand p {
  color: var(--text-secondary);
  max-width: 320px;
  line-height: 1.6;
}

.footer-col h4, .footer-col h3 {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--color-dark);
  text-decoration: underline;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--card-border);
  font-size: 0.82rem;
}

/* ==========================================================================
   Photo Media, Icon Tiles & Image Credits  (added for visual upgrade)
   ========================================================================== */

/* Icon chip: colored rounded badge holding a unique line icon on each tile */
.icon-chip {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: var(--brand-gradient-soft);
  border: 1.5px solid var(--card-border);
  color: var(--color-dark);
  flex-shrink: 0;
  transition: transform 0.25s ease, background 0.25s ease;
}

.icon-chip svg {
  width: 28px;
  height: 28px;
  stroke: var(--color-dark);
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bento-card-link:hover .icon-chip {
  transform: translateY(-2px) rotate(-3deg);
  background: var(--brand-gradient);
}

[data-theme="dark"] .icon-chip svg { stroke: var(--color-cream); }
[data-theme="dark"] .bento-card-link:hover .icon-chip svg { stroke: var(--color-dark); }

/* Photo thumbnail that sits at the top of a calculator/hub tile */
.card-photo {
  display: block;
  width: calc(100% + 3.5rem);
  margin: -1.75rem -1.75rem 1.25rem;
  height: 160px;
  object-fit: cover;
  background: var(--card-cream);
  border-bottom: 2.5px solid var(--color-lime);
}

.bento-card-link:hover .card-photo { border-bottom-color: var(--color-blue); }

/* Hub hero photo (replaces the flat SVG banner) */
.hub-hero-photo {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--card-border);
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-md);
}

.hub-hero-photo img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
}

.hub-hero-photo .hub-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(21,21,21,0.55) 0%, rgba(21,21,21,0.15) 55%, rgba(21,21,21,0) 100%);
}

/* Feature photo block on individual calculator pages */
.feature-photo {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
}

.feature-photo img {
  width: 100%;
  height: 340px;
  object-fit: cover;
  display: block;
}

@media (max-width: 640px) {
  .feature-photo img { height: 220px; }
  .hub-hero-photo img { height: 220px; }
}

/* Visible image credit / attribution line linking back to the source page */
.img-credit {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  text-align: right;
}

.img-credit a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.img-credit a:hover { color: var(--color-blue-deep); }

/* Credit pinned over a photo (hub + feature photos) */
.img-credit-overlay {
  position: absolute;
  bottom: 8px;
  right: 10px;
  z-index: 2;
  font-size: 0.72rem;
  color: #fff;
  background: rgba(21, 21, 21, 0.55);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  backdrop-filter: blur(4px);
}

.img-credit-overlay a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Hub hero heading overlay text */
.hub-hero-caption {
  position: absolute;
  left: 1.75rem;
  bottom: 1.5rem;
  z-index: 2;
  color: #fff;
  max-width: 60%;
}

.hub-hero-caption .eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--color-lime);
  color: var(--color-dark);
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.6rem;
}

@media (max-width: 640px) {
  .hub-hero-caption { max-width: 90%; left: 1rem; bottom: 1rem; }
}

/* ==========================================================================
   Graphic Polish  (hero wash, diagram backdrop) — visual upgrade
   ========================================================================== */

/* Homepage hero: soft brand gradient wash + decorative dotted grid */
.hero {
  background:
    radial-gradient(120% 140% at 15% 0%, rgba(164, 215, 253, 0.35) 0%, rgba(164, 215, 253, 0) 55%),
    radial-gradient(120% 140% at 100% 100%, rgba(200, 242, 107, 0.35) 0%, rgba(200, 242, 107, 0) 55%),
    var(--card-bg);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(21, 21, 21, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(80% 80% at 50% 0%, #000 0%, transparent 75%);
          mask-image: radial-gradient(80% 80% at 50% 0%, #000 0%, transparent 75%);
  pointer-events: none;
}

.hero > * { position: relative; z-index: 1; }

[data-theme="dark"] .hero::before {
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
}

/* Diagram container: branded backdrop so schematic SVGs feel intentional */
.diagram-container {
  background:
    radial-gradient(100% 120% at 0% 0%, rgba(164, 215, 253, 0.18) 0%, rgba(164, 215, 253, 0) 60%),
    radial-gradient(100% 120% at 100% 100%, rgba(200, 242, 107, 0.18) 0%, rgba(200, 242, 107, 0) 60%),
    var(--card-cream);
  border: 1px solid var(--card-border);
  position: relative;
}

.diagram-container::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image:
    linear-gradient(rgba(21, 21, 21, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 21, 21, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.diagram-container > * { position: relative; z-index: 1; }

.diagram-container img, .diagram-container svg {
  box-shadow: var(--shadow-sm);
  background: #fff;
}

[data-theme="dark"] .diagram-container::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
}

/* ==========================================================================
   Reference Tables (guides / cheat sheets)
   ========================================================================== */

.ref-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  margin: 1.25rem 0 1.75rem;
  -webkit-overflow-scrolling: touch;
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 420px;
}

.ref-table caption {
  text-align: left;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.75rem 1rem 0;
  caption-side: bottom;
}

.ref-table th,
.ref-table td {
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
}

.ref-table thead th {
  background: var(--card-cream);
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.ref-table tbody tr:last-child td { border-bottom: none; }
.ref-table tbody tr:nth-child(even) td { background: rgba(21, 21, 21, 0.015); }
.ref-table td:first-child { font-weight: 700; color: var(--text-primary); }

[data-theme="dark"] .ref-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.03); }

/* Call-to-tool banner inside a guide */
.guide-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--brand-gradient-soft);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.guide-cta p { margin: 0; color: var(--text-secondary); font-size: 0.95rem; }
.guide-cta b { color: var(--text-primary); }

.guide-body h2 { margin-top: 2rem; }
.guide-body p { color: var(--text-secondary); margin-bottom: 1rem; }
.guide-body ul { color: var(--text-secondary); margin: 0 0 1.25rem 1.25rem; line-height: 1.8; }
