/* Frog Capital's own type and palette, taken from the live site:
   Lato 300/400/700/900 · lime #dae13f · teal #00b197 · purple #6948d1 · navy #020042 */
:root {
  --lime: #dae13f;
  --teal: #00b197;
  --purple: #6948d1;
  --navy: #020042;
  --ink: #1b1b26;
  --muted: #63636f;
  --faint: #8e8e9c;
  --line: #e6e6ec;
  --ground: #fff;
  --raise: #f7f7f3;
  --r: 10px;
  --wrap: 1080px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.62 Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  display: flex; flex-direction: column; min-height: 100vh;
}
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 4px; }

/* ---------- masthead ---------- */
.masthead { border-bottom: 1px solid var(--line); background: var(--ground); }
.masthead-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 14px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--navy);
}
/* Frog's own logo. The theme ships it filled white for its dark nav, so the
   fill is set to currentColor on import and takes the colour from here. */
.wordmark .logo { height: 38px; width: auto; display: block; color: var(--navy); }
.build {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px; color: var(--faint); letter-spacing: -.01em;
  margin-left: auto; margin-right: 16px; white-space: nowrap;
}
.build:empty { display: none; }

.controls { display: flex; align-items: center; gap: 18px; }
.layouts, .textsize { display: flex; align-items: center; gap: 4px; }
.textsize button {
  font: inherit; font-weight: 700; color: var(--muted);
  background: transparent; border: 1px solid var(--line); border-radius: 6px;
  min-width: 30px; padding: 3px 7px; cursor: pointer; transition: all .13s ease;
  line-height: 1.5;
}
.textsize button:nth-child(2) { font-size: 12.5px; }
.textsize button:nth-child(3) { font-size: 15px; }
.textsize button:nth-child(4) { font-size: 17px; }
.textsize button:hover { color: var(--navy); border-color: var(--navy); }
.textsize button:active { transform: scale(.94); }
.layouts-label {
  font-size: 10.5px; font-weight: 900; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint); margin-right: 6px;
}
.layouts button {
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--muted);
  background: transparent; border: 1px solid transparent; border-radius: 999px;
  padding: 4px 11px; cursor: pointer; transition: all .13s ease;
}
.layouts button:hover { color: var(--navy); background: var(--raise); }
.layouts button[aria-pressed="true"] {
  color: var(--navy); background: var(--lime); border-color: var(--lime);
}

.wordmark-text {
  font-size: 15px; font-weight: 300; letter-spacing: .04em; color: var(--muted);
  padding-left: 12px; border-left: 1px solid var(--line); line-height: 1.2;
}


/* ---------- shell ---------- */
.wrap { flex: 1; width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 22px 56px; }


/* ---------- hero ---------- */
.hero { max-width: 700px; margin: 0 auto; padding: 52px 0 0; text-align: center; }
.hero-title {
  font-size: 34px; font-weight: 900; line-height: 1.15;
  letter-spacing: -.02em; color: var(--navy); margin: 0 0 12px;
}
.hero-sub { font-size: 15.5px; color: var(--muted); margin: 0 0 26px; }
.app-searched .hero { padding-top: 26px; text-align: left; max-width: none; }
.app-searched .hero-title, .app-searched .hero-sub { display: none; }

