/* subthis — caption-file design system. RTL-safe: logical properties only;
   anything terminal/code/timecode is pinned dir=ltr in the markup. */

:root {
  --bg: #14161d;
  --surface: #1d2129;
  --surface-2: #232836;
  --line: #2e3442;
  --text: #eae8e1;
  --muted: #9aa0ad;
  --caption: #ffd75e;      /* broadcast subtitle yellow */
  --caption-ink: #14161d;
  --link: #8ad8cf;
  --ok: #7ee08a;
  --bad: #ff7a76;
  --warn: #ffc46b;
  --radius: 10px;
  --font-display: "Suez One", "Rubik", serif;
  --font-body: "Rubik", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "Consolas", monospace;
  --display-weight: 400;
}
/* Hebrew pages: Rubik for titles, Heebo for running text */
html[lang="he"] {
  --font-display: "Rubik", "Heebo", "Segoe UI", system-ui, sans-serif;
  --font-body: "Heebo", "Rubik", "Segoe UI", system-ui, sans-serif;
  --display-weight: 700;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--caption); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: 1040px; margin-inline: auto; padding-inline: 24px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-block-end: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 24px;
  padding-block: 9px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-size: 1.35rem; color: var(--text);
}
.logo:hover { text-decoration: none; }
.logo .mark { width: 44px; height: 44px; display: block; }
.site-nav { display: flex; align-items: center; gap: 20px; margin-inline-start: auto; }
.site-nav a { color: var(--muted); font-size: .95rem; }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.lang-switch {
  display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden;
  font-size: .85rem;
}
.lang-switch a { padding: 4px 12px; color: var(--muted); }
.lang-switch a:hover { text-decoration: none; color: var(--text); }
.lang-switch .active { background: var(--caption); color: var(--caption-ink); font-weight: 500; }
@media (max-width: 640px) {
  .site-header .wrap { flex-wrap: wrap; gap: 8px 16px; row-gap: 6px; }
  .site-nav { gap: 14px; flex-wrap: wrap; margin-inline-start: 0; flex-basis: 100%; }
  .site-nav a { font-size: .9rem; }
  .logo { font-size: 1.2rem; }
  .logo .mark { width: 36px; height: 36px; }
}

