/* ============================================================
   Pixel to Print — Main Stylesheet
   XCreativeDesign | MIT License
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,300&family=DM+Mono:wght@400;500&display=swap');

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-primary:    #1A6EFF;
  --brand-secondary:  #0D47CC;
  --brand-accent:     #00C2A8;
  --brand-warm:       #FF6B35;

  /* Light Mode (Default) */
  --bg-base:          #F8F9FC;
  --bg-surface:       #FFFFFF;
  --bg-elevated:      #FFFFFF;
  --bg-subtle:        #F0F2F8;
  --bg-tool:          #FFFFFF;

  --text-primary:     #0D1117;
  --text-secondary:   #4A5568;
  --text-muted:       #8896A8;
  --text-inverse:     #FFFFFF;

  --border-default:   #E2E8F0;
  --border-strong:    #CBD5E0;
  --border-focus:     #1A6EFF;

  --shadow-sm:        0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:        0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg:        0 12px 40px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-tool:      0 2px 20px rgba(26,110,255,0.08);

  /* Quality Colors */
  --q-outstanding:    #00875A;
  --q-excellent:      #36B37E;
  --q-good:           #FF991F;
  --q-marginal:       #FF5630;
  --q-insufficient:   #DE350B;

  /* Spacing */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   16px;
  --space-lg:   24px;
  --space-xl:   40px;
  --space-2xl:  64px;
  --space-3xl:  96px;

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:    cubic-bezier(0.4, 0, 1, 1);
  --duration:   200ms;
}

/* ── Dark Mode ────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-base:          #0A0E1A;
  --bg-surface:       #111827;
  --bg-elevated:      #1A2235;
  --bg-subtle:        #1E2A3D;
  --bg-tool:          #111827;

  --text-primary:     #F0F4FF;
  --text-secondary:   #94A3B8;
  --text-muted:       #64748B;
  --text-inverse:     #0D1117;

  --border-default:   #1E2A3D;
  --border-strong:    #2D3F5A;
  --border-focus:     #3B82F6;

  --shadow-sm:        0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:        0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:        0 12px 40px rgba(0,0,0,0.5);
  --shadow-tool:      0 2px 20px rgba(26,110,255,0.15);
}

/* ── Reset & 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: 'DM Sans', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--duration) var(--ease-out),
              color var(--duration) var(--ease-out);
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }

/* ── Skip Link (Accessibility) ────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--brand-primary);
  color: white;
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 9999;
  transition: top var(--duration);
}
.skip-link:focus { top: var(--space-md); }

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav-link {
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  transition: color var(--duration), background var(--duration);
  text-decoration: none;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Theme Toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration);
  font-size: 16px;
}

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

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

/* Mobile menu */
.mobile-menu-btn {
  display: none;
  width: 40px; height: 40px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 18px;
  align-items: center;
  justify-content: center;
}

/* ── Hero Section ─────────────────────────────────────────── */
.hero {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  padding: var(--space-3xl) var(--space-xl) var(--space-2xl);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -60%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(26,110,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  max-width: 700px;
  margin: 0 auto;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 14px;
  background: rgba(26,110,255,0.08);
  border: 1px solid rgba(26,110,255,0.2);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--brand-primary);
  margin-bottom: var(--space-lg);
}

.hero-badge-dot {
  width: 6px; height: 6px;
  background: var(--brand-accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.8); }
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.hero h1 span {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto var(--space-xl);
  line-height: 1.7;
  font-weight: 300;
}

.hero-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.trust-item svg {
  width: 14px; height: 14px;
  color: var(--brand-accent);
  flex-shrink: 0;
}

/* ── Main Tool Layout ─────────────────────────────────────── */
.tool-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-xl);
}

.tool-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: var(--space-xl);
  align-items: start;
}

/* ── Panel Base ───────────────────────────────────────────── */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.panel-header {
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.panel-body { padding: var(--space-xl); }

/* ── Upload Zone ──────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  background: var(--bg-subtle);
  position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--brand-primary);
  background: rgba(26,110,255,0.04);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon {
  width: 52px; height: 52px;
  margin: 0 auto var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: var(--shadow-sm);
}

.upload-primary {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.upload-secondary {
  font-size: 13px;
  color: var(--text-muted);
}

.upload-secondary span {
  color: var(--brand-primary);
  font-weight: 500;
}

.upload-formats {
  margin-top: var(--space-sm);
  font-size: 12px;
  color: var(--text-muted);
}

/* Image Preview */
.image-preview {
  display: none;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-subtle);
  aspect-ratio: 16/9;
}

