/* ================================================================
   GOOJ v2 — Editorial Industrial Design System
   Design: OKLCH palette / Outfit typography / 4pt spatial rhythm
   ================================================================ */

/* ===== Font Import ===== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ================================================================
   1. DESIGN TOKENS
   ================================================================ */

:root {
  /* Typography — Fluid Modular Scale (Perfect Fourth 1.333) */
  --font-display: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-body: 'Outfit', system-ui, -apple-system, sans-serif;

  --text-xs: clamp(0.7rem, 1.5vw, 0.75rem);
  --text-sm: clamp(0.8125rem, 1.6vw, 0.875rem);
  --text-base: clamp(0.9375rem, 1.8vw, 1rem);
  --text-md: clamp(1.0625rem, 2vw, 1.125rem);
  --text-lg: clamp(1.375rem, 2.6vw, 1.5rem);
  --text-xl: clamp(1.75rem, 3.5vw, 2rem);
  --text-2xl: clamp(2.25rem, 4.5vw, 2.625rem);
  --text-3xl: clamp(2.75rem, 6vw, 3.5rem);
  --text-4xl: clamp(3.5rem, 8vw, 4.625rem);

  /* Spacing — 4pt Base System */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;
  --space-5xl: 8rem;

  /* Layout */
  --max-width: 1600px;
  --header-height: 68px;
  --content-padding: clamp(1rem, 4vw, 3rem);

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  /* Motion Tokens */
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 120ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
  --duration-entrance: 600ms;

  /* ===== DARK MODE (Default) ===== */
  --bg-base: oklch(11% 0.012 260);
  --bg-surface: oklch(15% 0.010 260);
  --bg-elevated: oklch(19% 0.008 260);
  --bg-overlay: oklch(22% 0.006 260);

  --border-subtle: oklch(25% 0.008 260);
  --border-default: oklch(32% 0.010 260);
  --border-strong: oklch(40% 0.012 260);

  --text-primary: oklch(94% 0.004 90);
  --text-secondary: oklch(68% 0.012 255);
  --text-tertiary: oklch(48% 0.010 255);
  --text-inverse: oklch(12% 0.010 260);

  --accent-primary: oklch(62% 0.22 265);
  --accent-primary-hover: oklch(68% 0.20 265);
  --accent-primary-subtle: oklch(62% 0.22 265 / 0.12);
  --accent-warm: oklch(68% 0.17 30);
  --accent-warm-hover: oklch(73% 0.16 30);

  --brand-gradient: linear-gradient(135deg, oklch(62% 0.22 265), oklch(68% 0.17 30));
  --brand-gradient-subtle: linear-gradient(135deg, oklch(62% 0.22 265 / 0.08), oklch(68% 0.17 30 / 0.08));

  /* Semantic */
  --success: oklch(64% 0.16 145);
  --warning: oklch(72% 0.16 85);
  --error: oklch(58% 0.20 25);

  /* Shadows (dark mode — subtle depth) */
  --shadow-sm: 0 1px 2px oklch(0% 0 0 / 0.25);
  --shadow-md: 0 4px 12px oklch(0% 0 0 / 0.35);
  --shadow-lg: 0 8px 32px oklch(0% 0 0 / 0.45);
  --shadow-glow: 0 0 40px oklch(62% 0.22 265 / 0.15);
}

/* ===== LIGHT MODE ===== */
body.light-theme {
  --bg-base: oklch(97.5% 0.005 90);
  --bg-surface: oklch(100% 0 0);
  --bg-elevated: oklch(99% 0.003 90);
  --bg-overlay: oklch(96% 0.005 90);

  --border-subtle: oklch(90% 0.008 260);
  --border-default: oklch(85% 0.010 260);
  --border-strong: oklch(75% 0.012 260);

  --text-primary: oklch(18% 0.010 260);
  --text-secondary: oklch(42% 0.015 260);
  --text-tertiary: oklch(55% 0.012 260);
  --text-inverse: oklch(96% 0.004 90);

  --accent-primary: oklch(48% 0.22 265);
  --accent-primary-hover: oklch(42% 0.20 265);
  --accent-primary-subtle: oklch(48% 0.22 265 / 0.08);

  --brand-gradient: linear-gradient(135deg, oklch(48% 0.22 265), oklch(55% 0.18 35));
  --brand-gradient-subtle: linear-gradient(135deg, oklch(48% 0.22 265 / 0.06), oklch(55% 0.18 35 / 0.06));

  --shadow-sm: 0 1px 3px oklch(0% 0 0 / 0.06);
  --shadow-md: 0 4px 16px oklch(0% 0 0 / 0.08);
  --shadow-lg: 0 12px 40px oklch(0% 0 0 / 0.10);
  --shadow-glow: 0 0 50px oklch(48% 0.22 265 / 0.12);
}

