:root {
  --bg: #f2ede5;
  --bg-soft: #e8dfd2;
  --paper: #fbf7f0;
  --ink: #2b241d;
  --muted: #6a5b4c;
  --accent: #7a3e20;
  --accent-soft: #b86c46;
  --line: rgba(70, 52, 38, 0.18);
  --line-strong: rgba(86, 56, 34, 0.55);
  --shadow: 0 18px 45px rgba(59, 42, 28, 0.12);
  --serif: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--serif);
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.72), transparent 30%),
    linear-gradient(180deg, #d7c8b4 0%, var(--bg) 22%, #ece5db 100%);
  line-height: 1.65;
}

a {
  color: var(--accent);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

img[alt="Bomber Command Losses by W. R. Chorley"] {
  width: min(50vw, 160px);
  margin-top: 42px;
  margin-inline: auto;
}

.site-header {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 24px 28px;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 28px;
  align-items: stretch;
}

.hero-panel,
.hero-aside,
.intro-card,
.content-section {
  background: rgba(251, 247, 240, 0.88);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 38px;
}

.hero-kicker,
.section-eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--accent-soft);
}

.hero-panel h1,
.content-section h2 {
  margin: 0;
  line-height: 1.06;
}

.hero-panel h1 {
  font-size: clamp(2.5rem, 5vw, 4.7rem);
  max-width: 12ch;
}

.hero-subtitle {
  margin: 18px 0 12px;
  font-size: 1.05rem;
  color: var(--muted);
}

.hero-copy,
.section-intro {
  max-width: 65ch;
  color: var(--muted);
}

.hero-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  max-width: 65ch;
}

.hero-links .hero-copy {
  margin: 0;
}

.hero-copy-right {
  text-align: right;
}

.hero-link {
  display: inline-block;
  color: #9b7724;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.14em;
  font-weight: 700;
  font-size: 1.12rem;
  letter-spacing: 0.04em;
}

.section-link {
  margin: 0 0 18px;
}

.hero-aside {
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-aside img {
  width: 100%;
  max-height: 440px;
  object-fit: contain;
}

.hero-caption {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 16px 24px;
  background: rgba(242, 237, 229, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.site-nav a {
  text-decoration: none;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  transition: background-color 220ms ease, color 220ms ease, opacity 220ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a.is-active {
  background: var(--accent);
  color: #fffdf8;
}

.page-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 24px 56px;
}

.intro-card,
.content-section {
  padding: 28px;
  margin-bottom: 28px;
}

.page-transition-mode .content-section {
  display: none;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 280ms ease, transform 280ms ease;
}

.page-transition-mode .content-section.is-hidden {
  display: none;
}

.page-transition-mode .content-section.is-active,
.page-transition-mode .content-section.is-fading {
  display: block;
}

.page-transition-mode .content-section.is-active {
  opacity: 1;
  transform: translateY(0);
}

.page-transition-mode .content-section.is-fading {
  opacity: 0;
  transform: translateY(10px);
}

.content-section h2 {
  font-size: clamp(1.9rem, 4vw, 3rem);
  margin-bottom: 10px;
}

.story-block {
  margin-top: 26px;
  padding: 22px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 251, 245, 0.6);
  box-shadow: 0 10px 24px rgba(59, 42, 28, 0.06);
}

.story-block,
.story-block * {
  max-width: 100%;
}

.story-block p,
.story-block b,
.story-block a {
  overflow-wrap: anywhere;
  word-break: normal;
}

#memorial-overview {
  position: relative;
  overflow: hidden;
  color: #18140f;
  cursor: pointer;
}

#memorial-overview::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("assets/images/haughton_chapel_nottinghamshire.jpg") center center / cover no-repeat;
  opacity: 0.65;
  pointer-events: none;
}

#memorial-overview > * {
  position: relative;
  z-index: 1;
}

#memorial-overview b,
#memorial-overview p,
#memorial-overview {
  color: #18140f;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72), 0 0 8px rgba(240, 236, 230, 0.7);
}

.story-block h3 {
  margin: 0 0 16px;
  font-size: 1.35rem;
}

.service-record-link {
  justify-self: start;
  text-align: left;
  margin: 0 0 10px;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}

.service-record-link a {
  overflow-wrap: anywhere;
}

#service-record table {
  border-collapse: collapse;
  max-width: 100%;
}

#service-record td {
  padding: 4px 6px;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.story-block-muted {
  opacity: 0.92;
}