.ask {
  display: flex; align-items: center; gap: 8px;
  border: 2px solid var(--navy); border-radius: var(--r);
  background: var(--ground); padding: 4px 4px 4px 18px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ask:focus-within {
  border-color: var(--teal); box-shadow: 0 0 0 4px rgba(0, 177, 151, .15);
}
.ask input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 17px; color: var(--ink); padding: 13px 0;
}
.ask input::placeholder { color: #a3a3b0; }
.ask button {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 7px; background: var(--navy); color: var(--lime);
  cursor: pointer; transition: background .15s ease, transform .1s ease;
}
.ask button:hover { background: var(--purple); }
.ask button:active { transform: scale(.94); }
.ask button[disabled] { opacity: .5; cursor: default; }

.suggestions {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; justify-content: center;
}
.app-searched .suggestions { justify-content: flex-start; }
.suggestions button {
  font: inherit; font-size: 13px; color: var(--muted);
  background: var(--raise); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 13px; cursor: pointer; transition: all .14s ease;
}
.suggestions button:hover { color: var(--navy); border-color: var(--navy); background: var(--ground); }

/* ---------- results ---------- */
.asked {
  font-size: 20px; font-weight: 900; color: var(--navy);
  letter-spacing: -.015em; margin: 0 0 10px; line-height: 1.3;
}
.asked:empty { display: none; }

.status { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.status:empty { display: none; }
.status .spinner {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--teal);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .status .spinner { animation-duration: 2.4s; }
}

/* Reader-controlled. --answer-size is set on #app by the A-/A/A+ controls and
   drives everything in the results, so the whole block scales together. */
#app { --answer-size: 16.5px; }
.answer { font-size: var(--answer-size); line-height: 1.7; }
.answer h3 { font-size: calc(var(--answer-size) * 0.92); }
.src-quote, .ref-title { font-size: calc(var(--answer-size) * 0.86); }
.player-card .ttl, .video-card .t { font-size: calc(var(--answer-size) * 0.84); }
.asked { font-size: calc(var(--answer-size) * 1.2); }
.answer:empty { display: none; }
.answer > *:first-child { margin-top: 14px; }
.answer p { margin: 0 0 15px; }
.answer ul, .answer ol { margin: 0 0 15px; padding-left: 21px; }
.answer li { margin-bottom: 7px; }
.answer li::marker { color: var(--teal); }
.answer strong { font-weight: 900; color: var(--navy); }
.answer h3 {
  font-size: 15px; font-weight: 900; margin: 24px 0 9px; color: var(--navy);
  letter-spacing: .01em;
}
.answer code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em;
  background: var(--raise); padding: 1px 5px; border-radius: 4px;
}
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 54px 0 46px;
}
.loading[hidden] { display: none; }
.loading-mark { position: relative; display: grid; place-items: center;
  width: 132px; height: 132px; }
.loading-mark::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--teal); border-right-color: var(--lime);
  animation: spin 1.05s cubic-bezier(.5,.12,.5,.88) infinite;
}
.loading-mark .logo { width: 74px; height: auto; color: var(--navy); opacity: .9; }
@media (prefers-reduced-motion: reduce) {
  .loading-mark::before { animation-duration: 3s; }
}

/* Completed blocks and the in-progress tail are separate elements. */
.answer > *:first-child { margin-top: 14px; }

/* ---------- audio rail: players sit beside the text ---------- */
.rail-title, .refs-title {
  font-size: 10.5px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 12px;
}
.rail { position: sticky; top: 22px; display: grid; gap: 18px; }

/* A photo from the cited source itself, shown at its live frogcapital.com URL. */
.hero-img { margin: 0; }
.hero-img a { display: block; text-decoration: none; color: inherit; }
.hero-img img {
  width: 100%; height: auto; display: block; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--raise);
  transition: border-color .15s ease, filter .15s ease;
}
.hero-img a:hover img { border-color: var(--navy); filter: brightness(1.04); }
.hero-img figcaption {
  margin-top: 8px; font-size: 12px; line-height: 1.45; color: var(--muted);
}
.hero-img figcaption .k {
  display: block; font-size: 10px; font-weight: 900; letter-spacing: .07em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 2px;
}
.hero-img a:hover figcaption .t { text-decoration: underline; color: var(--navy); }
.hero-img figcaption .t { font-weight: 700; color: var(--navy); }
.hero-img figcaption .go { color: var(--faint); }
.hero-img[hidden] { display: none; }
#players, #videos { display: grid; gap: 12px; }
.video-card {
  border: 1px solid var(--line); border-left: 3px solid #c2622a;
  border-radius: var(--r); padding: 12px 13px; background: var(--raise);
}
.video-card .k {
  font-size: 10px; font-weight: 900; letter-spacing: .07em;
  text-transform: uppercase; color: var(--faint);
}
.video-card .t {
  display: block; margin-top: 4px; font-weight: 700; font-size: 13.5px;
  line-height: 1.32; color: var(--navy); text-decoration: none;
}
.video-card .t:hover { text-decoration: underline; }
.video-card .go {
  display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 700;
  color: #a8511f; text-decoration: none;
}
.video-card .go:hover { text-decoration: underline; }

