/* ==================================================================
   /tools/youtube-timestamp-link-generator on the foundation look.
   Loaded ONLY when the 'tools-timestamp-link-generator-fnd' redesign
   switch is on for this viewer (never in embed mode); the old page keeps
   its own stylesheets.

   Layout unique to this page only. The first screen, the guide, the
   questions, the links and the close are the shared tool kit
   (foundation-tools.css); the inputs, segments, badges, rows, icon
   buttons, the data table and the numbered heads are the foundation's
   and are NOT redrawn here.

   Same shape as the embed code page (tools-embed-code-fnd.css), which
   this file copies rather than shares so neither page can move the
   other: one centred column at every width. Paste, then the answer card
   right under the bar (the video, the start time, the link and Copy),
   then the chapter builder.
   ================================================================== */

/* ------------------------------------------------------------------
   1. THE FIRST SCREEN
   ------------------------------------------------------------------ */
@media (min-width: 1024px) {
  .tsl3-top .fnd-tool-top__in { display: block; }
  /* A plain card, never pinned: the chapter card would slide under it. */
  .fnd .tsl3 .tsl3-out { position: relative; top: auto; }
  .fnd .tsl3 .fnd-tool-lead { max-width: 960px; }
  .fnd .tsl3 .fnd-tool-lead .fnd-display { max-width: none; }
}
.fnd .tsl3 .fnd-tool-lead,
.fnd .tsl3 .tsl3-ask,
.fnd .tsl3 .tsl3-out,
.fnd .tsl3 .tsl3-more { max-width: 760px; margin-left: auto; margin-right: auto; }

/* The name and its line, centred over the bar they introduce. */
.fnd .tsl3 .fnd-tool-lead { text-align: center; }
.fnd .tsl3 .fnd-tool-lead .fnd-display,
.fnd .tsl3 .fnd-tool-lead__sub { margin-left: auto; margin-right: auto; text-align: center; }
.fnd .tsl3 .fnd-tool-lead__sub { text-wrap: balance; }
.fnd .tsl3 h1.fnd-display,
.fnd .tsl3-qa__list summary,
.fnd.tsl3-page .fnd-tool-close .fnd-btn { text-wrap: balance; }
@media (max-width: 413px) {
  .fnd .tsl3 .fnd-tool-lead .fnd-display { font-size: 2.15rem; }
}
@media (max-width: 559px) {
  .fnd .tsl3 .fnd-tool-lead { margin-bottom: var(--fnd-s4); }
}

/* The bar sits bare on the page like a search box: no card around it. */
.fnd .tsl3 .tsl3-ask { background: none; border: 0; border-radius: 0; box-shadow: none; }
.fnd .tsl3 .tsl3-ask > .fnd-card-body { padding: 0; }
.tsl3-ask,
.tsl3-out { scroll-margin-top: calc(var(--header-height, 61px) + 16px); }

