/* Rangooo article and activity pages: template-level polish (linked by tools/articles-polish.js).
   Covers the single-topic .fe-hero article template (<main class="fe fp">), the moral quiz (.mq), the quiz hub (.qz)
   and the activity-sheets hub. Phones (<700px) on .fp pages are drawn by the guide-mode / step-cards app view, so
   nearly everything here is for 700px and wider; the few phone rules only touch the long page those views fall back to. */

/* ---------- 1. reading width: site.css sets `.rg main{max-width:1120px}`, which beats each template's own width
   (.fe 900px, .mq 760px, .qz 860px). Text then sat in a 626px column on the left of a 1120px box. Restore them. */
.rg main.fe{max-width:900px}
.rg main.mq{max-width:760px}
.rg main.qz{max-width:860px}

@media (min-width:700px){
  /* ---------- 2. hero: more air, a measured headline, and a little space before the first section */
  .fp .fe-hero{padding:36px 40px 38px;border-radius:28px}
  .fp .fe-hero h1{font-size:clamp(34px,4.4vw,50px);line-height:1.08;max-width:20ch;text-wrap:balance}
  .fp .fe-hero p{font-size:18px;line-height:1.6;max-width:60ch;text-wrap:pretty}
  .fe .crumb{margin:12px 0 10px}

  /* ---------- 3. type scale and rhythm: h1 50 / h2 28 / h3 20 Inter semibold (site.css forces 20) / body 17 (was 48 / 24 / 20 / 16) */
  .fp .fp-sec{margin-top:40px}
  .fp .fp-sec h2{font-size:28px;line-height:1.2;margin:0 0 12px;text-wrap:balance}
  .fp .fp-sec h3{font:600 20px/1.35 Inter,'Noto Sans',system-ui,sans-serif;letter-spacing:0;margin:22px 0 6px}
  .fp .fp-sec h2+h3{margin-top:6px}
  .fp .fp-sec p{font-size:17px;line-height:1.7;max-width:68ch;margin:0 0 12px}
  .fp .fp-sec ul,.fp .fp-sec ol{margin:4px 0 14px;padding-left:24px;max-width:68ch}
  .fp .fp-sec li{font-size:17px;line-height:1.65;margin:0 0 8px;padding-left:2px}
  .fp .fp-sec li::marker{color:var(--acc)}
  .fp .fp-sec ol>li::marker{font-weight:600}
  .fp .fp-sec li>p{margin:0 0 6px}
  .fp .fp-sec p a,.fp .fp-sec li a,.fp .fp-sec td a{color:var(--acc);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px}
  .fp .fp-sec p a:hover,.fp .fp-sec li a:hover,.fp .fp-sec td a:hover{text-decoration-thickness:2px}
  .fp .fp-sec a:focus-visible{outline:3px solid #E8590C;outline-offset:2px;border-radius:4px}
  .fp .fp-small{font-size:15px}

  /* ---------- 4. callout: the closing note matches the site's cards (solid hairline, warm paper) instead of a dashed box */
  .fp .fp-sec.fp-note{margin-top:44px;padding:22px 26px;border:1px solid #EFD9BC;border-radius:22px;background:#FFF8EE}
  .fp .fp-sec.fp-note h2{font-size:22px}
  .fp .fp-sec.fp-note p{font-size:16px;margin-bottom:6px}
  .fp .fp-sec.fp-note p:last-child{margin-bottom:0}

  /* ---------- 5. related-pages pills: hover and spacing */
  .fp-nav{gap:10px;margin-top:28px}
  .fp-nav a{transition:border-color .15s,background-color .15s}
  .fp-nav a:hover{border-color:var(--acc);background:#F3F8F8}

  /* ---------- 5b. directory lists (stories-and-activities): two columns instead of one 28-row column */
  .fp .fp-sec ul.sa-list{columns:2 320px;column-gap:40px;max-width:none}
  .fp .fp-sec ul.sa-list>li{break-inside:avoid}
  .fp .fp-sec ul.sa-list a{text-decoration:none}
  .fp .fp-sec ul.sa-list a:hover strong{text-decoration:underline;text-underline-offset:3px}

  /* ---------- 6. tables: one rounded frame with row rules, instead of a full cell grid */
  .fp table{border-collapse:separate;border-spacing:0;border:1px solid var(--line);border-radius:14px;overflow:hidden}
  .fp th,.fp td{border:0;border-bottom:1px solid var(--line)}
  .fp tbody tr:last-child>th,.fp tbody tr:last-child>td{border-bottom:0}
}

/* ---------- 7. answer reveal (<details>, riddles / jokes / national-days quiz): a real button-sized control, all widths */
.fp details{margin:6px 0 4px;max-width:68ch}
.fp details>summary{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 16px 0 12px;border-radius:999px;
  border:1px solid #D5D6CF;background:#fff;color:var(--acc);font:600 15px/1.2 Inter,'Noto Sans',system-ui,sans-serif;
  cursor:pointer;list-style:none;user-select:none;-webkit-tap-highlight-color:transparent;transition:border-color .15s,background-color .15s}
.fp details>summary::-webkit-details-marker{display:none}
.fp details>summary::before{content:"";width:8px;height:8px;margin:0 2px 0 4px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(-45deg);transition:transform .2s}
.fp details[open]>summary::before{transform:rotate(45deg) translate(-2px,-2px)}
.fp details>summary:hover{border-color:var(--acc);background:#F3F8F8}
.fp details>summary:focus-visible{outline:3px solid #E8590C;outline-offset:2px}
.fp details>summary~*{width:fit-content;max-width:100%;box-sizing:border-box;margin:10px 0 4px;padding:12px 16px;border-radius:14px;background:#F3F8F8;border-left:3px solid var(--acc)}
.fp details>p:last-child{margin-bottom:4px}
.fp .fp-sec li:has(>details){margin-bottom:18px}

/* ---------- 8. quizzes: options in two columns on wide screens; question cards stay one readable width */
@media (min-width:900px){
  .mq .mq-opts{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
}

/* ---------- dark mode: the same two switches fpage.css uses */
@media (prefers-color-scheme:dark){
  html:has(main.fp) .fp details>summary{background:#18222D;border-color:#34445A}
  html:has(main.fp) .fp details>summary:hover{background:#16323A}
  html:has(main.fp) .fp details>summary~*{background:#16323A}
  html:has(main.fp) .fp .fp-sec.fp-note{background:#18222D;border-color:rgba(240,168,98,.35)}
  html:has(main.fp) .fp-nav a:hover{background:#16323A}
}
html[data-night="1"]:has(main.fp) .fp details>summary{background:#18222D;border-color:#34445A}
html[data-night="1"]:has(main.fp) .fp details>summary:hover{background:#16323A}
html[data-night="1"]:has(main.fp) .fp details>summary~*{background:#16323A}
html[data-night="1"]:has(main.fp) .fp .fp-sec.fp-note{background:#18222D;border-color:rgba(240,168,98,.35)}
html[data-night="1"]:has(main.fp) .fp-nav a:hover{background:#16323A}

@media (prefers-reduced-motion:reduce){
  .fp details>summary,.fp details>summary::before,.fp-nav a{transition:none}
}
