/*
 * Colors align with styles/styles.css design tokens (heritage rust / gold / parchment).
 * We do not import styles.css here — it sets body { display: none } until the main app adds .appear.
 */
:root {
  color-scheme: light;

  /* Heritage palette — same hex as styles/styles.css */
  --color-rust: #a14f2b;
  --color-gold: #c5a059;
  --color-parchment: #f5f2ed;
  --color-ink: #1a1a1a;
  --color-rust-bright: #d16a3e;
  --color-gray-200: #d3d3d3;
  --color-gray-300: #b5b5b5;
  --color-gray-400: #999;
  --color-gray-600: #636363;
  --ink: var(--color-ink);
  --muted: var(--color-gray-600);
  --line: rgb(161 79 43 / 12%);
  --surface: #fff;
  --canvas: var(--color-parchment);
  --accent: var(--color-rust);
  --accent-hover: var(--color-rust-bright);
  --accent-soft: rgb(161 79 43 / 10%);
  --gradient-brand: linear-gradient(135deg, var(--color-rust) 0%, var(--color-gold) 100%);
  --shadow-rust: 0 4px 16px rgb(161 79 43 / 28%);
  --radius: 12px;
  --radius-sm: 8px;

  /* Spacing scale */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.25rem;
  --s-6: 1.5rem;
  --s-8: 2rem;
  --s-10: 2.5rem;
}

* {
  box-sizing: border-box;
}

::selection {
  background: rgb(161 79 43 / 20%);
  color: inherit;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: montserrat, "Trebuchet MS", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-rust);
  text-decoration: none;
}

a:hover {
  color: var(--color-gold);
  text-decoration: underline;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.4;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ——— Shell: full width with sensible side padding ——— */
.presenter-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: min(1180px, 100vw - 2 * var(--s-8));
  margin: 0 auto;
  padding: var(--s-6) var(--s-6) var(--s-8);
}

/* ——— Header ——— */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-6);
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--line);
}

.topbar-brand {
  min-width: 0;
}

.topbar-title {
  margin: 0 0 var(--s-2);
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.25;
}

.topbar-subtitle {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--muted);
  max-width: 42rem;
}

.topbar-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-4);
  flex-shrink: 0;
  padding-top: var(--s-1);
}

.topbar-da-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.topbar-da-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.topbar-da-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topbar-new-da {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1;
}

.topbar-edit-da-icon {
  display: block;
  flex-shrink: 0;
}

.topbar-change-url {
  padding: var(--s-2) var(--s-3);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.topbar-change-url:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.step-badge {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.step-badge-num {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}

.step-badge-of {
  font-size: 0.8125rem;
}

.step-badge-total {
  font-weight: 600;
  color: var(--ink);
}

.progress-track {
  height: 4px;
  margin-bottom: var(--s-6);
  border-radius: 999px;
  background: rgb(161 79 43 / 10%);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--gradient-brand);
  transition: width 0.2s ease;
}

/* ——— Slide row: nav | card | nav ——— */
.slide-area {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: space-between;
  gap: clamp(var(--s-4), 2vw, var(--s-6));
  min-height: min(60vh, 640px);
  padding-bottom: var(--s-4);
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  flex-shrink: 0;
  width: 48px;
  min-width: 48px;
  height: 104px;
  margin-top: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 2rem;
  line-height: 1;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
}

.nav-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: var(--shadow-rust);
}

.slide-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 0;
}

/* Cover slide: vertically center the card in the slide row (same min-height as other slides). */
.slide-main:has(.slide-card-title) {
  justify-content: center;
}

/* ——— Card: uses horizontal space; not a skinny column ——— */
.slide-card {
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  padding: var(--s-8) var(--s-8) var(--s-6);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow:
    0 1px 3px rgb(0 0 0 / 6%),
    0 4px 24px rgb(0 0 0 / 4%);
}

