/* Lectura Voice — style.css */

:root {
  --c-bg: #fff;
  --c-bg-alt: #f7f7f5;
  --c-text: #1a1a1a;
  --c-text-light: #555;
  --c-accent: #2a5ea8;
  --c-accent-hover: #1d4580;
  --c-border: #ddd;
  --c-border-light: #eee;
  --c-chip-bg: #e8eff8;
  --c-chip-text: #2a5ea8;
  --c-ipa: #6b4c9a;
  --c-tag: #888;
  --c-highlight: #fef08a;
  --c-highlight-active: #facc15;
  --c-highlight-past: #e0e7ff;
  --ff-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ff-mono: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
  --max-w: 52rem;
  --gap: 1.5rem;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--ff-sans);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--c-accent-hover); }

/* Layout */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1rem; width: 100%; }

/* Header / Nav */
.site-header {
  background: var(--c-bg-alt);
  border-bottom: 1px solid var(--c-border);
  padding: 0.75rem 0;
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.site-logo {
  flex-shrink: 0;
}
.site-logo:hover { text-decoration: none; }
.site-logo-img { height: 2.2rem; display: block; }
.site-nav { display: flex; gap: 1rem; font-size: 0.9rem; flex: 1; justify-content: center; }
.site-nav a { color: var(--c-text-light); padding: 0.2rem 0.5rem; border-radius: 3px; }
.site-nav a:hover { color: var(--c-accent); text-decoration: none; }
.site-nav a.active { color: var(--c-accent); font-weight: 600; background: var(--c-chip-bg); }
.site-lectura {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--c-text-light);
  white-space: nowrap;
}
.site-lectura:hover { text-decoration: none; color: var(--c-accent); }
.site-lectura-img { height: 1.4rem; }

/* Main */
main { flex: 1; padding: var(--gap) 0 3rem; }

/* Footer */
.site-footer {
  background: var(--c-bg-alt);
  border-top: 1px solid var(--c-border);
  padding: 1.5rem 0;
  font-size: 0.85rem;
  color: var(--c-text-light);
  text-align: center;
}

/* Hero (accueil) */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}
.hero-logo { max-width: 28rem; width: 100%; height: auto; margin-bottom: 0.5rem; }
.hero h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.hero-subtitle { font-size: 1.3rem; font-weight: 600; color: var(--c-text); margin-bottom: 0.25rem; }
.hero p { color: var(--c-text-light); font-size: 1.05rem; margin-bottom: 1rem; }

/* Demo cards */
.demo-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}
.demo-card {
  display: block;
  padding: 1.5rem;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  color: var(--c-text);
  transition: border-color 0.15s;
}
.demo-card:hover { border-color: var(--c-accent); text-decoration: none; }
.demo-card h2 { font-size: 1.15rem; margin-bottom: 0.5rem; color: var(--c-accent); }
.demo-card p { font-size: 0.92rem; color: var(--c-text-light); margin-bottom: 0.5rem; }
.demo-card ul { font-size: 0.88rem; color: var(--c-text-light); margin-left: 1.2rem; margin-bottom: 0.75rem; }
.demo-card li { margin-bottom: 0.2rem; }
.demo-card-action {
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--c-accent);
}

/* Page title */
.page-title { font-size: 1.6rem; margin-bottom: 0.25rem; }
.page-subtitle { color: var(--c-text-light); font-size: 1rem; margin-bottom: var(--gap); }

/* Tab navigation */
.tab-nav {
  display: flex;
  gap: 0;
  margin-bottom: var(--gap);
  border-bottom: 2px solid var(--c-border);
}
.tab-btn {
  padding: 0.5rem 1.2rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid transparent;
  border-bottom: none;
  cursor: pointer;
  color: var(--c-text-light);
  background: none;
  border-radius: 4px 4px 0 0;
}
.tab-btn:hover { color: var(--c-accent); background: var(--c-bg-alt); }
.tab-btn.tab-active {
  color: var(--c-accent);
  border-color: var(--c-border);
  border-bottom: 2px solid var(--c-bg);
  margin-bottom: -2px;
  background: var(--c-bg);
  font-weight: 600;
}

/* Demo panel */
.demo-panel {
  background: var(--c-bg);
  border: 1px solid var(--c-border-light);
  border-radius: 6px;
  padding: 1.5rem;
}

/* Demo input */
.demo-input-group { margin-bottom: 1rem; }
.demo-input-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--c-text);
}
.demo-textarea {
  width: 100%;
  padding: 0.6rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  background: var(--c-bg);
  color: var(--c-text);
  resize: vertical;
  outline: none;
}
.demo-textarea:focus { border-color: var(--c-accent); box-shadow: 0 0 0 2px rgba(42,94,168,0.15); }