/* The paste bar, copied from the embed code page's .ecg3-bar. */
.fnd .tsl3-bar {
  display: flex; align-items: center; gap: var(--fnd-s2);
  background: var(--fnd-card);
  border: 1px solid var(--fnd-edge);
  border-radius: 999px;
  padding: 5px 5px 5px 20px;
  box-shadow: 0 1px 2px rgba(23, 20, 31, .05), 0 12px 28px -16px rgba(23, 20, 31, .3);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.fnd .tsl3-bar:focus-within {
  border-color: var(--fnd-text);
  box-shadow: 0 0 0 3px var(--fnd-accent-soft), 0 12px 28px -16px rgba(23, 20, 31, .3);
}
.tsl3-bar > .fa-link { flex: 0 0 auto; font-size: 15px; color: var(--fnd-text-faint); }
.fnd .tsl3 .tsl3-bar .fnd-input {
  flex: 1 1 auto; width: auto; min-width: 0;
  padding: 0 var(--fnd-s1);
  background: transparent; border: 0; border-radius: 0;
}
.fnd .tsl3 .tsl3-bar .fnd-input:focus { box-shadow: none; }
.fnd .tsl3-bar .fnd-btn { flex: 0 0 auto; border-radius: 999px; white-space: nowrap; }
.fnd .tsl3-bar:has(.fnd-btn:focus-visible) {
  border-color: var(--fnd-edge);
  box-shadow: 0 1px 2px rgba(23, 20, 31, .05), 0 12px 28px -16px rgba(23, 20, 31, .3);
}
@media (max-width: 559px) {
  .fnd .tsl3-bar { padding-left: 16px; }
}
@media (max-width: 413px) {
  .fnd .tsl3-bar .fnd-btn { padding: 0 var(--fnd-s3); }
}
/* The smallest phones drop the link mark so the hint still fits. */
@media (max-width: 379px) {
  .fnd .tsl3-bar { padding-left: 14px; }
  .tsl3-bar > .fa-link { display: none; }
}
.fnd .tsl3 .tsl3-bar__help { margin: var(--fnd-s3) 0 0; text-align: center; text-wrap: pretty; }
.fnd .tsl3 .tsl3-bar ~ .fnd-error { text-align: center; text-wrap: pretty; }
/* Their own link on show: the line under the bar steps aside so the
   link and Copy sit higher (set by the script). */
.fnd .tsl3--done .tsl3-bar__help { display: none; }

/* ------------------------------------------------------------------
   2. THE ANSWER: the video, the start time, the link and Copy
   ------------------------------------------------------------------ */
.fnd .tsl3 .tsl3-out { margin-top: var(--fnd-s5); }
.tsl3-out.tsl3-out--in { animation: tsl3-in 320ms cubic-bezier(.22, 1, .36, 1); }
@keyframes tsl3-in { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .tsl3-out.tsl3-out--in { animation: none; }
}

/* The example: a badge saying so, and nothing to copy or share. The time
   boxes still change the example link, so the tool shows what it does. */
.fnd .tsl3-exnote {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 4px var(--fnd-s2);
  margin: 0 0 var(--fnd-s4);
  font-size: var(--fnd-t-meta); line-height: 1.5; color: var(--fnd-text-soft);
}
.tsl3-out:not(.tsl3-out--example) .tsl3-exnote,
.tsl3-out--example .tsl3-row,
.tsl3-out--example .tsl3-share { display: none; }

/* A link that would not read leaves the last video on the card: fade it
   and take its Copy, test and share away so the wrong link never leaves.
   Start over stays. */
.tsl3-out--stale .fnd-card-body > :not(.tsl3-row) { opacity: .4; }
.tsl3-out--stale .tsl3-copy,
.tsl3-out--stale a.tsl3-link,
.tsl3-out--stale .tsl3-share { display: none; }
.tsl3-out--stale .tsl3-row { margin-top: var(--fnd-s3); }

/* The video: its picture small on the left, the name beside it. */
.tsl3-video { display: flex; align-items: center; gap: var(--fnd-s3); }
/* With the Example note gone, the video starts the card. */
.fnd .tsl3-out:not(.tsl3-out--example) .tsl3-video { margin-top: 0; }
.fnd .tsl3-video__thumb {
  flex: 0 0 auto; display: block;
  width: 96px; height: auto; aspect-ratio: 16 / 9;
  object-fit: cover; border-radius: var(--fnd-r-sm);
  background: var(--fnd-paper-2);
}
.tsl3-video__txt { min-width: 0; }
.fnd .tsl3-video__title {
  margin: 0;
  font-family: var(--fnd-display-font); font-weight: 700;
  font-size: var(--fnd-t-h3); line-height: 1.3; color: var(--fnd-text);
  text-wrap: balance; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tsl3-video__title:focus { outline: none; }
.fnd .tsl3-video__meta { margin: 2px 0 0; font-size: var(--fnd-t-meta); color: var(--fnd-text-soft); overflow-wrap: anywhere; }
.tsl3-video__meta:empty { display: none; }
@media (max-width: 413px) {
  .fnd .tsl3-video__thumb { width: 80px; }
  .fnd .tsl3-video__title { font-size: var(--fnd-t-body); }
}
.fnd .tsl3 .tsl3-warn { margin: var(--fnd-s3) 0 0; color: var(--fnd-text); text-wrap: pretty; }
.tsl3-warn[hidden] { display: none; }

/* Start at: hours, minutes and seconds like a clock, each box with its
   word under it, a colon between. */
.fnd .tsl3-time { margin: var(--fnd-s5) 0 0; padding: 0; border: 0; min-width: 0; }
.fnd .tsl3-time > .fnd-label { padding: 0; margin-bottom: var(--fnd-s2); }
.tsl3-clock { display: flex; align-items: flex-start; gap: var(--fnd-s2); }
.tsl3-unit { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0; }
.fnd .tsl3 .tsl3-num {
  width: 72px; flex: 0 0 auto;
  font-weight: 700; font-variant-numeric: tabular-nums; text-align: center;
}
.fnd .tsl3 .tsl3-num::placeholder { font-weight: 400; }
.tsl3-unit__w { font-size: var(--fnd-t-meta); color: var(--fnd-text-soft); }
/* As tall as the 52px box, so the colon sits on its middle. */
.tsl3-colon { line-height: 52px; font-weight: 700; color: var(--fnd-text-faint); }
@media (max-width: 419px) {
  .fnd .tsl3 .tsl3-clock .tsl3-num { width: 64px; }
}
.fnd .tsl3 .tsl3-when { margin: var(--fnd-s2) 0 0; color: var(--fnd-text-soft); text-wrap: pretty; }

/* The link: a head with "Your link" and the three kinds, then the link
   on its soft panel, set like the embed code page's code. */
.tsl3-codehead {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--fnd-s2) var(--fnd-s4);
  min-height: 44px; margin-top: var(--fnd-s5);
}
.fnd .tsl3-codehead__k { margin: 0; font-size: var(--fnd-t-meta); font-weight: 600; color: var(--fnd-text-soft); }
/* On a phone the three buttons name what is in the box, so "Your link"
   is left to screen readers, and the panel shows less at once so Copy
   stays near. */
@media (max-width: 559px) {
  .fnd .tsl3 .tsl3-out .tsl3-codehead__k {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
    clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap;
  }
  .fnd .tsl3 .tsl3-code { max-height: 168px; }
  .fnd .tsl3 .tsl3-out .tsl3-fmt { width: 100%; }
  .fnd .tsl3 .tsl3-out .tsl3-fmt button { flex: 1 1 0; padding: 0 var(--fnd-s2); }
}
.fnd .tsl3-code {
  margin: var(--fnd-s3) 0 0;
  padding: var(--fnd-s3);
  max-height: 220px; overflow: auto;
  background: var(--fnd-paper-2); border-radius: var(--fnd-r-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fnd-t-sm); line-height: 1.6; color: var(--fnd-text);
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal;
  tab-size: 2;
}
.tsl3-code:focus-visible { outline: 2px solid var(--fnd-accent-deep); outline-offset: 2px; }
.fnd .tsl3 .tsl3-fmthelp { margin: var(--fnd-s2) 0 0; text-wrap: pretty; }

.tsl3-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--fnd-s2) var(--fnd-s4); margin-top: var(--fnd-s4); }
.fnd .tsl3 .tsl3-copy[data-copied="true"] { background: var(--fnd-ok); border-color: var(--fnd-ok); }
@media (max-width: 559px) {
  .fnd .tsl3 .tsl3-copy { flex: 1 1 100%; justify-content: center; }
}
/* Text buttons grown to a 44px tap, in the accent so they read as things
   to press. */
