:root {
  --paper: #f3efe0;
  --paper-deep: #ebe4d2;
  --paper-tab: #e4d8c0;
  --ink: #2a2420;
  --forest: #2d3b2d;
  --moss: #485434;
  --coral: #a64d2e;
  --teal: #2f6f6a;
  --tape: rgba(255, 236, 179, 0.88);
  --shadow: rgba(40, 24, 12, 0.16);
  --rule: rgba(42, 36, 32, 0.55);
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --typewriter: "Special Elite", "Courier New", Courier, monospace;
  --sans: "Source Sans 3", "Segoe UI", sans-serif;
  --hand: "Caveat", "Patrick Hand", cursive;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.scrapbook {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.55;
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 12% 0%, rgba(255, 255, 255, 0.45) 0%, transparent 50%),
    radial-gradient(ellipse at 88% 8%, rgba(72, 84, 52, 0.05) 0%, transparent 42%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(90, 70, 40, 0.015) 3px,
      rgba(90, 70, 40, 0.015) 4px
    ),
    linear-gradient(180deg, #f7f2e6 0%, var(--paper) 28%, var(--paper-deep) 100%);
  min-height: 100vh;
  overflow-x: clip;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 10000;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.site-header {
  position: relative;
  padding: 1.1rem 1.5rem 0;
  max-width: 1080px;
  margin: 0 auto;
}

/* Reserve room for absolute Scrapbook|Original only while logo + nav share a row. */
.site-header:has(.view-toggle) .brand-row {
  padding-right: 9.5rem;
}

.brand-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.5rem;
  padding-bottom: 0.85rem;
  border-bottom: 1.5px solid var(--rule);
}

/* Mid widths: nav sits under the logo — drop the toggle gutter so About stays on the nav line. */
@media (max-width: 980px) and (min-width: 761px) {
  .site-header:has(.view-toggle) .brand-row {
    padding-right: 0;
  }
  .primary-nav {
    justify-content: flex-start;
    width: 100%;
    gap: 0.75rem 1.15rem;
  }
}

.logo-link {
  display: inline-block;
  line-height: 0;
}

.logo {
  display: block;
  width: min(220px, 58vw);
  height: auto;
}

/* Exploratory vintage travel-ticket masthead (transparent ticket art). */
.logo-link--ticket {
  flex: 0 1 auto;
  max-width: min(20rem, 100%);
  margin: 0.15rem 0 0.05rem -0.15rem;
}

.logo--ticket {
  width: min(20rem, 100%);
  max-width: 100%;
  height: auto;
  transform: rotate(-1deg);
  transform-origin: left center;
  filter: drop-shadow(0 1px 1px rgba(40, 24, 12, 0.1));
}

.primary-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.85rem 1.35rem;
  font-family: var(--typewriter);
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.primary-nav a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1.5px solid var(--ink);
  padding-bottom: 0.1rem;
}

.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
  color: var(--forest);
  border-bottom-style: dashed;
}

.view-toggle {
  position: absolute;
  top: 1.1rem;
  right: 1.5rem;
  font-family: var(--typewriter);
  font-size: 0.85rem;
  margin: 0;
  text-align: right;
  white-space: nowrap;
  z-index: 2;
}
.view-toggle a {
  color: var(--ink);
  text-decoration: none;
  opacity: 0.75;
}
.view-toggle a.is-active {
  color: var(--coral);
  opacity: 1;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.view-toggle a:hover { opacity: 1; color: var(--coral); }
.view-sep { margin: 0 0.35rem; opacity: 0.45; }

.utility-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin: 1.5rem 0 0;
  font-family: var(--typewriter);
  font-size: 0.9rem;
}
.utility-nav a {
  color: var(--moss);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.search-page {
  max-width: 40rem;
  margin: 0 auto;
  text-align: center;
}
.search-page .site-search {
  margin-top: 1.25rem;
  text-align: left;
}
/* Soften Pagefind chrome to sit on scrapbook paper */
.search-page .pagefind-ui {
  --pagefind-ui-primary: #2f5d50;
  --pagefind-ui-text: #2a241c;
  --pagefind-ui-background: #f7f1e4;
  --pagefind-ui-border: #d4c4a8;
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 4px;
  --pagefind-ui-font: var(--sans, "Source Sans 3", sans-serif);
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
}

.hero-home {
  text-align: center;
  padding: 1.5rem 0 0.25rem;
}

.brand-heading {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.2rem, 6.2vw, 3.6rem);
  line-height: 1.08;
  color: var(--forest);
  margin: 0.15rem 0 0.65rem;
  letter-spacing: -0.01em;
  text-align: center;
}