/* ================================================================
   2. GLOBAL RESET & BASE
   ================================================================ */

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.65;
  color: var(--text-primary);
  background-color: var(--bg-base);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--duration-slow) var(--ease-out-quart),
              color var(--duration-slow) var(--ease-out-quart);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out-quart);
}

ul, ol { list-style: none; }

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
}

::selection {
  background: oklch(48% 0.22 265 / 0.25);
  color: var(--text-primary);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ================================================================
   3. GRID BACKGROUND (subtle dot pattern)
   ================================================================ */

.grid-bg {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, var(--border-subtle) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: -1;
  opacity: 0.6;
}

body.light-theme .grid-bg {
  opacity: 0.5;
}

/* ================================================================
   4. HEADER
   ================================================================ */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 1000;
  transition: background-color var(--duration-normal) var(--ease-out-quart),
              backdrop-filter var(--duration-normal) var(--ease-out-quart),
              box-shadow var(--duration-normal) var(--ease-out-quart);
}

.header.scrolled {
  background-color: oklch(11% 0.012 260 / 0.82);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  box-shadow: 0 1px 0 var(--border-subtle);
}

body.light-theme .header.scrolled {
  background-color: oklch(97.5% 0.005 90 / 0.82);
  box-shadow: 0 1px 0 var(--border-default);
}

.header-container {
  max-width: var(--max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--content-padding);
  display: flex;
  align-items: center;
  gap: var(--space-2xl);
}

/* Logo */
.logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}

/* Navigation */
.nav {
  display: flex;
  gap: var(--space-xs);
  flex: 1;
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--duration-fast) var(--ease-out-quart);
  letter-spacing: 0.01em;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--accent-primary-subtle);
}

.nav-link.active {
  color: var(--accent-primary);
  background: var(--accent-primary-subtle);
  font-weight: 600;
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* Search */
.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  transition: all var(--duration-fast) var(--ease-out-quart);
}

.search-box:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-subtle);
}

.header-search-input {
  width: 180px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: var(--text-sm);
  outline: none;
}

.header-search-input::placeholder {
  color: var(--text-tertiary);
}

.header-search-btn {
  padding: 8px 12px 8px 4px;
  color: var(--text-tertiary);
  transition: color var(--duration-fast);
}

.header-search-btn:hover { color: var(--accent-primary); }

/* Header Login Button */
.header-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid var(--border-default);
  transition: all var(--duration-fast) var(--ease-out-quart);
}

.header-login-btn:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background: var(--accent-primary-subtle);
}

/* User Menu */
.user-menu-wrap { position: relative; }

.user-avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 2px solid var(--border-default);
  transition: border-color var(--duration-fast);
}

.user-avatar-btn:hover { border-color: var(--accent-primary); }

.avatar-circle {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-gradient);
  color: white;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--duration-fast) var(--ease-out-expo);
  z-index: 1001;
}

.user-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--duration-fast);
}

.user-dropdown-item:hover {
  background: var(--accent-primary-subtle);
  color: var(--text-primary);
}

.user-dropdown-item.sign-out:hover {
  background: oklch(58% 0.20 25 / 0.1);
  color: var(--error);
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-xs) 0;
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  color: var(--text-tertiary);
  transition: all var(--duration-fast) var(--ease-out-quart);
}

.theme-toggle:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-primary-subtle);
}

.icon-moon, .icon-sun { width: 16px; height: 16px; }
body.light-theme .icon-moon { display: none; }
body:not(.light-theme) .icon-sun { display: none; }
body.light-theme .icon-sun { display: block; }

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border-radius: var(--radius-md);
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: all var(--duration-normal) var(--ease-out-quart);
}

/* Mobile Nav */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: oklch(11% 0.012 260 / 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-md);
  z-index: 999;
  transform: translateY(-100%);
  transition: transform var(--duration-normal) var(--ease-out-expo);
}

.mobile-nav.active {
  display: block;
  transform: translateY(0);
}

