/* ── PHOTOS PAGE ── */

body {
  background-image: none;
  background-color: var(--bg);
}

/* ── PARALLAX SHINKANSEN WALLPAPER ── */
/* position: absolute inside .archive-page (overflow: hidden) → caged between header and status bar */
.shinkansen-bg {
  position: absolute;
  top: 0;           /* archive-page starts right below archive-header */
  right: 0;
  width: 58.65vw;      /* +15% from 51vw */
  max-width: 782px;
  height: auto;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
  transform: translateY(0);
}

/* active nav link */
.nav-active { color: var(--accent-bright) !important; }
.nav-active::before { opacity: 1 !important; }

/* ── LAYOUT ── */
.site-wrapper {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.archive-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  position: relative;   /* establishes containing block for absolute SVG */
  overflow: hidden;     /* clips SVG outside this area — cages train between header and status bar */
}

/* ── STICKY HEADER ── */
.archive-header {
  padding: 1.8rem 3.5rem 1.4rem;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
  background-color: var(--bg);
  z-index: 10;
  position: relative;
}

.archive-eyebrow {
  font-size: 0.58rem;
  letter-spacing: 0.28em;
  color: var(--accent);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.archive-title {
  font-family: 'Doto', monospace;
  font-size: clamp(1.6rem, 3.5vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

.archive-sub {
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  color: var(--accent);
  opacity: 0.65;
  margin-top: 0.3rem;
}

/* ── SCROLLABLE TIMELINE CONTAINER ── */
.timeline-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(123,94,167,0.2) transparent;
}

.timeline-scroll::-webkit-scrollbar { width: 3px; }
.timeline-scroll::-webkit-scrollbar-thumb { background: rgba(123,94,167,0.25); border-radius: 2px; }

/* ── TIMELINE WRAPPER ── */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 3rem 3.5rem 6rem 0;
  min-height: 100%;
}

/* ── VERTICAL LINE ── */
.timeline::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 4.5rem;
  width: 4px;
  background: rgba(168,127,212,0.45);
  z-index: 0;
  border-radius: 2px;
}

/* ── TRAVELING VERTICAL BEAM ── */
/*
  Pure white beam, 3px wide, travels the line from top to active dot.
  Absorbs into dot on arrival, dot flashes white, connector fires.
  5s cycle — beam / dot / connector locked to same duration.
  --beam-end (px) set by JS = dot centre from timeline top.
*/
.timeline::after {
  content: '';
  position: absolute;
  left: calc(4.5rem - 1px);   /* centred on 4px line */
  top: 0;
  width: 3px;
  height: 60px;
  background: linear-gradient(to bottom,
    transparent        0%,
    rgba(255,255,255,0.15) 20%,
    rgba(255,255,255,0.85) 70%,
    rgba(255,255,255,1.00) 100%
  );
  border-radius: 2px;
  z-index: 5;
  pointer-events: none;
  will-change: transform, opacity;
  animation: beamDescend 5s linear infinite;
  --beam-end: 300px;
  box-shadow: 0 0 6px 1px rgba(255,255,255,0.4);
}

@keyframes beamDescend {
  0%    { transform: translateY(0px);                           opacity: 0; height: 60px; }
  5%    { transform: translateY(0px);                           opacity: 1; height: 60px; }
  57%   { transform: translateY(calc(var(--beam-end) - 60px));  opacity: 1; height: 60px; }
  62%   { transform: translateY(var(--beam-end));                opacity: 0; height: 4px;  }
  62.1% { transform: translateY(0px);                           opacity: 0; height: 60px; }
  100%  { transform: translateY(0px);                           opacity: 0; height: 60px; }
}

/* beam no longer lives on the stop pseudo-element */
.timeline-stop.active::before { display: none; }

/* animation restart — briefly kill beam so it replays from 0 on stop change */
.timeline.beam-reset::after { animation: none; }

/* ── SINGLE STOP ── */
.timeline-stop {
  position: relative;
  width: calc(100% - 5rem);
  margin-left: 5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 5rem;
  z-index: 1;
}
.timeline-stop:last-child { margin-bottom: 0; }

/* ── DOT — station marker ── */
.stop-dot {
  position: absolute;
  left: calc(-0.5rem - 8px);
  top: 3.2rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(60,40,100,0.9);
  border: 2px solid rgba(168,127,212,0.5);
  z-index: 4;
  transition: none;
}

.timeline-stop.active .stop-dot {
  animation: stationArrival 5s linear infinite;
}

