/* ============================================================
   UPGRADED STYLESHEET — full replacement for your original CSS
   Color scheme preserved. Drop this in place of your old file.
   ============================================================ */

/* ── DESIGN TOKENS ───────────────────────────────────────────── */
:root {
  /* Colors (unchanged from original) */
  --bg:           hsl(210 40% 98%);
  --fg:           hsl(222 24% 16%);
  --muted-fg:     hsl(220 10% 45%);
  --card:         hsl(0 0% 100%);
  --border:       hsl(220 18% 88%);
  --primary:      hsl(215 80% 45%);
  --primary-fg:   hsl(0 0% 100%);
  --secondary:    hsl(210 30% 96%);
  --hero-grad:    linear-gradient(135deg, #183b63 0%, #285d8f 55%, #4f7ca8 100%);

  /* Shadows — two-layer for real depth */
  --shadow-sm:    0 1px 3px hsl(220 30% 20% / 0.05),
                  0 6px 20px hsl(220 30% 20% / 0.07);
  --shadow-md:    0 4px 12px hsl(220 30% 18% / 0.09),
                  0 14px 40px hsl(220 30% 18% / 0.10);
  --shadow-hover: 0 8px 20px hsl(220 30% 18% / 0.12),
                  0 22px 52px hsl(220 30% 18% / 0.12);

  /* Radii */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;

  /* Media aspect ratio — change once, applies everywhere */
  --media-ratio: 4 / 3;

  /* Timing */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur:  0.28s;
}

/* Dark mode */
body.dark {
  --bg:           hsl(222 28% 10%);
  --fg:           hsl(210 25% 92%);
  --muted-fg:     hsl(215 14% 68%);
  --card:         hsl(222 24% 14%);
  --border:       hsl(220 16% 24%);
  --primary:      hsl(202 90% 62%);
  --primary-fg:   hsl(220 30% 10%);
  --secondary:    hsl(222 22% 18%);
  --hero-grad:    linear-gradient(135deg, hsl(202 90% 58%), hsl(263 80% 63%));
  --shadow-sm:    0 2px 8px  hsl(220 30% 2% / 0.25),
                  0 10px 30px hsl(220 30% 2% / 0.22);
  --shadow-md:    0 4px 16px  hsl(220 30% 2% / 0.32),
                  0 18px 52px hsl(220 30% 2% / 0.28);
  --shadow-hover: 0 8px 22px  hsl(220 30% 2% / 0.40),
                  0 26px 60px hsl(220 30% 2% / 0.36);
}


/* ── RESET ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: "Noto Sans JP", "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.8;
  font-size: 15px;
  transition: background var(--dur) ease, color var(--dur) ease;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }


/* ── LOADER ──────────────────────────────────────────────────── */
#loader {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 2000;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
#loader.hide { opacity: 0; visibility: hidden; }


/* ── FLOATING BUTTONS ────────────────────────────────────────── */
#theme-toggle,
#scroll-top {
  position: fixed; right: 20px;
  width: 44px; height: 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--fg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  z-index: 1200;
  font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  transition: box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
#theme-toggle:hover,
#scroll-top:hover {
  box-shadow: var(--shadow-md);
  transform: scale(1.06);
}
#theme-toggle { top: 20px; }

#scroll-top {
  bottom: 20px;
  opacity: 0; pointer-events: none;
  transform: translateY(10px);
  transition: opacity var(--dur) ease,
              transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
#scroll-top.show {
  opacity: 1; pointer-events: auto;
  transform: translateY(0);
}


/* ── HERO ────────────────────────────────────────────────────── */
.hero {
  background: var(--hero-grad);
  color: white;
  padding: 72px 24px 64px;
  position: relative;
  overflow: hidden;
}

/* Scalloped bottom edge — smooth transition to page */
.hero::after {
  content: "";
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 40px;
  background: var(--bg);
  clip-path: ellipse(55% 100% at 50% 100%);
  transition: background var(--dur) ease;
}

.hero-inner { max-width: 960px; margin: 0 auto; }

.hero-title {
  font-family: "DM Serif Display", "Noto Serif JP", Georgia, serif;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: 0.01em;
}

.hero-sub {
  margin: 10px 0 0;
  font-size: 14px;
  opacity: 0.88;
  letter-spacing: 0.015em;
}

.hero-back {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 24px; padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  background: hsl(0 0% 100% / 0.14);
  color: white;
  border: 1px solid hsl(0 0% 100% / 0.22);
  backdrop-filter: blur(10px);
  transition: background var(--dur) ease;
}
.hero-back:hover { background: hsl(0 0% 100% / 0.24); text-decoration: none; }


/* ── PAGE LAYOUT ─────────────────────────────────────────────── */
.page-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.section { margin-bottom: 20px; }


/* ── SECTION CARD ────────────────────────────────────────────── */
.section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.section-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.section-divider {
  height: 1px;
  background: var(--border);
  margin: 0 24px;
  opacity: 0.7;
}


/* ── SECTION HEADER ──────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; gap: 14px;
  padding: 22px 24px 0;
}

.section-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--secondary);
  border: 1px solid var(--border);
  font-size: 17px; flex: 0 0 auto;
}

.section-title {
  font-family: "Noto Serif JP", Georgia, serif;
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  font-weight: 700;
  line-height: 1.45;
  color: var(--fg);
}

.section-body { padding: 18px 24px 28px; }


/* ── ARCHIVE NAV ─────────────────────────────────────────────── */
.archive-intro {
  font-size: 13.5px;
  color: var(--muted-fg);
  margin: 0 0 16px;
  line-height: 1.8;
}

.year-nav { display: flex; flex-wrap: wrap; gap: 8px; }