#family-photographs .legacy-center > p:has(img) {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin: 0 0 12px;
  padding-top: 8px;
}

#family-photographs .legacy-center > p:has(img) img {
  height: 338px;
  width: auto;
  max-width: min(100%, 420px);
  object-fit: contain;
}

#family-photographs img[alt="Dayman Family Portrait"] {
  height: 862px;
  max-width: min(100%, 100%);
}

#family-photographs img[alt="Dayman Family Portrait"] + p,
#family-photographs p:has(img[alt="Dayman Family Portrait"]) + p {
  max-width: 780px;
  margin: 0 auto 22px;
  padding: 0 0 18px;
  border-bottom: 1px solid rgba(86, 56, 34, 0.2);
  text-align: left;
}

#family-photographs .indian-motorcycle-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  align-items: start;
  margin: 0 auto 22px;
  max-width: 820px;
}

#family-photographs .indian-motorcycle-colourized-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  align-items: start;
  margin: 0 auto 12px;
  max-width: 820px;
}

#family-photographs .indian-motorcycle-item {
  min-width: 0;
  text-align: left;
  justify-self: center;
  width: min(100%, 360px);
}

#family-photographs .indian-motorcycle-item a {
  display: grid;
  place-items: center;
  width: 100%;
  height: 560px;
  overflow: hidden;
}

#family-photographs .indian-motorcycle-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  margin-bottom: 12px;
}

#family-photographs .indian-motorcycle-colourized-layout .indian-motorcycle-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  margin-bottom: 12px;
}

#family-photographs .indian-motorcycle-item p {
  margin: 0;
}

#family-photographs .legacy-center > p:has(img) + p {
  max-width: 780px;
  margin: 0 auto 22px;
  padding: 0 0 18px;
  border-bottom: 1px solid rgba(86, 56, 34, 0.2);
}

.marker-pair {
  display: grid;
  gap: 14px;
  margin: 0 auto 18px;
  max-width: 760px;
}

.marker-pair-top {
  display: flex;
  justify-content: center;
}

.marker-pair-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  column-gap: 29px;
  gap: 29px;
}

.marker-pair img {
  display: block;
  height: clamp(285px, 33vw, 375px);
  width: 100%;
  max-width: 100%;
  object-fit: contain;
  margin: 0 auto;
}

.marker-pair-top img {
  height: clamp(306px, 36vw, 406px);
  width: auto;
  max-width: min(100%, 92%);
}

#family-tree img[alt="Frances Jacobson Portrait"] {
  height: 338px;
  width: auto;
  object-fit: contain;
}

.personal-history-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, auto));
  justify-content: center;
  align-items: start;
  gap: 20px;
  margin: 0 auto 12px;
}

.personal-history-pair > a {
  display: block;
}

.personal-history-pair img {
  height: 340px;
  width: auto;
  max-width: min(100%, 280px);
  object-fit: contain;
  display: block;
}

#otu-overview .legacy-center > p:has(img[src*="RAF_Stations1"], img[src*="RAF_BCLogo"]) {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  flex-direction: row-reverse;
  gap: 20px;
}

#otu-overview .legacy-center > p:has(img[src*="RAF_Stations1"], img[src*="RAF_BCLogo"]) img {
  height: 210px;
  width: auto;
  max-width: min(100%, 48%);
  object-fit: contain;
  flex: 0 1 auto;
}

#bomber-command-bases .legacy-center > p:has(img[src*="RAF_Stations.jpg"]) {
  margin: 0;
  line-height: 0;
}

#bomber-command-bases .legacy-center > p:has(img[src*="RAF_Stations.jpg"]) img {
  display: block;
  margin: 0 auto;
}


#memorial-overview .legacy-center {
  justify-items: center;
  text-align: center;
}

.legacy-center {
  display: grid;
  place-items: center;
  gap: 10px;
}

#october-12-1943 .legacy-center,
#service-record .legacy-center {
  min-width: 0;
  max-width: 100%;
}

#october-12-1943 .legacy-center {
  justify-items: stretch;
}

#october-12-1943 .legacy-center > p {
  min-width: 0;
}

#october-12-1943 p:has(img[src*="P_O_Dayman_Telegram.jpg"]) {
  display: grid;
  place-items: center;
  text-align: center;
}

#october-12-1943 img[src*="P_O_Dayman_Telegram.jpg"] {
  margin-inline: auto;
}

.pending-link-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.pending-tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff8ef;
  background: var(--accent-soft);
}