body.light-theme .mobile-nav {
  background: oklch(97.5% 0.005 90 / 0.9);
}

.mobile-nav .nav-link {
  display: block;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
}

/* ================================================================
   5. HERO SECTION
   ================================================================ */

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--header-height) + var(--space-4xl)) var(--content-padding) var(--space-4xl);
  overflow: hidden;
}

/* Hero ambient glow */
.hero::before {
  content: '';
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background: radial-gradient(ellipse at center, oklch(62% 0.22 265 / 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -10%;
  right: -10%;
  width: 500px;
  height: 400px;
  background: radial-gradient(ellipse at center, oklch(68% 0.17 30 / 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  width: 100%;
  text-align: center;
  padding: 0;
  animation: heroReveal var(--duration-entrance) var(--ease-out-expo);
}

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

/* Hero Label */
.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background: var(--accent-primary-subtle);
  border: 1px solid oklch(62% 0.22 265 / 0.18);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: var(--space-xl);
}

.hero-label::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* Hero Title */
.hero-title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
}

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

/* Hero Subtitle */
.hero-subtitle {
  font-size: var(--text-md);
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 580px;
  margin: 0 auto var(--space-2xl);
  font-weight: 400;
}

/* ================================================================
   6. AI INPUT SECTION
   ================================================================ */

.ai-input-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  background: var(--bg-elevated);
  border: none;
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  text-align: left;
  transition: all var(--duration-normal) var(--ease-out-quart);
  box-shadow: var(--shadow-md);
}

.ai-input-wrapper:focus-within {
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.ai-requirement-input {
  width: 100%;
  min-height: 80px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: 1.7;
  resize: none;
  outline: none;
  padding: var(--space-sm) var(--space-md);
}
.ai-requirement-input:focus {
  border-color: var(--accent-primary);
}

.ai-requirement-input::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
}

.ai-input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: none;
}

.ai-char-count {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.ai-analyze-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: linear-gradient(135deg, oklch(55% 0.28 265), oklch(62% 0.25 280));
  color: #ffffff;
  font-size: var(--text-sm);
  font-weight: 700;
  border-radius: var(--radius-full);
  border: none;
  transition: all var(--duration-fast) var(--ease-out-quart);
  box-shadow:
    0 4px 24px oklch(55% 0.28 265 / 0.45),
    0 1px 4px oklch(0% 0 0 / 0.2);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px oklch(0% 0 0 / 0.2);
  cursor: pointer;
}

.ai-analyze-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 32px oklch(55% 0.28 265 / 0.55),
    0 2px 8px oklch(0% 0 0 / 0.3);
}

.ai-analyze-btn:active {
  transform: translateY(0);
  box-shadow:
    0 2px 12px oklch(55% 0.28 265 / 0.4),
    0 1px 3px oklch(0% 0 0 / 0.2);
}

/* Light mode: solid deep indigo with strong contrast */
body.light-theme .ai-analyze-btn {
  background: linear-gradient(135deg, oklch(42% 0.24 265), oklch(50% 0.22 280));
  color: #ffffff;
  box-shadow:
    0 4px 20px oklch(42% 0.24 265 / 0.35),
    0 1px 3px oklch(0% 0 0 / 0.12);
  font-weight: 700;
  text-shadow: 0 1px 2px oklch(0% 0 0 / 0.15);
}

body.light-theme .ai-analyze-btn:hover {
  box-shadow:
    0 8px 28px oklch(42% 0.24 265 / 0.45),
    0 2px 6px oklch(0% 0 0 / 0.18);
}

/* AI Examples */
.ai-examples {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.ai-examples span {
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-quart);
  font-weight: 500;
  white-space: nowrap;
  animation: exampleFadeIn 0.35s var(--ease-out-quart) backwards;
}

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

.ai-example-skeleton {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: 500;
  background: var(--bg-surface);
  animation: skeletonPulse 1.8s ease-in-out infinite;
}

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

.ai-examples span:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-primary-subtle);
}

/* ================================================================
   7. FEATURED TOOLS SECTION
   ================================================================ */

.section {
  padding: var(--space-5xl) var(--content-padding);
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  overflow: hidden;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--content-padding);
}

