/*
 * Shared presentation for the static Lola Elena Bran memorial.
 * The proportions echo WordPress Twenty Seventeen without carrying its unused
 * block, administration, feed, or compatibility styles.
 */

/* Locally hosted Libre Franklin preserves the original site's typography. */
@font-face {
  font-family: "Libre Franklin";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("../fonts/libre-franklin-300.woff2") format("woff2");
}

@font-face {
  font-family: "Libre Franklin";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/libre-franklin-400.woff2") format("woff2");
}

@font-face {
  font-family: "Libre Franklin";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/libre-franklin-600.woff2") format("woff2");
}

@font-face {
  font-family: "Libre Franklin";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/libre-franklin-800.woff2") format("woff2");
}

/* Central variables make the restrained memorial palette easy to maintain. */
:root {
  --content-width: 740px;
  --wide-width: 1120px;
  --ink: #222;
  --muted-ink: #666;
  --line: #eee;
  --paper: #fff;
  --focus: #1769aa;
  --header-image: url("../media/2023/12/new-cropped-lola-lady40-scaled-1.jpg");
  color-scheme: light;
}

/* Use predictable sizing for media and navigation at every viewport. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Match the original site's clean white canvas and comfortable reading rhythm. */
html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Libre Franklin", "Helvetica Neue", sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.75;
}

/* Keep links recognisable without introducing a new accent colour. */
a {
  color: var(--ink);
  text-decoration-color: #aaa;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--muted-ink);
  text-decoration-color: currentColor;
}

/* Show a consistent, high-contrast keyboard indicator throughout the site. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* Keep the skip link out of view until a keyboard user requests it. */
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.65rem 0.9rem;
  transform: translateY(-200%);
  background: var(--paper);
  box-shadow: 0 2px 12px rgb(0 0 0 / 20%);
  font-weight: 700;
}

.skip-link:focus {
  transform: translateY(0);
}

/* The photographic masthead intentionally fills a broad cinematic strip. */
.header-image {
  min-height: clamp(22rem, 56.25vw, 46rem);
  background-image:
    linear-gradient(to bottom, transparent 58%, rgb(0 0 0 / 22%)),
    var(--header-image);
  background-position: center center;
  background-size: cover;
}

/* Overlay the original title treatment near the lower-left of the portrait. */
.site-branding {
  position: absolute;
  top: clamp(15rem, 42vw, 35rem);
  left: 50%;
  width: min(calc(100% - 3rem), var(--wide-width));
  transform: translateX(-50%);
  color: #fff;
  text-shadow: 0 1px 3px rgb(0 0 0 / 60%);
}

