/* /youtube-downloader/: helper states and the "why there's an app" diagram. The link form itself
   (.video-form, .detected, .log) lives in /style.css, shared with the local homepage downloader. */

:root { --yt: #e5322d; }

/* ---------- Helper panel states ---------- */

.helper-title { margin: 0 0 0.5rem; font-size: 1.35rem; letter-spacing: -0.02em; line-height: 1.15; }
.helper-block > p { max-width: 62ch; margin: 0 0 0.75rem; color: var(--ink-2); }
.helper-block a:not(.dl) { color: var(--accent); text-underline-offset: 3px; }
.helper-block .note { margin: 0.6rem 0 0; }
.helper-block .note b { color: var(--ink); }
.helper-block .actions { margin: 1.1rem 0 0.9rem; }
.helper-meta { font: 0.78rem var(--font-mono); }

a.dl-big { gap: 0.5rem; padding: 0.85rem 1.4rem; font-size: 1rem; }

.helper-state {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  color: var(--ink-2);
  font: 500 0.85rem var(--font-mono);
}
.helper-state.is-ok { color: var(--ok); }
.pulse { width: 0.55rem; height: 0.55rem; flex: none; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
.is-ok .pulse { animation: none; }
@keyframes pulse { 50% { opacity: 0.25; transform: scale(0.75); } }

/* "New version available": sits above the current state, highlighted but not alarming */
.helper-update {
  margin: 0 0 1.5rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid color-mix(in srgb, var(--hi) 55%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--hi) 9%, var(--card));
}
.helper-update > p { margin: 0 0 0.75rem; color: var(--ink-2); }
.helper-update .actions { margin: 0.25rem 0 0; }
.helper-update .helper-install { margin-bottom: 0; }

/* Install steps for the detected OS, right under the download button */
.helper-install { display: grid; gap: 1.25rem; max-width: 62ch; margin: 1.5rem 0 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.helper-install .os-label { margin: 0 0 0.6rem; color: var(--ink); font: 650 0.8rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }
/* Only one OS showing: its label adds nothing. */
.helper-install:has(> [data-os][hidden]) .os-label { display: none; }
.helper-steps { display: grid; gap: 0.85rem; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.helper-steps li { position: relative; padding-left: 2.4rem; color: var(--ink-2); counter-increment: step; }
.helper-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.05rem;
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
  color: var(--accent);
  font: 700 0.85rem var(--font-sans);
}
.helper-steps b { color: var(--ink); }
.helper-recheck { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; }
.helper-waiting { margin: 0; }
#helper-recheck-status:empty { display: none; }

.helper-ready-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.helper-ready-head button { padding: 0.5rem 0.9rem; font-size: 0.82rem; white-space: nowrap; }
.helper-link { margin-bottom: 0.5rem; }

.install-os { margin: 1.5rem 0 0.75rem; font-size: 1.05rem; letter-spacing: -0.01em; }

/* ---------- Diagram: a laptop running the page and the helper, YouTube beside it ----------
   Same mockup language as the homepage hero (home.css): card windows, traffic lights, soft deep
   shadows. Everything inside the screen is sized in cqi, so it scales like a picture. */

.flow-fig { margin: 0 0 1.5rem; }
.flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9.5rem 8.5rem;
  grid-template-areas:
    "srv . ."
    "pc  b yt";
  align-items: center;
  column-gap: 1rem;
  padding: clamp(1rem, 0.5rem + 2vw, 2.25rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(40rem 20rem at 20% 0%, color-mix(in srgb, var(--brand) 7%, transparent), transparent 70%),
    color-mix(in srgb, var(--field) 70%, var(--card));
  color: var(--ink);
}

/* inthetab.com's servers: present but out of the path */
.flow-srv { grid-area: srv; display: grid; justify-items: center; }
.srv-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.9rem;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  color: var(--ink-2);
  opacity: 0.8;
}
.srv-card .icon { width: 1.4rem; height: 1.4rem; }
.srv-card b { display: block; color: var(--ink-2); font-size: 0.82rem; }
.srv-card small { font: 0.68rem var(--font-mono); }
.cut { position: relative; display: grid; justify-items: center; height: 3rem; }
.cut-line { width: 0; height: 100%; border-left: 2px dashed var(--line); }
.cut-x {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink-2);
  font: 600 0.7rem/1 var(--font-sans);
  transform: translateY(-50%);
}
.cut-note { position: absolute; top: 50%; left: calc(50% + 1.2rem); color: var(--ink-2); font: 500 0.72rem var(--font-mono); white-space: nowrap; transform: translateY(-50%); }