/* Section Header — Editorial Style */
.section-header {
  text-align: left;
  margin-bottom: var(--space-3xl);
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: var(--space-md);
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  width: 48px;
  background: var(--accent-primary);
  opacity: 0.4;
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.section-subtitle {
  font-size: var(--text-md);
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.6;
}

/* Tool Grid — 3 Columns */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-lg);
}

/* Tool Card */
.tool-card {
  position: relative;
  background: var(--bg-surface);
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out-quart);
  opacity: 0;
  transform: translateY(24px);
}

.tool-card.revealed {
  animation: cardReveal 0.5s var(--ease-out-quart) forwards;
}

@keyframes cardReveal {
  to { opacity: 1; transform: translateY(0); }
}

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

/* Tool Card Top */
.tool-card-top {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--brand-gradient-subtle);
}

.tool-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--accent-primary);
  stroke-width: 2;
  fill: none;
}

.tool-icon img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: contain;
}

.tool-card-header {
  flex: 1;
  min-width: 0;
}

.tool-name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: var(--space-xs);
}

.tool-tags-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tool-tag {
  padding: 2px 10px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.tool-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.tool-btn-sm {
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
  transition: all var(--duration-fast);
}

.tool-btn-detail {
  color: var(--text-tertiary);
  border: 1px solid var(--border-subtle);
  background: transparent;
}

.tool-btn-detail:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background: var(--accent-primary-subtle);
}

.tool-btn-icon {
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tool-btn-icon:hover {
  background: var(--accent-primary);
  color: white;
}

.tool-btn-icon svg {
  width: 12px;
  height: 12px;
}

/* Tool Description */
.tool-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* View All */
.section-footer {
  text-align: center;
  margin-top: var(--space-2xl);
}

.view-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--duration-fast) var(--ease-out-quart);
}

.view-all-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-primary-subtle);
  transform: translateY(-1px);
}

/* ================================================================
   8. CATEGORY SECTION
   ================================================================ */

.category-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-md);
}

.category-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out-quart);
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out-quart);
  z-index: 0;
}

.category-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.category-card:hover::before {
  opacity: 0.04;
}

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

.category-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--brand-gradient-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
}

.category-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--accent-primary);
  stroke-width: 2;
  fill: none;
}

.category-name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.category-count {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* ================================================================
   9. AI LOADING & RESULT
   ================================================================ */

/* ---- Legacy variable bridges for ai-analysis.css ---- */
:root {
  --accent-cyan: var(--accent-primary);
  --accent-purple: var(--accent-warm);
}
body.light-theme {
  --accent-cyan: var(--accent-primary);
  --accent-purple: var(--accent-warm);
}

.ai-loading {
  width: 100%;
  max-width: 1280px;
  margin: var(--space-md) auto var(--space-2xl);
  padding: 0 var(--content-padding);
  text-align: left;
}

#ai-loading {
  margin-top: 50px;
}

.ai-loading .loader-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
  margin: 0 auto var(--space-lg);
  animation: pulseDot 1.5s ease-in-out infinite;
}

/* Status Card — override ai-analysis.css with v2 tokens */
.ai-status-card {
  background: var(--bg-surface) !important;
  border: none !important;
  border-radius: var(--radius-xl) !important;
  padding: var(--space-xl) !important;
  box-shadow: var(--shadow-md);
}

.ai-status-header {
  gap: var(--space-md) !important;
  margin-bottom: var(--space-md) !important;
}

.ai-status-title {
  font-family: var(--font-display) !important;
}

.ai-loading-spinner {
  border-color: var(--border-default) !important;
  border-top-color: var(--accent-primary) !important;
}

.ai-status-subtitle {
  color: var(--text-tertiary) !important;
  margin-bottom: var(--space-md) !important;
}

.ai-status-body {
  gap: 8px !important;
}

.ai-status-row {
  color: var(--text-secondary) !important;
  font-family: var(--font-body) !important;
}

/* Status dots — step indicators */
.ai-status-dot.pending {
  background: var(--border-default) !important;
}
.ai-status-dot.active {
  background: var(--accent-primary) !important;
  box-shadow: 0 0 10px oklch(62% 0.22 265 / 0.5) !important;
}
.ai-status-dot.done {
  background: var(--success) !important;
}

/* Progress bar */
.ai-loading-progress {
  background: var(--border-subtle) !important;
  border-radius: var(--radius-full) !important;
  height: 4px !important;
  margin: var(--space-md) 0 !important;
}
.ai-loading-progress-fill {
  background: var(--brand-gradient) !important;
  border-radius: var(--radius-full) !important;
}