.site-title {
  color: inherit;
  font-size: clamp(2rem, 4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.08;
  text-decoration: none;
  text-transform: uppercase;
}

.site-title:hover {
  color: inherit;
}

.site-description {
  margin: 0.25rem 0 0;
  font-size: clamp(0.9rem, 1.8vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0.18em;
}

/* Hold the primary navigation beneath the masthead like Twenty Seventeen. */
.site-navigation {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

/* The original theme offers a quiet shortcut from the masthead to the chapter. */
.menu-scroll-down {
  display: none;
  color: var(--muted-ink);
  font-size: 1.35rem;
  line-height: 1;
  text-decoration: none;
}

.primary-menu {
  display: flex;
  width: min(calc(100% - 3rem), var(--wide-width));
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.primary-menu a {
  display: block;
  padding: 1.15rem 1rem;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
}

.primary-menu a:hover,
.primary-menu a[aria-current="page"] {
  color: var(--muted-ink);
}

/* JavaScript reveals this control only when it can operate the mobile menu. */
.menu-toggle {
  display: none;
  align-items: center;
  gap: 0.55rem;
  width: min(calc(100% - 3rem), var(--wide-width));
  margin: 0 auto;
  padding: 0.9rem 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.menu-toggle__close {
  display: none;
  font-size: 1.5rem;
  line-height: 1;
}

.menu-toggle__open {
  font-size: 1.2rem;
  line-height: 1;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__open {
  display: none;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__close {
  display: inline;
}

/* Each chapter begins with its WordPress featured image at full width. */
.page-image {
  min-height: clamp(18rem, 50vw, 44rem);
  background-image:
    linear-gradient(rgb(0 0 0 / 4%), rgb(0 0 0 / 4%)),
    var(--page-image);
  background-position: center center;
  background-size: cover;
}

/* Keep long memoir chapters narrow enough for comfortable continuous reading. */
.page-content {
  width: min(calc(100% - 3rem), var(--content-width));
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) 0;
}

/* Leave room when an anchor target lands beneath the fixed desktop menu. */
#content {
  scroll-margin-top: 4rem;
}

.entry-header h1 {
  margin: 0 0 2.5rem;
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  font-weight: 300;
  line-height: 1.25;
}

.entry-content h2 {
  margin: 3rem 0 1rem;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  line-height: 1.3;
}

.entry-content h3 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.15rem;
  line-height: 1.4;
}

.entry-content p,
.entry-content ul,
.entry-content ol {
  margin: 0 0 1.5rem;
}

.entry-content li + li {
  margin-top: 0.65rem;
}

/* Let photographs keep their natural ratio and never exceed the reading column. */
figure {
  margin: 2.5rem 0;
}

figure img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

figcaption {
  margin-top: 0.6rem;
  color: var(--muted-ink);
  font-size: 0.8125rem;
  font-style: italic;
  line-height: 1.5;
  text-align: center;
}

/* Make audio controls usable across the full content width. */
audio {
  display: block;
  width: 100%;
}

/* Preserve video shape without hard-coded WordPress iframe dimensions. */
.entry-content iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
}

.entry-content figure:has(iframe) {
  aspect-ratio: 16 / 9;
}

.entry-content figure:has(iframe) > div {
  height: 100%;
}

/* Close the memorial with a quiet rule rather than WordPress attribution. */
.site-footer {
  width: min(calc(100% - 3rem), var(--wide-width));
  margin: 0 auto;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted-ink);
  font-size: 0.8rem;
}

.site-footer p {
  margin: 0;
}

/* Collapse the menu and reduce oversized mastheads on phones and small tablets. */
@media (max-width: 767px) {
  .header-image {
    min-height: 30rem;
    background-position: 52% center;
  }

  .site-branding {
    top: 21rem;
  }

  .js .menu-toggle {
    display: flex;
  }

  .primary-menu {
    display: block;
    width: calc(100% - 3rem);
  }

  .js .primary-menu {
    display: none;
  }

  .js .primary-menu.is-open {
    display: block;
  }

  .primary-menu a {
    padding: 0.8rem 0;
    border-top: 1px solid var(--line);
  }

  .page-image {
    min-height: 60vw;
  }

  .page-content {
    width: min(calc(100% - 2rem), var(--content-width));
  }
}

/*
 * Twenty Seventeen's defining desktop scroll treatment begins at 48rem:
 * viewport-height photographs stay anchored while their containers pass over
 * them, and the navigation moves from the masthead floor to the viewport top.
 */
@media (min-width: 768px) {
  .site-header {
    position: relative;
    height: 100vh;
    max-height: 100%;
  }

  .header-image {
    width: 100%;
    height: 100vh;
    min-height: 0;
    max-height: 100%;
    background-attachment: fixed;
  }

  .site-branding {
    top: auto;
    bottom: 5.5rem;
  }

  .site-navigation {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
  }

  .site-navigation.is-fixed {
    position: fixed;
    top: 0;
    right: 0;
    bottom: auto;
    left: 0;
    z-index: 1000;
  }

  .menu-scroll-down {
    position: absolute;
    top: 50%;
    right: max(1.5rem, calc((100% - var(--wide-width)) / 2));
    display: block;
    padding: 0.75rem;
    transform: translateY(-50%);
  }

  .site-navigation.is-fixed .menu-scroll-down {
    display: none;
  }

  .page-image {
    height: 100vh;
    min-height: 0;
    max-height: 1200px;
    background-attachment: fixed;
  }

  /* Mobile Safari does not reliably support fixed background attachment. */
  @supports (-webkit-touch-callout: none) {
    .header-image,
    .page-image {
      background-attachment: scroll;
    }
  }
}

/* Respect users who ask the operating system to minimise motion. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
