/* laousmail.com design language on top of the app shell.
   Cormorant Garamond carries the voice (screen titles), JetBrains Mono the labels
   and timecodes, Outfit everything else. Ember-to-gold pills for primary actions. */

@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/cormorant-garamond-600.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/cormorant-garamond-500-italic.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-500.woff2") format("woff2");
}

/* Form controls inherit Outfit instead of the browser's default face */
input,
select,
textarea,
button {
  font-family: inherit;
}

.lyrics-row-fields input,
.field textarea {
  font-family: var(--lyric);
}

/* ——— Brand: an eclipse, not a sun ——— */
.brand-mark {
  position: relative;
  background:
    radial-gradient(circle, var(--bg) 0 58%, transparent 61%),
    conic-gradient(from 210deg, var(--hot), var(--gold), #ffe2b0, var(--gold), var(--hot));
  box-shadow:
    0 0 14px color-mix(in srgb, var(--hot) 55%, transparent),
    0 0 34px -6px color-mix(in srgb, var(--gold) 35%, transparent);
}

.brand-name {
  font-weight: 600;
  letter-spacing: -0.005em;
}

.brand-tag {
  font: 500 0.62rem/1.3 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ——— Screen heads ——— */
.screen-head h2,
.intro-card h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2.35rem;
  line-height: 1.02;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.screen-head-compact h2 {
  font-size: 1.95rem;
}

.intro-card h2 {
  font-size: 2rem;
}

.eyebrow,
.subhead,
.sheet-lang-label {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
}

.screen-lead {
  font-size: 1rem;
  line-height: 1.55;
  max-width: 38ch;
}

/* ——— Buttons: gradient pill with a passing sheen, as on laousmail.com ——— */
.btn-fill {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--grad);
  color: var(--on);
  box-shadow: 0 10px 28px -12px color-mix(in srgb, var(--hot) 70%, transparent);
}

.btn-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.4) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
  pointer-events: none;
}

@media (hover: hover) {
  .btn-fill:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px -10px color-mix(in srgb, var(--hot) 75%, transparent);
  }

  .btn-fill:hover:not(:disabled)::after {
    transform: translateX(120%);
  }

  .btn-ghost:hover:not(:disabled) {
    box-shadow: inset 0 0 0 1.5px var(--gold);
  }
}

/* ——— Labels, chips, timecodes ——— */
.status-pill {
  padding: 0;
  border: 0;
  background: none;
  font: 400 0.75rem/1.4 var(--mono);
  letter-spacing: 0.04em;
}

/* The loaded card already shows file + duration */
body.audio-ready #audio-status {
  display: none;
}

.progress-chip,
.offset-chip,
.time-display,
.project-progress,
#video-scrub-time,
#loaded-duration {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.project-progress {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.simple-more > summary {
  font: 500 0.7rem/1.4 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.8rem 0.15rem;
}

.simple-more > summary::after,
.simple-more[open] > summary::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-top: 0.2rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--dur) var(--ease);
}

.simple-more[open] > summary::after {
  transform: rotate(45deg);
}

.simple-more[open] > summary {
  color: var(--ink);
}

/* ——— Sync: "Export subtitles" appears once every line is timed ——— */
.sync-head-row {
  align-items: center;
  flex-wrap: wrap;
}

.sync-head-row > div:first-child {
  flex: 1 1 auto;
}

.sync-export {
  min-height: 2.4rem;
  padding: 0 1rem;
  font-size: 0.85rem;
}

/* ——— Film: preview stage takes the output's exact shape ———
   Width is the smaller of the column and (height cap × ratio), so wide ratios
   shrink to fit instead of being squashed. --ar / --arn are set by js/video.js. */
.video-stage {
  --stage-h: min(55vh, 34rem);
  aspect-ratio: var(--ar, 9 / 16);
  width: min(100%, calc(var(--stage-h) * var(--arn, 0.5625)));
  height: auto;
  max-height: none;
  transition: width var(--dur-slow) var(--ease);
}

.video-stage-compact {
  --stage-h: min(30vh, 22rem);
}

/* Only the preview + scrubber stay pinned; solid so options never show through */
.film-sticky {
  background: var(--bg);
}

/* Ratio picker: small shapes you can read at a glance */
.ratio-seg {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.25rem;
  margin: 0 auto 0.4rem;
  max-width: 26rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg2);
}

.ratio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0 0.5rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  color: var(--mute);
  font: 500 0.78rem var(--mono);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.ratio-btn[aria-checked="true"] {
  background: var(--ink);
  color: var(--bg);
}

.ratio-shape {
  display: block;
  height: 1rem;
  aspect-ratio: var(--ar);
  max-width: 1.6rem;
  border: 1.5px solid currentColor;
  border-radius: 3px;
}