.hero-dek {
  font-family: var(--typewriter);
  font-size: clamp(0.95rem, 2.2vw, 1.1rem);
  color: var(--ink);
  margin: 0 auto 1.4rem;
  max-width: 36rem;
  text-align: center;
}

.hand-title {
  font-family: var(--hand);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  color: var(--ink);
  margin: 0.2rem 0;
}

.year-nav {
  text-align: center;
  margin: 0.5rem 0 1.85rem;
}

.year-nav-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin: 0 0 0.95rem;
  font-family: var(--hand);
  font-size: clamp(1.45rem, 3.5vw, 1.85rem);
  color: var(--ink);
  font-style: italic;
}

.year-nav-label::before,
.year-nav-label::after {
  content: "";
  flex: 1 1 2rem;
  max-width: 9rem;
  border-top: 1.5px dashed rgba(42, 36, 32, 0.45);
}

.year-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem 0.65rem;
  font-family: var(--typewriter);
}

.year-tabs a {
  display: inline-block;
  min-width: 3.4rem;
  padding: 0.42rem 0.7rem;
  color: var(--ink);
  text-decoration: none;
  background: var(--paper-tab);
  border: 1px solid rgba(42, 36, 32, 0.12);
  box-shadow: 1px 2px 0 rgba(40, 24, 12, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.year-tabs a:hover,
.year-tabs a.is-current {
  transform: translateY(-2px);
  box-shadow: 2px 4px 0 rgba(40, 24, 12, 0.16);
  color: var(--forest);
}

.year-tabs a.is-current {
  outline: 1.5px solid var(--forest);
  outline-offset: 1px;
}

.feature-grid,
.year-grid {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

/* Homepage: keep six featured pages in a stable 3×2, not a wide 4×2. */
.feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.feature-card a,
.year-story a {
  display: block;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.45);
  padding: 0.6rem;
  transform: rotate(-0.4deg);
  box-shadow: 0 4px 14px var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.feature-card:nth-child(even) a,
.year-story:nth-child(even) a { transform: rotate(0.5deg); }
.feature-card a:hover,
.year-story a:hover {
  transform: rotate(0deg) translateY(-3px);
  box-shadow: 0 8px 20px var(--shadow);
}
.feature-card img,
.year-story img {
  display: block;
  width: 100%;
  height: auto;
  background: #ddd;
}
.feature-title {
  display: block;
  font-family: var(--hand);
  font-size: 1.35rem;
  margin-top: 0.4rem;
}
.feature-date {
  display: block;
  font-family: var(--typewriter);
  font-size: 0.85rem;
  color: #5a4a3c;
}

.story-header { text-align: center; margin-bottom: 1.25rem; }
.story-date {
  font-family: var(--typewriter);
  color: #5a4a3c;
}
.review-note {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--coral);
}

.breadcrumbs {
  font-family: var(--typewriter);
  font-size: 0.95rem;
  text-align: left;
  margin: 0.75rem 0 1.25rem;
}
.breadcrumbs a { color: var(--teal); }

.page-chain {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: stretch;
  gap: 0.85rem 1.25rem;
  margin: 0.85rem 0 1.4rem;
}

.page-chain-card {
  position: relative;
  display: inline-flex;
  text-decoration: none;
  color: var(--teal);
  min-width: min(11.5rem, 100%);
  padding-top: 0.35rem;
  transform: rotate(-0.6deg);
  transition: transform 0.2s ease;
}

.page-chain-next {
  margin-left: auto;
  transform: rotate(0.7deg);
}

.page-chain-card::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 50%;
  z-index: 2;
  width: 64px;
  height: 20px;
  margin-left: -32px;
  background: var(--tape);
  box-shadow: 0 1px 2px rgba(40, 24, 12, 0.12);
  transform: rotate(-1.5deg);
  opacity: 0.95;
  pointer-events: none;
}

.page-chain-next::before {
  transform: rotate(1.8deg);
}

.page-chain-face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.95rem 1.15rem 0.85rem;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.42) 0%, transparent 42%),
    var(--paper-deep);
  border: 1.5px dashed var(--coral);
  filter: drop-shadow(0 4px 5px rgba(40, 24, 12, 0.18));
  font-family: var(--hand);
  font-size: clamp(1.45rem, 3.2vw, 1.85rem);
  font-weight: 700;
  line-height: 1;
  transition: filter 0.2s ease, color 0.2s ease;
  clip-path: polygon(
    0.8% 2.2%,
    3% 0.4%,
    8% 1.8%,
    14% 0.2%,
    22% 1.5%,
    31% 0.5%,
    42% 1.8%,
    53% 0.3%,
    64% 1.6%,
    74% 0.4%,
    84% 1.7%,
    92% 0.5%,
    97% 1.4%,
    99.4% 4%,
    98.2% 12%,
    99.6% 22%,
    98.4% 34%,
    99.5% 46%,
    98.3% 58%,
    99.6% 70%,
    98.2% 82%,
    99.4% 92%,
    97.5% 97.5%,
    90% 99%,
    80% 97.8%,
    68% 99.2%,
    56% 98%,
    44% 99.3%,
    32% 97.9%,
    20% 99.1%,
    10% 98%,
    3% 99%,
    0.6% 94%,
    1.8% 82%,
    0.4% 70%,
    1.7% 58%,
    0.5% 46%,
    1.6% 34%,
    0.4% 22%,
    1.5% 12%
  );
}