.image-preview img {
  width: 100%; height: 100%;
  object-fit: contain;
}

.image-preview.visible { display: block; }

.preview-remove {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 28px; height: 28px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration);
}

.preview-remove:hover { background: rgba(220,38,38,0.8); }

/* Image Stats Bar */
.image-stats {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border-default);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: var(--space-md);
}

.image-stats.visible { display: grid; }

.stat-cell {
  background: var(--bg-subtle);
  padding: var(--space-sm) var(--space-md);
  text-align: center;
}

.stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* EXIF badge */
.exif-badge {
  display: none;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 10px;
  background: rgba(0,194,168,0.1);
  border: 1px solid rgba(0,194,168,0.25);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--brand-accent);
  font-weight: 500;
}
.exif-badge.visible { display: inline-flex; }

/* ── Form Controls ────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.input-wrap {
  position: relative;
}

.input-wrap input,
.input-wrap select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  transition: border-color var(--duration), box-shadow var(--duration);
  appearance: none;
  -webkit-appearance: none;
}

.input-wrap input:focus,
.input-wrap select:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(26,110,255,0.12);
}

.input-suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
  font-family: 'DM Mono', monospace;
}

.input-wrap input[type="number"] { padding-right: 40px; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238896A8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px !important;
}

/* Aspect Lock */
.aspect-lock-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.aspect-lock-btn {
  width: 32px; height: 32px;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: all var(--duration);
  flex-shrink: 0;
}

.aspect-lock-btn.locked {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: rgba(26,110,255,0.08);
}

.aspect-lock-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Smart Presets ────────────────────────────────────────── */
.presets-section { margin-top: var(--space-lg); }

.presets-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  display: block;
}

.preset-tabs {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}

.preset-tab {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  transition: all var(--duration);
}

.preset-tab:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.preset-tab.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: white;
}

.preset-items {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xs);
  max-height: 200px;
  overflow-y: auto;
  padding-right: 4px;
}

.preset-items::-webkit-scrollbar { width: 4px; }
.preset-items::-webkit-scrollbar-track { background: transparent; }
.preset-items::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.preset-item {
  padding: 8px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  transition: all var(--duration);
  line-height: 1.3;
}

.preset-item:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: rgba(26,110,255,0.04);
}

/* ── Calculate Button ─────────────────────────────────────── */
.calc-btn {
  width: 100%;
  padding: 14px var(--space-xl);
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all var(--duration) var(--ease-out);
  position: relative;
  overflow: hidden;
  margin-top: var(--space-lg);
}

.calc-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity var(--duration);
}

.calc-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(26,110,255,0.35); }
.calc-btn:hover::before { opacity: 1; }
.calc-btn:active { transform: translateY(0); }
.calc-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Results Panel ────────────────────────────────────────── */
.results-panel { position: sticky; top: 80px; }

.results-empty {
  padding: var(--space-3xl) var(--space-xl);
  text-align: center;
  color: var(--text-muted);
}

.results-empty-icon {
  font-size: 40px;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}

.results-empty p {
  font-size: 14px;
  line-height: 1.6;
}

/* PPQS Score Card */
.score-card {
  padding: var(--space-xl);
  border-bottom: 1px solid var(--border-default);
  display: none;
}

.score-card.visible { display: block; }

.score-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.score-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
}

.score-number {
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-family: 'DM Mono', monospace;
  margin-bottom: var(--space-xs);
}

.score-bar-wrap {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.score-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s var(--ease-out);
  width: 0%;
}

.score-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Dimension Cards */
.dimensions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border-default);
  border-bottom: 1px solid var(--border-default);
}

.dim-card {
  background: var(--bg-surface);
  padding: var(--space-lg) var(--space-md);
  text-align: center;
}