/* Opening slide: same footprint as content slides (fills slide row), title centered. */
.slide-card-title {
  min-height: min(52vh, 560px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-top: var(--s-10);
  padding-bottom: var(--s-10);
}

.slide-header {
  margin-bottom: var(--s-6);
}

.slide-label {
  margin: 0 0 var(--s-3);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.slide-title {
  margin: 0;
  font-size: clamp(1.375rem, 2.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
}

.slide-card-title .slide-header {
  margin-bottom: var(--s-6);
}

.slide-card-title .slide-title {
  font-size: clamp(1.5rem, 3.2vw, 2.125rem);
  max-width: 22ch;
  margin-inline: auto;
}

.slide-hint {
  margin: var(--s-8) 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.slide-card-title .slide-hint {
  margin-top: var(--s-8);
  margin-bottom: 0;
}

/* Key takeaway — bottom summary after body + links */
.slide-takeaway {
  margin-top: var(--s-6);
  margin-bottom: 0;
  padding: var(--s-5) var(--s-6);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--accent);
}

.takeaway-label {
  display: block;
  margin-bottom: var(--s-2);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-rust);
}

.takeaway-text {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
}

.slide-lead {
  margin: 0 0 var(--s-5);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--muted);
}

.slide-list {
  margin: 0 0 var(--s-6);
  padding-left: 1.25rem;
  line-height: 1.65;
}

.slide-list li {
  margin-bottom: var(--s-3);
  padding-left: var(--s-2);
}

.slide-list li:last-child {
  margin-bottom: 0;
}

.slide-block {
  margin-top: var(--s-6);
}

.slide-block:first-of-type {
  margin-top: 0;
}

.slide-block-title {
  margin: 0 0 var(--s-4);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.slide-block-links {
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}

.slide-block-links .slide-block-title {
  margin-bottom: var(--s-4);
}

.slide-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
}

.show-link,
.show-link-disabled {
  display: inline-flex;
  align-items: center;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

.show-link {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.show-link:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

.show-link-disabled {
  background: var(--color-gray-200);
  color: var(--muted);
  cursor: default;
}

.hint,
.link-url {
  display: none;
}

/* ——— Dots ——— */
.slide-dots {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: auto;
  padding-top: var(--s-6);
}

.slide-dots .dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border-radius: 50%;
  background: var(--color-gray-300);
  transition: background 0.15s ease, transform 0.15s ease;
}

.slide-dots .dot:hover:not(.is-active) {
  background: var(--color-gray-400);
}

.slide-dots .dot.is-active {
  background: var(--accent);
  transform: scale(1.15);
}

.placeholder-copy {
  margin: 0;
  color: var(--muted);
  text-align: center;
  padding: var(--s-8);
}

/* ——— Setup: URL entry ——— */
.presenter-setup {
  max-width: 36rem;
  margin: var(--s-10) auto;
  padding: var(--s-8);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 4px 24px rgb(0 0 0 / 6%);
}

.presenter-setup-title {
  margin: 0 0 var(--s-3);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}

.presenter-setup-lead {
  margin: 0 0 var(--s-6);
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.5;
}

.slides-url-label {
  display: block;
  margin-bottom: var(--s-2);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.slides-url-input {
  width: 100%;
  padding: var(--s-3) var(--s-4);
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--canvas);
  color: var(--ink);
}

.slides-url-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.slides-url-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-5);
}

.slides-url-new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-3) var(--s-6);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.slides-url-new:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.slides-url-new:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.slides-url-submit {
  padding: var(--s-3) var(--s-6);
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.slides-url-submit:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.link-like {
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  background: none;
  border: 0;
  cursor: pointer;
}

.presenter-error {
  max-width: 40rem;
  margin: var(--s-8) auto;
  padding: var(--s-6);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.presenter-error p {
  margin: 0 0 var(--s-3);
  line-height: 1.5;
}

.presenter-error-hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.presenter-error code {
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
}

.slide-card code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.875em;
  padding: 0.1em 0.35em;
  background: var(--accent-soft);
  border-radius: 4px;
  color: var(--color-rust);
}

/* ——— Breakpoints (600 / 900 / 1200) ——— */
@media (width <= 900px) {
  .presenter-shell {
    max-width: 100%;
    padding: var(--s-5) var(--s-5) var(--s-6);
  }

  .slide-card {
    padding: var(--s-6) var(--s-6) var(--s-5);
  }
}

@media (width <= 600px) {
  .presenter-shell {
    padding: var(--s-4) var(--s-4) var(--s-5);
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-meta {
    align-self: flex-start;
  }

  .slide-area {
    flex-direction: column;
    align-items: stretch;
    min-height: auto;
    gap: var(--s-4);
  }

  .nav-btn {
    width: 100%;
    height: 48px;
    margin-top: 0;
  }

  .slide-card {
    padding: var(--s-5);
  }

  .slide-card-title {
    min-height: min(42vh, 380px);
    padding-top: var(--s-8);
    padding-bottom: var(--s-8);
  }
}
