/* ============================================
   SQUARE FOOT CALCULATORS — Premium Design System
   ============================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  /* Primary Palette */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  /* Accent (Teal/Cyan) */
  --accent-400: #2dd4bf;
  --accent-500: #14b8a6;
  --accent-600: #0d9488;

  /* Success / Orange */
  --success-500: #22c55e;
  --warning-500: #f59e0b;
  --danger-500: #ef4444;
  --orange-500: #f97316;

  /* Neutral */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --gray-950: #020617;

  /* Semantic */
  --bg-body: var(--gray-950);
  --bg-card: rgba(30, 41, 59, 0.6);
  --bg-card-hover: rgba(30, 41, 59, 0.8);
  --bg-input: rgba(15, 23, 42, 0.8);
  --border-default: rgba(148, 163, 184, 0.15);
  --border-focus: var(--primary-500);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  --gradient-hero: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  --gradient-card: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.5));
  --gradient-glow: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(59, 130, 246, 0.1), transparent 40%);

  /* Glass */
  --glass-bg: rgba(30, 41, 59, 0.45);
  --glass-border: rgba(148, 163, 184, 0.12);
  --glass-blur: 24px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.15);
  --shadow-glow-accent: 0 0 40px rgba(20, 184, 166, 0.15);

  /* Sizing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --max-width: 1200px;
  --max-width-narrow: 800px;
  --header-height: 72px;
}

/* ---------- Reset ---------- */
*, *::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: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body.no-scroll {
  overflow: hidden;
}

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

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

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary-600), var(--accent-600));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--primary-500), var(--accent-500));
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--primary-600) var(--gray-900);
}

/* ---------- Animated Aurora Background ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(59, 130, 246, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(139, 92, 246, 0.06), transparent),
    radial-gradient(ellipse 50% 60% at 60% 80%, rgba(20, 184, 166, 0.05), transparent);
  pointer-events: none;
  z-index: 0;
  animation: auroraShift 25s ease-in-out infinite alternate;
}

@keyframes auroraShift {
  0% {
    background:
      radial-gradient(ellipse 80% 50% at 20% 40%, rgba(59, 130, 246, 0.08), transparent),
      radial-gradient(ellipse 60% 40% at 80% 20%, rgba(139, 92, 246, 0.06), transparent),
      radial-gradient(ellipse 50% 60% at 60% 80%, rgba(20, 184, 166, 0.05), transparent);
  }
  33% {
    background:
      radial-gradient(ellipse 70% 60% at 40% 30%, rgba(59, 130, 246, 0.1), transparent),
      radial-gradient(ellipse 50% 50% at 70% 60%, rgba(139, 92, 246, 0.07), transparent),
      radial-gradient(ellipse 60% 40% at 30% 70%, rgba(20, 184, 166, 0.06), transparent);
  }
  66% {
    background:
      radial-gradient(ellipse 60% 70% at 60% 50%, rgba(59, 130, 246, 0.07), transparent),
      radial-gradient(ellipse 80% 40% at 30% 40%, rgba(139, 92, 246, 0.08), transparent),
      radial-gradient(ellipse 40% 50% at 70% 30%, rgba(20, 184, 166, 0.07), transparent);
  }
  100% {
    background:
      radial-gradient(ellipse 90% 50% at 50% 60%, rgba(59, 130, 246, 0.09), transparent),
      radial-gradient(ellipse 50% 60% at 20% 50%, rgba(139, 92, 246, 0.05), transparent),
      radial-gradient(ellipse 70% 40% at 80% 60%, rgba(20, 184, 166, 0.08), transparent);
  }
}

/* ---------- Links ---------- */
a {
  color: var(--primary-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--primary-300);
}

img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ---------- Focus-Visible Accessibility ---------- */
:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

a:focus-visible {
  outline: 2px solid var(--primary-400);
  outline-offset: 2px;
  border-radius: 4px;
}

.btn:focus-visible {
  outline: 2px solid var(--primary-400);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.form-input:focus-visible,
.form-select:focus-visible {
  outline: none; /* uses custom border-color + box-shadow instead */
}

.tab:focus-visible {
  outline: 2px solid var(--primary-400);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); letter-spacing: -0.02em; }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.5rem); letter-spacing: -0.01em; }
h4 { font-size: 1.125rem; }

p { color: var(--text-secondary); line-height: 1.7; }

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

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

.section {
  padding: 80px 0;
}

.section--sm {
  padding: 48px 0;
}