.page-chain-label {
  color: var(--teal);
  letter-spacing: 0.01em;
}

.page-chain-arrow {
  flex: 0 0 auto;
  width: clamp(2.75rem, 8vw, 4.5rem);
  height: auto;
  color: var(--teal);
}

.page-chain-card:hover,
.page-chain-card:focus-visible {
  color: var(--forest);
  outline: none;
}

.page-chain-card:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 4px;
}

.page-chain-prev:hover,
.page-chain-prev:focus-visible {
  transform: rotate(-0.6deg) translateY(-2px);
}

.page-chain-next:hover,
.page-chain-next:focus-visible {
  transform: rotate(0.7deg) translateY(-2px);
}

.page-chain-card:hover .page-chain-face,
.page-chain-card:focus-visible .page-chain-face {
  filter: drop-shadow(0 7px 8px rgba(40, 24, 12, 0.22));
}

.page-chain-card:hover .page-chain-label,
.page-chain-card:focus-visible .page-chain-label {
  color: var(--forest);
}

.page-chain-card:hover .page-chain-arrow,
.page-chain-card:focus-visible .page-chain-arrow {
  color: var(--forest);
}

.story-flow {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.diary-entry {
  background: rgba(255, 248, 238, 0.72);
  border: 1px solid rgba(28, 20, 16, 0.1);
  box-shadow: 0 5px 16px var(--shadow);
  padding: 1.15rem 1.2rem 1.4rem;
  position: relative;
}

.diary-entry::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 28px;
  width: 78px;
  height: 24px;
  background: var(--tape);
  transform: rotate(-2deg);
  opacity: 0.92;
}