/*
  stationArrival — 5s, locked to beamDescend:
  62%: beam arrives → dot flashes white
  65%: settle to bright
  72%: connector fires, dot holds
  78%: dim back to rest
*/
@keyframes stationArrival {
  0%,61%  { background: rgba(60,40,100,0.9);   border-color: rgba(168,127,212,0.5); box-shadow: none;                                            transform: scale(1);   }
  62%     { background: #fff;                  border-color: #fff;                  box-shadow: 0 0 0 3px rgba(255,255,255,0.25), 0 0 12px #fff;  transform: scale(1.2); }
  66%     { background: rgba(220,200,255,0.9); border-color: #e0c8ff;               box-shadow: 0 0 8px rgba(255,255,255,0.3);                   transform: scale(1.1); }
  78%     { background: rgba(60,40,100,0.9);   border-color: rgba(168,127,212,0.5); box-shadow: none;                                            transform: scale(1);   }
  100%    { background: rgba(60,40,100,0.9);   border-color: rgba(168,127,212,0.5); box-shadow: none;                                            transform: scale(1);   }
}

.stop-dot::after { display: none; }

/* ── CONNECTOR — signal fires rightward dot → window ── */
.stop-connector {
  position: absolute;
  left: calc(-0.5rem + 8px);
  top: calc(3.2rem + 6px);
  height: 4px;
  width: var(--connector-w, 2rem);
  background: rgba(168,127,212,0.35);
  border-radius: 0 2px 2px 0;
  z-index: 3;
  overflow: hidden;
}

.timeline-stop.active .stop-connector {
  background: rgba(168,127,212,0.55);
}

.stop-connector::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -80px;
  width: 80px;
  background: linear-gradient(to right,
    transparent 0%,
    rgba(168,127,212,0.5) 25%,
    rgba(255,255,255,0.9) 55%,
    var(--accent-bright) 80%,
    transparent 100%
  );
  opacity: 0;
}

.timeline-stop.active .stop-connector::after {
  animation: connectorFire 5s linear infinite;
}

/*
  connectorFire — 5s, fires at 65% (dot is lit), sweeps right, fades by 78%
*/
@keyframes connectorFire {
  0%,64%  { left: -80px; opacity: 0; }
  65%     { left: -80px; opacity: 1; }
  76%     { left: 100%;  opacity: 0.85; }
  78%     { left: 100%;  opacity: 0; }
  100%    { left: 100%;  opacity: 0; }
}

/* ── VERTICAL TICK | at end of connector ── */
/* left matches connector left + connector width = calc(-0.5rem + 8px) + var(--connector-w) */
.stop-connector-tick {
  position: absolute;
  left: calc(-0.5rem + 8px + var(--connector-w, 2rem));
  top: calc(3.2rem + 6px - 8px);
  height: 20px;
  width: 4px;
  background: rgba(168,127,212,0.45);
  border-radius: 2px;
  z-index: 3;
}

.timeline-stop.active .stop-connector-tick {
  background: rgba(168,127,212,0.7);
}

/* ── STOP LABEL — aligned to window left edge ── */
.stop-label {
  width: 100%;
  margin-bottom: 0.6rem;
  padding-left: calc(var(--label-indent, 0px) * 1.045);
}

.stop-label-eyebrow {
  font-size: 0.94rem;    /* was 0.78rem, +20% */
  letter-spacing: 0.26em;
  color: var(--accent-bright);
  text-transform: uppercase;
  margin-bottom: 0.1rem;
  display: block;
}

.stop-label-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.53rem;    /* was 1.3rem, +18% */
  color: var(--text-primary);
  letter-spacing: 0.02em;
  line-height: 1.2;
  display: block;
}

.stop-label-quote {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.71rem;    /* was 0.6rem, +18% */
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-top: 0.3rem;
  display: block;
  line-height: 1.5;
}

.stop-label-quote::before {
  content: '>_ ';
  color: var(--accent);
}

/* ── remove old elements ── */
.stop-header  { display: none; }
.stop-title-block { padding-left: 0; }
.connector-line, .connector-tick { display: none; }


/* ── TRAIN WINDOW ── */
.train-window {
  width: 100%;
  max-width: 832px;   /* was 640px, +30% */
  cursor: pointer;
  outline: none;
  align-self: center;
}

.train-window:focus-visible .window-frame-outer { border-color: var(--accent-bright); }

.window-frame-outer {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 2px solid rgba(168,127,212,0.35);
  border-radius: 18px;
  background: rgba(8,8,8,0.85);
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s;
}

.train-window:hover .window-frame-outer { border-color: var(--accent-bright); }

.window-pane {
  position: absolute;
  inset: 10px;
  border-radius: 12px;
  border: 1px solid rgba(168,127,212,0.2);
  overflow: hidden;
  background: rgba(20,12,36,0.9);
}

.window-preview {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
}

.window-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  transition: opacity 0.3s;
}

.train-window:hover .window-preview-img { opacity: 0.9; }

