/* ===================================================================
   Audiogram Generator — premium light UI
   Shared across /tools/audiogram-generator/ and its pSEO sub-pages.
   Class vocabulary is preserved; only the styling is rewritten.
   Accent hue: 320 (magenta / purple).
   =================================================================== */

:root {
  --ink: oklch(24% .02 300);
  --muted: oklch(52% .03 300);
  --paper: oklch(97% .008 300);
  --surface: oklch(100% .002 300);
  --line: oklch(90% .015 300);
  --accent: oklch(56% .2 320);
  --accent-dark: oklch(46% .18 320);
  --accent-soft: oklch(94% .05 320);
  --stage: oklch(22% .03 320);
  --radius: 16px;
  --shadow: 0 1px 2px oklch(24% .04 300 / .04), 0 12px 32px oklch(24% .04 300 / .07);

  /* Compatibility aliases consumed by pSEO sub-page inline styles */
  --heading: var(--ink);
  --primary: var(--accent-dark);
  --border: var(--line);
  --bg: var(--paper);
  --text: var(--ink);

  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid oklch(70% .16 320); outline-offset: 3px; border-radius: 6px; }

/* --------------------------------------------------------------- Header */
.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 clamp(16px, 5vw, 64px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo {
  font-size: 1.15rem;
  font-weight: 850;
  letter-spacing: -.04em;
  text-decoration: none;
  color: var(--ink);
}
.logo span { color: var(--accent); }
.site-header nav { display: flex; gap: 24px; margin-left: auto; font-size: .9rem; color: var(--muted); }
.site-header nav a { text-decoration: none; font-weight: 600; transition: color .18s; }
.site-header nav a:hover { color: var(--accent-dark); }

/* --------------------------------------------------------------- Layout */
.page-wrapper { max-width: 1200px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 40px) 80px; }

/* --------------------------------------------------------------- Hero */
.hero { padding: 64px 0 40px; max-width: 800px; }
.hero-badge {
  display: inline-block;
  padding: 6px 15px;
  background: var(--accent-soft);
  border: 1px solid oklch(85% .07 320);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--accent-dark);
  margin-bottom: 18px;
}
.page-title {
  font-size: clamp(40px, 7vw, 76px);
  font-weight: 800;
  line-height: .98;
  letter-spacing: -.055em;
  margin-bottom: 18px;
  text-wrap: balance;
}
.page-sub {
  max-width: 640px;
  color: var(--muted);
  font-size: clamp(16px, 2.2vw, 18px);
  line-height: 1.6;
}

/* --------------------------------------------------------------- Tool layout */
.tool-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-top: 8px;
}

/* --------------------------------------------------------------- Sidebar */
.sidebar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 22px 22px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 96px;
}
.settings-group { padding: 20px 0; border-top: 1px solid var(--line); }
.settings-group:first-child { border-top: none; }
.settings-group h3 {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 12px;
}

/* Upload buttons */
.upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 11px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: oklch(99% .01 320);
  font-weight: 700;
  font-size: .92rem;
  text-align: center;
  transition: transform .18s cubic-bezier(.16,1,.3,1), background .18s, border-color .18s;
}
.upload-btn:hover { transform: translateY(-1px); background: var(--accent-dark); border-color: var(--accent-dark); }
.upload-btn.secondary {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: oklch(85% .07 320);
}
.upload-btn.secondary:hover { background: oklch(90% .06 320); border-color: var(--accent); }
.upload-btn svg { flex: none; }

.file-info { margin-top: 10px; font-size: .82rem; word-break: break-word; }
.muted { color: var(--muted); }

/* Select + input */
.styled-select, .styled-input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  font-size: 16px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  transition: border-color .18s, box-shadow .18s;
}
.styled-select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23764'  stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.styled-select:focus, .styled-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.styled-input::placeholder { color: oklch(66% .02 300); }

/* Color picker */
.color-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.color-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--line);
  padding: 0;
  transition: transform .18s cubic-bezier(.16,1,.3,1), box-shadow .18s;
}
.color-btn:hover { transform: translateY(-2px); }
.color-btn.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent);
}

/* Export actions */
.export-actions { padding-top: 20px; border-top: 1px solid var(--line); }
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  font-size: .98rem;
  transition: transform .18s cubic-bezier(.16,1,.3,1), background .18s, border-color .18s, opacity .18s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.primary-btn { background: var(--accent); border-color: var(--accent); color: oklch(99% .01 320); }
.primary-btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; background: var(--paper); border-color: var(--line); color: var(--muted); }
.privacy-note { margin-top: 12px; font-size: .78rem; line-height: 1.5; color: var(--muted); text-align: center; }