/* ---------- hero: the caption player ---------- */
.hero { padding-block: 64px; text-align: center; }
.kaps-mock {
  margin-inline: auto; max-width: 880px; text-align: start;
  background: #0b1020; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  font-family: var(--font-body);
}
.kaps-mock .term-bar { background: #151a2a; }
.kp-logo {
  margin-inline-start: auto; background: #fff; border-radius: 6px; padding: 3px 8px;
  display: inline-flex; align-items: center;
}
.kp-logo img { height: 22px; width: auto; display: block; }
.kp-body { padding: 26px 24px 24px; text-align: center; }
.kp-title { margin: 0; font-size: 1.25rem; font-weight: 600; color: #f4f6fb; }
.kp-toggle { margin: 10px 0 20px; }
.kp-pill {
  display: inline-block; font-size: .8rem; color: #c7cde0;
  border: 1px solid #2a3350; border-radius: 999px; padding: 3px 12px;
}
.kp-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; text-align: start; }
.kp-card {
  background: #121a2f; border: 1px solid #222c48; border-radius: 16px; padding: 18px 18px 14px;
  display: flex; flex-direction: column; gap: 6px; color: #e6e9f2;
}
.kp-card.featured { background: #2f5cff; border-color: #2f5cff; color: #fff; }
.kp-card h3 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.kp-emoji { font-size: 1.05em; }
.kp-price { margin: 4px 0 0; font-size: 1.55rem; font-weight: 700; line-height: 1.2; }
.kp-price s { font-size: .8rem; font-weight: 400; opacity: .55; margin-inline-start: 6px; }
.kp-note { margin: 0; font-size: .78rem; font-weight: 600; opacity: .85; }
.kp-mins { margin: 8px 0 0; font-size: .85rem; opacity: .8; }
.kp-btn {
  margin-block: 12px 8px; text-align: center; font-size: .9rem; font-weight: 500;
  border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 8px 14px;
}
.kp-card.featured .kp-btn { background: #fff; color: #2f5cff; border-color: #fff; }
.kp-price-row { position: relative; }
.kp-tag {
  position: absolute; inset-inline-end: -6px; inset-block-start: -12px;
  display: flex; flex-direction: column; align-items: center; line-height: 1.05;
  background: var(--caption); color: var(--caption-ink);
  padding: 5px 12px 6px; border-radius: 8px;
  box-shadow: 0 8px 22px rgba(0,0,0,.45), 0 0 0 2px rgba(0,0,0,.25);
  font-family: var(--font-display); font-weight: var(--display-weight);
  transform: rotate(-7deg);
  pointer-events: none;
}
[dir="rtl"] .kp-tag { transform: rotate(7deg); }
.kp-tag small { font-family: var(--font-body); font-size: .68rem; font-weight: 500; opacity: .8; }
.kp-tag b { font-size: 1.15rem; font-weight: inherit; }
.kp-amount { position: relative; opacity: .55; }
.kp-amount::after {
  content: ""; position: absolute; inset-inline: -3px; top: 52%; height: 3px;
  background: var(--bad); border-radius: 2px;
}
.kp-price s { display: none; }
@media (max-width: 720px) {
  .kp-cards { grid-template-columns: 1fr; }
  .kp-card.featured { order: -1; }
  .kp-body { padding: 20px 14px 16px; }
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.2;
  margin-block: 0 36px;
  font-weight: var(--display-weight);
}
.hero h1 mark { background: var(--caption); color: var(--caption-ink); border-radius: 6px; padding-inline: 10px; }
.hero .sub { color: var(--muted); max-width: 620px; margin-inline: auto; margin-block-start: 40px; font-size: 1.1rem; }
.hero .cta-row { display: flex; gap: 14px; justify-content: center; margin-block-start: 30px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 12px 26px; border-radius: 8px;
  font-weight: 500; font-size: 1rem; border: 1px solid var(--line);
  color: var(--text); background: var(--surface);
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn.primary { background: var(--caption); color: var(--caption-ink); border-color: var(--caption); }
.btn.primary:hover { filter: brightness(1.06); }
.hero .badges { margin-block-start: 26px; color: var(--muted); font-size: .88rem; letter-spacing: .04em; }

/* ---------- SRT-numbered sections ---------- */
section.block { padding-block: 64px; border-block-start: 1px solid var(--line); }
.cue-label {
  font-family: var(--font-mono); font-size: .8rem; color: var(--muted);
  display: flex; gap: 14px; margin-block-end: 10px;
}
.cue-label .n { color: var(--caption); }
h2 {
  font-family: var(--font-display); font-weight: var(--display-weight);
  font-size: clamp(1.5rem, 3vw, 2.1rem); margin-block: 0 14px;
}
.block > .wrap > p.lede { color: var(--muted); max-width: 640px; margin-block-start: 0; }

/* ---------- terminal frames ---------- */
.term {
  background: #101319;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: .88rem;
  line-height: 1.6;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.term-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.term-bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--line); display: inline-block; }
.term-bar i:nth-child(1) { background: #ff5f57; } .term-bar i:nth-child(2) { background: #febc2e; } .term-bar i:nth-child(3) { background: #28c840; }
.term-bar span { margin-inline-start: 8px; color: var(--muted); font-size: .78rem; font-family: var(--font-body); }
.term pre {
  margin: 0; padding: 18px 20px; overflow-x: auto;
  white-space: pre; color: #d6d9e0;
}
/* terminal + code are always LTR, even on the Hebrew pages */
.term pre, pre.code, code, .kbd, .cue-label { direction: ltr; text-align: left; unicode-bidi: isolate; }
.term .ok { color: var(--ok); } .term .bad { color: var(--bad); } .term .warn { color: var(--warn); }
.term .dim { color: var(--muted); } .term .yel { color: var(--caption); } .term .cyn { color: var(--link); }
.term .prompt { color: var(--ok); }
.term .cursor { display: inline-block; width: .55em; height: 1em; background: var(--caption); vertical-align: -.2em; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- demo scene: drag file -> terminal -> srt -> editor ---------- */
.scene {
  position: relative; display: grid; grid-template-columns: 150px 1fr 1fr; gap: 16px; align-items: stretch;
  direction: ltr; text-align: left;
}
.shelf { display: flex; flex-direction: column; gap: 12px; }
.file {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: .74rem; color: var(--muted);
  transition: transform .2s ease, opacity .25s ease, border-color .2s ease;
}
.file .ic { width: 30px; height: 30px; color: var(--text); stroke-width: 1.6; }
.file.srt .ic { color: var(--caption); }
.file.srt { opacity: 0; transform: scale(.6); }
.file.srt.on { opacity: 1; transform: none; }
.file.grab { transform: scale(.94); border-color: var(--caption); }
.scene .term { box-shadow: none; min-width: 0; }
.scene .term pre { font-size: .84rem; padding: 14px 16px; }
.editor { background: #0f1218; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.ed-preview {
  position: relative; flex: 1; min-height: 96px; margin: 12px 12px 8px;
  background: radial-gradient(120% 90% at 50% 0%, #2a3350 0%, #1a2033 55%, #12161f 100%);
  border-radius: 6px; border: 1px solid var(--line);
}
.ed-caption {
  position: absolute; inset-inline: 10px; bottom: 8px; margin-inline: auto; width: max-content; max-width: calc(100% - 20px);
  background: rgba(0,0,0,.82); color: var(--caption); font-family: var(--font-display); font-weight: var(--display-weight);
  font-size: .85rem; padding: 2px 10px 4px; border-radius: 4px; text-align: center;
  opacity: 0; transform: translateY(4px); transition: opacity .25s ease, transform .25s ease;
}
.ed-caption.on { opacity: 1; transform: none; }
.ed-tracks { padding: 0 12px 12px; display: grid; gap: 5px; }
.ed-track { position: relative; height: 18px; background: #161b26; border-radius: 4px; padding-left: 34px; }
.ed-label { position: absolute; left: 6px; top: 0; line-height: 18px; font-family: var(--font-mono); font-size: .62rem; color: var(--muted); }
.ed-clip { position: absolute; left: 34px; right: 6px; top: 3px; bottom: 3px; border-radius: 3px; }
.ed-clip.video { background: linear-gradient(90deg, #3b5bdb, #5c7cfa); }
.ed-clip.audio { background: repeating-linear-gradient(90deg, #2f9e44 0 2px, #1f6b2f 2px 4px); opacity: .8; }
.ed-track.subs { border: 1px dashed color-mix(in srgb, var(--caption) 40%, transparent); background: #12151d; transition: border-color .2s ease, background .2s ease; }
.ed-track.subs.over { border-color: var(--caption); background: color-mix(in srgb, var(--caption) 12%, #12151d); }
.ed-cue { position: absolute; top: 3px; bottom: 3px; background: var(--caption); border-radius: 2px; transform: scaleY(0); transition: transform .18s ease; }
.ed-cue.on { transform: none; }
.pointer, .drag-ghost { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; will-change: transform; }
.pointer { width: 22px; height: 22px; opacity: 0; transition: transform .6s cubic-bezier(.4,0,.2,1), opacity .2s ease; }
.pointer.on { opacity: 1; }
.pointer.press { transform-origin: 5px 3px; }
.pointer svg { width: 100%; height: 100%; fill: #fff; stroke: #000; stroke-width: 1.2; stroke-linejoin: round; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }
.drag-ghost {
  padding: 4px 9px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--caption);
  font-family: var(--font-mono); font-size: .72rem; color: var(--text); white-space: nowrap;
  opacity: 0; transition: transform .6s cubic-bezier(.4,0,.2,1), opacity .15s ease; box-shadow: 0 8px 20px rgba(0,0,0,.5);
}
.drag-ghost.on { opacity: .95; }
.nle-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin: 18px 0 0; color: var(--muted); font-size: .92rem; }
.nle { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 500; }
.nle img { display: block; border-radius: 5px; }
/* tablets: shelf becomes a row on top, terminal and editor side by side */
@media (max-width: 1000px) {
  .scene { grid-template-columns: 1fr 1fr; }
  .shelf { grid-column: 1 / -1; flex-direction: row; }
  .file { flex: 0 1 170px; }
}
/* phones: everything stacks; the cursor still travels between the panels */
@media (max-width: 640px) {
  .scene { grid-template-columns: 1fr; gap: 12px; }
  .file { flex: 1 1 0; padding-block: 10px 8px; }
  .scene .term pre { font-size: .78rem; }
  .ed-preview { min-height: 84px; }
}

/* ---------- install tabs ---------- */
.os-note { color: var(--muted); font-size: .92rem; margin-block-end: 14px; }
.os-note strong { color: var(--caption); font-weight: 500; }
.tabs { display: flex; gap: 8px; margin-block-end: 18px; flex-wrap: wrap; }
.tabs button {
  font: inherit; font-size: .95rem; cursor: pointer;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 20px;
}
.tabs button[aria-selected="true"] { background: var(--caption); color: var(--caption-ink); border-color: var(--caption); font-weight: 500; }
.os-pane[hidden] { display: none; }
.steps {
  counter-reset: step; list-style: none; margin: 0; padding: 0;
  max-width: 680px;
}
.steps > li {
  display: grid; grid-template-columns: 26px 1fr; column-gap: 14px;
  padding-block: 16px; border-block-start: 1px solid var(--line);
}
.steps > li:first-child { border-block-start: 0; padding-block-start: 4px; }
.steps > li > * { grid-column: 2; min-width: 0; }
.steps > li::before {
  counter-increment: step; content: counter(step);
  grid-column: 1; grid-row: 1; margin-block-start: 1px;
  background: var(--caption); color: var(--caption-ink);
  font-family: var(--font-mono); font-weight: 600; font-size: .8rem;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.steps h3 { margin: 0; font-size: 1.02rem; font-weight: 500; line-height: 26px; }
html[lang="he"] .steps h3, html[lang="he"] .doc-body h3 { font-family: var(--font-display); font-weight: 600; }
.steps p { margin: 6px 0 0; color: var(--muted); font-size: .92rem; }
.steps .step-cta { justify-self: start; margin-block-start: 14px; padding: 14px 26px; font-size: 1.05rem; }
pre.code {
  background: #101319; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; overflow-x: auto; margin-block: 10px 0;
  font-family: var(--font-mono); font-size: .86rem; line-height: 1.55; color: #d6d9e0;
}
/* code is LTR everywhere, so the copy button always sits at the physical right,
   and the pre reserves room for it so long commands never slide underneath. */
.copy-wrap { position: relative; direction: ltr; }
.copy-wrap > pre.code { padding-right: 48px; }
.copy-btn {
  position: absolute; top: 6px; right: 6px;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; cursor: pointer;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px;
}
.copy-btn:hover { color: var(--text); border-color: var(--muted); }
.copy-btn .ic { width: 15px; height: 15px; }
.copy-btn .ic-check { display: none; }
.copy-btn.done { color: var(--caption-ink); background: var(--caption); border-color: var(--caption); }
.copy-btn.done .ic-copy { display: none; }
.copy-btn.done .ic-check { display: block; }

/* ---------- icons (Lucide, inline sprite per page) ---------- */
.ic {
  width: 1em; height: 1em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -.15em;
}
.btn { display: inline-flex; align-items: center; gap: 8px; }
.btn .ic { width: 1.05em; height: 1.05em; }
.ic-ext { width: .8em; height: .8em; margin-inline-start: 3px; opacity: .7; vertical-align: 0; }
a:hover .ic-ext { opacity: 1; }
[dir="rtl"] .ic-ext { transform: scaleX(-1); }

/* ---------- price comparison ---------- */
.price-table {
  border-collapse: separate; border-spacing: 0; width: 100%; font-size: .95rem; margin-block: 18px 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.price-table th, .price-table td { padding: 13px 16px; text-align: start; border-block-start: 1px solid var(--line); }
.price-table thead th {
  border-block-start: 0; background: var(--surface-2); color: var(--muted);
  font-weight: 500; font-size: .85rem;
}
.price-table th.tool { vertical-align: top; white-space: nowrap; padding-block-start: 14px; }
.price-table tbody tr:not(:has(th.tool)) td { border-block-start-color: color-mix(in srgb, var(--line) 50%, transparent); }
.tool-chip { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); }
.tool-chip img { width: 28px; height: 28px; border-radius: 7px; display: block; }
.price-table td.price { white-space: nowrap; }
.price-table td.ours {
  color: var(--caption); font-family: var(--font-mono); font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--caption) 7%, var(--surface));
  border-inline-start: 1px solid color-mix(in srgb, var(--caption) 25%, var(--line));
}
.price-table thead th:last-child { color: var(--caption); background: color-mix(in srgb, var(--caption) 10%, var(--surface-2)); }
.price-table td.ours small { font-family: var(--font-body); font-weight: 400; color: var(--muted); font-size: .8rem; }
.verdict {
  font-family: var(--font-display); font-weight: var(--display-weight);
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  margin-block: 22px 8px;
}
.verdict mark { background: var(--caption); color: var(--caption-ink); border-radius: 6px; padding-inline: 8px; }
.footnote { color: var(--muted); font-size: .8rem; max-width: 760px; }

/* RTL: the SRT cue label keeps LTR content but sits at the reading start edge */
[dir="rtl"] .cue-label { justify-content: flex-end; }

/* ---------- reveal animation (translateY only: direction-safe) ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .55s ease, transform .55s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* ---------- docs ---------- */
.docs-layout { display: grid; grid-template-columns: 240px 1fr; gap: 48px; padding-block: 48px; }
.toc { position: sticky; top: 84px; align-self: start; font-size: .92rem; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc a {
  display: block; color: var(--muted); padding: 6px 12px; border-radius: 6px;
  border-inline-start: 2px solid transparent;
}
.toc a:hover { color: var(--text); text-decoration: none; background: var(--surface); }
.toc a.here { color: var(--caption); border-inline-start-color: var(--caption); }
.toc .toc-num { font-family: var(--font-mono); font-size: .78rem; margin-inline-end: 8px; color: var(--caption); }
.doc-body { min-width: 0; max-width: 720px; }
@media (max-width: 860px) {
  .docs-layout { grid-template-columns: 1fr; gap: 28px; padding-block: 28px; }
  .toc { position: static; top: auto; }
  .toc ol { display: flex; flex-wrap: wrap; gap: 6px; }
  .toc a { border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: .88rem; }
  .toc a.here { border-color: var(--caption); background: color-mix(in srgb, var(--caption) 12%, transparent); }
  .toc .toc-num { margin-inline-end: 5px; }
}
.doc-body h1 { font-family: var(--font-display); font-weight: var(--display-weight); font-size: 2.2rem; margin-block: 0 8px; }
.doc-body .lede { color: var(--muted); margin-block-start: 0; }
.doc-body section { padding-block: 34px; border-block-end: 1px solid var(--line); }
.doc-body h2 { scroll-margin-top: 90px; }
.doc-body h3 { font-size: 1.05rem; font-weight: 500; margin-block: 26px 8px; }
.doc-body .term { margin-block: 10px 12px; box-shadow: none; font-size: .82rem; }
.doc-body h4 { font-family: var(--font-mono); font-size: .95rem; font-weight: 600; color: var(--caption); margin-block: 26px 6px; }
[dir="rtl"] .doc-body h4 { text-align: left; }
.doc-body .term pre { padding: 14px 16px; }
.doc-body table { border-collapse: collapse; width: 100%; font-size: .92rem; margin-block: 12px; }
.doc-body th, .doc-body td { border: 1px solid var(--line); padding: 8px 12px; text-align: start; vertical-align: top; }
.doc-body th { background: var(--surface); font-weight: 500; }
.doc-body td code, .doc-body p code, .doc-body li code {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 6px; font-size: .85em;
}
.callout {
  border-inline-start: 3px solid var(--caption); background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0; padding: 12px 16px; margin-block: 14px;
  font-size: .95rem;
}
[dir="rtl"] .callout { border-radius: var(--radius) 0 0 var(--radius); }

/* ---------- footer ---------- */
.site-footer { border-block-start: 1px solid var(--line); padding-block: 36px; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; }
.site-footer .spacer { margin-inline-start: auto; }