/* ---------- Header / Navbar ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-default);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
}

.header__logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header__nav a {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.header__nav a:hover,
.header__nav a.active {
  color: var(--text-primary);
  background: rgba(59, 130, 246, 0.1);
}

/* Mobile menu toggle */
.header__menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
}

.header__menu-toggle svg {
  display: block;
}

@media (max-width: 768px) {
  .header__menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .header__nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    flex-direction: column;
    background: rgba(2, 6, 23, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 80px 24px 32px;
    border-left: 1px solid var(--border-default);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    overflow-y: auto;
    gap: 4px;
  }
  .header__nav.open {
    transform: translateX(0);
  }
  .header__nav a {
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
  }
}

/* Mobile menu overlay */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ---------- Hero Section ---------- */
.hero {
  padding: 100px 0 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.12), transparent 70%);
  pointer-events: none;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-400);
  margin-bottom: 24px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero__title {
  margin-bottom: 20px;
}

.hero__subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  max-width: 640px;
  margin: 0 auto 40px;
  color: var(--text-secondary);
}

/* Hero Floating Orbs */
.hero__orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(60px);
}

.hero__orb--1 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15), transparent 70%);
  top: -50px;
  left: -80px;
  animation: floatOrb 8s ease-in-out infinite;
}

.hero__orb--2 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12), transparent 70%);
  top: 40px;
  right: -40px;
  animation: floatOrb 10s ease-in-out infinite 2s;
}

.hero__orb--3 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.1), transparent 70%);
  bottom: -60px;
  left: 30%;
  animation: floatOrb 12s ease-in-out infinite 4s;
}

@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(15px, -20px) scale(1.05); }
  50% { transform: translate(-10px, -35px) scale(0.95); }
  75% { transform: translate(20px, -15px) scale(1.02); }
}

/* ---------- Stats / Trust Bar ---------- */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 8px;
  max-width: 700px;
  margin: 0 auto;
}

.stats-bar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 12px;
  position: relative;
}

.stats-bar__item:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 25%;
  height: 50%;
  width: 1px;
  background: var(--border-default);
}

.stats-bar__value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.stats-bar__label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 640px) {
  .stats-bar {
    flex-wrap: wrap;
    border-radius: var(--radius-lg);
  }
  .stats-bar__item {
    flex: 1 1 45%;
    padding: 14px 8px;
  }
  .stats-bar__item:nth-child(2)::after {
    display: none;
  }
  .stats-bar__item:nth-child(1)::after,
  .stats-bar__item:nth-child(3)::after {
    display: block;
  }
}

/* ---------- Glass Card ---------- */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-glow);
  opacity: 0;
  transition: opacity var(--transition-slow);
  pointer-events: none;
}

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

.card:hover {
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(59, 130, 246, 0.08);
  transform: translateY(-2px);
}

.card--no-hover:hover {
  transform: none;
  box-shadow: none;
}

.card--calculator {
  max-width: 700px;
  margin: 0 auto;
  padding: 40px;
}

/* ---------- Tool Card (for hub page grid) ---------- */
.tool-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.tool-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateY(-6px) perspective(800px) rotateX(1deg);
  box-shadow: var(--shadow-glow), 0 12px 40px rgba(0,0,0,0.3);
}

.tool-card:hover::before {
  transform: scaleX(1);
}

.tool-card__icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.15);
  transition: transform var(--transition-base);
}

.tool-card:hover .tool-card__icon {
  transform: scale(1.08);
}

.tool-card__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.tool-card__desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex-grow: 1;
}

.tool-card__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-400);
  transition: gap var(--transition-fast), color var(--transition-fast);
}

.tool-card:hover .tool-card__link {
  gap: 10px;
  color: var(--primary-300);
}

/* Icon color variants */
.tool-card__icon--blue { background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.2); }
.tool-card__icon--teal { background: rgba(20, 184, 166, 0.1); border-color: rgba(20, 184, 166, 0.2); }
.tool-card__icon--orange { background: rgba(249, 115, 22, 0.1); border-color: rgba(249, 115, 22, 0.2); }
.tool-card__icon--purple { background: rgba(139, 92, 246, 0.1); border-color: rgba(139, 92, 246, 0.2); }
.tool-card__icon--green { background: rgba(34, 197, 94, 0.1); border-color: rgba(34, 197, 94, 0.2); }
.tool-card__icon--rose { background: rgba(244, 63, 94, 0.1); border-color: rgba(244, 63, 94, 0.2); }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  gap: 24px;
}

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

