/*
Theme Name: Sven Legacy
Theme URI: https://svenlegacy.org
Author: Erik Leland
Description: Memorial and foundation site for Sven Claire Leland (1992-2024) of Mattawa, Washington.
Version: 0.2.0
Requires at least: 6.4
Requires PHP: 8.0
Text Domain: svenlegacy
*/

:root {
  --navy: #1f2f4a;
  --navy-deep: #16223a;
  --rust: #a94f2a;
  --rust-light: #f0b48f;
  --sage: #66744f;
  --wheat: #f3ecdf;
  --wheat-deep: #ebe1cf;
  --paper: #fbf8f2;
  --white: #fff;
  --ink: #2a2723;
  --muted: #655e54;
  --line: #e0d5c2;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", -apple-system, "Segoe UI", Roboto, sans-serif;
  --wrap: 1140px;
  --prose: 680px;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(31, 47, 74, .06), 0 8px 24px -12px rgba(31, 47, 74, .18);
  --gutter: 16px;
}
@media (min-width: 600px) { :root { --gutter: 24px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--navy); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--rust); }
:focus-visible { outline: 3px solid var(--rust); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  color: var(--navy-deep);
  margin: 0 0 .5em;
  letter-spacing: -.01em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.25rem, 6vw, 3.75rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.25rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1.1em; text-wrap: pretty; }

.wrap { width: min(var(--wrap), 100% - var(--gutter) * 2); margin-inline: auto; }
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link:focus {
  clip: auto; width: auto; height: auto; z-index: 100;
  background: #fff; padding: 8px 14px; top: 8px; left: 8px;
}
.eyebrow {
  font-size: .8rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--rust); font-weight: 600; margin: 0 0 .75em;
}

/* ---------- Header ---------- */
.site-header {
  background: rgba(251, 248, 242, .96);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
@media (max-width: 600px) { .admin-bar .site-header { top: 0; } }
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 72px;
}
.brand { text-decoration: none; color: var(--navy-deep); line-height: 1.15; }
.brand:hover { color: var(--navy-deep); }
.brand-name { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; display: block; }
.brand-dates { font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.primary-nav { display: flex; align-items: center; gap: 8px; }
.primary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.primary-nav a:not(.btn) {
  display: block; padding: 10px 12px; text-decoration: none; color: var(--ink);
  font-weight: 600; font-size: 1rem; border-radius: var(--radius);
}
.primary-nav a:not(.btn):hover { color: var(--rust); background: var(--wheat); }
.primary-nav .current-menu-item > a,
.primary-nav .current_page_item > a { color: var(--rust); }
.nav-toggle {
  display: none; align-items: center; gap: 8px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; font: inherit; font-size: 1rem; font-weight: 600; color: var(--navy);
  cursor: pointer; min-height: 44px;
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative;
  transition: transform .2s ease, background .2s ease;
}
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .primary-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 24px -16px rgba(31, 47, 74, .25);
    padding: 8px var(--gutter) 20px;
  }
  .primary-nav.is-open { display: flex; }
  .primary-nav ul { flex-direction: column; }
  .primary-nav a:not(.btn) { padding: 14px 4px; border-bottom: 1px solid var(--line); border-radius: 0; font-size: 1.1rem; }
  .primary-nav a:not(.btn):hover { background: none; }
  .nav-donate { margin-top: 16px; text-align: center; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 22px; border-radius: var(--radius);
  background: var(--navy); color: #fff; text-decoration: none; font-weight: 600; font-size: 1.02rem;
  border: 2px solid var(--navy); line-height: 1.2; text-align: center;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--navy-deep); border-color: var(--navy-deep); color: #fff; }
