/* ==========================================
   ToolsBuilt - Global Styles & Design System
   ========================================== */

:root {
  /* Colors - Light Theme */
  --font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --primary-text: #ffffff;

  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.85);
  --bg-input: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-badge: #e0e7ff;
  
  --border-color: #e2e8f0;
  --border-focus: #4f46e5;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --text-badge: #3730a3;

  /* Category Tiles - Light Mode */
  --cat-date-bg: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  --cat-date-color: #4338ca;

  --cat-math-bg: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  --cat-math-color: #047857;

  --cat-text-bg: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  --cat-text-color: #b45309;

  --cat-security-bg: linear-gradient(135deg, #ffe4e6 0%, #fecdd3 100%);
  --cat-security-color: #be123c;

  --cat-fun-bg: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
  --cat-fun-color: #7e22ce;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 20px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.1);
  --shadow-hover: 0 12px 30px rgba(79, 70, 229, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --max-width: 1100px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Explicit Dark Theme override or system dark preference */
[data-theme="dark"] {
  --primary-light: rgba(79, 70, 229, 0.25);
  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #243347;
  --bg-header: rgba(15, 23, 42, 0.85);
  --bg-input: #0f172a;
  --bg-muted: #1e293b;
  --bg-badge: rgba(79, 70, 229, 0.2);

  --border-color: #334155;
  --border-focus: #6366f1;

  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;
  --text-badge: #a5b4fc;

  /* Category Tiles - Dark Mode */
  --cat-date-bg: linear-gradient(135deg, rgba(79, 70, 229, 0.3) 0%, rgba(99, 102, 241, 0.2) 100%);
  --cat-date-color: #a5b4fc;

  --cat-math-bg: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(5, 150, 105, 0.2) 100%);
  --cat-math-color: #6ee7b7;

  --cat-text-bg: linear-gradient(135deg, rgba(245, 158, 11, 0.3) 0%, rgba(217, 119, 6, 0.2) 100%);
  --cat-text-color: #fcd34d;

  --cat-security-bg: linear-gradient(135deg, rgba(244, 63, 94, 0.3) 0%, rgba(225, 29, 72, 0.2) 100%);
  --cat-security-color: #fda4af;

  --cat-fun-bg: linear-gradient(135deg, rgba(168, 85, 247, 0.3) 0%, rgba(147, 51, 234, 0.2) 100%);
  --cat-fun-color: #c084fc;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 12px 30px rgba(79, 70, 229, 0.25);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary-light: rgba(79, 70, 229, 0.25);
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #243347;
    --bg-header: rgba(15, 23, 42, 0.85);
    --bg-input: #0f172a;
    --bg-muted: #1e293b;
    --bg-badge: rgba(79, 70, 229, 0.2);

    --border-color: #334155;
    --border-focus: #6366f1;

    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --text-subtle: #94a3b8;
    --text-badge: #a5b4fc;

    --cat-date-bg: linear-gradient(135deg, rgba(79, 70, 229, 0.3) 0%, rgba(99, 102, 241, 0.2) 100%);
    --cat-date-color: #a5b4fc;

    --cat-math-bg: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(5, 150, 105, 0.2) 100%);
    --cat-math-color: #6ee7b7;

    --cat-text-bg: linear-gradient(135deg, rgba(245, 158, 11, 0.3) 0%, rgba(217, 119, 6, 0.2) 100%);
    --cat-text-color: #fcd34d;

    --cat-security-bg: linear-gradient(135deg, rgba(244, 63, 94, 0.3) 0%, rgba(225, 29, 72, 0.2) 100%);
    --cat-security-color: #fda4af;

    --cat-fun-bg: linear-gradient(135deg, rgba(168, 85, 247, 0.3) 0%, rgba(147, 51, 234, 0.2) 100%);
    --cat-fun-color: #c084fc;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 12px 30px rgba(79, 70, 229, 0.25);
  }
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Skip to main content accessibility link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background-color: var(--primary);
  color: #ffffff;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  z-index: 1000;
  font-weight: 600;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

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

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(1.85rem, 4vw, 2.5rem); margin-bottom: 0.75rem; }
h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); margin-bottom: 1rem; margin-top: 2rem; }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.35rem); margin-bottom: 0.5rem; }

