/* ══════════════════════════════════════════════════════════════
   PicDriver - Depth of Field / Focus Online Tool (12-in-1) CSS
══════════════════════════════════════════════════════════════ */

:root {
  --bg:            #0d1117;
  --surface:       #161b22;
  --surface2:      #1f2730;
  --surface-card:  #181e26;
  --border:        #30363d;
  --border-light:  rgba(255, 255, 255, 0.1);
  --accent:        #f78166;
  --accent-dim:    rgba(247, 129, 102, 0.12);
  --accent-glow:   rgba(247, 129, 102, 0.35);
  --accent2:       #79c0ff;
  --accent2-dim:   rgba(121, 192, 255, 0.12);
  --accent3:       #56d364;
  --accent3-dim:   rgba(86, 211, 100, 0.12);
  --purple:        #d2a8ff;
  --yellow:        #e3b341;
  --text-primary:  #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #6e7681;
  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     18px;
  --shadow:        0 8px 32px rgba(0,0,0,.45);
  --font-heading:  'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-sans:     'DM Sans', -apple-system, sans-serif;
  --font-mono:     'Space Mono', monospace;
  --transition:    0.22s cubic-bezier(.4,0,.2,1);
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top Header ── */
.site-header {
  background: rgba(13, 17, 23, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 19px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), #ff9b82);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0d1117;
  font-weight: 800;
}

.logo-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(247, 129, 102, 0.3);
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #0d1117;
    flex-direction: column;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
  }
  .nav-links.open { display: flex; }
}

/* ── Container ── */
.page-wrapper {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 80px;
  flex: 1;
  width: 100%;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

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

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 36px 0 28px;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(247, 129, 102, 0.3);
  border-radius: 100px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(28px, 4.5vw, 44px);
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 12px;
}

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

.hero p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto 20px;
  line-height: 1.65;
}

/* ── 12 Quick-Switch Tool Chips ── */
.tools-chips-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}

.tools-chips-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.tools-chips-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tools-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-chip {
  background: var(--surface2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tool-chip:hover {
  background: var(--surface-card);
  border-color: var(--accent);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.tool-chip.active {
  background: linear-gradient(135deg, var(--accent) 0%, #d8573a 100%);
  color: #0d1117;
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.tool-chip.fire {
  border-color: rgba(247, 129, 102, 0.4);
}

/* ── Mode Navigation Tabs ── */
.suite-mode-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.suite-mode-nav::-webkit-scrollbar { display: none; }

.mode-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.mode-tab-btn:hover {
  background: var(--surface2);
  color: var(--text-primary);
}

.mode-tab-btn.active {
  background: var(--surface2);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 16px var(--accent-dim);
}

/* ── Mode Panels ── */
.mode-panel { display: none; }
.mode-panel.active { display: block; animation: fadeIn .3s ease; }

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

/* ── Split Layout for Calculator & Visual Simulator ── */
.calc-split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 960px) {
  .calc-split-layout { grid-template-columns: 1fr; }
}

.calc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.calc-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.calc-card-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.calc-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Unit Switcher Bar ── */
.unit-toggle-bar {
  display: inline-flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.unit-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.unit-btn.active {
  background: var(--accent);
  color: #0d1117;
  font-weight: 700;
}

/* ── Form Controls ── */
.control-field {
  margin-bottom: 18px;
}

.control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.control-select, .control-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition);
}

.control-select:focus, .control-input:focus {
  border-color: var(--accent);
}

.control-slider {
  width: 100%;
  margin-top: 8px;
  accent-color: var(--accent);
  cursor: pointer;
}

.slider-val-readout {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}

/* ── Results Summary Cards Grid ── */
.results-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.res-stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: all var(--transition);
}

.res-stat-card.highlight {
  border-color: var(--accent);
  background: rgba(247, 129, 102, 0.08);
}

.res-stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.res-stat-val {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
}

.res-stat-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Interactive Focus Range Visual Diagram ── */
.dof-visualizer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 80px;
}

.visual-range-container {
  margin: 20px 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.range-scale-bar {
  height: 24px;
  border-radius: 6px;
  background: #10141b;
  display: flex;
  overflow: hidden;
  position: relative;
  margin: 14px 0 8px;
  border: 1px solid var(--border);
}

.seg-front-blur { background: rgba(121, 192, 255, 0.2); transition: width 0.3s ease; }
.seg-sharp-dof { background: linear-gradient(90deg, #56d364, #56d364); transition: width 0.3s ease; }
.seg-rear-blur { background: rgba(121, 192, 255, 0.2); transition: width 0.3s ease; }

.range-labels-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.dof-distribution-box {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  background: var(--surface-card);
  border-radius: var(--radius-sm);
  margin-top: 14px;
  font-size: 12px;
}

/* ── Bokeh Simulation Preview ── */
.bokeh-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 18px;
  position: relative;
  overflow: hidden;
  height: 140px;
}

.bokeh-orb {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(247,129,102,0.85) 0%, rgba(247,129,102,0.15) 70%, transparent 100%);
  pointer-events: none;
  transition: all 0.3s ease;
}

.bokeh-caption {
  position: absolute;
  bottom: 10px;
  left: 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(13, 17, 23, 0.7);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ── Generic Tools Grid ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.tool-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tool-box-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.tool-box-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.tool-field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.tool-field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.tool-field-input, .tool-field-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  width: 140px;
  outline: none;
}

.tool-field-input:focus, .tool-field-select:focus {
  border-color: var(--accent);
}

.tool-result-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-result-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.tool-result-val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

/* ── Stacking Table ── */
.stacking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 14px;
}

.stacking-table th {
  background: var(--surface2);
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stacking-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

/* ── SEO Section ── */
.seo-section {
  margin: 50px 0 30px;
  border-top: 1px solid var(--border);
  padding-top: 40px;
}

.seo-section h2 {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.seo-section h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 28px 0 12px;
}

.seo-section p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 16px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.feature-card-icon {
  font-size: 22px;
  margin-bottom: 10px;
}

.feature-card h4 { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.feature-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin: 0; }

/* ── FAQ Accordion ── */
.faq-list { margin-top: 20px; }

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color var(--transition);
}

.faq-item:hover { border-color: var(--border-light); }

.faq-q {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 16px 20px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  gap: 12px;
}

.faq-q svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform var(--transition);
  color: var(--text-muted);
}