.diary-entry-date {
  font-family: var(--hand);
  font-size: clamp(1.55rem, 3.5vw, 2rem);
  font-weight: 700;
  color: var(--forest);
  margin: 0.15rem 0 1rem;
  text-align: center;
}

.diary-entry-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.story-block.text-photo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: center;
}
.story-block.text-photo.flip .note-card { order: 2; }
.story-block.text-photo.flip .photo-stack { order: 1; }

.note-card {
  background: #fff8ee;
  border: 1px solid rgba(28, 20, 16, 0.08);
  padding: 1rem 1.15rem;
  box-shadow: 0 3px 10px var(--shadow);
  position: relative;
}
.diary-entry .note-card {
  background: rgba(255, 255, 255, 0.65);
  box-shadow: none;
}
.diary-entry .note-card::before { display: none; }

.note-card::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 24px;
  width: 72px;
  height: 22px;
  background: var(--tape);
  transform: rotate(-2deg);
  opacity: 0.9;
}
.note-card p { margin: 0 0 0.75rem; }
.note-card p:last-child { margin-bottom: 0; }
.note-card a { color: var(--teal); }

.photo-frame {
  display: inline-block;
  background: #fff;
  padding: 0.55rem 0.55rem 1.4rem;
  box-shadow: 0 6px 18px var(--shadow);
  transform: rotate(0.6deg);
  max-width: 100%;
}
.story-block:nth-child(odd) .photo-frame { transform: rotate(-0.8deg); }
.photo-frame img {
  display: block;
  max-width: 100%;
  height: auto;
}
.photo-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.archive-periods {
  max-width: 40rem;
  margin: 1.5rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}