.dim-unit {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.dim-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.dim-copy {
  margin-top: var(--space-xs);
  font-size: 11px;
  color: var(--brand-primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}

.dim-copy:hover { text-decoration: underline; }

/* DPI Analysis */
.dpi-analysis {
  padding: var(--space-xl);
  border-bottom: 1px solid var(--border-default);
  display: none;
}

.dpi-analysis.visible { display: block; }

.analysis-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-md);
}

.dpi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-default);
  font-size: 13px;
}

.dpi-row:last-child { border-bottom: none; }

.dpi-row-label { color: var(--text-secondary); }

.dpi-row-value {
  font-family: 'DM Mono', monospace;
  font-weight: 600;
  color: var(--text-primary);
}

/* Suggestions */
.suggestions-wrap {
  padding: var(--space-xl);
  display: none;
  flex-direction: column;
  gap: var(--space-md);
}

.suggestions-wrap.visible { display: flex; }

.suggestion-card {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border-left: 3px solid;
  background: var(--bg-subtle);
}

.suggestion-card.positive {
  border-color: var(--q-excellent);
  background: rgba(54,179,126,0.06);
}

.suggestion-card.high {
  border-color: var(--q-good);
  background: rgba(255,153,31,0.06);
}

.suggestion-card.critical {
  border-color: var(--q-insufficient);
  background: rgba(222,53,11,0.06);
}

.suggestion-card.info,
.suggestion-card.medium {
  border-color: var(--brand-primary);
  background: rgba(26,110,255,0.06);
}

.suggestion-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.suggestion-detail {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.suggestion-tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.suggestion-tool-tag {
  padding: 3px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Max Print Info */
.max-print-info {
  padding: var(--space-md) var(--space-xl);
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-default);
  font-size: 13px;
  color: var(--text-muted);
  display: none;
}

.max-print-info.visible { display: block; }

.max-print-info strong { color: var(--text-primary); }

/* ── Tab Switcher (Calculator / Sweet Spot) ───────────────── */
.mode-tabs {
  display: flex;
  gap: 4px;
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-subtle);
}

.mode-tab {
  flex: 1;
  padding: 8px var(--space-md);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--duration);
  text-align: center;
}

.mode-tab.active {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: rgba(26,110,255,0.06);
}

.mode-tab:hover:not(.active) {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.mode-panel { display: none; }
.mode-panel.active { display: block; }

/* ── Info Section ─────────────────────────────────────────── */
.info-section {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  padding: var(--space-3xl) var(--space-xl);
}

.info-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.section-heading {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.section-sub {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: var(--space-2xl);
  font-weight: 300;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.info-card {
  padding: var(--space-xl);
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  transition: box-shadow var(--duration), transform var(--duration);
}

.info-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.info-card-icon {
  font-size: 24px;
  margin-bottom: var(--space-md);
}

.info-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  letter-spacing: -0.01em;
}

.info-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.info-card a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-primary);
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  padding: var(--space-2xl) var(--space-xl);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2xl);
  align-items: start;
}

.footer-brand p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: var(--space-sm);
  max-width: 320px;
  line-height: 1.6;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  align-items: flex-end;
}

.footer-link-group {
  display: flex;
  gap: var(--space-lg);
}

.footer-link {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--duration);
}

.footer-link:hover { color: var(--text-primary); text-decoration: none; }

.footer-bottom {
  max-width: 1200px;
  margin: var(--space-xl) auto 0;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.footer-copy {
  font-size: 12px;
  color: var(--text-muted);
}

.footer-privacy {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.privacy-dot {
  width: 6px; height: 6px;
  background: var(--brand-accent);
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Toast Notification ───────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-primary);
  color: var(--text-inverse);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  transition: transform 0.3s var(--ease-out);
  white-space: nowrap;
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* ── Loading State ────────────────────────────────────────── */
.loading-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(var(--bg-surface), 0.8);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xl);
  z-index: 10;
}

.loading-overlay.visible { display: flex; }

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border-default);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .tool-grid { grid-template-columns: 1fr; }
  .results-panel { position: static; }
  .header-nav { display: none; }
  .mobile-menu-btn { display: flex; }
}