.player-card {
  border: 1px solid var(--line); border-left: 3px solid #c9cf6a;
  border-radius: var(--r); padding: 13px 14px; background: var(--raise);
}
.player-card .ep {
  font-size: 10px; font-weight: 900; letter-spacing: .07em;
  text-transform: uppercase; color: var(--faint);
}
.player-card .ttl {
  display: block; margin-top: 4px; font-weight: 700; font-size: 14px;
  line-height: 1.32; color: var(--navy); text-decoration: none;
}
.player-card .ttl:hover { text-decoration: underline; }
.player-card .at {
  margin-top: 5px; font-size: 11.5px; color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.player-card blockquote {
  margin: 9px 0 0; padding-left: 9px; border-left: 2px solid #e2e4c0;
  font-size: 12.5px; line-height: 1.5; color: var(--muted);
}
.player-card audio { width: 100%; height: 34px; margin-top: 11px; display: block; }
.player-card .ep-link {
  display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 700;
  color: var(--purple); text-decoration: none;
}
.player-card .ep-link:hover { text-decoration: underline; }

/* ---------- condensed references ---------- */
.refs { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 18px; align-self: start; }
.refs ol { list-style: none; margin: 0; padding: 0; }

.ref {
  display: flex; align-items: baseline; gap: 10px;
  padding: 7px 8px; border-radius: 7px; margin-left: -8px;
  transition: background .12s ease;
}
.ref:hover, .ref.flash { background: var(--raise); }
.ref:hover .ref-n, .ref.flash .ref-n { color: var(--navy); }
.ref + .ref { border-top: 1px solid #f0f0f4; }

.ref-n {
  flex: none; width: 18px; text-align: center;
  font-size: 11px; font-weight: 700; line-height: 16px;
  color: var(--faint); font-variant-numeric: tabular-nums;
}
.ref-body { min-width: 0; flex: 1; }
.ref-title {
  font-size: 14px; font-weight: 700; color: var(--navy); text-decoration: none;
  line-height: 1.35;
}
.ref-title:hover { text-decoration: underline; }
.ref-meta {
  font-size: 11.5px; color: var(--faint); margin-left: 8px; white-space: nowrap;
}
.ref-meta .kind { font-weight: 900; text-transform: uppercase; letter-spacing: .06em; font-size: 10px; }
.ref[data-type="web"]   .kind { color: var(--teal); }
.ref[data-type="pdf"]   .kind { color: var(--purple); }
.ref[data-type="audio"] .kind { color: #8a9016; }
.ref[data-type="video"] .kind { color: #c2622a; }
.ref-open {
  flex: none; font-size: 12px; font-weight: 700; color: var(--muted);
  text-decoration: none; opacity: 0; transition: opacity .12s ease;
}
.ref:hover .ref-open { opacity: 1; }
.ref-open:hover { color: var(--navy); }

.timings {
  grid-column: 1 / -1; margin-top: 18px; font-size: 11px; color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.error {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--r);
  background: #fff4f4; border: 1px solid #ffd6d6; color: #a4272f; font-size: 14px;
}

/* ---------- results grid ---------- */
.results {
  margin-top: 34px;
  display: grid; gap: 0 40px; align-items: start;
  grid-template-columns: minmax(0, 1fr) 300px;
  /* The rail spans both rows rather than sharing one with the answer. If it
     were a single row, a rail holding several players would set the row height
     and leave a gap between the end of the text and the references. */
  grid-template-areas:
    "answer audio"
    "refs   audio";
  grid-template-rows: auto 1fr;
}
.answer-col { grid-area: answer; min-width: 0; }
.rail { grid-area: audio; }
.refs        { grid-area: refs; }
/* No audio for this question: let the text use the full measure. */
.results:not(.has-audio) {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "answer" "refs";
  grid-template-rows: auto auto;
}
.results:not(.has-audio) .answer-col { max-width: 760px; }
.results:not(.has-audio) .refs { max-width: 760px; }

/* ================= LAYOUTS =================
   Both views show the same things - only cited sources, a player for relevant
   audio, a photo from the source, and the numbered reference table. They differ
   only in where those sit. */

/* SPLIT (default): answer left, media rail right, references under the text. */
#app[data-layout="split"] .hero { max-width: 780px; }

/* STACKED: one column, everything sequential. Reads like a document. */
#app[data-layout="stacked"] .results {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "answer" "audio" "refs";
  grid-template-rows: auto auto auto;
  gap: 26px 0;
  max-width: 760px;
}
#app[data-layout="stacked"] .rail { position: static; }
#app[data-layout="stacked"] .hero-img { max-width: 340px; }
#app[data-layout="stacked"] #players,
#app[data-layout="stacked"] #videos {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
#app[data-layout="stacked"] .hero { max-width: 760px; }
#app[data-layout="stacked"] .refs { margin-top: 0; }
#app[data-layout="stacked"] .results:not(.has-audio) .answer-col,
#app[data-layout="stacked"] .results:not(.has-audio) .refs { max-width: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .results, .results:not(.has-audio) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "answer" "audio" "refs";
    grid-template-rows: auto auto auto;
    gap: 26px 0;
  }
  .rail { position: static; }
  .hero-img { max-width: 340px; }
  .results:not(.has-audio) .answer-col,
  .results:not(.has-audio) .refs { max-width: none; }
}
@media (max-width: 620px) {
  .wrap { padding: 0 15px 40px; }
  .masthead-inner { padding: 12px 15px; }
  .hero { padding-top: 30px; }
  .hero-title { font-size: 26px; }
  .ask input { font-size: 16px; padding: 11px 0; }
  .asked { font-size: 17px; }
  .answer { font-size: 16px; }
  .wordmark .logo { height: 30px; }
  .build {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px; color: var(--faint); letter-spacing: -.01em;
  margin-left: auto; margin-right: 16px; white-space: nowrap;
}
.build:empty { display: none; }

.controls { display: flex; align-items: center; gap: 18px; }
.layouts, .textsize { display: flex; align-items: center; gap: 4px; }
.textsize button {
  font: inherit; font-weight: 700; color: var(--muted);
  background: transparent; border: 1px solid var(--line); border-radius: 6px;
  min-width: 30px; padding: 3px 7px; cursor: pointer; transition: all .13s ease;
  line-height: 1.5;
}
.textsize button:nth-child(2) { font-size: 12.5px; }
.textsize button:nth-child(3) { font-size: 15px; }
.textsize button:nth-child(4) { font-size: 17px; }
.textsize button:hover { color: var(--navy); border-color: var(--navy); }
.textsize button:active { transform: scale(.94); }
.layouts-label {
  font-size: 10.5px; font-weight: 900; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint); margin-right: 6px;
}
.layouts button {
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--muted);
  background: transparent; border: 1px solid transparent; border-radius: 999px;
  padding: 4px 11px; cursor: pointer; transition: all .13s ease;
}
.layouts button:hover { color: var(--navy); background: var(--raise); }
.layouts button[aria-pressed="true"] {
  color: var(--navy); background: var(--lime); border-color: var(--lime);
}

.wordmark-text { display: none; }
  .ref { flex-wrap: wrap; }
  .ref-meta { margin-left: 29px; white-space: normal; }
  .ref-open { display: none; }
}