@media (max-width: 1024px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* ---------- Form Controls ---------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-label__icon {
  font-size: 1rem;
}

.form-input,
.form-select {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input:hover,
.form-select:hover {
  border-color: rgba(148, 163, 184, 0.3);
}

/* Input error / validation */
.form-input.error {
  border-color: var(--danger-500);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
  animation: shake 0.4s ease;
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8.825a.7.7 0 0 1-.5-.2l-4-4a.7.7 0 1 1 1-1L6 7.125l3.5-3.5a.7.7 0 1 1 1 1l-4 4a.7.7 0 0 1-.5.2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

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

/* Inline unit label */
.input-with-unit {
  position: relative;
}

.input-with-unit .form-input {
  padding-right: 50px;
}

.input-with-unit__label {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn--primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

/* Shine sweep on hover */
.btn--primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 20%,
    rgba(255, 255, 255, 0.15) 45%,
    rgba(255, 255, 255, 0.25) 50%,
    rgba(255, 255, 255, 0.15) 55%,
    transparent 80%
  );
  transition: none;
}

.btn--primary:hover::after {
  animation: btnShine 0.6s ease forwards;
}

@keyframes btnShine {
  0% { left: -100%; }
  100% { left: 120%; }
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--secondary {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary-400);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.btn--secondary:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.3);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.btn--ghost:hover {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-primary);
}

.btn--lg {
  padding: 16px 36px;
  font-size: 1.05rem;
}

.btn--sm {
  padding: 10px 18px;
  font-size: 0.85rem;
}

.btn--full {
  width: 100%;
}

.btn--icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* Copy button */
.btn--copy {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-default);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 2;
}

.btn--copy:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--primary-400);
}

.btn--copy.copied {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--success-500);
}

/* ---------- Result Display ---------- */
.result {
  margin-top: 32px;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(20, 184, 166, 0.06));
  border: 1px solid rgba(59, 130, 246, 0.15);
  text-align: center;
  animation: resultSlideIn 0.4s var(--transition-spring);
  position: relative;
}

.result:not(.result--hidden) {
  animation: resultSlideIn 0.4s ease-out, resultGlow 3s ease-in-out 0.4s infinite;
}

.result--hidden {
  display: none;
}

.result__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.result__value {
  font-family: 'Space Grotesk', monospace;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-400), var(--accent-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.result__unit {
  font-size: 1rem;
  -webkit-text-fill-color: var(--primary-400);
  font-weight: 600;
}

.result__details {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.result__detail-item {
  padding: 12px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  transition: border-color var(--transition-fast);
}

.result__detail-item:hover {
  border-color: rgba(59, 130, 246, 0.2);
}

.result__detail-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.result__detail-value {
  font-family: 'Space Grotesk', monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

@keyframes resultSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes resultGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
  50% {
    box-shadow: 0 0 20px 2px rgba(59, 130, 246, 0.08);
  }
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  flex-wrap: wrap;
}

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

.breadcrumbs a:hover {
  color: var(--primary-400);
}

.breadcrumbs__sep {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ---------- Related Calculators ---------- */
.related {
  margin-top: 64px;
}

.related__title {
  margin-bottom: 24px;
}

/* ---------- Info / Content Sections ---------- */
.content-section {
  margin-top: 64px;
}

.content-section h2 {
  margin-bottom: 16px;
}

.content-section h3 {
  margin-top: 24px;
  margin-bottom: 12px;
  font-size: 1.2rem;
}

.content-section p {
  margin-bottom: 16px;
}

.content-section ul,
.content-section ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.content-section li {
  list-style: disc;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.7;
}

.content-section ol li {
  list-style: decimal;
}

/* ---------- Formula Box ---------- */
.formula-box {
  padding: 20px 24px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.12);
  border-radius: var(--radius-md);
  font-family: 'Space Grotesk', monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-300);
  text-align: center;
  margin: 16px 0;
}

/* ---------- FAQ ---------- */
.faq-item {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.faq-item:hover {
  border-color: rgba(148, 163, 184, 0.25);
}

.faq-item.open {
  border-color: rgba(59, 130, 246, 0.25);
  border-left: 3px solid var(--primary-500);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.05);
}

.faq-question {
  width: 100%;
  padding: 18px 20px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  transition: color var(--transition-fast);
}

.faq-question:hover {
  color: var(--primary-300);
}

.faq-question__icon {
  font-size: 1.25rem;
  color: var(--text-muted);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), color var(--transition-fast);
  flex-shrink: 0;
}