/* Footer area — elapsed time + check button */
.ai-status-footer {
  margin-top: var(--space-md) !important;
  padding-top: var(--space-md);
  border-top: none;
}

.ai-status-warning {
  font-size: 12px !important;
  color: var(--text-tertiary) !important;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-status-warning svg {
  stroke: var(--accent-warm);
}

.ai-status-elapsed {
  font-size: 12px !important;
  color: var(--text-tertiary) !important;
}

/* ============================================================
   ACTION BUTTONS — only style for loading card context
   ============================================================ */

/* Reset the action btn to original ai-analysis.css values, just improve visual */
.ai-action-btn {
  font-family: var(--font-body) !important;
}

.ai-action-btn.primary {
  background: var(--brand-gradient) !important;
  color: #ffffff !important;
}

.ai-action-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px oklch(55% 0.28 265 / 0.35);
}

.ai-action-btn.secondary {
  background: var(--bg-surface) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border-default) !important;
}

.ai-action-btn.secondary:hover {
  border-color: var(--accent-primary) !important;
  color: var(--accent-primary) !important;
}

/* ============================================================
   REPORT — bridge tokens for ai-analysis.css result styles
   ============================================================ */

/* Card backgrounds & border removal */
:root {
  --bg-card: var(--bg-surface);
  --bg-secondary: var(--bg-elevated);
  --border-color: var(--border-default);
  --font-family: var(--font-body);
  --report-card-hover: var(--bg-overlay);
}
body.light-theme {
  --bg-card: var(--bg-surface);
  --bg-secondary: var(--bg-elevated);
  --border-color: var(--border-default);
  --font-family: var(--font-body);
  --report-card-hover: var(--bg-overlay);
}

/* Remove gray borders from report content cards */
.ai-metric-card,
.ai-section,
.ai-col-card,
.ai-stack-item,
.ai-phase-card,
.ai-sol-card,
.ai-preview-card,
.ai-summary-card {
  border: none !important;
}

/* Keep bottom borders for headers/dividers */
.ai-phase-card-header {
  border-bottom: 1px solid var(--border-subtle) !important;
}
.ai-sol-card .ai-sol-desc {
  border-top: 1px solid var(--border-subtle) !important;
}
.ai-section .ai-section-divider {
  border-color: var(--border-subtle) !important;
}

.ai-result {
  max-width: var(--max-width);
  margin: 50px auto var(--space-2xl);
  padding: 0 var(--content-padding);
}

.ai-result:not(:empty) {
  margin-top: 50px;
  margin-bottom: var(--space-4xl);
}

/* Report-tweaks */
.ai-result-hero { padding: 0 !important; }
.ai-result-stats { border: none !important; margin-top: 40px; }
.ai-stat { border: none !important; }

/* ================================================================
   10. FOOTER
   ================================================================ */

.footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: var(--space-3xl) var(--content-padding) var(--space-xl);
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
}

.footer-brand {
  text-align: center;
}

