/* ═══════════════════════════════════════════════════
   QUICKR DESIGN SYSTEM — Shared Foundation
   ═══════════════════════════════════════════════════ */

:root {
  --bg-primary: #FAF8F5;
  --bg-secondary: #F3EFE9;
  --bg-tertiary: #EDE8E0;
  --bg-card: #FFFFFF;
  --text-primary: #1A1714;
  --text-secondary: #5C554A;
  --text-tertiary: #8A8279;
  --text-muted: #7A7368;
  --accent: #C4632A;
  --accent-light: #F5E6DC;
  --accent-hover: #A8521F;
  --border: #E8E3DB;
  --border-light: #F0ECE5;
  --green: #2D7A4F;
  --green-light: #E5F2EB;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(26,23,20,0.04);
  --shadow-md: 0 2px 8px rgba(26,23,20,0.06), 0 1px 2px rgba(26,23,20,0.04);
  --shadow-lg: 0 4px 16px rgba(26,23,20,0.08), 0 2px 4px rgba(26,23,20,0.04);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ═══ Dark Mode ═══ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #1A1714;
    --bg-secondary: #252220;
    --bg-tertiary: #302C28;
    --bg-card: #2A2623;
    --text-primary: #FAF8F5;
    --text-secondary: #B8B0A6;
    --text-tertiary: #8A8279;
    --text-muted: #8A8279;
    --accent: #E07A3A;
    --accent-light: #3D2A1E;
    --accent-hover: #F09050;
    --border: #3A3530;
    --border-light: #302C28;
    --green: #4ABA72;
    --green-light: #1E3328;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.2);
  }
}
[data-theme="dark"] {
  --bg-primary: #1A1714;
  --bg-secondary: #252220;
  --bg-tertiary: #302C28;
  --bg-card: #2A2623;
  --text-primary: #FAF8F5;
  --text-secondary: #B8B0A6;
  --text-tertiary: #8A8279;
  --text-muted: #8A8279;
  --accent: #E07A3A;
  --accent-light: #3D2A1E;
  --accent-hover: #F09050;
  --border: #3A3530;
  --border-light: #302C28;
  --green: #4ABA72;
  --green-light: #1E3328;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.2);
}

/* ═══ Reset ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ═══ Skip Link (Accessibility) ═══ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 200;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.skip-link:focus {
  top: 8px;
}

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

/* ═══ Nav ═══ */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 248, 245, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) nav {
    background: rgba(26, 23, 20, 0.85);
  }
}
[data-theme="dark"] nav {
  background: rgba(26, 23, 20, 0.85);
}
.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}
.brand svg { flex-shrink: 0; }
.brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s var(--ease);
}
.nav-links a:hover { color: var(--text-primary); }

/* ═══ Theme Toggle ═══ */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { width: 18px; height: 18px; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .icon-moon { display: block; }
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="dark"]):not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
}

/* ═══ Hamburger Menu ═══ */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-primary);
}
.hamburger svg { width: 24px; height: 24px; }
.mobile-menu {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 8px 24px 16px;
  z-index: 99;
  box-shadow: var(--shadow-lg);
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}
.mobile-menu.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.mobile-menu a {
  display: block;
  padding: 12px 0;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
  border-bottom: 1px solid var(--border-light);
}
.mobile-menu a:hover { color: var(--accent); }
.mobile-menu-divider {
  height: 1px;
  background: var(--border-light);
  margin: 8px 0;
}
.mobile-menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.mobile-menu-row:last-child { border-bottom: none; }
.mobile-menu-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
}
.mobile-menu-search:hover { color: var(--accent); }
.mobile-menu-search svg { width: 18px; height: 18px; flex-shrink: 0; }
.mobile-theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s var(--ease);
}
.mobile-theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ═══ Breadcrumb ═══ */
.breadcrumb {
  padding: 12px 0;
  font-size: 0.82rem;
  color: var(--text-tertiary);
}
.breadcrumb a {
  color: var(--text-tertiary);
  transition: color 0.2s var(--ease);
}
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 8px; opacity: 0.5; }

/* ═══ Footer ═══ */
footer {
  border-top: 1px solid var(--border-light);
  padding: 32px 0;
}
.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-left { font-size: 0.8rem; color: var(--text-muted); }
.footer-left strong {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 400;
}
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: var(--text-muted); font-size: 0.8rem; transition: color 0.2s var(--ease); }
.footer-links a:hover { color: var(--text-secondary); }

/* ═══ Tool Page: Hero ═══ */
.tool-hero { padding: 48px 0 32px; }
.tool-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 400;
  margin-bottom: 10px;
}
.tool-hero p { color: var(--text-secondary); font-size: 1rem; max-width: 560px; }

/* ═══ Tool Page: Toolbar ═══ */
.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}
.toolbar-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.18s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.toolbar-btn:hover { border-color: var(--accent); color: var(--accent); }
.toolbar-btn.active-mode { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ═══ Tool Page: How To Use ═══ */
.how-to-section {
  padding: 48px 0 32px;
  border-top: 1px solid var(--border-light);
}
.how-to-section h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 24px;
}
.how-to-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0;
  list-style: none;
}
.how-to-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.how-to-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-light);
  color: var(--green);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.how-to-step div { font-size: 0.92rem; color: var(--text-secondary); line-height: 1.6; }
.how-to-step div strong { color: var(--text-primary); }

/* ═══ Tool Page: Related Tools (pill style) ═══ */
.related-aside {
  max-width: 800px;
  margin: 32px auto 48px;
  padding: 0 24px;
}
.related-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.related-links a {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s var(--ease);
}
.related-links a:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* ═══ FAQ Section ═══ */
.faq-section {
  padding: 48px 0;
  border-top: 1px solid var(--border-light);
}
.faq-section h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 24px;
  color: var(--text-primary);
}
.faq-item {
  border-bottom: 1px solid var(--border-light);
  padding: 16px 0;
}
.faq-item summary {
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text-primary);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--text-muted);
  transition: transform 0.2s var(--ease);
}
.faq-item[open] summary::after {
  content: '-';
}
.faq-item .faq-answer {
  padding-top: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ═══ Keyboard Shortcuts Modal ═══ */
.shortcuts-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,23,20,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.shortcuts-overlay.open { display: flex; }
.shortcuts-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}
.shortcuts-modal h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  margin-bottom: 20px;
}
.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.shortcut-row kbd {
  font-family: var(--font-body);
  font-size: 0.78rem;
  background: var(--bg-secondary);
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

/* ═══ Responsive ═══ */
@media (max-width: 600px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .footer-inner { flex-direction: column; gap: 12px; text-align: center; }
}

/* ═══ Print Styles ═══ */
@media print {
  nav, footer, .hamburger, .mobile-menu, #shortcutsOverlay,
  #cmdOverlay, #btt, .toolbar, .category-filters, .hero-cta-btn,
  .support-section, .search-wrap, .skip-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .container { max-width: 100%; padding: 0; }
  a { color: #000; text-decoration: underline; }
  .faq-item[open] .faq-answer, .faq-item .faq-answer { display: block; }
  .tool-card, .panel, .stat-card { break-inside: avoid; border: 1px solid #ccc; }
  #outputPanel, #textArea { min-height: auto; overflow: visible; white-space: pre-wrap; }
}
