:root {
  --paper: #fbfaf7;
  --paper-warm: #fff6e6;
  --ink: #182623;
  --ink-light: #4c5b58;
  --mist: #dbeff2;
  --leaf: #2f6f5e;
  --coral: #d85f4f;
  --grape: #8f5a88;
  --gold: #ecb94f;
  --plum: #4b3854;
  --sky: #3b82a0;
  --shadow: 0 14px 36px rgba(30, 44, 41, 0.14);
  --soft-shadow: 0 6px 18px rgba(30, 44, 41, 0.08);
  --font-display: 'Playfair Display', serif;
  --font-body: 'DM Sans', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
}

a { color: inherit; }

.loading-gate {
  position: fixed;
  inset: 0;
  background: transparent;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.loading-gate.hidden { display: none; }

.loading-gate.auth-denied:not(.hidden) {
  display: flex;
  background:
    linear-gradient(90deg, rgba(251, 250, 247, 0.94) 0%, rgba(251, 250, 247, 0.78) 44%, rgba(251, 250, 247, 0.22) 100%),
    var(--hero-image, #fbfaf7) var(--hero-position, center) / cover no-repeat;
}

.loading-box {
  background: rgba(255, 255, 255, 0.92);
  padding: 40px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 18px 48px rgba(11, 24, 21, 0.14);
  backdrop-filter: blur(12px);
}

.loading-box h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.loading-box p {
  color: var(--ink-light);
  margin-bottom: 16px;
}

.auth-error {
  color: #9b2c2c;
  font-size: 0.9rem;
  margin-top: 16px;
  display: none;
}

.sign-out-btn {
  background: var(--plum);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 16px;
  display: none;
}

.top-nav {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(16px) saturate(1.04);
  padding: 12px clamp(16px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.46);
  box-shadow: 0 12px 36px rgba(24, 38, 35, 0.10);
}

.back-link {
  text-decoration: none;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
  min-height: 40px;
  padding: 0 8px 0 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
}

.back-link::before {
  content: '';
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: var(--paper) url('/assets/icons/home-front-watercolor-icon-2026-v4.webp') center / cover no-repeat;
  box-shadow: 0 8px 18px rgba(24, 38, 35, 0.10);
}

.user-info {
  display: none;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--plum);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  overflow: hidden;
}

.sign-out {
  background: none;
  border: 1px solid rgba(24, 38, 35, 0.12);
  color: var(--ink-light);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 8px;
}

.back-link:focus-visible,
.sign-out:focus-visible {
  outline: 3px solid rgba(236, 185, 79, 0.75);
  outline-offset: 3px;
}

.album-hero {
  width: min(1120px, calc(100% - clamp(28px, 8vw, 104px)));
  min-height: clamp(300px, 34vw, 360px);
  margin: clamp(24px, 5vw, 42px) auto 0;
  background: var(--hero-image) var(--hero-position, center) / cover no-repeat;
  display: flex;
  align-items: flex-end;
  padding: clamp(34px, 6vw, 58px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(118, 101, 76, 0.18);
}

.album-hero::after {
  content: none;
}

.hero-intro {
  width: min(1120px, calc(100% - clamp(28px, 8vw, 104px)));
  margin: clamp(26px, 5vw, 46px) auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: clamp(20px, 5vw, 52px);
  align-items: end;
}

.hero-intro h1 {
  font-family: var(--font-display);
  font-size: clamp(3.1rem, 7vw, 5.2rem);
  line-height: 0.9;
  font-weight: 700;
}

.hero-intro p:not(.eyebrow) {
  color: var(--ink-light);
  font-size: clamp(1.02rem, 1.9vw, 1.22rem);
  line-height: 1.58;
  max-width: 620px;
}

.hero-content {
  width: min(620px, 100%);
  max-width: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  box-shadow: 0 16px 42px rgba(24, 38, 35, 0.12);
  backdrop-filter: blur(10px) saturate(1.03);
  padding: clamp(20px, 4vw, 34px);
  text-shadow: none;
}

.eyebrow,
.section-kicker {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--coral);
  margin-bottom: 12px;
}

.album-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(3.25rem, 8vw, 5.2rem);
  line-height: 0.88;
  font-weight: 700;
  margin-bottom: 18px;
}

.album-hero p:not(.eyebrow) {
  color: var(--ink-light);
  font-size: clamp(1.04rem, 2vw, 1.3rem);
  line-height: 1.55;
  max-width: 560px;
}

.story {
  max-width: 1240px;
  margin: 0 auto;
  padding: 48px clamp(18px, 4vw, 34px) 80px;
}

body.has-album-nav .story {
  max-width: 1400px;
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  column-gap: clamp(24px, 4vw, 48px);
  align-items: start;
}