.pending-url {
  display: inline-block;
  font-size: 0.84rem;
  color: var(--muted);
  word-break: break-all;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 26px;
}

.gallery-card {
  margin: 0;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  padding: 12px;
}

.funeral-inline-block {
  width: min(100%, 760px);
  margin: 18px auto 22px;
}

.funeral-inline-block > p {
  margin: 0 0 36px;
  white-space: nowrap;
}

.funeral-inline-image {
  display: flex;
  justify-content: center;
  width: 100%;
}

.funeral-inline-image a {
  display: inline-flex;
  justify-content: center;
}

.funeral-inline-image img {
  width: auto;
  max-width: min(75%, 690px);
  height: auto;
  display: block;
  margin-inline: auto;
}

.losses-link-line,
p[align="center"] + .losses-link-line {
  margin-top: 0;
}

.losses-link-line {
  text-align: center;
  margin: 0 0 2.5em;
}

.loss-detail-card {
  margin: 18px 0 22px;
  padding: 18px 18px 8px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.newspaper-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 24px;
  align-items: start;
}

.newspaper-transcript,
.newspaper-image {
  min-width: 0;
}

.newspaper-image .legacy-center {
  place-items: start;
  gap: 0;
}

.newspaper-image img {
  max-width: 100%;
  height: auto;
}

.newspaper-layout p:empty,
.newspaper-layout .legacy-center > p:empty,
.newspaper-layout .legacy-center > div:empty {
  display: none;
}

.newspaper-image .legacy-center > p[align="center"] {
  margin: 0;
  min-height: 0;
}

.newspaper-image .legacy-center > p[align="left"] {
  margin: 0;
}

.gallery-card img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
}

.pdf-card-preview {
  aspect-ratio: 4 / 3;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: linear-gradient(180deg, #f8f2e9 0%, #efe3d0 100%);
  text-align: center;
}

.pdf-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.gallery-card img[src*="PO%20J%20Christie_nanton_memorial.jpg"],
.gallery-card img[src*="PO J Christie_nanton_memorial.jpg"] {
  object-position: center bottom;
}

.gallery-card figcaption {
  margin-top: 10px;
  font-size: 0.95rem;
}

p,
ul,
ol {
  margin-top: 0;
}

@media (max-width: 860px) {
  .site-header {
    grid-template-columns: 1fr;
    padding-top: 32px;
  }

  .hero-panel {
    padding: 28px;
  }

  .intro-card,
  .content-section {
    padding: 22px;
  }

  .page-shell {
    padding-inline: 14px;
  }

  .story-block {
    padding: 16px;
  }

  #service-record table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #service-record table tbody {
    display: table;
    min-width: 680px;
  }

  #service-record table td {
    font-size: 0.92rem;
    line-height: 1.35;
  }

  .funeral-inline-block > p {
    white-space: normal;
  }

  .losses-link-line,
  #october-12-1943 p[align="center"],
  #october-12-1943 p[align="left"] {
    max-width: 100%;
  }

  .newspaper-layout {
    grid-template-columns: 1fr;
  }

  #family-photographs .legacy-center > p:has(img) img {
    height: 260px;
    max-width: 100%;
  }

  #family-photographs img[alt="Dayman Family Portrait"] {
    height: 664px;
    max-width: 100%;
  }

  #family-photographs .indian-motorcycle-layout {
    grid-template-columns: 1fr;
  }

  #family-photographs .indian-motorcycle-colourized-layout {
    grid-template-columns: 1fr;
  }

  #family-photographs .indian-motorcycle-item img {
    width: 100%;
    height: 100%;
  }

  #family-photographs .indian-motorcycle-colourized-layout .indian-motorcycle-item img {
    width: 100%;
    height: 100%;
  }

  #family-photographs .indian-motorcycle-item a {
    height: 400px;
  }

  .marker-pair img {
    height: 260px;
  }

  .marker-pair {
    grid-template-columns: 1fr;
    row-gap: 14px;
  }

  #family-tree img[alt="Frances Jacobson Portrait"] {
    height: 260px;
  }

  .personal-history-pair {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .personal-history-pair img {
    height: 260px;
    max-width: 100%;
  }

  #otu-overview .legacy-center > p:has(img[src*="RAF_Stations1"], img[src*="RAF_BCLogo"]) {
    flex-wrap: wrap;
  }

  #otu-overview .legacy-center > p:has(img[src*="RAF_Stations1"], img[src*="RAF_BCLogo"]) img {
    height: 160px;
    max-width: 100%;
  }
}
