/* ==========================================================================
   pages.css — shared chrome for the content pages (home, winners, about,
   legal, 404). Loaded after tokens.css; it does NOT need site.css.

   Same restraint as the competition widget (GLEAM.md section 0): flat white
   surfaces, hairline borders, 4px radii on cards and 3px on buttons, 13-14px
   Helvetica, one green CTA, 20-30px of padding. Nothing here gradients,
   glows, lifts on hover, animates on scroll or sets type above 26px.

   Every colour, radius, font and shadow comes from a --gw-* token so the
   theme editor repaints these pages too. --gw-maxw-wide is not in tokens.css,
   so it is always read as var(--gw-maxw-wide, 940px) — set it on :root or
   inline on a page to widen a single layout.

   Contents
     1. Local values + page shell
     2. Header: brand, nav, header CTA, burger
     3. Main, hero, section
     4. Card, grid, CTA buttons, meta
     5. Lists, steps, winners, stats
     6. Prose + FAQ accordion
     7. Empty state + footer
     8. Responsive
     9. Dark-mode refinements
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Local values + page shell
   -------------------------------------------------------------------------- */

/* One derived grey the design needs (the #b6bac1 chevron/rule tone), mixed
   from the tokens so a re-themed page keeps its contrast relationships.
   Every use site passes var(--gw-muted) as the fallback, so the rules still
   stand if a block is rendered outside .pg or color-mix is unsupported. */
.pg {
  --gwp-faint: color-mix(in srgb, var(--gw-muted) 62%, var(--gw-surface));

  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--gw-bg);
  color: var(--gw-text);
  font-family: var(--gw-font);
  font-size: 14px;
  line-height: 1.45;
}

@supports not (color: color-mix(in srgb, red, blue)) {
  .pg {
    --gwp-faint: var(--gw-muted);
  }
}

/* --------------------------------------------------------------------------
   2. Header: brand, nav, header CTA, burger
   60px tall, white, one hairline underneath, sticky. It is also the
   positioning context for the mobile nav panel.
   -------------------------------------------------------------------------- */

.pg-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 60px;
  flex: none;
  background: var(--gw-surface);
  border-bottom: 1px solid var(--gw-border);
}

.pg-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--gw-maxw-wide, 940px);
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

/* Brand ------------------------------------------------------------------- */

.pg-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--gw-text);
  font-family: var(--gw-font-head);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}

.pg-brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: var(--gw-radius-sm);
  background: var(--gw-primary);
  color: var(--gw-primary-ink);
}

.pg-brand__mark svg,
.pg-brand__mark img {
  width: 13px;
  height: 13px;
}

.pg-brand__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Nav --------------------------------------------------------------------- */

.pg-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.pg-nav a,
.pg-nav__link {
  color: var(--gw-muted);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.12s ease;
}

.pg-nav a:hover,
.pg-nav__link:hover {
  color: var(--gw-text);
}

.pg-nav a.is-active,
.pg-nav__link.is-active,
.pg-nav a[aria-current='page'] {
  color: var(--gw-text);
}

/* The small green button that sits at the end of the nav. */
.pg-nav__cta,
.pg-nav a.pg-nav__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: var(--gw-radius-sm);
  background: var(--gw-primary);
  color: var(--gw-primary-ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.pg-nav__cta svg {
  width: 13px;
  height: 13px;
}

.pg-nav a.pg-nav__cta:hover {
  color: var(--gw-primary-ink);
}

/* Burger ------------------------------------------------------------------ */

.pg-burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--gw-border-strong);
  border-radius: var(--gw-radius-sm);
  background: var(--gw-surface);
  color: var(--gw-text);
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.pg-burger svg {
  width: 18px;
  height: 18px;
}

/* --------------------------------------------------------------------------
   3. Main, hero, section
   -------------------------------------------------------------------------- */

.pg-main {
  width: 100%;
  max-width: var(--gw-maxw-wide, 940px);
  flex: 1 0 auto;
  margin: 0 auto;
  padding: 30px 20px;
}

/* Plain intro block — a title, a sentence, optionally a couple of buttons.
   No border and no background: it is type on the page background. */