body.has-album-nav .story > :not(.album-jump-nav) {
  grid-column: 2;
}

.album-jump-nav {
  grid-column: 1;
  grid-row: 1 / span 120;
  position: sticky;
  top: 82px;
  align-self: start;
  padding: 10px;
  border: 1px solid rgba(24, 38, 35, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(14px) saturate(1.04);
}

.album-jump-title {
  color: var(--ink-light);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 8px 6px;
}

.album-jump-nav a {
  display: block;
  color: var(--ink-light);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.25;
  padding: 9px 10px;
  border-radius: 8px;
}

.album-jump-nav a:hover,
.album-jump-nav a:focus-visible {
  color: var(--ink);
  background: rgba(236, 185, 79, 0.18);
}

.album-jump-nav a.is-active {
  color: var(--ink);
  background: rgba(47, 111, 94, 0.12);
}

.story-header {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: clamp(28px, 6vw, 64px);
  align-items: start;
  margin-bottom: 42px;
}

.section-kicker {
  color: var(--coral);
  margin-bottom: 8px;
}

.story h2,
.album-section h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.04;
  margin-bottom: 18px;
}

.story-copy {
  color: var(--ink-light);
  font-size: 1.03rem;
  line-height: 1.75;
}

.story-copy p + p { margin-top: 16px; }

.detail-list {
  background: white;
  border: 1px solid rgba(24, 38, 35, 0.1);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
  overflow: hidden;
}

.detail-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(24, 38, 35, 0.08);
}

.detail-row:last-child { border-bottom: 0; }

.detail-label {
  color: var(--ink-light);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-value {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.35;
}

.metadata-note {
  color: var(--ink-light);
  font-size: 0.88rem;
  line-height: 1.55;
  margin-top: 12px;
}

.album-section {
  margin-top: 54px;
  content-visibility: auto;
  contain-intrinsic-size: 900px;
  scroll-margin-top: 96px;
}

.section-intro {
  color: var(--ink-light);
  max-width: 760px;
  line-height: 1.65;
  margin: -8px 0 22px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

figure {
  min-width: 0;
  background: white;
  border: 1px solid rgba(24, 38, 35, 0.1);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--soft-shadow);
  display: flex;
  flex-direction: column;
  content-visibility: auto;
  contain-intrinsic-size: 420px;
}

figure.feature {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
}

figure.wide {
  grid-column: span 2;
}

figure img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #e9e5dc;
}

figure.feature img {
  height: 100%;
  min-height: 420px;
  aspect-ratio: auto;
}

figure.tall img {
  aspect-ratio: 3 / 4;
}

figure.panorama img {
  aspect-ratio: 16 / 9;
}

figcaption {
  padding: 15px 16px 17px;
  flex: 1;
}

figure.feature figcaption {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(22px, 4vw, 40px);
}

.photo-meta {
  display: block;
  color: var(--coral);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.caption-title {
  display: block;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 5px;
}

figure.feature .caption-title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 700;
}

.caption-text {
  color: var(--ink-light);
  font-size: 0.91rem;
  line-height: 1.5;
}

figure:not(.feature) .caption-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.footer {
  text-align: center;
  width: min(1080px, calc(100% - clamp(24px, 8vw, 104px)));
  margin: 0 auto clamp(18px, 4vw, 34px);
  padding: 26px clamp(20px, 4vw, 34px);
  color: var(--ink-light);
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 16px 44px rgba(11, 24, 21, 0.14);
  backdrop-filter: blur(16px) saturate(1.04);
}

@media (max-width: 900px) {
  .hero-intro {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .story-header {
    grid-template-columns: 1fr;
  }

  body.has-album-nav .story {
    display: block;
    max-width: 1240px;
  }

  .album-jump-nav {
    position: sticky;
    top: 61px;
    z-index: 80;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    margin: -12px 0 32px;
    padding: 8px;
    scrollbar-width: thin;
  }

  .album-jump-title {
    flex: 0 0 auto;
    padding: 8px 10px 8px 8px;
  }

  .album-jump-nav a {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  figure.feature {
    grid-template-columns: 1fr;
  }

  figure.feature img {
    min-height: 0;
    aspect-ratio: 16 / 10;
  }
}

@media (max-width: 620px) {
  .top-nav {
    padding: 10px 14px;
  }

  .album-hero {
    width: min(100% - 28px, 640px);
    min-height: 420px;
    margin-top: 18px;
    padding: 32px 20px;
    background: var(--hero-image) var(--hero-mobile-position, var(--hero-position, center)) / cover no-repeat;
  }

  .story {
    padding-top: 36px;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .photo-grid {
    grid-template-columns: 1fr;
  }

  figure,
  figure.feature,
  figure.wide {
    grid-column: auto;
  }

  .birthday-label {
    white-space: normal;
  }
}
