/* Quick! layout and components. Colors, fonts, sizes and shadows come from the
   variables in theme.css, which every page loads first. To reskin, change or
   override theme.css; this file should not need to change. */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-page);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--color-primary);
  line-height: var(--line-height-heading);
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.25rem, 6vw, 3.75rem); font-weight: var(--weight-bold); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.25rem); font-weight: var(--weight-bold); }
h3 { font-size: 1.25rem; font-weight: var(--weight-semibold); }

a { color: var(--color-primary); }

.wrap { max-width: var(--wrap-max); margin: 0 auto; padding: 0 var(--gutter); }

/* Header */
/* The Young Life wordmark is drawn for a dark background, so the header is navy. */
.site-header { background: var(--color-primary); color: var(--color-on-primary); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: var(--header-height); }
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; }
.brand img { height: var(--logo-height); width: auto; display: block; }
.brand .product {
  font-family: var(--font-heading); font-weight: var(--weight-bold); font-size: 1.25rem; color: var(--color-on-primary);
  border-left: 2px solid var(--color-on-primary-divider); padding-left: 0.75rem;
}
.nav { display: flex; align-items: center; gap: 1.25rem; font-weight: var(--weight-semibold); font-size: 0.95rem; }
.nav a { text-decoration: none; color: var(--color-on-primary); }
.nav a:hover { text-decoration: underline; }

/* Pilot notice above the header */
.pilot-banner { background: var(--color-accent); color: var(--color-on-color); font-size: 0.9rem; padding: 0.6rem 0; line-height: 1.45; }

/* Test-site notice under the pilot banner. Only the test environment renders it. */
.test-banner { background: var(--color-secondary); color: var(--color-on-color); font-size: 0.9rem; padding: 0.6rem 0; line-height: 1.45; }
.test-banner .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.test-note { margin-bottom: 1.25rem; }

/* Buttons: pill shaped and uppercase, like younglife.org */
.btn {
  display: inline-block; border-radius: var(--radius-pill); padding: 0.8rem 1.75rem;
  font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 0.03em; text-decoration: none;
  color: var(--color-on-accent); background: var(--color-accent); border: 0;
}
.btn:hover { filter: brightness(0.95); }
.btn.green { background: var(--color-secondary); }
.btn.navy { background: var(--color-primary); }
.btn.outline { background: transparent; border: 2px solid var(--color-on-primary); color: var(--color-on-primary); }
.btn.small { padding: 0.5rem 1.1rem; font-size: 0.8rem; }

/* Sections */
.hero { padding: 4rem 0 3rem; }
.hero.wash { background: var(--color-surface-alt); padding: 6rem 0; }
.hero p.lead { font-size: 1.15rem; color: var(--color-text-muted); max-width: 44rem; }
.band { padding: 3rem 0; }
.band.wash { background: var(--color-surface-alt); }
.muted { color: var(--color-text-muted); }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
.card {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.25rem;
  box-shadow: var(--shadow-card);
}
.card h3 { margin-bottom: 0.25rem; }
.card p { margin: 0.25rem 0 0; color: var(--color-text-muted); font-size: 0.95rem; }
a.card { display: block; text-decoration: none; color: inherit; border-top: 4px solid var(--color-secondary); }
a.card:hover { border-color: var(--color-primary); }
.card .meta { font-size: 0.85rem; color: var(--color-text-muted); margin-top: 0.75rem; overflow-wrap: anywhere; }
.card .url { font-size: 0.85rem; color: var(--color-primary); overflow-wrap: anywhere; }

.tag {
  display: inline-block; font-size: 0.75rem; font-weight: var(--weight-bold); text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.15rem 0.6rem; border-radius: var(--radius-pill); background: var(--color-surface-alt); color: var(--color-primary); margin-bottom: 0.5rem;
}
.tag.now { background: var(--color-secondary); color: var(--color-on-primary); }
.tag.next { background: var(--color-accent); color: var(--color-on-color); }