.footer-brand .logo {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

.footer-tagline {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.footer-links {
  display: flex;
  gap: var(--space-xl);
  flex-wrap: wrap;
  justify-content: center;
}

.footer-link {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
  transition: color var(--duration-fast);
}

.footer-link:hover {
  color: var(--accent-primary);
}

.footer-bottom {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
  justify-content: center;
}

.footer-copy {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* ================================================================
   11. UTILITIES
   ================================================================ */

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

.page {
  animation: pageIn 0.5s var(--ease-out-quart);
}

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

/* ================================================================
   12. REDUCED MOTION
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .tool-card { opacity: 1; transform: none; }
}

/* ================================================================
   13. RESPONSIVE
   ================================================================ */

/* Tablet — 1024px */
@media (max-width: 1024px) {
  :root {
    --header-height: 60px;
  }

  .nav { display: none; }
  .menu-toggle { display: flex; }

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

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

/* Mobile — 768px */
@media (max-width: 768px) {
  .search-box { display: none; }

  .hero {
    min-height: 85vh;
    padding: calc(var(--header-height) + var(--space-2xl)) var(--content-padding) var(--space-2xl);
  }

  .tool-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .section {
    padding: var(--space-4xl) var(--content-padding);
  }

  .section-title {
    font-size: var(--text-2xl);
  }

  .ai-examples {
    gap: 6px;
  }

  .ai-examples span {
    padding: 5px 10px;
    font-size: 11px;
  }

  .footer-links {
    gap: var(--space-md);
  }
}

/* Small Mobile — 480px */
@media (max-width: 480px) {
  .category-grid {
    grid-template-columns: 1fr 1fr;
  }

  .tool-card {
    padding: var(--space-md);
  }

  .hero-title {
    font-size: clamp(2rem, 10vw, 2.5rem);
  }
}

/* ===== Blog Grid & Card ===== */
.blog-hero {
  padding: 120px 0 48px;
}
.blog-hero .section-title {
  text-align: left;
  margin-bottom: 12px;
}
.blog-hero .section-subtitle {
  text-align: left;
}

/* Blog Layout */
.blog-layout {
  display: flex;
  gap: 48px;
  align-items: flex-start;
}
.blog-main {
  flex: 1;
  min-width: 0;
}
.blog-sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 96px;
}

/* Blog Grid - 4 columns */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* Blog Card */
.blog-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}
.blog-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
}
.blog-card-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}
.blog-card-body {
  padding: 16px;
}
.blog-card-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px;
  line-height: 1.4;
}
.blog-card-title a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}
.blog-card-title a:hover {
  color: var(--accent-cyan);
}
.blog-card-excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.blog-card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.blog-card-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.blog-card-tag:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}
.blog-read-more {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-cyan);
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}
.blog-read-more:hover {
  opacity: 0.8;
}

/* Blog Empty State */
.blog-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-secondary);
  padding: 64px 0;
  font-size: 16px;
}

/* Blog Pagination */
.blog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
  flex-wrap: wrap;
}
.blog-page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
}
.blog-page-link:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}
.blog-page-link.active {
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Blog Sidebar */
.blog-sidebar-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}
.blog-sidebar-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}
.blog-recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.blog-recent-list li {
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.4;
}
.blog-recent-list li:last-child {
  margin-bottom: 0;
}
.blog-recent-list a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}
.blog-recent-list a:hover {
  color: var(--accent-cyan);
}
.blog-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ===== Blog Article Detail ===== */
.blog-article {
  flex: 1;
  min-width: 0;
}
.blog-breadcrumb {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.blog-breadcrumb a {
  color: var(--accent-cyan);
  text-decoration: none;
}
.blog-breadcrumb a:hover {
  text-decoration: underline;
}
.blog-article-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 16px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.blog-article-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.blog-tag {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--accent-cyan);
  border-radius: 20px;
  color: var(--accent-cyan);
  font-size: 12px;
  text-decoration: none;
  transition: all 0.2s ease;
}
.blog-tag:hover {
  background: rgba(0, 212, 255, 0.1);
}
.blog-featured-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 32px;
  border: 1px solid var(--border-color);
}
.blog-article-content {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-primary);
}
.blog-article-content h1,
.blog-article-content h2,
.blog-article-content h3,
.blog-article-content h4 {
  margin-top: 32px;
  margin-bottom: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.blog-article-content h2 { font-size: 24px; }
.blog-article-content h3 { font-size: 20px; }
.blog-article-content p { margin-bottom: 16px; }
.blog-article-content a {
  color: var(--accent-cyan);
  text-decoration: none;
}
.blog-article-content a:hover {
  text-decoration: underline;
}
.blog-article-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 16px 0;
}
.blog-article-content pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.5;
}
.blog-article-content code {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: 14px;
}
.blog-article-content :not(pre) > code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  border: 1px solid var(--border-color);
}
.blog-article-content blockquote {
  border-left: 3px solid var(--accent-cyan);
  padding: 12px 20px;
  margin: 16px 0;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 0 8px 8px 0;
}
.blog-article-content ul, .blog-article-content ol {
  padding-left: 24px;
  margin: 16px 0;
}
.blog-article-content li {
  margin-bottom: 8px;
}
.blog-article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}
.blog-article-content th, .blog-article-content td {
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  text-align: left;
  font-size: 14px;
}
.blog-article-content th {
  background: var(--bg-secondary);
  font-weight: 600;
}
.blog-article-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 32px 0;
}

/* Article Nav (Prev/Next) */
.blog-article-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}
.blog-prev, .blog-next {
  max-width: 45%;
  color: var(--accent-cyan);
  text-decoration: none;
