/* Evan's Place. One stylesheet for every page. */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #222222;
  --muted: #5b5b5b;
  --line: #dedad2;
  --accent: #245a78;
  --accent-soft: #e6eef3;
  --row: 200px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.6 Arial, Helvetica, sans-serif;
}

a { color: var(--accent); }
a:hover { color: #163d53; }

/* Every text link is a button: in the page's paragraphs and the footer. */
main p a, .site-footer a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 4px 0;
  padding: 8px 18px;
  border-radius: 4px;
  background: var(--accent);
  color: #ffffff;
  font-weight: bold;
  line-height: 1.3;
  text-decoration: none;
  overflow-wrap: anywhere;
}

main p a:hover, .site-footer a:hover {
  background: #163d53;
  color: #ffffff;
}

/* A download gets a download icon (an arrow onto a tray), in the button's own colour. */
a[download]::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M7 10l5 5 5-5M4 17v3h16v-3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M7 10l5 5 5-5M4 17v3h16v-3'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Home page: the cottage's own section, after Evan's photos and Michael's note */
.home-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.home-section h2 {
  margin: 0 0 8px;
  font-size: 1.75rem;
  line-height: 1.25;
}

/* Memorial Service: the slideshow above the recording */
/* Edge to edge (Martín, 2026-11-03). --sbw is the scrollbar's width, set by the script,
   so the slideshow fills the window without making the page scroll sideways. */
.slideshow {
  width: calc(100vw - var(--sbw, 0px));
  margin: 0 0 16px calc(50% - (100vw - var(--sbw, 0px)) / 2);
}

.slides {
  position: relative;
  /* Tall as the screen allows while the player below stays in view. */
  height: clamp(240px, calc(100vh - 220px), 62vw);
  overflow: hidden;
  background: #1b1b1b;
}

.slides img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.8s ease;
}

.slides img.is-hidden { opacity: 0; }

/* The audio bar, along the foot of the slideshow */
.slides-audio {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 32px 16px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
}

.slides-audio audio {
  display: block;
  width: 100%;
  max-width: 1072px;
  margin: 0 auto;
}

.slides-play {
  z-index: 2;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 88px;
  height: 88px;
  margin: -44px 0 0 -44px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.6);
  cursor: pointer;
}

/* The triangle */
.slides-play::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -16px 0 0 -9px;
  border-style: solid;
  border-width: 16px 0 16px 28px;
  border-color: transparent transparent transparent #ffffff;
}

.slides-play:hover { background: rgba(20, 20, 20, 0.8); }