@media (max-width: 640px) {
  :root {
    --space-xl: 24px;
    --space-2xl: 40px;
    --space-3xl: 64px;
  }

  .header-inner { padding: var(--space-md); }
  .hero { padding: var(--space-2xl) var(--space-md); }
  .tool-section { padding: var(--space-lg) var(--space-md); }
  .form-row { grid-template-columns: 1fr; }
  .dimensions-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-links { align-items: flex-start; }
  .footer-link-group { flex-direction: column; gap: var(--space-sm); }
  .hero-trust { gap: var(--space-md); }
  .info-section { padding: var(--space-2xl) var(--space-md); }
}

/* ── Accessibility ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.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;
}

/* High contrast support */
@media (prefers-contrast: high) {
  :root {
    --border-default: #000;
    --text-secondary: #000;
  }
}

/* ============================================================
   ADDITIONS v2 — How-to, Use Cases, Guides, FAQ, Contrast fixes
   ============================================================ */

/* ── Contrast Fixes (WCAG AA minimum 4.5:1) ─────────────── */
/* text-secondary was #4A5568 on white = 7.4:1 ✅             */
/* text-muted was #8896A8 on white = 3.5:1 ❌ → fix below     */
:root {
  --text-muted: #6B7280;  /* Updated: #6B7280 on white = 4.6:1 ✅ */
}

[data-theme="dark"] {
  --text-muted: #9CA3AF;  /* #9CA3AF on #111827 = 5.2:1 ✅ */
}

/* ── Mobile nav ──────────────────────────────────────────── */
/* mobile-nav is hidden by default via HTML [hidden] attribute.
   Only shown on ≤1024px via JS toggle.
   [hidden] must override display — use !important guard below. */
.mobile-nav {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  padding: var(--space-sm) var(--space-md);
  flex-direction: column;
  display: none;        /* hidden by default on ALL screen sizes */
}

/* When JS removes [hidden] and screen is ≤1024px, show it */
@media (max-width: 1024px) {
  .mobile-nav:not([hidden]) {
    display: flex;
  }
}

/* Ensure [hidden] always wins regardless of other rules */
[hidden] { display: none !important; }

.mobile-nav-link {
  padding: 12px var(--space-md);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: background var(--duration);
}

.mobile-nav-link:hover {
  background: var(--bg-subtle);
  text-decoration: none;
}

/* ── Logo mark SVG bg ────────────────────────────────────── */
.logo-mark {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Panel body gap ──────────────────────────────────────── */
.panel-body {
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* ── Form fieldset ───────────────────────────────────────── */
.form-fieldset {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.form-label-sm {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}

.label-optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12px;
}

/* ── Stats row ───────────────────────────────────────────── */
.stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  min-height: 20px;
}

/* ── Info callout ────────────────────────────────────────── */
.info-callout {
  padding: var(--space-md);
  background: rgba(26,110,255,0.06);
  border: 1px solid rgba(26,110,255,0.15);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.info-callout strong { color: var(--text-primary); }

/* ── Link button ─────────────────────────────────────────── */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--brand-primary);
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-btn:hover { text-decoration: none; }

/* ── Results visibility ──────────────────────────────────── */
.results-empty-sub {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Section shared styles ───────────────────────────────── */
.section-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.section-inner--narrow {
  max-width: 800px;
}

.section-label-tag {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(26,110,255,0.08);
  border: 1px solid rgba(26,110,255,0.18);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-md);
}

/* ── How-To Section ──────────────────────────────────────── */
.how-section {
  padding: var(--space-3xl) 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.step-card {
  padding: var(--space-xl);
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  position: relative;
}

.step-number {
  font-size: 40px;
  font-weight: 800;
  font-family: 'DM Mono', monospace;
  color: var(--border-strong);
  line-height: 1;
  margin-bottom: var(--space-md);
  letter-spacing: -0.04em;
}

.step-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.step-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* PPQS Explainer */
.ppqs-explainer {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-2xl);
  padding: var(--space-xl) var(--space-2xl);
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  align-items: center;
}

.ppqs-explainer-text h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}

.ppqs-explainer-text p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-md);
}

.ppqs-explainer-text p:last-child { margin-bottom: 0; }

