:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --border: #334155;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

html {
  scroll-padding-top: 5.5rem;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}
.logo span { color: var(--primary); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  flex: 1;
  position: relative;
  z-index: 2;
}
.site-nav a {
  color: var(--muted);
  font-size: 0.9rem;
  position: relative;
  z-index: 1;
  touch-action: manipulation;
}
@media (hover: hover) {
  .site-nav a:hover { color: var(--primary); text-decoration: none; }
}
.site-nav a[aria-current="page"] { color: var(--primary); font-weight: 600; }

#theme-toggle {
  flex-shrink: 0;
  margin-inline-start: auto;
}

.site-main { flex: 1; padding: 1.5rem; max-width: 1200px; margin: 0 auto; width: 100%; }
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer p { margin: 0; }
.site-footer-links {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
}
.site-footer-links a { color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 18%, transparent);
}
.btn:active:not(:disabled) {
  transform: translateY(0);
}
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled,
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-sm {
  font-size: 0.8rem;
  padding: 0.4rem 0.65rem;
}
.btn.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-icon { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--muted); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.hero { text-align: center; margin-bottom: 2rem; }
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.25rem); margin-bottom: 0.5rem; }
.hero p { color: var(--muted); max-width: 560px; margin: 0 auto; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s;
}
.module-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  text-decoration: none;
}
.module-card h2 { margin: 0.5rem 0 0.25rem; font-size: 1.1rem; }
.module-card p { margin: 0; color: var(--muted); font-size: 0.875rem; }

.module-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  border-radius: 12px;
  line-height: 1;
}
.module-icon-pdf::before { content: 'PDF'; font-size: 0.65rem; letter-spacing: 0.02em; }
.module-icon-image::before { content: '◫'; font-size: 1.4rem; }
.module-icon-video::before { content: '▶'; font-size: 1.1rem; }
.module-icon-ocr::before { content: 'OCR'; font-size: 0.65rem; letter-spacing: 0.02em; }
.module-icon-doc::before { content: 'W'; font-size: 1rem; font-weight: 700; }
.module-icon-calculator::before { content: 'fx'; font-size: 0.9rem; font-style: italic; }
.module-icon-qr::before { content: 'QR'; font-size: 0.65rem; letter-spacing: 0.02em; }

.privacy-note {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
  font-size: 0.9rem;
}

/* Home SEO FAQ (tool.css not loaded on home) */
.tool-seo-faq { margin: 0; }
.tool-seo-faq dt {
  color: var(--text);
  font-weight: 600;
  margin-top: 1rem;
}
.tool-seo-faq dd { margin: 0.35rem 0 0; color: var(--muted); }
.tool-seo-h2 {
  color: var(--text);
  font-size: 1.15rem;
  margin: 1.5rem 0 0.75rem;
}
.tool-seo-intro { margin: 0 0 0.75rem; color: var(--muted); line-height: 1.6; }
.tool-seo-steps { margin: 0 0 1rem; padding-left: 1.25rem; color: var(--muted); }

.error-page { text-align: center; padding: 4rem 1rem; }

.legal-page {
  max-width: 720px;
  margin: 0 auto;
  line-height: 1.65;
}
.legal-page h1 { margin-top: 0; }
.legal-page h2 {
  margin-top: 2rem;
  font-size: 1.15rem;
}
.legal-page ul { padding-left: 1.25rem; }

.press-page { max-width: 800px; margin: 0 auto; line-height: 1.65; }
.press-page h1 { margin-top: 0; }
.press-lead { color: var(--muted); font-size: 1.05rem; }
.press-section { margin-top: 2.5rem; }
.press-section h2 { font-size: 1.15rem; margin-bottom: 0.35rem; }
.press-hint { color: var(--muted); font-size: 0.875rem; margin: 0 0 0.75rem; }
.press-copy-block {
  display: grid;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.press-copy-block pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.55;
}
.press-copy-btn { justify-self: start; }
.press-copy-inline { font-size: 0.8rem; padding: 0.3rem 0.65rem; margin-left: 0.5rem; }
.press-facts dt { font-weight: 600; margin-top: 0.75rem; }
.press-facts dd { margin: 0.2rem 0 0; color: var(--muted); }
.press-links { list-style: none; padding: 0; margin: 0; }
.press-links li { margin-bottom: 0.5rem; }
.press-assets { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.press-assets li { margin-bottom: 0.4rem; }
.press-asset-meta { color: var(--muted); font-size: 0.8rem; margin-left: 0.5rem; }
.press-logo-preview {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.press-logo-preview img { display: block; width: 100%; height: auto; }
.press-logo-preview figcaption {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  .site-header { flex-wrap: wrap; }
  .site-nav { order: 3; width: 100%; }
}

/* ── Custom checkboxes (project-wide) ── */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  border: 2px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  vertical-align: middle;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="checkbox"]:hover {
  border-color: var(--primary);
}

input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 46%;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

label:has(> input[type="checkbox"]),
label:has(input[type="checkbox"]:first-child) {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
  user-select: none;
}

label:has(input[type="checkbox"]:disabled) {
  cursor: not-allowed;
  opacity: 0.7;
}