p {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

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

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--text-main);
}

.site-logo svg {
  width: 2.25rem;
  height: 2.25rem;
}

.site-logo span.accent {
  color: var(--primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
}

/* Dark Mode Toggle Button */
.theme-toggle-btn {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.theme-toggle-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
}

.icon-sun { display: none; }
.icon-moon { display: block; }

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

/* Mobile Navigation Hamburger */
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 0.5rem;
}

.mobile-menu-btn svg {
  width: 1.75rem;
  height: 1.75rem;
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }

  .main-nav {
    position: fixed;
    top: 4.25rem;
    left: 0;
    right: 0;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.25rem;
    align-items: flex-start;
    box-shadow: var(--shadow-lg);
    transform: translateY(-120%);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
  }

  .main-nav.is-active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
}

/* Breadcrumbs */
.breadcrumb {
  padding: 1.25rem 0 0.75rem 0;
  font-size: 0.875rem;
  color: var(--text-subtle);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  gap: 0.5rem;
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.breadcrumb li::after {
  content: "/";
  color: var(--text-subtle);
}

.breadcrumb li:last-child::after {
  content: "";
}

.breadcrumb a {
  color: var(--text-muted);
}

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

.breadcrumb li[aria-current="page"] {
  color: var(--text-main);
  font-weight: 500;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3.5rem 1rem 2.5rem 1rem;
  max-width: 800px;
  margin: 0 auto;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.search-box {
  position: relative;
  max-width: 550px;
  margin: 0 auto;
}

.search-input {
  width: 100%;
  padding: 1rem 1.25rem 1rem 3rem;
  font-size: 1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--primary-light);
  outline: none;
}

.search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  width: 1.25rem;
  height: 1.25rem;
  pointer-events: none;
}

/* Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0 2.5rem 0;
}

.tool-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
  background-color: var(--bg-card-hover);
}

/* 48x48 Modern Rounded SVG Icon Tile */
.tool-icon-tile {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.1rem;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.tool-icon-tile svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

.tool-card:hover .tool-icon-tile {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.tool-icon-tile[data-cat="date-time"] {
  background: var(--cat-date-bg);
  color: var(--cat-date-color);
}

.tool-icon-tile[data-cat="math"] {
  background: var(--cat-math-bg);
  color: var(--cat-math-color);
}

.tool-icon-tile[data-cat="text"] {
  background: var(--cat-text-bg);
  color: var(--cat-text-color);
}

.tool-icon-tile[data-cat="security"] {
  background: var(--cat-security-bg);
  color: var(--cat-security-color);
}

.tool-icon-tile[data-cat="fun"] {
  background: var(--cat-fun-bg);
  color: var(--cat-fun-color);
}

.tool-card h2, .tool-card h3 {
  font-size: 1.2rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.tool-card p {
  font-size: 0.925rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.tool-card-action {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.tool-card-action svg {
  width: 1rem;
  height: 1rem;
  transition: transform 0.2s ease;
}

.tool-card:hover .tool-card-action svg {
  transform: translateX(4px);
}

/* Why ToolsBuilt Section */
.why-section {
  background-color: var(--bg-muted);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  margin: 2rem 0 4rem 0;
  border: 1px solid var(--border-color);
}

.why-section h2 {
  text-align: center;
  margin-top: 0;
  margin-bottom: 2rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
}

.feature-item {
  text-align: center;
}

.feature-icon {
  width: 3.25rem;
  height: 3.25rem;
  background-color: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.feature-icon svg {
  width: 1.6rem;
  height: 1.6rem;
  stroke: currentColor;
}

.feature-item h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.feature-item p {
  font-size: 0.925rem;
  margin-bottom: 0;
}

/* Calculator & Tool Interface */
.tool-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin: 1.5rem 0 2.5rem 0;
}

@media (min-width: 640px) {
  .tool-container {
    padding: 2.5rem;
  }
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .form-grid.two-col {
    grid-template-columns: 1fr 1fr;
  }
}

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

.form-group label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-main);
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
  outline: none;
}

.button-group {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-text);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

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

.btn-secondary {
  background-color: var(--bg-muted);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--border-color);
}

.btn-secondary:active {
  transform: translateY(1px);
}

/* Tool Result Box */
.result-box {
  display: none;
  margin-top: 2rem;
  padding: 2rem;
  background-color: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  border-left: 5px solid var(--primary);
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-box.is-visible {
  display: block;
}

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

.result-header {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.result-primary {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 1.25rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.result-stat-card {
  background-color: var(--bg-card);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.result-stat-label {
  font-size: 0.825rem;
  color: var(--text-subtle);
  margin-bottom: 0.25rem;
}

.result-stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Steps List */
.steps-list {
  list-style-type: none;
  counter-reset: step-counter;
  margin: 1.5rem 0 2.5rem 0;
}

.steps-list li {
  counter-increment: step-counter;
  position: relative;
  padding-left: 3.25rem;
  margin-bottom: 1.25rem;
}

.steps-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.25rem;
  height: 2.25rem;
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.steps-list h4 {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.steps-list p {
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* Content Article Formatting */
.content-article {
  margin: 3rem 0;
  line-height: 1.75;
}

.content-article h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.content-article h3 {
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
}

.content-article p {
  margin-bottom: 1.25rem;
  font-size: 1.025rem;
}

.content-article ul, .content-article ol {
  margin: 1rem 0 1.5rem 1.5rem;
  color: var(--text-muted);
}

.content-article li {
  margin-bottom: 0.5rem;
}

.info-callout {
  background-color: var(--bg-muted);
  border-left: 4px solid var(--primary);
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 1.5rem 0;
}

.info-callout p {
  margin-bottom: 0;
  font-size: 0.975rem;
}

/* FAQ Accordion Component */
.faq-section {
  margin: 3rem 0;
}

.accordion-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.accordion-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.accordion-header {
  width: 100%;
  padding: 1.25rem 1.5rem;
  background: transparent;
  border: none;
  text-align: left;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

.accordion-header:hover {
  color: var(--primary);
  background-color: var(--bg-muted);
}

.accordion-icon {
  width: 1.25rem;
  height: 1.25rem;
  transition: transform 0.3s ease;
  flex-shrink: 0;
  color: var(--text-subtle);
}

.accordion-header[aria-expanded="true"] .accordion-icon {
  transform: rotate(180deg);
  color: var(--primary);
}

.accordion-content {
  padding: 0 1.5rem 1.25rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.975rem;
  line-height: 1.6;
}

.accordion-content[hidden] {
  display: none;
}

/* Reserved Ad Containers (Prevents Layout Shift) */
.ad-placement {
  margin: 2rem 0;
  text-align: center;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Page Standard Layout (About, Contact, Terms, Privacy) */
.page-container {
  max-width: 850px;
  margin: 2rem auto 4rem auto;
}

.page-header {
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
}

.page-header h1 {
  margin-bottom: 0.5rem;
}

/* Footer */
.site-footer {
  margin-top: auto;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 3rem 0 2rem 0;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

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

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

.footer-brand h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.footer-brand p {
  font-size: 0.9rem;
  max-width: 380px;
}

.footer-col h4 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-main);
  margin-bottom: 1rem;
}

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

.footer-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--primary);
}

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

/* Utility Classes */
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-12 { margin-top: 3rem; }
.mb-4 { margin-bottom: 1rem; }
.my-8 { margin-top: 2rem; margin-bottom: 2rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.text-sm { font-size: 0.875rem; }
.text-muted { color: var(--text-muted); }
.hidden { display: none !important; }

/* ==========================================
   Tool Page Layout Components
   ========================================== */

/* Tool page article wrapper */
.tool-page { max-width: 860px; margin: 0 auto; }

.tool-header { margin-bottom: 2rem; }

.tool-title-row {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}

.tool-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* Tool icon wrapper (large tile used in tool pages) */
.tool-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tool-icon-wrapper svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
}

.tool-icon-wrapper.date-time {
  background: var(--cat-date-bg);
  color: var(--cat-date-color);
}

.tool-icon-wrapper.math {
  background: var(--cat-math-bg);
  color: var(--cat-math-color);
}

.tool-icon-wrapper.text {
  background: var(--cat-text-bg);
  color: var(--cat-text-color);
}

.tool-icon-wrapper.security {
  background: var(--cat-security-bg);
  color: var(--cat-security-color);
}

.tool-icon-wrapper.fun {
  background: var(--cat-fun-bg);
  color: var(--cat-fun-color);
}

/* Tool card (always visible, used on inner tool pages) */
.tool-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

/* Tool card small (for related tools) */
.tool-card-link { text-decoration: none; color: inherit; }
.tool-card-sm {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.tool-card-sm:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

.tool-card-sm h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.tool-card-sm p {
  font-size: 0.875rem;
  margin-bottom: 0;
}

/* Tool form grid */
.tool-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .tool-form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Form components for tool pages */
.form-input {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-main);
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
  outline: none;
}

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

.form-group label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-with-button {
  display: flex;
  gap: 0.5rem;
}

.input-with-button .form-input { flex: 1; }

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
}

.checkbox-label input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary);
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.code-input {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.925rem;
  resize: vertical;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover { background-color: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background-color: var(--bg-muted);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover { background-color: var(--border-color); }

.btn-outline {
  background-color: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background-color: var(--primary-light);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.875rem;
}

.btn-block { width: 100%; }

.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Result box (always visible version for tool pages) */
.result-box {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

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

.result-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
}

.primary-result {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.result-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.res-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.res-label {
  font-size: 0.775rem;
  color: var(--text-subtle);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.res-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Quick Answer Box */
.quick-answer-box {
  background: linear-gradient(135deg, var(--primary-light) 0%, rgba(99, 102, 241, 0.08) 100%);
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1.5rem 2rem;
  margin: 2rem 0;
}

.quick-answer-box h2 {
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
  margin-top: 0;
  color: var(--primary);
}

.quick-answer-box p { margin-bottom: 0; }

/* Key Facts Box */
.key-facts-box {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem 2rem;
  margin: 1.5rem 0;
}

.key-facts-box h3 { margin-top: 0; margin-bottom: 0.75rem; }
.key-facts-box ul { margin-left: 1.25rem; color: var(--text-muted); }
.key-facts-box li { margin-bottom: 0.5rem; }

/* Article content section */
.article-content {
  margin-top: 2rem;
  line-height: 1.75;
}

.article-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.article-content h3 { margin-top: 1.5rem; }

.article-content p { margin-bottom: 1.2rem; }

.article-content ul, .article-content ol {
  margin: 1rem 0 1.5rem 1.5rem;
  color: var(--text-muted);
}

.article-content li { margin-bottom: 0.5rem; }

.article-content code {
  background: var(--bg-muted);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

/* FAQ Accordion (details/summary pattern) */
.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-question {
  padding: 1.1rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-question::-webkit-details-marker { display: none; }

.faq-question::after {
  content: '+';
  font-size: 1.4rem;
  color: var(--primary);
  font-weight: 400;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 1rem;
}

details[open] .faq-question::after { content: '−'; }

.faq-question:hover { color: var(--primary); background: var(--bg-muted); }

.faq-answer {
  padding: 0 1.5rem 1.1rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.975rem;
  line-height: 1.65;
}

.faq-answer p { margin-bottom: 0; }

/* Last updated line */
.last-updated {
  font-size: 0.825rem;
  color: var(--text-subtle);
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* Wheel layout */
.wheel-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 680px) {
  .wheel-layout {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.wheel-controls-col { display: flex; flex-direction: column; gap: 1.25rem; }

.wheel-canvas-col {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.canvas-wrapper {
  position: relative;
  display: inline-block;
}

#wheelCanvas {
  display: block;
  max-width: 100%;
  border-radius: var(--radius-lg);
}

/* Winner Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.25s ease;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  padding: 3rem 2.5rem;
  max-width: 440px;
  width: 100%;
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-title {
  font-size: 1.4rem;
  margin-bottom: 1.25rem;
  color: var(--primary);
}

.winner-display-name {
  font-size: clamp(1.6rem, 5vw, 2.5rem);
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  word-break: break-word;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Cookie consent banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
}

/* Breadcrumb (simple text style for tool pages) */
.breadcrumb {
  padding: 0.75rem 0 1.25rem;
  font-size: 0.875rem;
  color: var(--text-subtle);
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--text-main); font-weight: 500; }