.pg-hero {
  padding: 28px 0;
}

/* Defensive: a hero placed straight under the header rather than inside
   .pg-main still gets the container and its side padding. */
.pg > .pg-hero {
  width: 100%;
  max-width: var(--gw-maxw-wide, 940px);
  margin: 0 auto;
  padding-right: 20px;
  padding-left: 20px;
}

.pg-hero h1,
.pg-hero__title {
  margin: 0;
  font-family: var(--gw-font-head);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--gw-text);
}

.pg-hero p,
.pg-hero__sub {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--gw-muted);
  font-size: 15px;
}

.pg-hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

/* Section ----------------------------------------------------------------- */

.pg-section {
  margin-top: 26px;
}

.pg-section:first-child,
.pg-hero + .pg-section {
  margin-top: 0;
}

.pg-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
  padding-bottom: 9px;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--gw-border);
}

.pg-section__head h2,
.pg-section__title {
  margin: 0;
  font-family: var(--gw-font-head);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--gw-text);
}

.pg-section__sub {
  min-width: 0;
  color: var(--gw-muted);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   4. Card, grid, CTA buttons, meta
   -------------------------------------------------------------------------- */

.pg-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--gw-border);
  border-radius: var(--gw-radius);
  background: var(--gw-surface);
  box-shadow: var(--gw-shadow);
}

.pg-card > :last-child {
  margin-bottom: 0;
}

.pg-card h3,
.pg-card__title {
  margin: 0 0 6px;
  font-family: var(--gw-font-head);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--gw-text);
}

.pg-card p,
.pg-card__text {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--gw-muted);
}

/* Grid -------------------------------------------------------------------- */

.pg-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 15px;
}

.pg-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* CTA --------------------------------------------------------------------- */

