/* Standalone LinkedIn carousel builder. Own palette and layout: tools under
   /free-tools/ are self-contained pages (ADR 0003). */

:root {
  --bg: #ffffff;
  --text: #16181c;
  --muted: #5b6570;
  --border: #d7dce1;
  --chip-bg: #eef1f4;
  --accent: #0a66c2;
  --accent-contrast: #ffffff;
  --page: #f7f8fa;
  --warn: #8a5a00;
  --warn-bg: #fdf3e0;
  --danger: #b42318;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --text: #e7e9ea;
    --muted: #8b98a5;
    --border: #2f3336;
    --chip-bg: #1f2327;
    --accent: #378fe9;
    --accent-contrast: #0b0d0f;
    --page: #0c0e10;
    --warn: #e9b949;
    --warn-bg: #2c2413;
    --danger: #f28b82;
  }
}

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  line-height: 1.5;
}

.page-head {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 0.5rem;
}

.page-head .back {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.page-head .back:hover {
  color: var(--accent);
}

.page-head h1 {
  margin: 0.5rem 0 0;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

.tagline {
  max-width: 44rem;
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

main.layout {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 21rem);
  gap: 1.75rem;
  align-items: start;
}

.label {
  display: block;
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* --- Deck --------------------------------------------------------------- */

.deck-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}

.stats {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.dropzone {
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  padding: 2.25rem 1.25rem;
  margin-bottom: 1rem;
  border: 2px dashed var(--border);
  border-radius: 14px;
  background: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--accent);
  background: var(--chip-bg);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.dropzone:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Once there is a deck, the drop zone shrinks to a strip that no longer pushes
   the slides off the screen. */
.dropzone.is-compact {
  padding: 0.7rem 1rem;
  margin-bottom: 0.85rem;
  grid-template-columns: auto auto;
  justify-content: center;
  gap: 0.15rem 0.6rem;
}

.dropzone.is-compact .drop-title {
  font-size: 0.9rem;
}

.drop-title {
  font-weight: 600;
}

.drop-hint {
  font-size: 0.82rem;
  color: var(--muted);
}

.slides {
  --page-ratio: 4 / 5;
  --page-bg: #ffffff;
  --fit: cover;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.slide {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.frame {
  position: relative;
  aspect-ratio: var(--page-ratio);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--page-bg);
}

.frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: var(--fit);
}

.number {
  position: absolute;
  top: 0.3rem;
  left: 0.3rem;
  min-width: 1.4rem;
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.62);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.slide-name {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slide-note {
  margin: 0;
  font-size: 0.72rem;
  color: var(--warn);
}

.slide-actions {
  display: flex;
  gap: 0.25rem;
}

.slide-actions button {
  flex: 1;
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1;
  padding: 0.32rem 0;
  cursor: pointer;
}

.slide-actions button:hover:not(:disabled) {
  background: var(--chip-bg);
  border-color: var(--accent);
}

.slide-actions button:disabled {
  opacity: 0.4;
  cursor: default;
}

.slide-actions .remove:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--bg);
}

.failures {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.failure {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.7rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--danger);
  border-radius: 8px;
  background: var(--bg);
  font-size: 0.85rem;
}

.failure + .failure {
  margin-top: 0.5rem;
}

.failure .reason {
  flex: 1 1 12rem;
  color: var(--muted);
}

/* --- Settings ----------------------------------------------------------- */

.side {
  position: sticky;
  top: 1rem;
}

.settings {
  margin: 0;
  padding: 0.85rem 1rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.settings legend {
  padding: 0 0.35em;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.7rem;
}

.fields + .fields {
  margin-top: 0.7rem;
}

.fields label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
}

select,
input[type="text"] {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  min-width: 0;
}

input[type="color"] {
  width: 100%;
  height: 2.25rem;
  padding: 0.15rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
}

.settings-hint {
  margin: 0.8rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.5rem 1.15rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn:hover:not(:disabled) {
  filter: brightness(0.94);
}

.btn.quiet {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.quiet:hover:not(:disabled) {
  background: var(--chip-bg);
  filter: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.status {
  margin: 0.7rem 0 0;
  min-height: 1.2rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.warnings {
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
}

.warnings li {
  margin-top: 0.4rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 0.82rem;
}

/* --- FAQ ---------------------------------------------------------------- */

.faq {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.faq h2 {
  font-size: 1.05rem;
  margin: 0.5rem 0 0.75rem;
}

.faq details {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  padding: 0 1rem;
}

.faq details + details {
  margin-top: 0.6rem;
}

.faq summary {
  cursor: pointer;
  padding: 0.8rem 0;
  font-weight: 600;
}

.faq details p {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.92rem;
}

/* --- Focus and responsive ---------------------------------------------- */

select:focus-visible,
input:focus-visible,
button:focus-visible,
summary:focus-visible,
.dropzone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 52rem) {
  main.layout {
    grid-template-columns: 1fr;
  }

  .side {
    position: static;
    order: -1;
  }

  .fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .slides {
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  }
}