.fnd .tsl3 .tsl3-link.fnd-textbtn { --fnd-hit-y: 14px; font-size: var(--fnd-t-meta); color: var(--fnd-accent-deep); }
.fnd .tsl3 .tsl3-link.fnd-textbtn:hover { color: var(--fnd-text); }
.fnd .tsl3 .tsl3-link[hidden] { display: none; }

/* Share this moment: the shared icon row on the white card, under a rule. */
.tsl3-share {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--fnd-s1) var(--fnd-s3);
  margin-top: var(--fnd-s4); padding-top: var(--fnd-s3);
  border-top: 1px solid var(--fnd-rule);
}
.fnd .tsl3-share__k { margin: 0; font-size: var(--fnd-t-meta); font-weight: 600; color: var(--fnd-text-soft); }
.fnd .tsl3 .tsl3-share .fnd-tool-share { flex-wrap: wrap; margin: 0 -10px 0 0; }

/* ------------------------------------------------------------------
   3. CHAPTERS
   ------------------------------------------------------------------ */
.fnd .tsl3 .tsl3-more { grid-template-columns: minmax(0, 1fr); gap: var(--fnd-s5); margin-top: var(--fnd-s6); }
.fnd .tsl3 .tsl3-card .fnd-tool-more__sub { margin: 4px 0 0; text-wrap: pretty; }