.ratio-use {
  margin: 0 0 0.55rem;
  text-align: center;
  font: 400 0.68rem/1.4 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.film-scrub-field {
  background: none;
  border: 0;
  padding: 0;
}

.film-scrub-meta {
  flex-wrap: nowrap;
}

.film-scrub-meta .slider-short {
  display: none;
}

.film-scrub-meta .field-inline {
  flex-direction: row;
}

#video-scrub-time {
  font-size: 0.8rem;
  color: var(--mute);
}

/* ——— Toast never sits on top of a screen tip ——— */
body:has(#screen-tip:not([hidden])) .toast {
  bottom: calc(var(--tabbar-h) + var(--safe-b) + var(--kb-inset, 0px) + 5.25rem);
}

body.dock-on:has(#screen-tip:not([hidden])) .toast {
  bottom: calc(var(--tabbar-h) + var(--dock-h) + var(--safe-b) + var(--kb-inset, 0px) + 5rem);
}

@media (prefers-reduced-motion: reduce) {
  .btn-fill::after {
    display: none;
  }

  .btn-fill:hover:not(:disabled) {
    transform: none;
  }
}

/* Once complete, the Export button takes the progress chip's place (the dock still says "All lines timed") */
.sync-head-row:has(#btn-sync-export:not([hidden])) .progress-chip {
  display: none;
}

.sync-head-row:has(#btn-sync-export:not([hidden])) {
  flex-wrap: nowrap;
}

/* Range sliders must not pick up the text-field box */
.field input[type="range"],
input[type="range"] {
  min-height: var(--touch);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  appearance: auto;
  -webkit-appearance: auto;
  accent-color: var(--hot);
}

/* ——— Film layout: phones stack everything (wrappers are transparent so the preview
   stays pinned while you scroll the options); wide screens get two columns ——— */
.film-main,
.film-side {
  display: contents;
}

@media (min-width: 1024px) {
  #screen-video.is-active {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(20rem, 28rem);
    column-gap: 2rem;
    align-items: start;
  }

  #screen-video > .screen-head {
    grid-column: 1 / -1;
  }

  #screen-video .film-main {
    display: block;
    position: sticky;
    top: 0.5rem;
  }

  #screen-video .film-side {
    display: block;
  }

  #screen-video .film-sticky {
    position: static;
    width: min(100%, 58rem);
    margin-inline: auto;
  }

  #screen-video .film-output {
    margin-top: 0;
  }

  #screen-video .video-stage-compact {
    --stage-h: min(52vh, 40rem);
  }
}

/* The toast lets taps through, except on its button (Undo, Export…) */
.toast.is-on .toast-action {
  pointer-events: auto;
}

/* ——— Film: Full video / Lyrics only ——— */
.film-output {
  display: grid;
  gap: 0.6rem;
  margin: 0.25rem 0 0.9rem;
}

.output-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg2);
}

.output-btn {
  min-height: 2.6rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  color: var(--mute);
  font: 600 0.9rem var(--sans);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.output-btn[aria-checked="true"] {
  background: var(--ink);
  color: var(--bg);
}

.overlay-options {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.overlay-options[hidden] {
  display: none;
}

.overlay-lead {
  padding: 0;
  margin-bottom: 0.15rem;
  color: var(--mute);
  font-size: var(--fs-sm);
}

.overlay-choice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--touch-lg);
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg2);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.overlay-choice input {
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--hot);
}

.overlay-choice span {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.overlay-choice b {
  font-weight: 600;
  color: var(--ink);
}

.overlay-choice small {
  font: 400 0.72rem/1.4 var(--mono);
  color: var(--mute);
}

.overlay-choice:has(input:checked) {
  border-color: color-mix(in srgb, var(--hot) 70%, var(--line));
  background: color-mix(in srgb, var(--hot) 8%, var(--bg2));
}

.overlay-choice.is-unavailable {
  opacity: 0.45;
  cursor: not-allowed;
}

.overlay-howto {
  margin: 0.1rem 0 0;
  color: var(--mute);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

/* Preview of a transparent overlay: a checkerboard behind the text */
.video-stage[data-overlay="transparent"] {
  background-color: #1b1714;
  background-image:
    linear-gradient(45deg, #2a2420 25%, transparent 25%),
    linear-gradient(-45deg, #2a2420 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2420 75%),
    linear-gradient(-45deg, transparent 75%, #2a2420 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

/* Export: where the .srt goes in each editor */
.editor-card {
  display: grid;
  gap: 0.6rem;
}

.editor-list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.editor-list li {
  display: grid;
  gap: 0.1rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg2);
  font-size: var(--fs-sm);
  color: var(--mute);
}

.editor-list b {
  font-weight: 600;
  color: var(--ink);
}

/* Links styled as menu rows / cards (EclipseTone studio link) */
a.sheet-row {
  display: flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.sheet-row-studio {
  color: var(--gold);
}

.studio-card {
  display: grid;
  gap: 0.6rem;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--gold) 30%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--gold) 5%, var(--bg2));
}

.studio-card .btn {
  justify-self: start;
}