.archive-year-heading {
  margin: 0 0 0.35rem;
  font-family: var(--typewriter);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.archive-year-heading a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.period-months {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  font-family: var(--typewriter);
  line-height: 1.6;
}
.period-months a {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legacy-only {
  color: #7a6554;
  font-size: 0.85em;
}

.top-pages-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 46rem;
  margin-inline: auto;
}
.top-page-entry {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem 1rem;
  align-items: start;
  padding: 0.85rem 1rem;
  background: rgba(255, 252, 245, 0.88);
  border: 1px solid rgba(42, 36, 32, 0.14);
  box-shadow: 0 1px 0 rgba(42, 36, 32, 0.06);
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.45;
}
.top-page-entry.has-thumb {
  grid-template-columns: 10rem minmax(0, 1fr);
}
.top-page-thumb {
  display: block;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.55);
  padding: 0.4rem;
  transform: rotate(-1deg);
  box-shadow: 0 3px 10px var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.top-page-entry:nth-child(even) .top-page-thumb {
  transform: rotate(0.8deg);
}
a.top-page-thumb:hover {
  transform: rotate(0deg) translateY(-2px);
  box-shadow: 0 7px 16px var(--shadow);
}
.top-page-thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #ddd;
}
.top-page-body {
  display: flex;
  gap: 0.65rem 0.85rem;
  align-items: flex-start;
  min-width: 0;
}
.top-page-entry.is-struck .top-page-copy {
  text-decoration: line-through;
  opacity: 0.72;
}
.top-page-entry .video-badge {
  flex: 0 0 auto;
  display: inline-block;
  margin-top: 0.15rem;
  padding: 0.15rem 0.45rem;
  font-family: var(--typewriter);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  border: 1.5px solid var(--coral);
  background: rgba(166, 77, 46, 0.08);
}
.top-page-copy {
  flex: 1 1 auto;
  min-width: 0;
}
.top-page-entry .video-badge:hover {
  background: rgba(166, 77, 46, 0.16);
}
.top-page-copy a {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.home-links {
  margin-top: 2rem;
  text-align: center;
  font-family: var(--typewriter);
}
.home-links a { color: var(--teal); }

.about-page {
  max-width: 38rem;
  margin: 0 auto 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.about-contact {
  margin: 0;
  font-family: var(--hand);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--ink);
}
.about-contact a {
  color: var(--coral);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.about-portrait {
  margin: 0;
  text-align: center;
  max-width: min(22rem, 100%);
}
.about-photo {
  position: relative;
  transform: rotate(-1.2deg);
}
.about-photo::before {
  content: "";
  position: absolute;
  top: -0.55rem;
  left: 50%;
  width: 5.5rem;
  height: 1.35rem;
  margin-left: -2.75rem;
  background: var(--tape);
  transform: rotate(-2deg);
  box-shadow: 0 1px 2px rgba(42, 36, 32, 0.12);
  z-index: 1;
}
.about-photo-caption {
  margin: 0.85rem 0 0;
  font-family: var(--hand);
  font-size: 1.2rem;
  line-height: 1.35;
  color: #5a4a3c;
  max-width: 22rem;
}
.about-copy {
  width: 100%;
  text-align: left;
}
.about-copy p {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
  line-height: 1.55;
}
.about-copy p:last-child { margin-bottom: 0; }

.site-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem 1.5rem 2rem;
  font-family: var(--typewriter);
  font-size: 0.85rem;
  color: #6a5848;
  text-align: center;
  border-top: 1px dashed rgba(42, 36, 32, 0.28);
}

.missing-media {
  border: 2px dashed var(--coral);
  padding: 1rem;
  background: rgba(166, 77, 46, 0.08);
  font-family: var(--sans);
}

@media (max-width: 760px) {
  .brand-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .site-header:has(.view-toggle) .brand-row {
    padding-right: 0;
    padding-top: 1.5rem;
  }
  .logo-link--ticket {
    max-width: min(17.5rem, 92vw);
    margin-left: -0.05rem;
  }
  .logo--ticket {
    width: min(17.5rem, 92vw);
    transform: rotate(-0.6deg);
  }
  .primary-nav {
    justify-content: flex-start;
    width: 100%;
  }
  .view-toggle {
    top: 0.85rem;
    right: 0.9rem;
  }
  .feature-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
  .top-page-entry.has-thumb {
    grid-template-columns: 1fr;
  }
  .top-page-thumb {
    max-width: 16rem;
    transform: none;
  }
  .top-page-entry:nth-child(even) .top-page-thumb {
    transform: none;
  }
  .story-block.text-photo {
    grid-template-columns: 1fr;
  }
  .story-block.text-photo.flip .note-card,
  .story-block.text-photo.flip .photo-stack {
    order: initial;
  }
  .period-months { gap: 0.3rem 0.7rem; }
  body.scrapbook { font-size: 1rem; }
  .site-header,
  main,
  .site-footer { padding-left: 0.9rem; padding-right: 0.9rem; }
  .photo-frame { transform: none; }
  .about-photo { transform: none; }
  .brand-heading { font-size: clamp(1.85rem, 8vw, 2.6rem); }
  .year-nav-label::before,
  .year-nav-label::after { max-width: 3rem; }
  .page-chain {
    gap: 0.75rem;
  }
  .page-chain-card,
  .page-chain-next {
    flex: 1 1 calc(50% - 0.4rem);
    max-width: calc(50% - 0.4rem);
    min-width: 9.5rem;
    transform: none;
  }
  .page-chain-prev:hover,
  .page-chain-prev:focus-visible,
  .page-chain-next:hover,
  .page-chain-next:focus-visible {
    transform: translateY(-2px);
  }
  .page-chain-face {
    padding: 0.85rem 0.85rem 0.75rem;
    font-size: clamp(1.35rem, 5.5vw, 1.65rem);
  }
  .page-chain-arrow {
    width: clamp(2.4rem, 12vw, 3.4rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .feature-card a,
  .year-story a,
  .year-tabs a,
  .top-page-thumb,
  .page-chain-card,
  .page-chain-face { transition: none; }
}
