/* =========================================================================
   BoomReader UK — pages rendered by the Worker: blog, competitions, 404.
   Matches the look of the static pages (hero, grey sections, white cards).
   ========================================================================= */

:root {
  --c-indigo: #212771;
  --c-raspberry: #bf3765;
  --c-raspberry-btn: #b9335f;
  --c-raspberry-dark: #9c2a50;
  --c-ink: #2f3437;
  --c-text: #4a4f52;
  --c-muted: #61676e;   /* was #6b7178: 4.29:1 on the grey sections, now 4.97:1 (WCAG 1.4.3) */
  --c-green: #667f1c;
  --c-sun: #ffc93c;
  --c-grey: #efefef;
  --c-ground: #efefef;
  --c-line: #d8dbe4;
  --c-shadow: 0 14px 34px rgba(33, 39, 113, 0.09);
}

.c-wrap { position: relative; z-index: 2; max-width: 1120px; margin: 0 auto; }
.c-wrap--narrow { max-width: 760px; }
.c-center { text-align: center; }

/* hero */
.c-hero {
  position: relative; overflow: hidden;
  padding: 76px 24px 104px;
  background: linear-gradient(180deg, var(--c-indigo) 0%, var(--c-indigo) 40%, var(--c-raspberry) 100%);
  color: #fff; text-align: center;
}
.c-hero--post { text-align: left; padding-bottom: 96px; }
.c-hero h1 {
  max-width: 900px; margin: 0 auto;
  color: #fff; font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 800; line-height: 1.06;
  letter-spacing: -0.01em; text-wrap: balance;
}
.c-hero--post h1 { margin: 0; font-size: clamp(2rem, 4.4vw, 3.1rem); line-height: 1.1; }
.c-hero__intro { max-width: 680px; margin: 18px auto 0; color: rgba(255, 255, 255, 0.92); font-size: clamp(1.05rem, 1.5vw, 1.2rem); line-height: 1.6; }
.c-pill { display: inline-block; margin: 0 0 18px; padding: 7px 16px; border-radius: 999px; background: #fff; color: var(--c-indigo); font-size: 0.95rem; font-weight: 800; }
.c-torn { position: absolute; left: 0; right: 0; bottom: -1px; z-index: 3; display: block; width: 100%; height: 40px; }
.c-crumbs { margin: 0 0 14px; font-weight: 700; }
.c-crumbs a { color: #fff; text-decoration: none; border-bottom: 2px solid rgba(255, 255, 255, 0.4); }
.c-crumbs a:hover { border-color: var(--c-sun); }
.c-hero a:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: 4px; }

/* sections */
.c-sec { position: relative; padding: 72px 24px; background: #fff; color: var(--c-text); }
.c-sec--grey, .c-sec--post { background: var(--c-grey); }
.c-sec--post { padding-top: 40px; }
.c-h2 { margin: 0 0 28px; color: var(--c-ink); font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-weight: 800; line-height: 1.15; text-wrap: balance; }
.c-h3 { margin: 0; color: var(--c-ink); font-size: 1.35rem; font-weight: 800; line-height: 1.25; }
.c-lead { font-size: 1.12rem; }
.c-small { margin: 8px 0 0; font-size: 0.93rem; color: var(--c-muted); }
.c-empty { padding: 34px; border-radius: 22px; background: #fff; text-align: center; font-size: 1.05rem; }
.c-empty a, .c-prose a, .c-callout a, .c-small a, .c-check a { color: var(--c-raspberry-dark); font-weight: 700; text-underline-offset: 3px; }

/* buttons */
.c-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.c-actions--center { justify-content: center; }
.c-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 11px 24px;
  border: 2px solid transparent; border-radius: 999px;
  font: 700 1rem/1.2 "Red Hat Display", "Segoe UI", Arial, sans-serif;
  text-decoration: none; cursor: pointer;
  transition: background-color 150ms ease, transform 150ms ease;
}
.c-btn:hover { transform: translateY(-2px); }
.c-btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.c-btn--raspberry { border-color: var(--c-raspberry-btn); background: var(--c-raspberry-btn); color: #fff; }
.c-btn--raspberry:hover { border-color: var(--c-raspberry-dark); background: var(--c-raspberry-dark); }
.c-btn--plain { border-color: var(--c-line); background: #fff; color: var(--c-text); }
.c-btn--plain:hover { background: #f4f5f8; }
.c-btn:focus-visible, .c-chip:focus-visible, .c-card a:focus-visible { outline: 3px solid var(--c-ink); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .c-btn, .c-card { transition: none; } .c-btn:hover, .c-card:hover { transform: none; } }

/* category chips */
.c-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 30px; }
.c-chip { padding: 8px 16px; border-radius: 999px; background: #fff; color: var(--c-ink); font-weight: 700; font-size: 0.95rem; text-decoration: none; box-shadow: 0 2px 8px rgba(33, 39, 113, 0.06); }
.c-chip:hover { background: #fbe9ef; }
.c-chip[aria-current="page"] { background: var(--c-indigo); color: #fff; }

/* cards */
.c-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 24px; }
.c-card { display: flex; flex-direction: column; overflow: hidden; border-radius: 22px; background: #fff; box-shadow: var(--c-shadow); transition: transform 180ms ease, box-shadow 180ms ease; }
.c-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px rgba(33, 39, 113, 0.14); }
.c-card__media { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #e9ecf7; }
.c-card__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.c-card__ph { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, var(--c-indigo), var(--c-raspberry)) ; opacity: 0.85; }
.c-card__ph--trophy { background: var(--c-sun) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23212771' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 4h8v5a4 4 0 0 1-8 0z'/%3E%3Cpath d='M8 6H4v1a4 4 0 0 0 4 4M16 6h4v1a4 4 0 0 1-4 4M12 13v4M8 21h8M9 17h6'/%3E%3C/svg%3E") center / 30% no-repeat; opacity: 1; }
.c-card__body { display: flex; flex-direction: column; gap: 8px; padding: 22px 24px 26px; }
.c-card__body p { margin: 0; line-height: 1.6; }
.c-card__title { margin: 0; font-size: 1.22rem; font-weight: 800; line-height: 1.3; }
.c-card__title a { color: var(--c-ink); text-decoration: none; }
.c-card__title a:hover { color: var(--c-raspberry-dark); }
.c-meta { color: var(--c-muted); font-size: 0.9rem; font-weight: 600; }
.c-meta--light { margin: 16px 0 0; color: rgba(255, 255, 255, 0.85); }

.c-pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 40px; }
.c-pager > :last-child { justify-self: end; }
.c-pager__at { color: var(--c-muted); font-weight: 700; }

/* article */
.c-article__cover { display: block; width: 100%; height: auto; margin: 0 0 34px; border-radius: 22px; box-shadow: var(--c-shadow); }
.c-prose { color: var(--c-text); font-size: 1.1rem; line-height: 1.75; overflow-wrap: break-word; }
.c-sec--post .c-prose { padding: 40px 44px; border-radius: 26px; background: #fff; box-shadow: var(--c-shadow); }
.c-prose > :first-child { margin-top: 0; }
.c-prose h2 { margin: 1.8em 0 0.5em; color: var(--c-ink); font-size: 1.6rem; font-weight: 800; line-height: 1.25; }
.c-prose h3 { margin: 1.6em 0 0.4em; color: var(--c-ink); font-size: 1.28rem; font-weight: 800; }
.c-prose h4 { margin: 1.4em 0 0.3em; color: var(--c-ink); font-size: 1.1rem; font-weight: 800; }
.c-prose p, .c-prose ul, .c-prose ol, .c-prose blockquote, .c-prose figure, .c-prose table { margin: 0 0 1.1em; }
.c-prose ul, .c-prose ol { padding-left: 1.4em; }
.c-prose li { margin: 0.3em 0; }
.c-prose img { display: block; max-width: 100%; height: auto; margin: 1.4em auto; border-radius: 16px; }
.c-prose figcaption { margin-top: -0.6em; color: var(--c-muted); font-size: 0.92rem; text-align: center; }
.c-prose blockquote { padding: 14px 22px; border-left: 5px solid var(--c-raspberry); border-radius: 0 14px 14px 0; background: #fbe9ef; color: var(--c-ink); font-weight: 600; }
.c-prose iframe { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; margin: 1.4em 0; border: 0; border-radius: 16px; }
.c-prose table { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.c-prose th, .c-prose td { padding: 8px 10px; border: 1px solid var(--c-line); text-align: left; }
.c-prose pre { overflow-x: auto; padding: 14px; border-radius: 12px; background: #f4f5f8; font-size: 0.9rem; }
.c-prose .ql-align-center { text-align: center; }
.c-prose .ql-align-right { text-align: right; }
.c-prose .ql-align-justify { text-align: justify; }
.c-prose .ql-size-small { font-size: 0.85em; }
.c-prose .ql-size-large { font-size: 1.3em; }
.c-prose .ql-size-huge { font-size: 1.8em; }
.c-prose .ql-indent-1 { padding-left: 2em; }
.c-prose .ql-indent-2 { padding-left: 4em; }

.c-trial { margin-top: 34px; padding: 32px 36px; border-radius: 26px; background: linear-gradient(160deg, var(--c-raspberry) 0%, #7a2c63 50%, var(--c-indigo) 115%); color: #fff; }
.c-trial h2 { margin: 0; color: #fff; font-size: 1.5rem; font-weight: 800; }
.c-trial p { margin: 8px 0 0; color: rgba(255, 255, 255, 0.9); line-height: 1.6; }
.c-trial .c-btn--raspberry { border-color: #fff; background: #fff; color: var(--c-indigo); }
.c-trial .c-btn--plain { border-color: #fff; background: transparent; color: #fff; }
.c-trial .c-btn:focus-visible { outline-color: #fff; }

/* competitions */
.c-status { display: inline-block; margin-right: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 800; }
.c-status--open { background: #eef3e0; color: #4c6112; }
.c-status--upcoming { background: #fff4d6; color: #7a5400; }
.c-status--closed { background: #eceef3; color: #5a6068; }

.c-comp { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 36px; align-items: start; }
.c-comp__main > * + * { margin-top: 26px; }
.c-comp__main > .c-prose { padding: 34px 38px; border-radius: 24px; background: #fff; box-shadow: var(--c-shadow); }
.c-comp__side { position: sticky; top: calc(var(--site-header-h, 76px) + 20px); }
.c-callout { margin: 0; padding: 16px 20px; border-radius: 16px; background: #fff; font-size: 1.02rem; line-height: 1.5; box-shadow: var(--c-shadow); }
.c-callout--open { border-left: 6px solid var(--c-green); }
.c-callout--closed { border-left: 6px solid var(--c-raspberry); }
.c-winners { padding: 30px 34px; border-radius: 24px; background: #fff8e3; border: 2px solid var(--c-sun); }
.c-winners .c-prose { margin-top: 12px; }
.c-prompt { padding: 26px 30px; border-radius: 22px; background: #fff; box-shadow: var(--c-shadow); }
.c-prompt p { margin: 10px 0 0; line-height: 1.6; }
.c-terms { padding: 18px 24px; border-radius: 18px; background: #fff; }
.c-terms summary { cursor: pointer; color: var(--c-ink); font-weight: 800; }
.c-terms .c-prose { margin-top: 14px; font-size: 0.98rem; }
.c-dates { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 16px 0 22px; }
.c-dates dt { font-weight: 800; color: var(--c-ink); }
.c-dates dd { margin: 0; }

/* entry form */
.c-form, .c-done { padding: 30px; border-radius: 24px; background: #fff; box-shadow: var(--c-shadow); }
.c-done:focus { outline: none; }
.c-done p { line-height: 1.6; }
.c-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0 8px; }
.c-field { display: flex; flex-direction: column; gap: 6px; }
.c-field--wide { grid-column: 1 / -1; }
.c-field label { color: var(--c-ink); font-weight: 700; font-size: 0.95rem; }
.c-field input, .c-field select, .c-field textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 2px solid #8a8f99; border-radius: 14px; background: #fff;   /* 3.25:1 so the box can be seen (WCAG 1.4.11) */
  color: var(--c-ink); font: 500 1rem/1.4 "Red Hat Display", "Segoe UI", Arial, sans-serif;
}
.c-field textarea { resize: vertical; }
.c-field input[type="file"] { padding: 9px 10px; }
.c-field input:focus, .c-field select:focus, .c-field textarea:focus { outline: none; border-color: var(--c-indigo); box-shadow: 0 0 0 3px rgba(33, 39, 113, 0.15); }
.c-field.is-bad input, .c-field.is-bad select, .c-field.is-bad textarea { border-color: #c0392b; }
.c-hint { margin: 0; color: var(--c-muted); font-size: 0.85rem; }
.c-check { flex-direction: row; align-items: flex-start; gap: 10px; }
.c-check input { flex: none; width: 20px; height: 20px; min-height: 0; margin-top: 2px; accent-color: var(--c-raspberry-btn); }
.c-check label { font-weight: 500; font-size: 0.9rem; line-height: 1.5; color: var(--c-text); }
.c-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* visually hidden, still read by screen readers */
.c-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.c-formmsg { min-height: 1.4em; margin: 6px 0 12px; font-weight: 700; color: #b0302a; }
.c-formmsg.is-ok { color: #4c6112; }

@media (max-width: 900px) {
  .c-comp { grid-template-columns: 1fr; }
  .c-comp__side { position: static; }
}
@media (max-width: 600px) {
  .c-hero { padding: 56px 20px 88px; }
  .c-sec { padding: 52px 18px; }
  .c-sec--post .c-prose, .c-comp__main > .c-prose { padding: 26px 22px; border-radius: 20px; font-size: 1.04rem; }
  .c-fields { grid-template-columns: 1fr; }
  .c-form, .c-done { padding: 24px 20px; }
  .c-trial { padding: 26px 22px; }
  .c-pager { grid-template-columns: 1fr 1fr; }
  .c-pager__at { display: none; }
}

/* YouTube placeholders (the player loads after consent) */
.c-video { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; margin: 1.4em 0; overflow: hidden; border-radius: 16px; background: linear-gradient(160deg, var(--c-indigo), var(--c-raspberry)); }
.c-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; border: 0; border-radius: 0; aspect-ratio: auto; }
.c-video > button { display: inline-flex; align-items: center; gap: 10px; padding: 14px 24px; border: 0; border-radius: 999px; background: #fff; color: var(--c-indigo); font: 800 1rem/1 "Red Hat Display", "Segoe UI", Arial, sans-serif; cursor: pointer; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25); }
.c-video > button svg { width: 22px; height: 22px; fill: var(--c-raspberry); }
.c-video > button:hover { transform: translateY(-2px); }
.c-video > button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* competition preview links: the banner at the top of /competitions/preview/<token> */
.c-preview { position: relative; z-index: 5; padding: 12px 24px; background: #ffc93c; color: #2f3437; font-size: 0.95rem; line-height: 1.5; }
.c-preview strong { display: inline-block; margin-right: 8px; padding: 2px 10px; border-radius: 999px; background: #212771; color: #fff; font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; }
.c-preview a { color: #212771; font-weight: 800; }

/* private downloads page (/downloads/<form>/<token>), e.g. the Young Reporter packs */
.dl-list { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.dl-list a { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: 20px; background: #fff; color: var(--c-ink); text-decoration: none; box-shadow: var(--c-shadow); transition: transform 150ms ease; }
.dl-list a:hover { transform: translateY(-2px); }
.dl-list__icon { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 14px; background: var(--c-raspberry-btn); color: #fff; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.04em; }
.dl-list strong { display: block; font-size: 1.08rem; }
.dl-list small { display: block; color: var(--c-muted); }
.dl-list__go { margin-left: auto; color: var(--c-raspberry-dark); font-weight: 800; }
.dl-note { margin: 22px 0 0; color: var(--c-muted); font-size: 0.95rem; }
@media (prefers-reduced-motion: reduce) { .dl-list a { transition: none; } .dl-list a:hover { transform: none; } }