.faq-item.open .faq-question__icon {
  transform: rotate(45deg);
  color: var(--primary-400);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-item.open .faq-answer {
  max-height: 500px;
  padding: 0 20px 18px;
}

.faq-answer p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ---------- Footer ---------- */
.footer {
  padding: 48px 0 32px;
  border-top: 1px solid var(--border-default);
  margin-top: 80px;
}

.footer__inner {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) auto auto;
  align-items: flex-start;
  gap: clamp(32px, 5vw, 80px);
}

.footer__brand {
  max-width: 340px;
}

.footer__brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.footer__brand-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer__links {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, max-content));
  gap: clamp(40px, 6vw, 80px);
  justify-content: end;
}

.footer__col-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.footer__col ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer__col a {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.footer__col a:hover {
  color: var(--primary-400);
}

/* Social Icons */
.social-icons {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.social-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.social-icon:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--primary-400);
  transform: translateY(-2px);
}

.social-icon svg {
  width: 18px;
  height: 18px;
}

.footer__bottom {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-default);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .footer__inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer__links {
    grid-template-columns: 1fr;
    gap: 24px;
    justify-content: start;
  }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(5px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-in {
  animation: fadeInUp 0.6s ease-out both;
}

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

/* ---------- Tabs (for shape selectors etc.) ---------- */
.tabs {
  display: flex;
  gap: 4px;
  width: 100%;
  background: rgba(15, 23, 42, 0.5);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  margin-bottom: 24px;
  overflow: hidden;
}

.tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab.active,
.tab:hover {
  color: var(--text-primary);
  background: rgba(59, 130, 246, 0.15);
}

.tab.active {
  background: rgba(59, 130, 246, 0.2);
  color: var(--primary-300);
}

@media (max-width: 480px) {
  .tab {
    padding: 10px 8px;
    font-size: 0.78rem;
  }
}

/* ---------- Step indicator ---------- */
.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.step__num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border-default);
  font-size: 0.75rem;
}

.step.active .step__num {
  background: var(--primary-600);
  border-color: var(--primary-500);
  color: #fff;
}

.step.active {
  color: var(--text-primary);
}

.step__connector {
  width: 32px;
  height: 1px;
  background: var(--border-default);
}

/* ---------- Tooltip ---------- */
.tooltip {
  position: relative;
  cursor: help;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  background: var(--gray-800);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.tooltip:hover::after {
  opacity: 1;
}

/* ---------- Utility ---------- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.hidden { display: none; }

/* ---------- Scroll-triggered animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* ---------- Wall-specific multi-add ---------- */
.wall-entry {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  background: rgba(15, 23, 42, 0.4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  margin-bottom: 12px;
  animation: fadeInUp 0.3s ease-out;
}

.wall-entry .btn--icon {
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  margin-bottom: 2px;
}

/* ---------- Shape canvas area ---------- */
.shape-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

/* ---------- Back to Top ---------- */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.back-to-top:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--primary-400);
  transform: translateY(-2px);
}

/* ---------- Page Content (About, Terms, Privacy, Contact) ---------- */
.page-content {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
}

.page-content h2 {
  margin-top: 40px;
  margin-bottom: 16px;
}

.page-content h3 {
  margin-top: 28px;
  margin-bottom: 12px;
  font-size: 1.15rem;
}

.page-content p {
  margin-bottom: 16px;
  font-size: 0.95rem;
  line-height: 1.8;
}

.page-content ul,
.page-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.page-content li {
  list-style: disc;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.7;
  font-size: 0.95rem;
}

.page-content ol li {
  list-style: decimal;
}

.page-content hr {
  border: 0;
  border-top: 1px solid var(--border-default);
  margin: 40px 0;
}

/* Contact Form */
.contact-form {
  max-width: 600px;
  margin: 0 auto;
}

.contact-form .form-group {
  margin-bottom: 20px;
}

.form-status {
  text-align: center;
  padding: 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 16px;
  display: none;
}

.form-status.success {
  display: block;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: var(--success-500);
}

.form-status.error {
  display: block;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger-500);
}

/* Sitemap List */
.sitemap-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
}

.sitemap-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.sitemap-list a:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
  color: var(--primary-400);
  transform: translateX(4px);
}

.sitemap-list a::before {
  content: '→';
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.sitemap-list a:hover::before {
  color: var(--primary-400);
}

/* ---------- Conversion Table ---------- */
.conversion-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.95rem;
}

.conversion-table th,
.conversion-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-default);
}

.conversion-table th {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(15, 23, 42, 0.4);
}