/* Laptop */
:root { --alu: #d5d7e1; --alu-key: #b8bbca; --alu-lip: #a6a9b8; --bezel: #17181f; }
@media (prefers-color-scheme: dark) {
  :root { --alu: #3b3d50; --alu-key: #2a2c3b; --alu-lip: #2b2c39; --bezel: #07070b; }
}
.pc { grid-area: pc; display: grid; justify-items: center; padding-inline: 5%; filter: drop-shadow(0 30px 30px rgb(21 22 43 / 0.22)); }
.pc-screen {
  position: relative;
  width: 100%;
  padding: 1.6% 1.6% 2.4%;
  border-radius: 18px 18px 6px 6px;
  background: var(--bezel);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08);
}
.pc-screen::before { content: ""; position: absolute; top: 0.6%; left: 50%; width: 5px; height: 5px; border-radius: 50%; background: #2c2e3c; transform: translate(-50%, 50%); }
.pc-base { display: block; width: 112%; height: auto; margin-top: -1px; }
.deck { fill: var(--alu); }
.keys { fill: var(--alu-key); }
.pad { fill: color-mix(in srgb, var(--alu-key) 50%, var(--alu)); }
.lip { fill: var(--alu-lip); }
.notch { fill: color-mix(in srgb, var(--alu-lip) 70%, #000); }

.desk {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 5px;
  container-type: inline-size;
  background:
    radial-gradient(70% 90% at 10% 0%, color-mix(in srgb, var(--brand) 38%, var(--paper)), transparent 70%),
    radial-gradient(60% 80% at 100% 100%, color-mix(in srgb, var(--ok) 30%, var(--paper)), transparent 70%),
    color-mix(in srgb, var(--c-media) 18%, var(--paper));
}
.menubar {
  display: flex;
  align-items: center;
  gap: 1.8cqi;
  height: 3.4cqi;
  padding: 0 1.6cqi;
  background: color-mix(in srgb, var(--card) 65%, transparent);
  color: var(--ink);
  font: 500 1.3cqi var(--font-sans);
}
.menubar b { font-weight: 700; }
.mb-apple { width: 1.4cqi; height: 1.4cqi; border-radius: 50%; background: var(--ink); }
.mb-right { display: flex; align-items: center; gap: 1.2cqi; margin-left: auto; }
.mb-right img { width: 2.2cqi; height: 2.2cqi; padding: 0.15cqi; border-radius: 0.5cqi; background: color-mix(in srgb, var(--brand) 25%, var(--card)); }

/* Windows, as in the homepage hero */
.win {
  position: absolute;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.3cqi;
  background: var(--card);
  box-shadow: 0 1px 0 rgb(21 22 43 / 0.04), 0 4cqi 7cqi -3.5cqi rgb(21 22 43 / 0.55);
  color: var(--ink);
}
.browser { top: 7cqi; left: 3.5cqi; width: 44.5cqi; }
.win-tabs { display: flex; align-items: flex-end; gap: 1.2cqi; padding: 0.9cqi 1.2cqi 0; background: var(--field); }
.lights { display: flex; gap: 0.6cqi; align-self: center; padding-bottom: 0.7cqi; }
.lights i { width: 1.1cqi; height: 1.1cqi; border-radius: 50%; background: #ec6a5e; }
.lights i:nth-child(2) { background: #f4bf4f; }
.lights i:nth-child(3) { background: #61c554; }
.tab {
  display: flex;
  align-items: center;
  gap: 0.6cqi;
  padding: 0.75cqi 2.4cqi 0.75cqi 1.1cqi;
  border-radius: 0.9cqi 0.9cqi 0 0;
  background: var(--card);
  font: 600 1.2cqi var(--font-sans);
}
.tab img { width: 1.4cqi; height: 1.4cqi; }
.tab-plus { padding-bottom: 0.6cqi; color: var(--ink-2); font: 1.5cqi var(--font-sans); }
.win-addr {
  display: flex;
  align-items: center;
  gap: 0.6cqi;
  margin: 0.8cqi 1.2cqi;
  padding: 0.55cqi 1cqi;
  border-radius: 0.8cqi;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  color: var(--ink-2);
  font: 1.15cqi var(--font-mono);
}
.win-addr .icon { width: 1.2cqi; height: 1.2cqi; color: var(--ok); }
.win-body { display: grid; gap: 1.1cqi; padding: 1cqi 2cqi 2.2cqi; border-top: 1px solid var(--line); }
.page-h { margin-top: 0.8cqi; font: 750 2.1cqi/1.1 var(--font-sans); letter-spacing: -0.02em; }
.page-ok, .page-done { display: flex; align-items: center; gap: 0.6cqi; color: var(--ok); font: 500 1.1cqi var(--font-mono); }
.page-ok i { width: 0.8cqi; height: 0.8cqi; border-radius: 50%; background: currentColor; }
.page-form { display: flex; gap: 0.7cqi; }
.page-input, .page-select { padding: 0.8cqi 1cqi; border: 1px solid var(--line); border-radius: 0.8cqi; background: var(--field); font: 1.1cqi var(--font-mono); white-space: nowrap; }
.page-input { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.page-btn { padding: 0.8cqi 1.4cqi; border-radius: 0.8cqi; background: var(--accent); color: var(--on-accent); font: 650 1.15cqi var(--font-sans); box-shadow: 0 1cqi 2cqi -1cqi color-mix(in srgb, var(--accent) 80%, transparent); }

/* The helper's window, hanging from its menu bar icon */
.helper { top: 6cqi; right: 3cqi; display: grid; gap: 1cqi; width: 24cqi; padding: 1.6cqi; overflow: visible; }
.helper-head { display: flex; align-items: center; gap: 1.1cqi; }
.helper-head img { width: 4.4cqi; height: 4.4cqi; padding: 0.4cqi; border-radius: 1.1cqi; background: #fff; box-shadow: 0 0.4cqi 1cqi -0.3cqi rgb(21 22 43 / 0.5), inset 0 0 0 1px rgb(21 22 43 / 0.08); }
.helper-head b { display: block; font: 700 1.45cqi var(--font-sans); }
.helper-head small { color: var(--ok); font: 500 1cqi var(--font-mono); }
.helper-tools { padding-top: 1cqi; border-top: 1px solid var(--line); color: var(--ink-2); font: 1.1cqi var(--font-mono); }
.helper-bar { height: 0.8cqi; overflow: hidden; border-radius: 99px; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.helper-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transform: scaleX(0.64); transform-origin: left; animation: fill 4.8s var(--ease-out-expo) infinite; }
@keyframes fill { from { transform: scaleX(0.1); } 80%, to { transform: scaleX(1); } }
.helper-step { color: var(--ink-2); font: 1.05cqi var(--font-mono); }

/* Downloads folder on the desktop */
.folder { position: absolute; top: 44cqi; left: 9cqi; display: grid; justify-items: center; gap: 0.5cqi; width: 11cqi; }
.folder-svg { width: 9cqi; height: auto; filter: drop-shadow(0 0.6cqi 0.8cqi rgb(21 22 43 / 0.25)); }
.folder-back { fill: color-mix(in srgb, var(--c-media) 75%, #000); }
.folder-front { fill: color-mix(in srgb, var(--c-media) 80%, #fff); }
.folder-arrow { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.file-badge {
  position: absolute;
  top: 3.2cqi;
  right: 0.4cqi;
  padding: 0.3cqi 0.5cqi;
  border-radius: 0.5cqi;
  background: var(--c-pdf);
  color: #fff;
  font: 700 1cqi/1 var(--font-mono);
  box-shadow: 0 0.4cqi 0.8cqi -0.2cqi rgb(21 22 43 / 0.5);
}
.folder-name { padding: 0.15cqi 0.6cqi; border-radius: 0.5cqi; background: color-mix(in srgb, var(--card) 70%, transparent); font: 600 1.15cqi var(--font-sans); }

/* Numbered overlays on the screen */
.ov { position: absolute; display: grid; justify-items: center; gap: 0.6cqi; }
.ov-1 { top: 11cqi; left: 49.5cqi; width: 22cqi; }
.ov-4 { top: 25cqi; left: 49.5cqi; width: 22cqi; }
.ov-save { top: 33cqi; left: calc(14.5cqi - 6px); }
.ov-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6cqi;
  padding: 0.5cqi 1cqi 0.5cqi 0.5cqi;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  box-shadow: 0 1cqi 2cqi -1cqi rgb(21 22 43 / 0.45);
  font: 650 max(1.2cqi, 0.7rem)/1.2 var(--font-sans);
  white-space: nowrap;
}
/* Overlays stay readable even when the screen is drawn small. */
.ov-text { white-space: normal; }
.ov-text small { display: block; color: var(--ink-2); font: 500 max(0.95cqi, 0.6rem) var(--font-mono); }
.ov .num { width: max(2cqi, 1.1rem); height: max(2cqi, 1.1rem); font-size: max(1.1cqi, 0.62rem); }
.ov .line { color: var(--ink); }

/* Outside the screen: YouTube as a floating card, like the hero's */
.yt-card {
  grid-area: yt;
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding: 1rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 30px 60px -30px rgb(21 22 43 / 0.5);
  text-align: center;
  transform: rotate(2deg);
}
.yt-card b { display: block; font-size: 0.92rem; }
.yt-card small { color: var(--ink-2); font: 0.68rem var(--font-mono); }
/* A generic red play tile, not YouTube's logo */
.yt-tile {
  position: relative;
  width: 3.6rem;
  height: 2.6rem;
  border-radius: 12px;
  background: linear-gradient(#ff5a50, var(--yt) 60%, #c41f1a);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), 0 8px 16px -8px rgb(196 31 26 / 0.7);
}
.yt-tile::after { content: ""; position: absolute; inset: 0; margin: auto; width: 0.9rem; height: 1rem; background: #fff; clip-path: polygon(0 0, 100% 50%, 0 100%); transform: translateX(2px); }

.pc-notes { display: none; }

/* Arrows: a track, a head, and a dot that travels hop by hop (1 → 2 → 3 → 4).
   Horizontal by default; the vertical ones are set per breakpoint below. */
.hop { grid-area: b; display: flex; flex-direction: column; justify-content: center; gap: 1.1rem; }
.arrow { display: flex; flex-direction: column; gap: 0.35rem; }
.arrow.is-back { flex-direction: column-reverse; }
.hop-text { display: flex; flex-wrap: wrap; align-items: center; gap: 0.1rem 0.4rem; color: var(--ink); font: 650 0.78rem/1.25 var(--font-sans); }
.hop-text small { flex-basis: 100%; color: var(--ink-2); font: 500 0.66rem/1.3 var(--font-mono); }
.num {
  display: inline-grid;
  place-items: center;
  width: 1.2rem;
  height: 1.2rem;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font: 650 0.66rem/1 var(--font-mono);
}

.line { position: relative; display: block; flex: none; width: 100%; height: 12px; color: var(--ink-2); background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat; }
.line::after { content: ""; position: absolute; top: 0; right: -1px; border-style: solid; border-color: transparent transparent transparent currentColor; border-width: 6px 0 6px 9px; }
.is-back .line { transform: scaleX(-1); }
.dot { position: absolute; inset: 0; overflow: hidden; }
.dot::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at calc(100% - 6px) 50%, var(--accent) 0 4px, transparent 4.5px);
  transform: translateX(-100%);
  animation: travel-x 4.8s linear infinite;
}
.hop-b .arrow:not(.is-back) .dot::before { animation-delay: 1.2s; }
.hop-b .is-back .dot::before { animation-delay: 2.4s; }
.ov-4 .dot::before { animation-delay: 3.6s; }
.ov-save .dot::before { animation-delay: 4.3s; }
@keyframes travel-x { 0% { transform: translateX(-100%); opacity: 1; } 18% { transform: translateX(0); opacity: 1; } 19%, 100% { transform: translateX(0); opacity: 0; } }
@keyframes travel-y { 0% { transform: translateY(-100%); opacity: 1; } 18% { transform: translateY(0); opacity: 1; } 19%, 100% { transform: translateY(0); opacity: 0; } }

/* Vertical arrows: the save arrow always, ② / ③ on narrow screens. */
.ov-save .line { width: 12px; height: 8cqi; background-size: 2px 100%; }
.ov-save .line::after { top: auto; right: 0; bottom: -1px; border-color: currentColor transparent transparent; border-width: 9px 6px 0; }
.ov-save .dot::before { background: radial-gradient(circle at 50% calc(100% - 6px), var(--accent) 0 4px, transparent 4.5px); animation-name: travel-y; }

@media (max-width: 1100px) {
  .flow {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "srv" "pc" "notes" "b" "yt";
    padding-inline: 0.75rem;
  }
  .pc { padding-inline: 4%; }
  .yt-card { justify-self: center; width: min(100%, 13rem); }
  .hop { flex-direction: row; justify-content: center; gap: 1.25rem; padding-block: 1rem; }
  .hop .arrow { flex-direction: row; align-items: center; gap: 0.5rem; flex: 1 1 0; max-width: 10rem; }
  .hop .line { width: 12px; height: auto; min-height: 4.5rem; align-self: stretch; background-size: 2px 100%; }
  .hop .line::after { top: auto; right: 0; bottom: -1px; border-color: currentColor transparent transparent; border-width: 9px 6px 0; }
  .hop .is-back .line { transform: scaleY(-1); }
  .hop .dot::before { background: radial-gradient(circle at 50% calc(100% - 6px), var(--accent) 0 4px, transparent 4.5px); animation-name: travel-y; }
}

/* Phones: the screen is too small for readable labels, so ① and ④ are spelled out under the laptop. */
@media (max-width: 40rem) {
  .ov-text { display: none; }
  .ov-pill { padding: 0.5cqi; }
  .ov .num { width: 3.6cqi; height: 3.6cqi; font-size: 2cqi; }
  .pc-notes {
    grid-area: notes;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem 1rem;
    margin: 0.9rem 0 0;
    color: var(--ink);
    font: 600 0.78rem var(--font-sans);
  }
  .pc-notes > span { display: inline-flex; align-items: center; gap: 0.4rem; }
  .cut { display: flex; align-items: center; justify-content: center; gap: 0.5rem; height: auto; padding-block: 0.75rem; }
  .cut-line { display: none; }
  .cut-x, .cut-note { position: static; transform: none; }
  .flow { padding-inline: 0.5rem; }
  .pc { padding-inline: 3%; }
}

.flow-legend { display: grid; gap: 0.5rem; margin: 1.1rem 0 0; padding: 0; list-style: none; counter-reset: hop; }
.flow-legend li { display: flex; gap: 0.6rem; max-width: 68ch; color: var(--ink-2); counter-increment: hop; }
.flow-legend li::before {
  content: counter(hop);
  display: inline-grid;
  place-items: center;
  width: 1.2rem;
  height: 1.2rem;
  flex: none;
  margin-top: 0.15rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font: 650 0.66rem/1 var(--font-mono);
}