.pg-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border: 1px solid transparent;
  border-radius: var(--gw-radius-sm);
  background: var(--gw-primary);
  color: var(--gw-primary-ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.pg-cta svg {
  flex: none;
  width: 14px;
  height: 14px;
}

.pg-cta--ghost {
  background: transparent;
  border-color: var(--gw-border-strong);
  color: var(--gw-text);
}

.pg-cta:disabled,
.pg-cta[aria-disabled='true'] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Darken on hover — never lift, glow or gradient. Falls back to the flat
   fill where color-mix is unsupported. */
@supports (background: color-mix(in srgb, red, blue)) {
  .pg-nav__cta:hover,
  .pg-cta:hover {
    background: color-mix(in srgb, var(--gw-primary) 92%, #000);
  }

  .pg-nav__cta:active,
  .pg-cta:active {
    background: color-mix(in srgb, var(--gw-primary) 86%, #000);
  }

  .pg-burger:hover {
    background: color-mix(in srgb, var(--gw-surface) 94%, #000);
  }
}

.pg-cta--ghost:hover,
.pg-cta--ghost:active {
  background: var(--gw-bg-2);
  border-color: var(--gw-border-strong);
  color: var(--gw-text);
}

.pg-cta--ghost:disabled:hover {
  background: transparent;
}

/* Meta -------------------------------------------------------------------- */

.pg-meta {
  margin: 0;
  color: var(--gw-muted);
  font-size: 12px;
}

.pg-meta a {
  color: var(--gw-accent);
}

.pg-meta a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   5. Lists, steps, winners, stats
   -------------------------------------------------------------------------- */

.pg-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pg-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 9px 0;
  border-top: 1px solid var(--gw-border);
  font-size: 13px;
  color: var(--gw-text);
}

.pg-list__item:first-child {
  border-top: 0;
  padding-top: 0;
}

.pg-list__item:last-child {
  padding-bottom: 0;
}

.pg-list__label {
  min-width: 0;
}

.pg-list__value {
  flex: none;
  color: var(--gw-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pg-list__item a {
  color: var(--gw-accent);
}

.pg-list__item a:hover {
  text-decoration: underline;
}

/* Steps ------------------------------------------------------------------- */

.pg-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  counter-reset: pg-step;
  list-style: none;
}

.pg-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  font-size: 13px;
}

/* The number comes from a counter, so a step needs no extra markup. Pages
   that render their own .pg-step__num get the same circle instead. */
.pg-step::before {
  content: counter(pg-step);
  counter-increment: pg-step;
}

.pg-step::before,
.pg-step__num {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gw-primary);
  color: var(--gw-primary-ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

@supports selector(:has(*)) {
  .pg-step:has(.pg-step__num)::before {
    content: none;
    counter-increment: none;
  }
}

.pg-step__body {
  min-width: 0;
  padding-top: 2px;
}

.pg-step__title {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gw-text);
}

.pg-step__text {
  margin: 0;
  color: var(--gw-muted);
  font-size: 13px;
}

/* Winners archive --------------------------------------------------------- */

.pg-winner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid var(--gw-border);
  font-size: 13px;
}

.pg-winner:first-child {
  border-top: 0;
}

.pg-winner__rank {
  flex: 0 0 26px;
  width: 26px;
  color: var(--gw-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pg-winner__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--gw-text);
}

.pg-winner__prize {
  flex: 0 1 auto;
  min-width: 0;
  color: var(--gw-muted);
  text-align: right;
}

.pg-winner__date {
  flex: none;
  color: var(--gwp-faint, var(--gw-muted));
  font-size: 12px;
  white-space: nowrap;
}

/* Stats ------------------------------------------------------------------- */

.pg-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pg-stat__value {
  font-family: var(--gw-font-head);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--gw-text);
  font-variant-numeric: tabular-nums;
}

.pg-stat__label {
  color: var(--gw-muted);
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   6. Prose + FAQ accordion
   -------------------------------------------------------------------------- */

.pg-prose {
  max-width: 720px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--gw-text);
}

.pg-prose > :first-child {
  margin-top: 0;
}

.pg-prose > :last-child {
  margin-bottom: 0;
}

.pg-prose h2 {
  margin: 22px 0 8px;
  font-family: var(--gw-font-head);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.pg-prose h3 {
  margin: 16px 0 6px;
  font-family: var(--gw-font-head);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.pg-prose p {
  margin: 0 0 10px;
}

.pg-prose ul,
.pg-prose ol {
  margin: 0 0 10px;
  padding-left: 20px;
}

.pg-prose ul {
  list-style: disc;
}

.pg-prose ol {
  list-style: decimal;
}

.pg-prose li {
  margin: 0 0 4px;
}

.pg-prose li::marker {
  color: var(--gw-muted);
}

.pg-prose a {
  color: var(--gw-accent);
  text-decoration: underline;
}

.pg-prose strong {
  font-weight: 600;
}

.pg-prose hr {
  height: 0;
  margin: 18px 0;
  border: 0;
  border-top: 1px solid var(--gw-border);
}

.pg-prose small {
  color: var(--gw-muted);
  font-size: 12px;
}

/* FAQ --------------------------------------------------------------------- */

/* Works with either markup: .pg-faq > .pg-faq__item > (q + a), or a flat
   run of q/a pairs straight inside .pg-faq. */
.pg-faq__item,
.pg-faq > .pg-faq__q {
  border-top: 1px solid var(--gw-border);
}

.pg-faq__item:first-child,
.pg-faq > .pg-faq__q:first-child {
  border-top: 0;
}

.pg-faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 0;
  color: var(--gw-text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.pg-faq__q svg {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  color: var(--gwp-faint, var(--gw-muted));
  transition: transform 0.18s ease;
}

.pg-faq__item.is-open .pg-faq__q svg,
.pg-faq__q[aria-expanded='true'] svg {
  transform: rotate(180deg);
}

.pg-faq__a {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  color: var(--gw-muted);
  font-size: 13px;
  transition: max-height 0.18s ease, opacity 0.18s ease, padding 0.18s ease;
}

.pg-faq__item.is-open .pg-faq__a,
.pg-faq__q[aria-expanded='true'] + .pg-faq__a {
  max-height: 420px;
  padding-bottom: 12px;
  opacity: 1;
  visibility: visible;
}

.pg-faq__a p {
  margin: 0 0 8px;
}

.pg-faq__a > :last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   7. Empty state + footer
   -------------------------------------------------------------------------- */

.pg-empty {
  margin: 0;
  padding: 26px 15px;
  color: var(--gw-muted);
  font-size: 13px;
  text-align: center;
}

.pg-footer {
  flex: none;
  padding: 20px;
  border-top: 1px solid var(--gw-border);
  background: var(--gw-surface);
  color: var(--gw-muted);
  font-size: 12px;
}

.pg-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  max-width: var(--gw-maxw-wide, 940px);
  margin: 0 auto;
}

.pg-footer__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pg-footer p {
  margin: 0;
}

.pg-footer a {
  color: var(--gw-muted);
  text-decoration: none;
}

.pg-footer a:hover {
  color: var(--gw-text);
  text-decoration: underline;
}

.pg-footer__sep {
  color: var(--gwp-faint, var(--gw-muted));
}

/* --------------------------------------------------------------------------
   8. Responsive
   One column and a collapsed nav under 720px; nothing overflows at 360px.
   -------------------------------------------------------------------------- */

@media (max-width: 720px) {
  .pg-burger {
    display: inline-flex;
    order: 2;
  }

  /* The nav drops out of the header bar and becomes a panel under it. */
  .pg-nav {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px 20px 12px;
    border-bottom: 1px solid var(--gw-border);
    background: var(--gw-surface);
    box-shadow: var(--gw-shadow);
  }

  .pg-nav.is-open {
    display: flex;
  }

  .pg-nav a,
  .pg-nav__link {
    padding: 10px 0;
    border-top: 1px solid var(--gw-border);
  }

  .pg-nav > :first-child {
    border-top: 0;
  }

  .pg-nav__cta,
  .pg-nav a.pg-nav__cta {
    align-self: flex-start;
    margin-top: 10px;
    padding: 6px 14px;
    border-top: 0;
  }

  .pg-grid--3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .pg-section__sub {
    flex: 1 0 100%;
  }

  .pg-hero {
    padding: 22px 0;
  }

  .pg-hero h1,
  .pg-hero__title {
    font-size: 22px;
  }

  .pg-hero p,
  .pg-hero__sub {
    font-size: 14px;
  }

  .pg-footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .pg-winner__prize {
    flex: 1 0 100%;
    padding-left: 38px;
    text-align: left;
  }
}

@media (max-width: 520px) {
  .pg-header__inner,
  .pg-footer {
    padding-right: 14px;
    padding-left: 14px;
  }

  .pg-nav {
    padding-right: 14px;
    padding-left: 14px;
  }

  .pg-main,
  .pg > .pg-hero {
    padding-right: 14px;
    padding-left: 14px;
  }

  .pg-main {
    padding-top: 22px;
    padding-bottom: 22px;
  }

  .pg-card {
    padding: 14px;
  }

  .pg-cta {
    padding: 9px 16px;
  }

  .pg-hero__actions .pg-cta {
    flex: 1 1 auto;
  }
}

@media (max-width: 380px) {
  .pg-brand {
    font-size: 14px;
  }

  .pg-winner__date {
    display: none;
  }

  .pg-prose {
    font-size: 13px;
  }
}

/* --------------------------------------------------------------------------
   9. Dark-mode refinements
   The tokens already carry the dark palette; these are the few places where
   a dark surface needs a different treatment rather than a different value.
   -------------------------------------------------------------------------- */

[data-mode='dark'] .pg-burger {
  background: var(--gw-surface-2);
}

/* On dark surfaces "darken" reads as dead — lift the fill instead. */
[data-mode='dark'] .pg-cta--ghost:hover,
[data-mode='dark'] .pg-cta--ghost:active {
  background: var(--gw-surface-2);
}

@supports (background: color-mix(in srgb, red, blue)) {
  [data-mode='dark'] .pg-burger:hover {
    background: color-mix(in srgb, var(--gw-surface-2) 90%, #fff);
  }

  [data-mode='dark'] .pg-cta--ghost:hover {
    background: color-mix(in srgb, var(--gw-surface) 88%, #fff);
  }
}

/* The light shadow is a hairline on white; on a dark surface it only muddies
   the card edge, so the border carries it alone. */
[data-mode='dark'] .pg-card {
  box-shadow: none;
}