.conversion-table td {
  color: var(--text-secondary);
}

.conversion-table td:first-child {
  font-weight: 600;
  color: var(--text-primary);
}

.conversion-table tr:hover td {
  background: rgba(59, 130, 246, 0.04);
}

/* ---------- Shape Formula Cards ---------- */
.shape-formula-card {
  padding: 24px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin: 20px 0;
  transition: border-color var(--transition-fast);
}

.shape-formula-card:hover {
  border-color: rgba(59, 130, 246, 0.2);
}

.shape-formula-card h3,
.shape-formula-card h4 {
  margin-top: 0;
  margin-bottom: 12px;
}

.shape-formula-card .formula-box {
  margin: 12px 0;
}

.shape-formula-card p:last-child {
  margin-bottom: 0;
}

/* ---------- Calculator Live Diagram ---------- */
.calc-diagram-wrap {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.calc-diagram-wrap:hover {
  border-color: rgba(59, 130, 246, 0.2);
}

#calc-diagram {
  display: block;
  width: 100%;
  height: auto;
}

.calc-diagram-area {
  text-align: center;
  padding: 10px 16px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.4);
  border-top: 1px solid var(--border-default);
  transition: all var(--transition-fast);
}

.calc-diagram-area--active {
  color: var(--text-primary);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(20, 184, 166, 0.06));
}

/* ---------- Interactive Area Demo ---------- */
.interactive-demo {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 20px 0;
  transition: border-color var(--transition-fast);
}

.interactive-demo:hover {
  border-color: rgba(59, 130, 246, 0.2);
}

.interactive-demo__controls {
  display: flex;
  gap: 24px;
  padding: 20px 24px;
  background: rgba(15, 23, 42, 0.4);
  border-bottom: 1px solid var(--border-default);
}

.interactive-demo__slider-group {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.interactive-demo__slider-group .form-label {
  min-width: 50px;
  margin: 0;
  font-size: 0.8rem;
}

.interactive-demo__slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.15);
  outline: none;
  cursor: pointer;
}

.interactive-demo__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #14b8a6);
  border: 2px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.interactive-demo__slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.5);
}

.interactive-demo__slider::-webkit-slider-thumb:active {
  transform: scale(1.25);
}

.interactive-demo__slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #14b8a6);
  border: 2px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.interactive-demo__slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.15);
}

.interactive-demo__val {
  min-width: 48px;
  text-align: right;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-400);
  white-space: nowrap;
}

.interactive-demo__canvas {
  padding: 16px;
}

#demo-svg {
  display: block;
  width: 100%;
  height: auto;
}

#demo-svg rect,
#demo-svg line,
#demo-svg text {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 640px) {
  .interactive-demo__controls {
    flex-direction: column;
    gap: 14px;
    padding: 16px;
  }

  .interactive-demo__slider-group .form-label {
    min-width: 42px;
  }

  .interactive-demo__canvas {
    padding: 8px;
  }
}

/* ---------- Shape Diagram (shared component) ---------- */
.shape-diagram {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 16px 0;
  transition: border-color var(--transition-fast);
}

.shape-diagram:hover {
  border-color: rgba(59, 130, 246, 0.18);
}

.shape-diagram__canvas {
  padding: 12px;
  display: flex;
  justify-content: center;
}

.shape-diagram__canvas svg {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
}

.shape-diagram__canvas svg rect,
.shape-diagram__canvas svg circle,
.shape-diagram__canvas svg polygon,
.shape-diagram__canvas svg path,
.shape-diagram__canvas svg line,
.shape-diagram__canvas svg text {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.shape-diagram__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.4);
  border-top: 1px solid var(--border-default);
  border-bottom: 1px solid var(--border-default);
}

.shape-diagram__input {
  flex: 1 1 120px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.shape-diagram__input label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  min-width: 38px;
}

.shape-diagram__input input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.12);
  outline: none;
  cursor: pointer;
  min-width: 0;
}

.shape-diagram__input input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #14b8a6);
  border: 2px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(59, 130, 246, 0.25);
  transition: transform 0.15s ease;
}

.shape-diagram__input input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.shape-diagram__input input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #14b8a6);
  border: 2px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.shape-diagram__input input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.12);
}

.shape-diagram__input span {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary-400);
  min-width: 42px;
  text-align: right;
  white-space: nowrap;
}

.shape-diagram__result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(20, 184, 166, 0.04));
}