/* Time, name, Add on one line; on a phone time and name share a line and
   Add takes the full width under them. */
.tsl3-chadd {
  display: grid; grid-template-columns: 112px minmax(0, 1fr) auto;
  align-items: end; gap: var(--fnd-s3);
  margin-top: var(--fnd-s4);
}
.tsl3-chadd__t,
.tsl3-chadd__n { min-width: 0; }
.fnd .tsl3 .tsl3-chadd .tsl3-num { width: 100%; }
.fnd .tsl3 .tsl3-chadd .fnd-input[aria-invalid="true"] { border-color: var(--fnd-danger); }
@media (max-width: 559px) {
  .tsl3-chadd { grid-template-columns: 92px minmax(0, 1fr); }
  .fnd .tsl3 .tsl3-chadd__go { grid-column: 1 / -1; width: 100%; justify-content: center; }
}
.fnd .tsl3 .tsl3-card .fnd-error { margin-top: var(--fnd-s3); }
.fnd .tsl3 .tsl3-ch-empty { margin: var(--fnd-s3) 0 0; text-wrap: pretty; }
.fnd .tsl3 .tsl3-ch-note { margin: var(--fnd-s2) 0 0; text-wrap: pretty; }
.tsl3-ch-note[hidden],
.tsl3-ch-empty[hidden],
.tsl3-ch-out[hidden] { display: none; }

/* The list: each chapter's time and name, its remove button on the same
   line at every width (the shared rows drop the end under on a phone). */
.fnd .tsl3 .tsl3-chlist { margin: var(--fnd-s4) 0 0; padding: 0; list-style: none; }
.fnd .tsl3 .tsl3-chlist .fnd-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 4px 0; }
.fnd .tsl3 .tsl3-chlist .fnd-row-main { grid-column: 1; }
.fnd .tsl3 .tsl3-chlist .fnd-row-end { grid-column: 2; grid-row: 1; margin-top: 0; }
.fnd .tsl3 .tsl3-chlist .fnd-row-t { -webkit-line-clamp: 3; overflow-wrap: anywhere; }
.tsl3-chlist__t { font-variant-numeric: tabular-nums; color: var(--fnd-text-soft); margin-right: 4px; }

/* Ready or not, then YouTube's three rules, each ticked or crossed. */
.fnd .tsl3-ch-state {
  margin: var(--fnd-s4) 0 0;
  font-family: var(--fnd-display-font); font-weight: 700;
  font-size: var(--fnd-t-body); line-height: 1.4; text-wrap: pretty;
}
.fnd .tsl3-ch-state--ok { color: var(--fnd-ok); }
.fnd .tsl3-ch-state--no { color: var(--fnd-text); }
.tsl3-rules { list-style: none; margin: var(--fnd-s2) 0 0; padding: 0; }
.tsl3-rule {
  display: flex; align-items: baseline; gap: var(--fnd-s2);
  padding: 3px 0;
  font-size: var(--fnd-t-sm); line-height: 1.5; color: var(--fnd-text);
  text-wrap: pretty;
}
.tsl3-rule > i { flex: 0 0 auto; }
.tsl3-rule--ok > i { color: var(--fnd-ok); }
.tsl3-rule--no > i { color: var(--fnd-danger); }
.tsl3-rule--ok { color: var(--fnd-text-soft); }
.fnd .tsl3 .tsl3-ch-out .tsl3-codehead { margin-top: var(--fnd-s5); }
.fnd .tsl3 .tsl3-copy:disabled { opacity: .5; cursor: not-allowed; }