.slides-play:focus-visible { outline: 3px solid #ffffff; outline-offset: 3px; }

.slides-play[hidden] { display: none; }

.slideshow figcaption {
  max-width: 1120px;
  min-height: 1.4em;
  margin: 8px auto 0;
  padding: 0 24px;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .slides img { transition: none; }
}

/* Home page: Michael's note, a centred column of left-aligned text */
.home-note {
  max-width: 40em;
  margin: 48px auto 0;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

/* Send Michael a photo, on every page */
.cta {
  margin-bottom: 24px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.cta h2 {
  margin: 0 0 12px;
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--text);
}

.cta p { margin: 0; }

/* The map on Where It Is */
.map {
  max-width: 40em;
  margin: 16px 0 24px;
}

.map iframe {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 4px;
}
a:focus-visible, button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

img { max-width: 100%; height: auto; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Header and menu */

.site-header {
  position: relative;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.bar, main, .site-footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.site-title {
  font: bold 2rem/1.2 Arial, Helvetica, sans-serif;
  color: var(--text);
  text-decoration: none;
}

.menu-buttons {
  display: flex;
  gap: 8px;
}

.menu-trigger, .menu-toggle {
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 8px 14px;
  cursor: pointer;
}

.menu-trigger::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 0 3px 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.menu-trigger[aria-expanded="true"]::after {
  transform: rotate(-135deg);
  margin-bottom: -1px;
}

.menu-trigger:hover, .menu-toggle:hover { background: var(--accent-soft); }

.menu-trigger.is-current {
  box-shadow: inset 0 -3px 0 var(--accent);
  border-radius: 4px 4px 0 0;
}

.menu-trigger[aria-expanded="true"] {
  background: var(--accent-soft);
  box-shadow: none;
  border-radius: 4px;
}

.menu-toggle { border-color: var(--line); }

/* The panel. Without the script it sits open under the title. */

.site-nav {
  background: var(--surface);
  padding: 8px 0 24px;
}

.js .site-nav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: calc(100vh - 100%);
  overflow-y: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.js .site-nav:not([data-open]) { display: none; }

.menu-group {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 24px 0;
}

.menu-group h2 {
  margin: 0 0 12px;
  font-size: 0.85rem;
  font-weight: bold;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* With one group open its button already names it. */
.js .site-nav:not([data-open="all"]) .menu-group h2 {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.menu-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu-cards a {
  display: block;
  color: var(--text);
  text-decoration: none;
}

.menu-cards img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 4px;
  background: var(--line);
}

.menu-cards span {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
  line-height: 1.35;
}

.menu-cards a:hover span { color: var(--accent); text-decoration: underline; }

.menu-cards a[aria-current="page"] img { outline: 3px solid var(--accent); outline-offset: 2px; }
.menu-cards a[aria-current="page"] span { font-weight: bold; }

/* Page */

main { padding-top: 32px; padding-bottom: 32px; }

h1 {
  margin: 0 0 24px;
  font: bold 1.75rem/1.25 Arial, Helvetica, sans-serif;
}

main > p { max-width: 40em; }

p.photo img {
  display: block;
  width: 600px;
  border-radius: 2px;
}


/* Photos: rows of equal height that fill the width, caption under each photo */

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 12px;
  margin: 32px 0;
  padding: 0;
  list-style: none;
}

.gallery::after {
  content: "";
  flex-grow: 1000;
}

.gallery li {
  flex: var(--r) 1 calc(var(--r) * var(--row));
  max-width: calc(var(--r) * var(--row) * 1.6);
}

.gallery figure { margin: 0; }

.gallery a { display: block; }

.gallery img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  background: var(--line);
}

.gallery figcaption {
  margin-top: 6px;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--muted);
}

/* With a mouse, the caption is a bubble over the photo while the pointer rests on it
   (Martín, 2026-11-03). On touch screens it stays under the photo. */
@media (hover: hover) and (pointer: fine) {
  .gallery figure { position: relative; }

  .gallery figcaption {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    margin: 0;
    padding: 8px 12px;
    border-radius: 4px;
    background: rgba(20, 20, 20, 0.88);
    color: #ffffff;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s, transform 0.15s;
    pointer-events: none;
  }

  .gallery figure:hover figcaption,
  .gallery figure:focus-within figcaption {
    opacity: 1;
    transform: none;
  }

  .gallery { row-gap: 12px; }
}

/* Home page: a masonry grid led by Evan's portrait. The script sets each photo's
   height in 4 px rows; without it the photos stay in the rows above. */

.gallery.masonry {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  grid-auto-rows: 4px;
  grid-auto-flow: row dense;
  gap: 0 12px;
}

.gallery.masonry::after { display: none; }

.gallery.masonry li { max-width: none; }

/* About the 600 px the portrait had on the old home page. */
.gallery.masonry li.hero { grid-column: span 3; }

/* Large view */

.viewer {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(15, 15, 15, 0.96);
  color: #f2f2f2;
}

.viewer::backdrop { background: rgba(15, 15, 15, 0.96); }

.viewer[open] {
  display: flex;
  flex-direction: column;
}

.viewer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-size: 0.95rem;
}

.viewer-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
}

.viewer-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.viewer-caption {
  min-height: 1.4em;
  margin: 12px auto 0;
  padding: 0 16px;
  max-width: 40em;
  text-align: center;
  line-height: 1.4;
}

.viewer-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px 20px;
}

.viewer button {
  font: inherit;
  font-size: 1rem;
  color: #f2f2f2;
  background: transparent;
  border: 1px solid #777;
  border-radius: 4px;
  padding: 8px 20px;
  cursor: pointer;
}

.viewer button:hover { background: #333; }

/* Footer */

.site-footer {
  padding-bottom: 40px;
  color: var(--muted);
}

/* Phone */

@media (max-width: 760px) {
  :root { --row: 140px; }

  body { font-size: 17px; }

  .bar, .menu-group, main, .site-footer { padding-left: 16px; padding-right: 16px; }

  .bar { padding-top: 12px; padding-bottom: 12px; }

  .site-title { font-size: 1.6rem; }

  .menu-trigger { display: none; }

  .menu-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }

  .menu-cards span { font-size: 0.95rem; }

  main { padding-top: 24px; }

  h1 { font-size: 1.5rem; }

  .gallery { gap: 20px 8px; }

  .gallery.masonry { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; }

  .slides { height: min(100vw, 66vh); }

  .slideshow figcaption { padding: 0 16px; }

  .gallery.masonry li.hero { grid-column: 1 / -1; }
}

@media (min-width: 761px) {
  .menu-toggle { display: none; }
}

/* Without the script there are no buttons to open the menu. */
html:not(.js) .menu-buttons { display: none; }