.ppqs-explainer-stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.ppqs-stat {
  padding: var(--space-md) var(--space-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  text-align: center;
}

.ppqs-stat-value {
  font-size: 32px;
  font-weight: 800;
  font-family: 'DM Mono', monospace;
  color: var(--brand-primary);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
}

.ppqs-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── Use Cases Section ───────────────────────────────────── */
.usecases-section {
  padding: var(--space-3xl) 0;
  background: var(--bg-base);
  border-top: 1px solid var(--border-default);
}

.usecase-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

.usecase-card {
  padding: var(--space-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  transition: box-shadow var(--duration), transform var(--duration);
}

.usecase-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.usecase-icon {
  font-size: 28px;
  margin-bottom: var(--space-md);
  line-height: 1;
}

.usecase-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  letter-spacing: -0.01em;
}

.usecase-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ── Guides Section ──────────────────────────────────────── */
.guides-section {
  padding: var(--space-3xl) 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
}

.guides-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.guide-card {
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--duration), transform var(--duration);
}

.guide-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.guide-card-inner {
  padding: var(--space-xl);
  display: flex;
  gap: var(--space-md);
  height: 100%;
}

.guide-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.guide-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.guide-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: var(--space-md);
}

.guide-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-primary);
  text-decoration: none;
  transition: gap var(--duration);
}

.guide-link:hover { gap: 10px; text-decoration: none; }

/* ── FAQ Section ─────────────────────────────────────────── */
.faq-section {
  padding: var(--space-3xl) 0;
  background: var(--bg-base);
  border-top: 1px solid var(--border-default);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.faq-item {
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-surface);
}

.faq-item:last-child { border-bottom: none; }

.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  list-style: none;
  user-select: none;
  transition: background var(--duration);
  line-height: 1.4;
}

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

.faq-q:hover { background: var(--bg-subtle); }

.faq-item[open] .faq-q { background: var(--bg-subtle); }

.faq-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform var(--duration);
}

.faq-item[open] .faq-arrow { transform: rotate(180deg); }

.faq-a {
  padding: 0 var(--space-xl) var(--space-lg);
  border-top: 1px solid var(--border-default);
  background: var(--bg-subtle);
}

.faq-a p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-top: var(--space-md);
}

.faq-a p:first-child { margin-top: var(--space-lg); }
.faq-a strong { color: var(--text-primary); font-weight: 600; }

/* ── Footer nav ──────────────────────────────────────────── */
.footer-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  align-items: flex-end;
}

/* ── Score card visibility ───────────────────────────────── */
.score-card[hidden],
.dpi-analysis[hidden],
.suggestions-wrap[hidden],
.max-print-info[hidden] {
  display: none;
}

.score-card { display: block; padding: var(--space-xl); border-bottom: 1px solid var(--border-default); }

/* ── Sweet Spot result ───────────────────────────────────── */
#ss-result:empty { display: none; }
#ss-result { margin-top: var(--space-md); display: flex; flex-direction: column; gap: var(--space-md); }

/* ── Responsive: Sections ────────────────────────────────── */
@media (max-width: 1024px) {
  .steps-grid    { grid-template-columns: repeat(2, 1fr); }
  .usecase-grid  { grid-template-columns: repeat(2, 1fr); }
  .guides-grid   { grid-template-columns: repeat(2, 1fr) !important; }
  .ppqs-explainer { grid-template-columns: 1fr; }
  .ppqs-explainer-stats { flex-direction: row; flex-wrap: wrap; }
  .ppqs-stat { flex: 1; min-width: 140px; }
  .footer-nav { align-items: flex-start; }
}

@media (max-width: 640px) {
  .steps-grid    { grid-template-columns: 1fr; }
  .usecase-grid  { grid-template-columns: 1fr; }
  .guides-grid   { grid-template-columns: 1fr !important; }
  .guide-card-inner { flex-direction: column; }
  .how-section,
  .usecases-section,
  .guides-section,
  .faq-section { padding: var(--space-2xl) 0; }
  .section-inner { padding: 0 var(--space-md); }
  .faq-q { padding: var(--space-md); font-size: 14px; }
  .faq-a { padding: 0 var(--space-md) var(--space-md); }
  .ppqs-explainer { padding: var(--space-lg); }
  .footer-nav { flex-direction: column; }
  .footer-link-group { flex-direction: column; gap: var(--space-sm); }
}