.year-nav a {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  border: 1px solid hsl(215 80% 45% / 0.22);
  background: transparent;
  color: var(--primary);
  transition: background var(--dur) ease,
              color var(--dur) ease,
              border-color var(--dur) ease,
              transform 0.15s ease;
}
.year-nav a:hover {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
  text-decoration: none;
  transform: scale(1.04);
}
.year-nav a.active {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
  pointer-events: none;
}


/* ── LEGACY CONTENT ──────────────────────────────────────────── */
.legacy-content {
  font-size: 14.5px;
  line-height: 1.9;
  color: var(--fg);
}
.legacy-content ul { list-style: none; padding: 0; }
.legacy-content li { display: block; }
.legacy-content a { color: var(--primary); }
.legacy-content a:hover { text-decoration: underline; }
.legacy-content br { content: ""; display: block; margin: 0.18rem 0; }

/* Inline images (not in gallery) */
.legacy-content img {
  display: inline-block;
  max-width: min(100%, 420px);
  width: auto; height: auto;
  margin: 8px 10px 8px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--secondary);
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  vertical-align: top;
  transition: box-shadow var(--dur) ease;
}
.legacy-content img:hover { box-shadow: var(--shadow-hover); }

.legacy-content video {
  width: 100%; height: 500px; display: block;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #000;
  box-shadow: var(--shadow-sm);
}


/* ── UNIFORM MEDIA CONTAINER ─────────────────────────────────── */
/*
   Wrap ANY <img> or <video> in this div to enforce uniform sizing.

   Usage:
     <div class="media-uniform">
       <img src="photo.jpg" alt="...">
     </div>

   For videos:
     <div class="media-uniform has-video">
       <video src="clip.mp4" controls></video>
     </div>

   Change --media-ratio in :root to switch all media at once.
*/
.media-uniform {
  position: relative;
  width: 100%;
  aspect-ratio: var(--media-ratio);
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--secondary);
  border: 1px solid var(--border);
}

.media-uniform img,
.media-uniform video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--ease);
}

.media-uniform:hover img { transform: scale(1.035); }

/* Dark overlay hint for video items */
.media-uniform.has-video::after {
  content: "";
  position: absolute; inset: 0;
  background: hsl(220 30% 6% / 0.20);
  pointer-events: none;
  transition: background var(--dur) ease;
}
.media-uniform.has-video:hover::after {
  background: hsl(220 30% 6% / 0.08);
}


/* ── GALLERY GRID ────────────────────────────────────────────── */
/*
   Usage:
     <div class="gallery-grid">
       <div class="gallery-item">
         <div class="media-uniform">
           <img src="..." alt="...">
         </div>
       </div>
       ... repeat ...
     </div>
*/
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--secondary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  transition: box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.gallery-item:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

/* When .media-uniform is inside .gallery-item, remove its own border/radius
   since the parent .gallery-item already handles that */
.gallery-item .media-uniform {
  border: none;
  border-radius: 0;
}

/* Single thumbnail or video wrap — same ratio, no extra markup needed */
.single-thumb,
.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: var(--media-ratio);
  overflow: hidden;
  border-radius: var(--radius-md);
  background: #000;
}

.single-thumb img,
.video-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


/* ── PAST LINKS ──────────────────────────────────────────────── */
.past-links strong {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
}
.past-links ul { margin-left: 18px; list-style: disc; }
.past-links li { margin: 6px 0; }


/* ── FOOTER ──────────────────────────────────────────────────── */
.footer {
  background: hsl(220 25% 8%);
  color: hsl(210 20% 90%);
  padding: 40px 0 28px;
  margin-top: 24px;
}
.footer-inner {
  max-width: 960px; margin: 0 auto; padding: 0 32px;
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 20px;
}
.footer-name {
  font-family: "DM Serif Display", serif;
  font-size: 16px;
  color: hsl(0 0% 100% / 0.9);
}
.footer-detail {
  font-size: 12px;
  color: hsl(0 0% 100% / 0.48);
  line-height: 2;
  margin-top: 6px;
}
.footer-detail a { color: hsl(200 70% 65%); }
.footer-bottom {
  max-width: 960px; margin: 20px auto 0;
  padding: 14px 32px 0;
  border-top: 1px solid hsl(220 15% 18%);
  font-size: 12px;
  color: hsl(0 0% 100% / 0.28);
}
.footer-div {
  width: 32px; height: 2px;
  background: var(--hero-grad);
  border-radius: 2px;
  margin-bottom: 12px;
}


/* ── LIGHTBOX ────────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0;
  background: hsl(220 30% 6% / 0.86);
  backdrop-filter: blur(14px) saturate(0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur) ease;
  z-index: 1000;
}
.lightbox.open { opacity: 1; pointer-events: auto; }

.lightbox-inner {
  position: relative;
  max-width: min(1100px, 92vw);
  max-height: 90vh;
  display: flex; align-items: center; justify-content: center;
}

.lightbox img {
  max-width: 100%; max-height: 90vh;
  display: block;
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 80px hsl(220 30% 3% / 0.55);
  background: white;
}

.lightbox-close {
  position: absolute;
  top: -14px; right: -14px;
  width: 40px; height: 40px;
  border: none; border-radius: 50%;
  background: var(--card);
  color: var(--fg);
  font-size: 22px; line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.lightbox-close:hover {
  transform: scale(1.12);
  box-shadow: var(--shadow-hover);
}


/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding-top: 88px; }

  .section-header,
  .section-body { padding-left: 16px; padding-right: 16px; }

  .section-divider { margin: 0 16px; }

  /* 2-column gallery on mobile — stays organized, never single column */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .legacy-content img { max-width: 100%; margin-right: 0; }

  .lightbox { padding: 16px; }
  .lightbox-close {
    top: -8px; right: -6px;
    width: 36px; height: 36px;
    font-size: 20px;
  }
}