.shape-diagram__area {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #2dd4bf);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.shape-diagram__metric {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --- Converter Widget --- */
.shape-diagram__converter {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  align-items: center;
}

.shape-diagram__converter input[type="number"] {
  flex: 1 1 100px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.shape-diagram__converter input[type="number"]:focus {
  border-color: var(--primary-400);
}

.shape-diagram__converter select {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.shape-diagram__converter select:focus {
  border-color: var(--primary-400);
}

.shape-diagram__conv-results {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.shape-diagram__conv-item {
  background: rgba(15, 23, 42, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  text-align: center;
}

.shape-diagram__conv-item strong {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-400);
}

.shape-diagram__conv-item small {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* --- Cost Widget --- */
.shape-diagram__cost-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 14px 16px;
  align-items: center;
}

.shape-diagram__cost-input {
  flex: 1 1 100px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.shape-diagram__cost-input label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.shape-diagram__cost-input input[type="number"],
.shape-diagram__cost-input input[type="range"] {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-primary);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  outline: none;
}

.shape-diagram__cost-input input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  padding: 0;
  background: rgba(148, 163, 184, 0.12);
}

.shape-diagram__cost-input input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #14b8a6);
  border: 2px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.shape-diagram__cost-input input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #14b8a6);
  border: 2px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.shape-diagram__cost-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(20, 184, 166, 0.04));
  flex-wrap: wrap;
}

.shape-diagram__cost-result span {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.shape-diagram__cost-result strong {
  color: var(--primary-400);
}

@media (max-width: 640px) {
  .shape-diagram__controls {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }

  .shape-diagram__input {
    flex: 1 1 100%;
  }

  .shape-diagram__converter {
    flex-direction: column;
  }

  .shape-diagram__cost-row {
    flex-direction: column;
  }
}

/* ---------- Print styles ---------- */
@media print {
  body::before { display: none; }
  .header, .footer, .btn, .related, .back-to-top { display: none; }
  .card { background: #fff; border: 1px solid #ddd; color: #000; }
  .result__value { color: #1d4ed8; -webkit-text-fill-color: #1d4ed8; }
}

/* ============================================
   LANGUAGE SWITCHER
   ============================================ */

/* ---------- Header Toggle Button ---------- */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  margin-left: 8px;
}

.lang-toggle:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(148, 163, 184, 0.3);
  color: var(--text-primary);
}

.lang-toggle__icon {
  flex-shrink: 0;
  opacity: 0.7;
}

.lang-toggle:hover .lang-toggle__icon {
  opacity: 1;
}

.lang-toggle__label {
  white-space: nowrap;
}

@media (max-width: 768px) {
  .lang-toggle {
    position: absolute;
    right: 56px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 10px;
    font-size: 0.75rem;
    gap: 5px;
  }

  .lang-toggle__label {
    display: none;
  }
}

/* ---------- Language Modal ---------- */
.lang-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lang-modal.open {
  opacity: 1;
  visibility: visible;
}

.lang-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lang-modal__panel {
  position: relative;
  background: rgba(10, 18, 35, 0.97);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  width: 92%;
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.92) translateY(12px);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(59, 130, 246, 0.06);
}

.lang-modal.open .lang-modal__panel {
  transform: scale(1) translateY(0);
}

.lang-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.lang-modal__title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.lang-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1;
}

.lang-modal__close:hover {
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-primary);
  border-color: rgba(148, 163, 184, 0.25);
}

/* ---------- Language Grid ---------- */
.lang-modal__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.lang-btn {
  padding: 11px 14px;
  background: rgba(22, 33, 55, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 10px;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.lang-btn:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(148, 163, 184, 0.22);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.lang-btn.active {
  border-color: var(--accent-500);
  color: var(--text-primary);
  background: rgba(20, 184, 166, 0.07);
  box-shadow: 0 0 16px rgba(20, 184, 166, 0.08), inset 0 0 0 1px rgba(20, 184, 166, 0.08);
}

.lang-btn.active:hover {
  background: rgba(20, 184, 166, 0.12);
}

/* RTL support for Arabic */
[dir="rtl"] .header .container {
  flex-direction: row-reverse;
}

[dir="rtl"] .header__nav {
  flex-direction: row-reverse;
}

[dir="rtl"] .tool-card__link {
  direction: ltr;
}

@media (max-width: 768px) {
  [dir="rtl"] .header__nav {
    flex-direction: column;
    left: 0;
    right: auto;
    border-left: none;
    border-right: 1px solid var(--border-default);
    transform: translateX(-100%);
  }
  [dir="rtl"] .header__nav.open {
    transform: translateX(0);
  }
}