/* ------------------------------------------------------------------
   4. THE GUIDE
   ------------------------------------------------------------------ */
.fnd .tsl3-guide .fnd-tool-read .fnd-h2 {
  margin-top: var(--fnd-s8);
  max-width: 24ch;
  scroll-margin-top: calc(var(--header-height, 61px) + var(--fnd-s4));
}
.tsl3-guide .fnd-tool-read .fnd-h2:focus { outline: none; }
@media (max-width: 767px) {
  .fnd .tsl3-guide .fnd-tool-read .fnd-h2 { margin-top: var(--fnd-s7); }
}
/* A link inside a sentence grows to a 45px press without moving the text. */
.fnd .tsl3-guide .fnd-tool-read p a:not(.fnd-btn),
.fnd .tsl3-qa__list p a:not(.fnd-btn) { padding-block: 12px; }

/* The three steps: the shared numbered heads, a paragraph under each. */
.tsl3-steps { list-style: none; margin: var(--fnd-s4) 0 0; padding: 0; }
.tsl3-steps li + li { margin-top: var(--fnd-s5); }
.tsl3-steps .fnd-numhead { margin-bottom: var(--fnd-s2); }
.fnd .tsl3-steps .fnd-numhead__t { font-size: var(--fnd-t-h3); }
.tsl3-steps p { margin: 0; padding-left: calc(32px + var(--fnd-s3)); }
@media (max-width: 559px) {
  .tsl3-steps p { padding-left: 0; }
}

/* The formats table holds an address and a sentence, not figures: the
   shared data table keeps its card and rules, but its cells wrap here.
   On a phone each row reads name, then the address, then the sentence,
   each on its own line. */
.fnd .tsl3-tbl tbody td:not(:first-child) { white-space: normal; font-variant-numeric: normal; }
.fnd .tsl3-tbl td:first-child { white-space: nowrap; }
@media (min-width: 640px) {
  .tsl3-tbl td { vertical-align: top; }
}
.fnd .tsl3-guide .tsl3-tbl td { text-wrap: pretty; }
@media (max-width: 639px) {
  .fnd .tsl3-guide .tsl3-tbl.fnd-tbl--data thead { display: none; }
  .fnd .tsl3-guide .tsl3-tbl.fnd-tbl--data tbody td:first-child { flex: 0 0 100%; }
  .fnd .tsl3-guide .tsl3-tbl.fnd-tbl--data tbody td:nth-child(2) {
    order: 4; flex: 0 0 100%; min-width: 0; padding: 2px 0 0;
    white-space: normal; overflow-wrap: anywhere;
  }
  .fnd .tsl3-guide .tsl3-tbl.fnd-tbl--data tbody td:nth-child(2)::before { content: none; }
  .fnd .tsl3-guide .tsl3-tbl.fnd-tbl--data tbody td:last-child {
    order: 5; flex: 0 0 100%; min-width: 0; padding: 2px 0 0;
    white-space: normal; text-align: left; overflow-wrap: anywhere;
    font-weight: 400; color: var(--fnd-text-soft); text-wrap: pretty;
  }
  .fnd .tsl3-guide .tsl3-tbl.fnd-tbl--data tbody td:last-child::before { content: none; }
}

/* Addresses in the table and the guide read as code. */
.fnd .tsl3-tbl code,
.fnd .tsl3-guide .fnd-tool-read p code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em; overflow-wrap: anywhere;
}
