/* ==========================================================================
   Schofield Family Site — modern design system
   Shared stylesheet for the redesigned pages.
   ========================================================================== */

:root {
  /* Palette — heritage greens + warm parchment accent */
  --color-bg: #f7f4ec;
  --color-surface: #ffffff;
  --color-surface-alt: #f0ebdd;
  --color-text: #23291f;
  --color-text-muted: #5c6354;
  --color-primary: #2f5d4a;
  --color-primary-dark: #214234;
  --color-accent: #a8702f;
  --color-border: #e2dccb;
  --color-link: #2f5d4a;
  --color-link-hover: #a8702f;

  /* Typography */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  /* Spacing / shape */
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(33, 66, 52, 0.08),
    0 2px 8px rgba(33, 66, 52, 0.06);
  --shadow-md: 0 6px 24px rgba(33, 66, 52, 0.12);
  --maxw: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #161812;
    --color-surface: #20241c;
    --color-surface-alt: #272c20;
    --color-text: #e9e6da;
    --color-text-muted: #a7ac9b;
    --color-primary: #6fae93;
    --color-primary-dark: #4f8a70;
    --color-accent: #d59a5a;
    --color-border: #353b2c;
    --color-link: #8fc4ab;
    --color-link-hover: #d59a5a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.5);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--color-link-hover);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.section {
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}

/* ---------- Site header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--color-text);
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
}

.nav {
  display: flex;
  gap: clamp(0.75rem, 2vw, 1.75rem);
  flex-wrap: wrap;
  font-weight: 500;
}

.nav a {
  color: var(--color-text-muted);
}

.nav a:hover {
  color: var(--color-link-hover);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-primary-dark) 100%
  );
  color: #fff;
  overflow: hidden;
}

.hero__inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  padding-block: clamp(3rem, 8vw, 6rem);
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.1;
  margin: 0 0 1rem;
}

.hero p {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: rgba(255, 255, 255, 0.85);
  max-width: 46ch;
  margin: 0 0 1.75rem;
}

.hero__media img {
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 100%;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  font-weight: 600;
  background: var(--color-accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, filter 0.15s ease;
}

.btn:hover {
  color: #fff;
  filter: brightness(1.07);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  box-shadow: none;
}

/* ---------- Section headings ---------- */
.section__head {
  margin-bottom: 2rem;
}

.section__head h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3.5vw, 2.3rem);
  margin: 0 0 0.5rem;
  color: var(--color-text);
}

.section__head p {
  color: var(--color-text-muted);
  margin: 0;
  max-width: 60ch;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-accent);
  margin: 0 0 0.5rem;
}

/* ---------- Card grid ---------- */
.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.4rem 1.4rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    border-color 0.15s ease;
  color: inherit;
  height: 100%;
}

a.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border));
  color: inherit;
}

.card h3 {
  font-family: var(--font-serif);
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
  color: var(--color-primary);
}

.card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.card__meta {
  margin-top: auto;
  padding-top: 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-accent);
}

.card ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ---------- Prose (article text) ---------- */
.prose {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 3rem);
  box-shadow: var(--shadow-sm);
  max-width: 72ch;
}

.prose p {
  margin: 0 0 1.1rem;
}

.prose h2,
.prose h3 {
  font-family: var(--font-serif);
  color: var(--color-primary);
}

.prose .signature {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--color-accent);
  font-size: 1.15rem;
}

.callout {
  border-left: 4px solid var(--color-accent);
  background: var(--color-surface-alt);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin: 1.5rem 0;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  align-items: center;
  padding-block: 1.75rem;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  padding-top: 1.25rem;
}

.breadcrumb a {
  color: var(--color-text-muted);
}

.breadcrumb a:hover {
  color: var(--color-link-hover);
}

/* ---------- Content pages (converted legacy pages) ---------- */
/* Page title band shown above article content */
.page-title {
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-primary-dark) 100%
  );
  color: #fff;
}

.page-title__inner {
  padding-block: clamp(1.75rem, 4vw, 3rem);
}

.page-title h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  line-height: 1.15;
  margin: 0;
}

.page-title p {
  margin: 0.5rem 0 0;
  color: rgba(255, 255, 255, 0.85);
}

/* Two-column layout: sidebar nav + article */
.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: start;
}

/* Sidebar nav replacing the old absolute-positioned menu */
.sidenav {
  position: sticky;
  top: 80px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  font-size: 0.92rem;
}

.sidenav h2 {
  font-family: var(--font-serif);
  font-size: 1rem;
  margin: 0 0 0.6rem;
  color: var(--color-primary);
}

.sidenav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidenav a {
  display: block;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
}

.sidenav a:hover {
  background: var(--color-surface-alt);
  color: var(--color-link-hover);
}

.sidenav a[aria-current="page"] {
  background: color-mix(in srgb, var(--color-primary) 14%, transparent);
  color: var(--color-primary);
  font-weight: 600;
}

/* Article body — wider than .prose for history chapters */
.article {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3.5vw, 2.75rem);
  box-shadow: var(--shadow-sm);
  max-width: 75ch;
}

.article h2,
.article h3 {
  font-family: var(--font-serif);
  color: var(--color-primary);
  line-height: 1.2;
}

.article h2 {
  margin-top: 2rem;
}

.article h2:first-child {
  margin-top: 0;
}

.article p {
  margin: 0 0 1.1rem;
}

.article ul {
  margin: 0 0 1.1rem;
  padding-left: 1.4rem;
}

.article li {
  margin-bottom: 0.35rem;
}

.article sup {
  font-size: 0.7em;
}

/* Emphasis color used heavily in originals for key names */
.name {
  color: var(--color-accent);
  font-weight: 600;
}

/* Figures and inline images within articles */
.article figure,
figure.figure {
  margin: 1.5rem 0;
  text-align: center;
}

figure.figure img {
  display: inline-block;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

figure.figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Responsive thumbnail gallery (travel pages) */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
  margin: 1rem 0 1.5rem;
}

.gallery figure {
  margin: 0;
}

.gallery a {
  display: block;
}

.gallery img {
  width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gallery a:hover img {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.gallery figcaption {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* Travel narrative: text beside a column of images */
.travel-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: start;
  margin-bottom: 1.75rem;
}

.travel-row > .travel-row__media {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.travel-row figure {
  margin: 0;
}

/* Prev/next + back navigation bar */
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.pager--bottom {
  margin: 1.5rem 0 0;
}

/* Data tables (photo indexes) */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  font-size: 0.92rem;
}

table.data th,
table.data td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

table.data thead th {
  position: sticky;
  top: 0;
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-sans);
  white-space: nowrap;
}

table.data tbody tr:nth-child(even) {
  background: var(--color-surface-alt);
}

table.data tbody tr:hover {
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidenav {
    position: static;
  }

  .travel-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .hero__inner {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .hero__media {
    order: -1;
  }
}