.window-dot-grid {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(168,127,212,0.25) 1px, transparent 1px);
  background-size: 8px 8px;
  z-index: 1;
  pointer-events: none;
}

/* dot matrix overlay on top of photos too */
.window-preview::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(168,127,212,0.18) 1px, transparent 1px);
  background-size: 8px 8px;
  z-index: 2;
  pointer-events: none;
}

/* reflection shimmer */
.window-reflection {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      125deg,
      transparent 0%,
      transparent 30%,
      rgba(168,127,212,0.08) 42%,
      rgba(220,200,255,0.18) 50%,
      rgba(168,127,212,0.08) 58%,
      transparent 70%,
      transparent 100%
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 7px,
      rgba(168,127,212,0.04) 7px,
      rgba(168,127,212,0.04) 8px
    );
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.3s;
}

.train-window:hover .window-reflection {
  background:
    linear-gradient(
      125deg,
      transparent 0%,
      transparent 28%,
      rgba(168,127,212,0.12) 42%,
      rgba(220,200,255,0.28) 50%,
      rgba(168,127,212,0.12) 58%,
      transparent 72%,
      transparent 100%
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 7px,
      rgba(168,127,212,0.06) 7px,
      rgba(168,127,212,0.06) 8px
    );
}

/* VIEW // 01 label — top-left of window-frame-outer (NOT inside pane, avoids overflow:hidden clip) */
.window-label {
  position: absolute;
  top: 14px;
  left: 18px;
  z-index: 5;
  pointer-events: none;
}

.window-label-tag {
  font-family: 'Doto', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: rgba(168,127,212,0.55);
  transition: color 0.3s;
}

.train-window:hover .window-label-tag { color: var(--accent-bright); }

/* OPEN hint bottom-right — on window-frame-outer */
.window-enter {
  position: absolute;
  bottom: 14px;
  right: 18px;
  z-index: 5;
  font-size: 0.48rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(168,127,212,0);
  transition: color 0.3s;
  pointer-events: none;
}

.train-window:hover .window-enter { color: var(--accent-bright); }

/* ── TERMINAL END OF LINE ── */
.timeline-end {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  width: calc(100% - 5rem);
  margin-left: 5rem;
  padding-top: 1rem;
}

.timeline-end-dot {
  position: absolute;
  left: calc(-0.5rem - 8px);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(168,127,212,0.5);
  background: var(--bg);
  flex-shrink: 0;
}

.timeline-end-label {
  font-size: 0.52rem;
  letter-spacing: 0.22em;
  color: rgba(168,127,212,0.4);
  text-transform: uppercase;
}

/* ── ERROR STATE ── */
.archive-error {
  font-size: 0.7rem;
  color: rgba(192,57,43,0.7);
  letter-spacing: 0.12em;
  padding: 3rem;
  text-align: center;
  width: 100%;
}