/* Demo controls */
.demo-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.control-group { display: flex; flex-direction: column; gap: 0.25rem; }
.control-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--c-text-light);
}
.control-actions { flex-direction: row; gap: 0.5rem; align-items: flex-end; }

.demo-select {
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  background: var(--c-bg);
  color: var(--c-text);
  outline: none;
}
.demo-select:focus { border-color: var(--c-accent); }

.demo-btn {
  padding: 0.5rem 1.2rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: none;
  border-radius: 4px;
  background: var(--c-accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
}
.demo-btn:hover { background: var(--c-accent-hover); }
.demo-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.demo-btn-secondary {
  background: var(--c-bg-alt);
  color: var(--c-text);
  border: 1px solid var(--c-border);
}
.demo-btn-secondary:hover { background: var(--c-border-light); }

/* Progress bar */
.progress-bar-container {
  height: 4px;
  background: var(--c-border-light);
  border-radius: 2px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--c-accent);
  border-radius: 2px;
  transition: width 0.1s linear;
}

/* Status */
.demo-status {
  font-size: 0.9rem;
  color: var(--c-text-light);
  margin-bottom: 0.75rem;
  min-height: 1.4em;
}
.demo-status.error { color: #c62828; }

/* Highlight zone */
.highlight-zone {
  background: var(--c-bg-alt);
  border: 1px solid var(--c-border-light);
  border-radius: 4px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  min-height: 3rem;
  font-size: 1.2rem;
  line-height: 2;
}
.highlight-placeholder {
  color: var(--c-text-light);
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1.5;
}
.hl-word {
  display: inline;
  padding: 0.15rem 0.25rem;
  border-radius: 3px;
  transition: background 0.1s;
  cursor: default;
}
.hl-active {
  background: var(--c-highlight-active);
  font-weight: 600;
}
.hl-past {
  background: var(--c-highlight-past);
}

/* Timings */
.timings-details {
  margin-top: 0.5rem;
}
.timings-details summary {
  font-size: 0.88rem;
  color: var(--c-text-light);
  cursor: pointer;
  padding: 0.3rem 0;
}
.timings-details summary:hover { color: var(--c-accent); }
.timings-table-wrap { max-height: 20rem; overflow-y: auto; margin-top: 0.5rem; }

/* Data table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table th, .data-table td {
  padding: 0.3rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--c-border-light);
}
.data-table th {
  font-weight: 600;
  background: var(--c-bg-alt);
  position: sticky;
  top: 0;
}
.data-table tbody tr:hover { background: #fafafa; }

/* Audio input */
.audio-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.file-name {
  font-size: 0.88rem;
  color: var(--c-text-light);
}
.record-status {
  font-size: 0.85rem;
  color: #c62828;
  font-weight: 500;
}

/* STT results */
.stt-results { margin-top: 1rem; }
.result-section { margin-bottom: 1rem; }
.result-section h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.3rem; }
.stt-output {
  background: var(--c-bg-alt);
  border: 1px solid var(--c-border-light);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  min-height: 2rem;
  word-break: break-word;
}
.stt-output.ipa {
  font-family: "Gentium Plus", "Charis SIL", "Noto Sans", "DejaVu Sans", var(--ff-sans);
  color: var(--c-ipa);
}

/* IPA */
.ipa {
  font-family: "Gentium Plus", "Charis SIL", "Noto Sans", "DejaVu Sans", var(--ff-sans);
  color: var(--c-ipa);
}

/* Placeholder panel */
.placeholder-panel {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--c-text-light);
}
.placeholder-panel pre {
  text-align: left;
  display: inline-block;
  background: var(--c-bg-alt);
  border: 1px solid var(--c-border-light);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  font-family: var(--ff-mono);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* 404 */
.page-404 { text-align: center; padding: 4rem 0; }
.page-404 h1 { font-size: 4rem; color: var(--c-border); }
.page-404 p { font-size: 1.1rem; color: var(--c-text-light); margin: 1rem 0; }

/* Responsive */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.5rem; }
  .demo-cards { grid-template-columns: 1fr; }
  .demo-controls { flex-direction: column; align-items: stretch; }
  .control-actions { flex-direction: row; }
  .tab-nav { overflow-x: auto; }
  .highlight-zone { font-size: 1rem; }
  .audio-input-row { flex-direction: column; align-items: stretch; }
}

/* Print */
@media print {
  .site-header, .site-footer, .demo-controls, .tab-nav, .progress-bar-container { display: none; }
  body { font-size: 11pt; color: #000; }
  a { color: #000; text-decoration: underline; }
  .container { max-width: 100%; }
}