.faq-item.open .faq-q svg { transform: rotate(45deg); color: var(--accent); }

.faq-a {
  display: none;
  padding: 0 20px 18px;
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.65;
}

.faq-item.open .faq-a { display: block; }


/* ==========================================================================
   Universal Mobile & Tablet Responsiveness Suite (320px - 1040px)
   ========================================================================== */

/* 1. Fluid Media & Canvas Scaling */
img, canvas, svg, video {
  max-width: 100% !important;
  height: auto !important;
}

/* 2. Responsive Touch-Scroll Tables */
table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
}

.table-responsive,
.table-container,
.table-wrap,
.table-wrapper,
.matrix-container,
.data-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 3. Tablet Breakpoint (<= 1040px) */
@media (max-width: 1040px) {
  .workspace,
  .studio-layout,
  .finder-workspace,
  .simulator-grid,
  .layout-grid,
  .remover-workspace {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .sidebar-panel,
  .controls-sidebar {
    border-left: none !important;
    border-top: 1px solid var(--border, rgba(255,255,255,0.1));
  }
}

/* 4. Mobile Portrait & Landscape (<= 768px) */
@media (max-width: 768px) {
  .site-header {
    height: auto !important;
    padding: 10px 16px !important;
  }

  .header-inner,
  .header-container {
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    width: 100%;
  }

  .logo,
  .brand-logo,
  .logo-wrap {
    font-size: 1.15rem !important;
  }

  .menu-toggle {
    display: block !important;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #0a0d14;
    flex-direction: column;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.1));
    z-index: 1000;
  }

  .nav-links.open {
    display: flex !important;
  }

  .hero {
    padding: 28px 16px 20px !important;
  }

  .hero h1 {
    font-size: clamp(1.6rem, 5.5vw, 2.3rem) !important;
    line-height: 1.2 !important;
  }

  .hero p {
    font-size: 0.92rem !important;
  }

  .page-wrapper,
  .portal-main,
  .container {
    padding: 16px 12px 40px !important;
  }

  .workspace,
  .studio-layout,
  .finder-workspace,
  .remover-workspace {
    padding: 0 !important;
    gap: 16px !important;
  }

  .panel-card,
  .results-card,
  .sidebar-panel,
  .stage-area,
  .card {
    padding: 16px 14px !important;
    border-radius: 12px !important;
  }

  .metrics-grid,
  .data-grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .calc-grid,
  .features-grid,
  .steps-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .tool-chips-grid,
  .chips-bar,
  .preset-chip-group,
  .mode-tabs {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .tool-chip,
  .preset-btn,
  .mode-tab-btn {
    padding: 6px 12px !important;
    font-size: 0.78rem !important;
  }

  .btn-primary,
  .btn-secondary,
  .action-btn,
  .btn-action {
    min-height: 44px;
    width: 100%;
    justify-content: center;
  }

  .btn-group,
  .action-btns,
  .download-row {
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
  }

  table {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    white-space: nowrap !important;
  }

  th, td {
    padding: 8px 10px !important;
    font-size: 0.8rem !important;
  }
}

/* 5. Small Handsets (<= 480px) */
@media (max-width: 480px) {
  .hero-pill,
  .hero-badge {
    font-size: 0.72rem !important;
    padding: 3px 10px !important;
  }

  .form-group {
    margin-bottom: 14px !important;
  }

  .form-control,
  .form-select,
  .control-input,
  .control-select,
  input[type="text"],
  input[type="number"],
  select {
    font-size: 16px !important; /* Prevents auto-zoom in iOS Safari */
    min-height: 42px;
  }

  .info-section,
  .guide-section,
  .faq-section {
    padding: 24px 12px !important;
  }
}