/* ── BOTTOM DRAWER (75% width, 50vh, centered) ── */
.album-sidebar {
  position: fixed;
  bottom: 0;
  left: 12.5%;
  width: 75%;
  height: 50vh;
  background: rgba(8,8,8,0.97);
  border: 1px solid rgba(123,94,167,0.3);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.album-sidebar.open { transform: translateY(0); }

/* ── DRAWER HEADER ── */
.sidebar-header {
  padding: 0.75rem 1.4rem;
  border-bottom: 1px solid rgba(123,94,167,0.2);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.8rem;
  flex-shrink: 0;
}

.sidebar-tag {
  font-size: 0.5rem;
  letter-spacing: 0.24em;
  color: var(--accent);
  text-transform: uppercase;
  flex-shrink: 0;
}

.sidebar-title {
  font-family: 'Doto', monospace;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  font-weight: 700;
  flex: 1;
}

.sidebar-quote {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: 0.08em;
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-quote::before { content: '>_ '; color: var(--accent); }

.sidebar-close {
  font-family: 'Doto', monospace;
  background: none;
  border: 1px solid rgba(74,140,92,0.4);
  color: var(--green);
  font-size: 0.65rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  letter-spacing: 0;
}

.sidebar-close:hover { border-color: var(--green); background: rgba(74,140,92,0.1); }

/* ── HORIZONTAL PHOTO STRIP ── */
.sidebar-strip {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.8rem 1.2rem;
  display: flex;
  flex-direction: row;
  gap: 0.6rem;
  align-items: center;
  scrollbar-width: thin;
  scrollbar-color: rgba(123,94,167,0.3) transparent;
}

.sidebar-strip::-webkit-scrollbar { height: 3px; }
.sidebar-strip::-webkit-scrollbar-thumb { background: rgba(123,94,167,0.35); border-radius: 2px; }

.strip-item {
  flex-shrink: 0;
  height: calc(50vh - 100px);
  opacity: 0;
  animation: fadeUp 0.35s forwards;
  cursor: pointer;
}

.strip-item img {
  height: 100%;
  width: auto;
  display: block;
  border: 1px solid rgba(123,94,167,0.2);
  transition: border-color 0.2s, transform 0.2s;
}

.strip-item img:hover { border-color: var(--accent-bright); transform: scale(1.02); }

/* ── DRAWER FOOTER ── */
.sidebar-footer {
  padding: 0.35rem 1.4rem;
  border-top: 1px solid rgba(123,94,167,0.15);
  font-size: 0.5rem;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ── BACKDROP ── */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8,8,8,0.4);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}

.sidebar-backdrop.open { opacity: 1; pointer-events: all; }

/* ── LIGHTBOX ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(8,8,8,0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.lightbox.open { opacity: 1; pointer-events: all; }

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border: 1px solid rgba(123,94,167,0.2);
  display: block;
}

.lightbox-top {
  position: absolute;
  top: 1.6rem;
  left: 1.8rem;
  right: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lightbox-name {
  font-family: 'Doto', monospace;
  font-size: clamp(0.8rem, 2vw, 1.1rem);
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

.lightbox-close {
  font-family: 'Doto', monospace;
  background: none;
  border: 1px solid rgba(74,140,92,0.4);
  color: var(--green);
  font-size: 0.7rem;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.lightbox-close:hover { border-color: var(--green); background: rgba(74,140,92,0.1); }

.lightbox-arrows {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 1.2rem;
  pointer-events: none;
}

.lightbox-arrow {
  font-family: 'Doto', monospace;
  background: rgba(8,8,8,0.65);
  border: 1px solid rgba(74,140,92,0.4);
  color: var(--green);
  font-size: 1rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  letter-spacing: 0;
  pointer-events: all;
}

.lightbox-arrow:hover { border-color: var(--green); background: rgba(74,140,92,0.15); }

.lightbox-counter {
  position: absolute;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.52rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ── KEYFRAMES ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .archive-header { padding: 1.4rem 1.4rem 1rem; }

  .timeline { padding: 2rem 1rem 4rem 0; }

  .timeline::before { left: 2rem; width: 3px; }
  .timeline::after  { left: calc(2rem - 1px); width: 3px; }

  /* line at 2rem, stop margin-left at 3rem, gap = 1rem = 16px
     dot left = -(1rem + 8px) to centre on line */
  .timeline-stop {
    width: calc(100% - 3rem);
    margin-left: 3rem;
    margin-bottom: 3.5rem;
  }

  .timeline-end {
    width: calc(100% - 3rem);
    margin-left: 3rem;
  }

  /* mobile: line at 2rem, stop margin-left at 3rem → dot offset = -(1rem + 8px)
     dot top aligned to window vertical centre:
     label block ≈ 2.6rem tall + window half-height ≈ (100vw - 3rem)*9/32
     Using calc for precision; dot centre = top + 7px */
  /* beam is on .timeline::after — no stop-level override needed */

  .stop-dot {
    left: calc(-1rem - 8px);
    top: calc(2.6rem + (100vw - 3rem) * 9 / 32 - 7px);
    width: 14px;
    height: 14px;
  }

  /* connector top = dot centre - 2px (half connector height) */
  /* connector left = mobile dot right edge = calc(-1rem - 8px + 14px) = calc(-1rem + 6px) */
  .stop-connector {
    left: calc(-1rem + 6px);
    top: calc(2.6rem + (100vw - 3rem) * 9 / 32);
  }

  /* tick left = connector left + connector width */
  .stop-connector-tick {
    left: calc(-1rem + 6px + var(--connector-w, 2rem));
    top: calc(2.6rem + (100vw - 3rem) * 9 / 32 - 10px);
  }

  .timeline-end-dot {
    left: calc(-1rem - 8px);
    width: 14px;
    height: 14px;
  }

  .stop-label-name  { font-size: 1rem; }
  .stop-label-eyebrow { font-size: 0.52rem; }
  .stop-label-quote { font-size: 0.62rem; }

  .train-window { max-width: 100%; align-self: stretch; }

  /* mobile drawer: 65% height, smaller previews */
  .album-sidebar {
    left: 0;
    width: 100%;
    height: 65vh;
    border-radius: 10px 10px 0 0;
    border: none;
    border-top: 1px solid rgba(123,94,167,0.3);
  }

  .strip-item { height: calc(65vh - 130px); }

  .strip-item img {
    height: 100%;
    width: auto;
    max-width: 160px;
    object-fit: cover;
  }

  .sidebar-quote { display: none; }

  .lightbox-arrows { padding: 0 0.6rem; }
}