/* --------------------------------------------------------------- Editor / preview */
.editor-main { min-width: 0; }
.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.editor-header h2 { font-size: 1.4rem; letter-spacing: -.04em; font-weight: 800; }
.format-pill {
  font-size: .74rem;
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid oklch(85% .07 320);
  padding: 5px 12px;
  border-radius: 999px;
}

/* The video stage stays dark — video reads best on dark */
.editor-container {
  position: relative;
  background: var(--stage);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(18px, 3vw, 32px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.canvas-wrapper {
  position: relative;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 44px oklch(10% .03 320 / .38);
}
.canvas-wrapper canvas {
  display: block;
  max-width: 100%;
  height: auto;
}
.player-controls { width: 100%; max-width: 480px; }
.player-controls audio { width: 100%; display: block; }

/* Rendering overlay */
.rendering-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 20px;
  background: oklch(18% .03 320 / .82);
  backdrop-filter: blur(6px);
  color: oklch(98% .01 320);
  text-align: center;
  padding: 24px;
}
.rendering-overlay p { font-weight: 700; }
.rendering-overlay .muted { color: oklch(80% .02 320); font-weight: 500; font-size: .85rem; }
#render-progress { color: oklch(78% .12 320); font-variant-numeric: tabular-nums; }
.loader-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid oklch(50% .04 320 / .4);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------- Content sections */
.dt-container { width: 100%; }
.dt-mb-16 { margin-bottom: 0; }

.faq-section { margin-top: 48px; }
.faq-heading, .related-heading {
  font-size: clamp(24px, 3.5vw, 34px);
  letter-spacing: -.05em;
  font-weight: 800;
  margin-bottom: 20px;
  text-wrap: balance;
}
.faq-list { display: flex; flex-direction: column; }
.faq-item {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}
.faq-item:last-child { border-bottom: 1px solid var(--line); }
.faq-item summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1.02rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--accent-dark); font-size: 22px; font-weight: 400; line-height: 1; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { margin-top: 12px; color: var(--muted); font-size: .95rem; line-height: 1.65; max-width: 68ch; }

/* Related tools */
.related-section { margin-top: 56px; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.related-card {
  display: flex;
  align-items: center;
  min-height: 60px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: .92rem;
  color: var(--ink);
  transition: transform .18s cubic-bezier(.16,1,.3,1), border-color .18s, box-shadow .18s;
}
.related-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }

/* --------------------------------------------------------------- Long-form SEO */
.seo-section { max-width: 800px; margin: 80px auto 0; }
.seo-section h2 {
  font-size: clamp(26px, 4vw, 40px);
  letter-spacing: -.055em;
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: 18px;
  text-wrap: balance;
}
.seo-section h3 {
  font-size: clamp(19px, 2.6vw, 24px);
  letter-spacing: -.03em;
  font-weight: 750;
  margin: 40px 0 14px;
}
.seo-section p { color: var(--muted); line-height: 1.75; max-width: 68ch; }
.step-list { list-style: none; margin-top: 8px; }
.step-list li {
  position: relative;
  padding: 10px 0 10px 26px;
  color: var(--muted);
  line-height: 1.6;
  border-top: 1px solid var(--line);
}
.step-list li:first-child { border-top: none; }
.step-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.step-list strong, .seo-section strong { color: var(--ink); font-weight: 700; }

/* --------------------------------------------------------------- Footer */
.site-footer {
  padding: 32px clamp(16px, 5vw, 64px);
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: .85rem;
  text-align: center;
  line-height: 1.8;
}
.site-footer a { color: var(--accent-dark); text-decoration: none; font-weight: 600; }
.site-footer a:hover { text-decoration: underline; }

/* --------------------------------------------------------------- Responsive */
@media (max-width: 900px) {
  .tool-layout { grid-template-columns: 1fr; gap: 20px; }
  .sidebar { position: static; }
  .hero { padding: 48px 0 32px; }
  .seo-section { margin-top: 56px; }
  .faq-section { margin-top: 40px; }
}

@media (max-width: 600px) {
  .site-header { gap: 16px; min-height: 64px; }
  .page-wrapper { padding-bottom: 56px; }
  .editor-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .editor-container { padding: 14px; border-radius: 16px; }
  .related-grid { grid-template-columns: 1fr; }
  /* 16px inputs prevent iOS zoom */
  .styled-select, .styled-input { font-size: 16px; }
}

/* prefers-reduced-motion MUST end the stylesheet */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