.callout {
  border-left: 4px solid var(--color-accent); background: var(--color-surface-alt); padding: 1rem 1.25rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Footer */
.site-footer { background: var(--color-primary); color: var(--color-on-primary); padding: 1.5rem 0; font-size: 0.9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }
.site-footer a { color: var(--color-on-primary); }
.site-footer nav { display: flex; gap: 1.5rem; flex-wrap: wrap; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.site-footer button.link { color: var(--color-accent); }

/* What's New dialog */
.modal {
  border: 0; border-radius: var(--radius); padding: 0; width: min(36rem, calc(100% - 2rem)); max-height: min(80vh, 40rem);
  color: var(--color-text); box-shadow: var(--shadow-modal);
}
.modal::backdrop { background: var(--color-backdrop); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border); position: sticky; top: 0; background: var(--color-surface);
}
.modal-head h2 { margin: 0; }
.modal-close { background: none; border: 0; font-size: 1.75rem; line-height: 1; cursor: pointer; color: var(--color-text-muted); }
.modal-body { padding: 0.5rem 1.25rem 1.25rem; }
.modal-body h3 { margin: 1rem 0 0.25rem; }
.modal-body h3 .muted { font-weight: 400; font-size: 0.9rem; }
.modal-body ul { margin: 0.25rem 0 0; padding-left: 1.25rem; }

/* Home and All sites: full-width color blocks, one per section */
.block { padding: var(--block-pad) 0; }
.block.navy { background: var(--color-primary); color: var(--color-on-primary); }
.block.navy h1, .block.navy h2, .block.navy > .wrap > h3 { color: var(--color-on-primary); }
.block.navy .muted { color: var(--color-on-primary-muted); }
.block.navy a:not(.btn):not(.card) { color: var(--color-accent); }
.block.gold { background: var(--color-accent); color: var(--color-on-color); }
.block.green { background: var(--color-secondary); color: var(--color-on-color); }
.block.wash { background: var(--color-surface-alt); }
.block.green .callout { background: var(--color-surface); }
.eyebrow { display: block; font-size: 0.8rem; font-weight: var(--weight-bold); letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 0.5rem; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1.5rem; margin-bottom: 1.25rem; }
.section-head h2 { margin: 0; }
.more { font-weight: var(--weight-bold); }

.mast { padding: 4.5rem 0 5rem; border-bottom: 6px solid var(--color-accent); }
.mast.short { padding: 3rem 0; }
.mast h1 { font-size: clamp(3.5rem, 12vw, 6.5rem); margin: 0 0 0.25rem; }
.bang { color: var(--color-accent); }
.mast .tagline { font-family: var(--font-heading); font-size: clamp(1.5rem, 4vw, 2.25rem); font-weight: var(--weight-semibold); margin: 0 0 1rem; }
.mast .lead { color: var(--color-on-primary-soft); font-size: 1.15rem; max-width: 44rem; margin: 0; }

/* Publish form */
.publish-grid { display: grid; gap: 1.5rem 3rem; align-items: start; }
@media (min-width: 56rem) { .publish-grid { grid-template-columns: 1fr 1.5fr; } }
.publish-grid .intro p { font-size: 1.1rem; }
.panel { background: var(--color-surface); color: var(--color-text); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow-panel); }
.field { display: block; font-weight: var(--weight-bold); margin: 1.1rem 0 0.4rem; }
.field:first-child { margin-top: 0; }
.field .muted { font-weight: 400; }
.input { font: inherit; width: 100%; padding: 0.7rem; border: 1px solid var(--color-input-border); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text); }
.address { font-size: 0.9rem; margin: 0.4rem 0 0; min-height: 1.4em; overflow-wrap: anywhere; }
.drop { display: block; border: 2px dashed var(--color-border-strong); border-radius: var(--radius); padding: 2rem 1rem; text-align: center; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--color-primary); background: var(--color-surface-hover); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop strong { display: block; font-size: 1.1rem; color: var(--color-primary); }
.panel .btn { margin-top: 1.25rem; cursor: pointer; font: inherit; font-weight: var(--weight-semibold); }
.panel .btn:disabled { opacity: 0.5; cursor: default; }
.form-status { margin: 1rem 0 0; }
.form-status:empty { display: none; }
.form-status.error { color: var(--color-error); }
.done { text-align: center; padding: 1rem 0; }
.done h3 { font-size: 2rem; }
.done .url { display: inline-block; font-size: 1.2rem; font-weight: var(--weight-bold); margin: 0.25rem 0 0.5rem; word-break: break-all; }
.done .btn { margin: 0.75rem 0.25rem 0; }
.confetti { position: fixed; top: -1rem; width: 0.6rem; height: 1rem; pointer-events: none; z-index: 10; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

/* Embeddable publish form (login.<sites domain>/embed/publish): just the panel, on a clear
   background, sized by its content so the parent page can fit the frame to it. */
body.embed { display: block; min-height: 0; background: var(--embed-background); padding: var(--embed-padding); }
body.embed .panel { box-shadow: var(--embed-shadow); }

/* Site lists */
.sites { grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
.card .desc { margin: 0.35rem 0 0; color: var(--color-text-muted); font-size: 0.92rem; }
.card .desc.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.toolbar .input { flex: 1 1 16rem; width: auto; }
.toolbar select.input { flex: 0 1 14rem; }

/* Simple centered pages (sign-in, signed out, not found) */
.simple { max-width: 40rem; padding: 4rem 1rem; margin: 0 auto; }

@media (max-width: 40rem) {
  .nav .hide-sm { display: none; }
  .hero { padding: 2.5rem 0 2rem; }
}

/* Metrics page */
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }
/* Labels wrap to one or two lines; the value sits at the bottom so every number lines up. */
.stat { display: flex; flex-direction: column; background: var(--color-surface); border: 1px solid var(--color-border); border-top: 4px solid var(--color-secondary); border-radius: var(--radius); padding: 1rem 1.25rem; }
.stat-label { display: block; font-size: 0.85rem; color: var(--color-text-muted); font-weight: var(--weight-semibold); }
.stat-value { display: block; margin-top: auto; padding-top: 0.25rem; font-family: var(--font-heading); font-size: 2.75rem; font-weight: var(--weight-bold); color: var(--color-primary); line-height: 1.1; }
.range { display: inline-flex; border: 1px solid var(--color-border); border-radius: var(--radius-pill); background: var(--color-surface); padding: 0.2rem; }
.range button { font: inherit; font-size: 0.85rem; font-weight: var(--weight-semibold); border: 0; background: none; color: var(--color-primary); padding: 0.35rem 0.9rem; border-radius: var(--radius-pill); cursor: pointer; }
.range button[aria-pressed="true"] { background: var(--color-primary); color: var(--color-on-primary); }
.chart-grid { display: grid; gap: 1rem; }
@media (min-width: 56rem) { .chart-grid { grid-template-columns: 1fr 1fr; } }
.chart { margin: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1rem 1rem 0.5rem; }
.chart figcaption { font-weight: var(--weight-bold); color: var(--color-primary); margin-bottom: 0.5rem; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--color-border); stroke-width: 1; }
.chart .axis { stroke: var(--color-border-strong); stroke-width: 1; }
.chart .tick { fill: var(--color-text-muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--color-primary); stroke-width: 2; stroke-linejoin: round; }
.chart .area { fill: var(--color-primary); opacity: 0.08; }
.chart .dot { fill: var(--color-primary); stroke: var(--color-surface); stroke-width: 2; }
.chart .bar { fill: var(--color-primary); }
.chart .cross { stroke: var(--color-text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip { position: fixed; z-index: 20; pointer-events: none; background: var(--color-primary-dark); color: var(--color-on-primary); font-size: 0.85rem; padding: 0.5rem 0.7rem; border-radius: var(--radius-sm); box-shadow: var(--shadow-tip); }
.chart-tip .tip-when { font-weight: var(--weight-bold); margin-bottom: 0.15rem; }
.chart-table { margin-top: 1rem; }
.chart-table summary { cursor: pointer; font-weight: var(--weight-semibold); color: var(--color-primary); }
.chart-table table { border-collapse: collapse; margin-top: 0.75rem; background: var(--color-surface); font-size: 0.9rem; }
.chart-table th, .chart-table td { text-align: left; padding: 0.35rem 1rem; border-bottom: 1px solid var(--color-border); }
.chart-table td + td, .chart-table th + th { text-align: right; }
.leaders { list-style: none; padding: 0; margin: 0 0 1rem; max-width: 36rem; counter-reset: leader; }
.leaders li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--color-border); overflow-wrap: anywhere; counter-increment: leader; }
.leaders li::before { content: counter(leader); font-weight: var(--weight-bold); color: var(--color-accent); min-width: 1.25rem; }
.leaders li span { flex: 1; }
.small-print { font-size: 0.85rem; }
.chart .chart-title { font-family: inherit; font-size: 1rem; font-weight: var(--weight-bold); color: var(--color-primary); margin: 0; }
.chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.chart .leaders { margin: 0; max-width: none; }
.leaders strong { font-size: 0.9rem; white-space: nowrap; }

/* For developers page: readable text columns, code samples with a copy button, and the home page teaser. */
.prose > p, .prose > ul, .prose > .code-block { max-width: 52rem; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin: 0.4rem 0; }
.prose h3 { margin: 1.75rem 0 0.5rem; }
.card h3 code, .prose code, .dev-teaser code { font-size: 0.9em; }
.code-block { position: relative; margin: 1rem 0; }
.code-block pre { margin: 0; overflow-x: auto; background: var(--color-primary-dark); color: var(--color-on-primary); border-radius: var(--radius); padding: 1.25rem; padding-top: 2.5rem; font-size: 0.85rem; line-height: 1.5; }
.code-block .copy { position: absolute; top: 0.5rem; right: 0.5rem; font: inherit; font-size: 0.8rem; font-weight: var(--weight-semibold); background: var(--color-accent); color: var(--color-on-color); border: 0; border-radius: var(--radius-pill); padding: 0.25rem 0.9rem; cursor: pointer; }
.grid > [id] { scroll-margin-top: 1rem; }
.dev-teaser { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; }
.dev-teaser p { max-width: 44rem; margin: 0.5rem 0 0; color: var(--color-text-muted); }