.btn-ghost { background: transparent; color: var(--navy); }
.btn-ghost:hover { background: var(--navy); color: #fff; }
.btn-light { background: #fff; color: var(--navy); border-color: #fff; }
.btn-light:hover { background: var(--wheat); border-color: var(--wheat); color: var(--navy); }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .55); }
.btn-outline-light:hover { background: rgba(255, 255, 255, .12); border-color: #fff; color: #fff; }
.btn-small { min-height: 40px; padding: 8px 16px; font-size: .95rem; }
.btn-block { display: flex; width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.stack { display: grid; gap: 10px; }
@media (max-width: 480px) {
  .btn-row .btn { flex: 1 1 100%; }
}

/* ---------- Home hero ---------- */
.hero { background: var(--wheat); padding: clamp(32px, 7vw, 88px) 0; }
.hero .wrap {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(28px, 5vw, 72px); align-items: center;
}
.hero-photo img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 25%;
  border-radius: var(--radius); box-shadow: 0 24px 48px -24px rgba(31, 47, 74, .5);
}
.hero-dates { font-family: var(--serif); font-size: clamp(1.1rem, 2.4vw, 1.35rem); color: var(--muted); margin-bottom: 1.2em; }
.hero-text .lead { font-size: 1.2rem; max-width: 34em; }
@media (max-width: 760px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 24px; }
  .hero-photo img { aspect-ratio: 1 / 1; max-height: 52vh; object-position: center 20%; }
  .hero-text .lead { font-size: 1.1rem; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(44px, 7vw, 88px) 0; }
.section-tight { padding-bottom: 0; }
.section-alt { background: var(--wheat); }
.section-head { max-width: 640px; margin-bottom: 28px; }
.section-head p { color: var(--muted); }

/* ---------- Event banner ---------- */
.event-banner { background: var(--navy); color: #fff; padding: clamp(36px, 5vw, 56px) 0; }
.event-banner .wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 40px; align-items: center;
}
.event-banner h2 { color: #fff; margin-bottom: .3em; }
.event-banner .eyebrow { color: var(--rust-light); }
.event-meta { margin: 0; color: #dfe5ef; font-size: 1.08rem; }
.event-meta strong { color: #fff; }
.event-blurb { margin: 12px 0 0; color: #c9d1de; max-width: 40em; }
@media (max-width: 760px) { .event-banner .wrap { grid-template-columns: 1fr; } }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.card {
  position: relative; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 26px 22px; display: flex; flex-direction: column; box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(31,47,74,.06), 0 16px 32px -14px rgba(31,47,74,.28); }
.card h3 { margin-bottom: .4em; }
.card p { color: var(--muted); flex: 1; margin-bottom: 16px; }
.card a.more { font-weight: 600; text-decoration: none; }
.card a.more::after { content: " \2192"; }
.card a.more::before { content: ""; position: absolute; inset: 0; }
@media (max-width: 860px) { .cards { grid-template-columns: 1fr; gap: 14px; } .card { padding: 22px; } }

/* ---------- Landscape band ---------- */
.landscape { position: relative; min-height: clamp(300px, 40vw, 440px); display: grid; place-items: center; overflow: hidden; background: var(--navy-deep); }
.landscape img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.landscape::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(22,34,58,.2), rgba(22,34,58,.65)); }
.landscape blockquote {
  position: relative; z-index: 1; margin: 0; padding: 48px var(--gutter); text-align: center;
  color: #fff; font-family: var(--serif); font-size: clamp(1.5rem, 3.4vw, 2.4rem); line-height: 1.25;
  max-width: 900px; text-shadow: 0 2px 16px rgba(0, 0, 0, .35); text-wrap: balance;
}
.landscape cite { display: block; font-family: var(--sans); font-style: normal; font-size: .95rem; margin-top: 14px; opacity: .9; }

/* ---------- Inner page hero ---------- */
.page-hero { background: var(--wheat); padding: clamp(36px, 6vw, 72px) 0 clamp(28px, 4.5vw, 52px); border-bottom: 1px solid var(--line); }
.page-hero h1 { margin-bottom: .25em; }
.page-intro { color: var(--muted); max-width: 38em; margin: 0; font-size: clamp(1.08rem, 2vw, 1.2rem); }

/* ---------- Two-column layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(32px, 5vw, 64px); align-items: start; }
.aside-card {
  position: sticky; top: 96px; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.aside-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: center 22%; border-radius: 6px; margin-bottom: 20px; }
.aside-title { font-size: 1.35rem; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .aside-card { position: static; }
  .layout-aside-first .aside { order: -1; }
}

.glance { margin: 0 0 20px; }
.glance > div { padding: 10px 0; border-top: 1px solid var(--line); }
.glance > div:first-child { border-top: 0; padding-top: 0; }
.glance dt { font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.glance dd { margin: 2px 0 0; font-weight: 600; line-height: 1.45; }
.glance dd a { font-weight: 400; font-size: .98rem; }

/* Event card (navy) */
.event-card { background: var(--navy); border-color: var(--navy); color: #fff; }
.event-card .aside-title { color: #fff; }
.event-card .eyebrow { color: var(--rust-light); }
.event-card .glance > div { border-color: rgba(255, 255, 255, .15); }
.event-card .glance dt { color: #b9c3d3; }
.event-card .glance dd, .event-card .glance a { color: #fff; }

/* ---------- Prose (page content) ---------- */
.prose { max-width: var(--prose); }
.prose-center { margin-inline: auto; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li { margin-bottom: .4em; }
.prose blockquote { border-left: 3px solid var(--rust); margin: 1.4em 0; padding-left: 20px; font-family: var(--serif); font-size: 1.2rem; }
.prose figure { margin: 0 0 1.6em; }
.prose figcaption, .feature-photo figcaption { font-size: .92rem; color: var(--muted); margin-top: 8px; }
.prose img { border-radius: 6px; }
.feature-photo img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }

/* Stats */
.stats { list-style: none; padding: 0 !important; margin: 0 0 1.6em; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stats li { background: var(--wheat); border-radius: var(--radius); padding: 18px 16px; margin: 0; }
.stat-num { display: block; font-family: var(--serif); font-size: clamp(1.6rem, 3.5vw, 2.1rem); font-weight: 600; color: var(--navy-deep); line-height: 1.1; }
.stat-label { display: block; font-size: .95rem; color: var(--muted); margin-top: 6px; line-height: 1.35; }
@media (max-width: 520px) { .stats { grid-template-columns: 1fr; } .stats li { display: flex; align-items: baseline; gap: 12px; } .stat-label { margin: 0; } }

/* ---------- Scholarship feature ---------- */
.scholarship {
  display: grid; grid-template-columns: 260px minmax(0, 1fr); background: var(--white);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.scholarship-amount {
  background: var(--navy); color: #fff; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 32px 20px; text-align: center;
}
.amount { font-family: var(--serif); font-size: clamp(2.6rem, 6vw, 3.6rem); font-weight: 600; line-height: 1; }
.amount-label { margin-top: 8px; color: #c9d1de; letter-spacing: .08em; text-transform: uppercase; font-size: .82rem; font-weight: 600; }
.scholarship-body { padding: clamp(24px, 4vw, 40px); }
.steps { margin: 0 0 24px; padding-left: 1.3em; }
.steps li { margin-bottom: 8px; }
@media (max-width: 700px) {
  .scholarship { grid-template-columns: 1fr; }
  .scholarship-amount { flex-direction: row; gap: 12px; padding: 20px; align-items: baseline; }
  .amount-label { margin: 0; }
}

/* Help list */
.help-list { list-style: none; margin: 0; padding: 0; }
.help-list li { border-top: 1px solid var(--line); }
.help-list li:first-child { border-top: 0; }
.help-list a { display: block; padding: 14px 0; text-decoration: none; color: var(--ink); }
.help-list a:hover strong { color: var(--rust); }
.help-list strong { display: block; color: var(--navy-deep); }
.help-list strong::after { content: " \2192"; }
.help-list span { display: block; color: var(--muted); font-size: .98rem; }

/* ---------- Gallery ---------- */
.gallery-content > p { max-width: var(--prose); }
.gallery-content .wp-block-gallery.has-nested-images {
  display: block !important; columns: 3 260px; column-gap: 14px; margin: 0 0 32px;
}
.gallery-content .wp-block-gallery.has-nested-images figure.wp-block-image {
  display: block; width: 100% !important; margin: 0 0 14px !important; break-inside: avoid;
  flex: none !important; background: var(--white); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.gallery-content .wp-block-gallery.has-nested-images figure.wp-block-image::before { display: none !important; }
.gallery-content .wp-block-gallery.has-nested-images figure.wp-block-image img {
  width: 100% !important; height: auto !important; object-fit: contain !important; border-radius: 0; cursor: zoom-in;
}
.gallery-content .wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
  position: static !important; background: none !important; color: var(--muted) !important;
  font-size: .92rem !important; text-align: left !important; padding: 10px 14px 12px !important;
  max-height: none !important; text-shadow: none !important; margin: 0 !important; overflow: visible !important;
}
.gallery-content .wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) img { height: auto !important; }
@media (max-width: 560px) {
  .gallery-content .wp-block-gallery.has-nested-images { columns: 1; }
}
/* Single images and plain galleries added without the block */
.gallery-content figure.wp-block-image:not(.wp-block-gallery figure) { margin: 0 0 20px; }

.note-box {
  display: flex; align-items: center; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap;
  background: var(--wheat); border-radius: var(--radius); padding: clamp(22px, 4vw, 32px);
}
.note-box h2 { font-size: 1.45rem; margin-bottom: .3em; }
.note-box p { margin: 0; color: var(--muted); max-width: 36em; }

/* ---------- Call-to-action band ---------- */
.cta-band { background: var(--navy); color: #fff; padding: clamp(36px, 5vw, 52px) 0; }
.cta-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap; }
.cta-band h2 { color: #fff; margin-bottom: .2em; }
.cta-band p { margin: 0; color: #c9d1de; }

/* ---------- Memory wall ---------- */
.memories { list-style: none; margin: 0; padding: 0; columns: 2 320px; column-gap: 20px; }
.memories-single { columns: 1; }
.memory {
  break-inside: avoid; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 24px; margin: 0 0 18px; box-shadow: var(--shadow);
  position: relative;
}
.memory::before {
  content: "\201C"; position: absolute; top: 6px; right: 18px; font-family: var(--serif);
  font-size: 3.4rem; line-height: 1; color: var(--wheat-deep);
}
.memory-text { font-size: 1.08rem; position: relative; padding-right: 28px; }
.memory-text p:last-child { margin-bottom: 0; }
.memory-meta { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .95rem; color: var(--muted); line-height: 1.5; }
.memory-meta strong { color: var(--ink); }
.memory-pending { font-size: .92rem; color: var(--rust); font-weight: 600; margin-bottom: 8px; }
.memory-empty { color: var(--muted); }
.home-memories-cta { margin-top: 12px; }

.layout-memories { grid-template-columns: minmax(0, 1fr) 400px; }
.layout-memories .memory-list-col { grid-column: 1; grid-row: 1; }
.layout-memories .memory-form-col { grid-column: 2; grid-row: 1; position: sticky; top: 96px; }
.list-title { font-size: 1.5rem; margin-bottom: 20px; }
.empty-state { background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px; color: var(--muted); }
.empty-state p:last-child { margin: 0; }
@media (max-width: 900px) {
  .layout-memories { grid-template-columns: 1fr; }
  .layout-memories .memory-list-col, .layout-memories .memory-form-col { grid-column: 1; grid-row: auto; position: static; }
}

.thanks { background: #eef3e6; border: 1px solid #c9d6b4; border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; }
.thanks h2 { font-size: 1.3rem; margin-bottom: .3em; color: #3e4c2c; }
.thanks p { margin: 0; }
.memory-form-wrap { background: var(--wheat); border-radius: var(--radius); padding: clamp(20px, 3.5vw, 30px); }
.comment-respond { margin: 0; }
.comment-reply-title { font-size: 1.5rem; margin-top: 0; }
.comment-form label { display: block; font-weight: 600; margin-bottom: 6px; }
.comment-form input[type=text], .comment-form input[type=email], .comment-form textarea {
  width: 100%; padding: 12px 14px; border: 1px solid #d4c7b0; border-radius: var(--radius);
  font: inherit; font-size: 1.05rem; background: #fff; color: var(--ink); min-height: 48px;
}
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(31, 47, 74, .18); }
.comment-form textarea { min-height: 160px; resize: vertical; }
.comment-form p { margin-bottom: 16px; }
.comment-form .form-submit { margin: 8px 0 0; }
.comment-form .form-submit input {
  width: 100%; min-height: 50px; background: var(--navy); color: #fff; border: 0; border-radius: var(--radius);
  padding: 13px 24px; font: inherit; font-weight: 600; cursor: pointer;
}
.comment-form .form-submit input:hover { background: var(--navy-deep); }
.comment-notes, .form-note { font-size: .95rem; color: var(--muted); font-weight: 400; }
.sl-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-deep); color: #c9d1de; padding: 52px 0 32px; font-size: 1rem; }
.site-footer a { color: #fff; text-decoration-color: rgba(255, 255, 255, .4); }
.site-footer a:hover { color: var(--rust-light); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.site-footer h3 { color: #fff; font-size: 1.15rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 4px; }
.site-footer li a { display: inline-block; padding: 4px 0; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 36px; padding-top: 20px; font-size: .9rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > div:first-child { grid-column: 1 / -1; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; gap: 24px; } .site-footer h3 { margin-bottom: .3em; } }

/* ---------- Fallback page / posts ---------- */
.entry { padding: clamp(36px, 5vw, 64px) 0; }
