/* Module 8 — The Ocean Through Time.
 * The descent's grammar, rotated onto time. Same hush, same serif, same
 * generous emptiness. The background moves through eras the way the water
 * moves through depth.
 */

body.history{ background: #05070c; overflow-x: hidden; }
body.history .masthead{ display: none; }
/* The timeline is full-bleed and hides its own chrome; the live
   rail is chrome. It belongs on reading pages, not inside an
   immersive one. */
body.history #live-rail{ display: none !important; }
body.history main{ padding: 0; }
body.history .foot{ display: none; }

#era-wash{
  position: fixed; inset: 0; z-index: 0;
  background: #0a0a10;
  transition: background-color 1.6s ease;
  will-change: background-color;
}
#grain{
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .5;
  background: radial-gradient(ellipse at 50% 40%, rgba(0,0,0,0) 32%, rgba(0,0,0,.6) 80%);
}
#drift{ position: fixed; inset: 0; z-index: 2; pointer-events: none; }

/* --------------------------------------------------------- the year meter */

.ymeter{
  position: fixed; top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  z-index: 40; pointer-events: none; line-height: 1;
}
.ymeter .y{
  font-family: var(--sans); font-weight: 200;
  font-size: clamp(1.9rem, 6vw, 3rem); letter-spacing: -.02em;
  color: rgba(var(--ink), .95); font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 26px rgba(0,0,0,.7);
}
.ymeter .y .bce{ font-size: .34em; letter-spacing: .18em; opacity: .6; margin-left: .4em; }
.ymeter .era{
  margin-top: .62em; font-size: clamp(.62rem, 2.4vw, .72rem);
  letter-spacing: .34em; text-transform: uppercase;
  color: rgba(var(--ink), .72); text-shadow: 0 1px 14px rgba(0,0,0,.7);
}
.ymeter .reach{
  margin-top: .8em; font-size: clamp(.58rem, 2vw, .64rem);
  letter-spacing: .12em; line-height: 1.7; color: rgba(var(--ink), .45);
  font-variant-numeric: tabular-nums; text-shadow: 0 1px 14px rgba(0,0,0,.7);
  max-width: 17em;
}
.ymeter .reach b{ font-weight: 400; color: rgba(var(--ink), .62); }

/* the century rail, mirroring the depth gauge */
.rail{
  position: fixed; right: max(16px, env(safe-area-inset-right));
  top: 22vh; bottom: 22vh; width: 1px; z-index: 40;
  background: rgba(var(--ink), .16); pointer-events: none;
}
.rail .tick{ position: absolute; right: 0; width: 9px; height: 1px;
  background: rgba(var(--ink), .3); }
.rail .tick span{ position: absolute; right: 15px; top: -.55em; font-size: 8.5px;
  letter-spacing: .18em; white-space: nowrap; color: rgba(var(--ink), .34); }
.rail .bead{
  position: absolute; right: -3px; width: 7px; height: 7px; margin-top: -3.5px;
  border-radius: 50%; background: rgba(var(--ink), .92);
  box-shadow: 0 0 12px rgba(220,230,255,.7);
}

/* ------------------------------------------------------------ the track -- */

#tl{ position: relative; z-index: 10; width: 100%; }

.tnode{ position: absolute; left: 0; width: 100%; transform: translateY(-50%); }
.tnode .inner{
  max-width: min(680px, 86vw); margin: 0 auto; opacity: 0;
}
@media (min-width: 940px){
  .tnode.left  .inner{ margin-left: calc(50% - 400px); margin-right: auto; }
  .tnode.right .inner{ margin-right: calc(50% - 400px); margin-left: auto; }
}

.tdate{
  display: block; font-family: var(--sans); font-weight: 300; font-size: 10px;
  letter-spacing: .38em; text-transform: uppercase;
  color: rgba(var(--ink), .45); margin-bottom: 1.3em;
}
.ttitle{
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(1.5rem, 4.4vw, 2.2rem); line-height: 1.28;
  letter-spacing: .01em; margin: 0 0 .55em; color: rgba(var(--ink), .96);
  text-shadow: 0 2px 30px rgba(0,0,0,.55);
}
.tbody{
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(1.02rem, 2.7vw, 1.22rem); line-height: 1.72;
  color: rgba(var(--ink), .74); margin: 0;
}
.tmeta{ display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 1.5em; }
.tbadge{
  font-size: 8.5px; letter-spacing: .26em; text-transform: uppercase;
  color: rgba(var(--ink), .5); border: 1px solid rgba(var(--ink), .2);
  padding: 5px 9px 4px; border-radius: 2px;
}
.tbadge.t-disaster{ border-color: rgba(255,170,120,.4); color: rgba(255,200,160,.75); }
.tbadge.t-culture{ border-color: rgba(200,170,255,.4); color: rgba(215,195,255,.75); }
.tbadge.t-science{ border-color: rgba(150,220,255,.4); color: rgba(180,230,255,.8); }
.tbadge.t-conservation{ border-color: rgba(150,240,190,.4); color: rgba(180,245,210,.8); }
.tbadge.t-mystery{ border-color: rgba(190,190,210,.35); color: rgba(210,210,230,.7); }
.tbadge.t-industry{ border-color: rgba(230,205,150,.4); color: rgba(240,220,175,.78); }

.tlink{
  font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase;
  color: rgba(var(--ink), .8); border-bottom: 1px solid rgba(var(--ink), .3);
}
.tcross{
  color: rgba(150,225,255,.9) !important;
  border-bottom-color: rgba(150,225,255,.45) !important;
}
.tcontested{
  margin-top: 1.3em; border-left: 2px solid rgba(255,196,120,.45);
  padding: 8px 0 8px 13px; font-size: .84rem; line-height: 1.6;
  color: rgba(255,214,160,.7); font-family: var(--sans);
}
.tcontested b{ font-weight: 400; letter-spacing: .2em; text-transform: uppercase; font-size: 9px; }
.tsources{ margin-top: 1.2em; font-size: .78rem; color: rgba(var(--ink), .32); }
.tsources a{ color: rgba(var(--ink), .5); border-bottom: 1px solid rgba(var(--ink), .16); }
.ttodo{
  margin-top: 1em; font-size: .78rem; color: rgba(255,214,160,.5);
  font-family: var(--sans);
}

/* -------------------------------------------------------- era announcement */

.tera .inner{ text-align: center; max-width: min(820px, 90vw); }
.tera-name{
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2rem, 8vw, 4.4rem); letter-spacing: .16em;
  text-transform: uppercase; line-height: 1.06; margin: 0;
  color: rgba(var(--ink), .95);
  text-shadow: 0 0 60px rgba(140,170,220,.22), 0 2px 40px rgba(0,0,0,.6);
}
.tera-span{
  margin-top: 1.9em; font-size: 10px; letter-spacing: .42em;
  text-transform: uppercase; color: rgba(var(--ink), .45);
}
.tera-sub{
  margin-top: 1.7em; font-family: var(--serif); font-style: italic;
  font-size: clamp(1rem, 3vw, 1.3rem); color: rgba(var(--ink), .6);
}
.tera-rule{ width: 74px; height: 1px; background: rgba(var(--ink), .35); margin: 2.4em auto 0; }

/* ------------------------------------------------------------- filters --- */

.tfilters{
  position: fixed; bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%); z-index: 45;
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  background: rgba(5,8,14,.82); border: 1px solid rgba(var(--ink), .12);
  border-radius: 2px; padding: 9px 12px; max-width: min(94vw, 780px);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .7s ease; pointer-events: none;
}
.tfilters.on{ opacity: 1; pointer-events: auto; }
.tfilters button{
  appearance: none; cursor: pointer; background: none;
  border: 1px solid rgba(var(--ink), .18); border-radius: 2px;
  color: rgba(var(--ink), .55); font-family: var(--sans); font-weight: 300;
  font-size: 8.5px; letter-spacing: .2em; text-transform: uppercase;
  padding: 6px 10px 5px;
}
.tfilters button.on{ border-color: rgba(var(--ink), .7); color: rgba(var(--ink), 1); }
.tfilters button:hover{ color: rgba(var(--ink), .95); }
.tnode.hidden{ display: none; }

/* --------------------------------------------------------------- closing - */

/* The closing is a tall block, so it hangs from its top rather than
   being centred on a point like the event cards. */
.tnode.tclose{ transform: none; }
.tclose .inner{ text-align: center; max-width: min(760px, 90vw); }
.tclose-line{
  font-family: var(--serif); font-weight: 300; font-style: italic;
  font-size: clamp(1.4rem, 5vw, 2.5rem); line-height: 1.48;
  color: rgba(var(--ink), .92); margin: 0;
  text-shadow: 0 0 60px rgba(90,160,210,.2);
}
.tclose-num{
  margin-top: 2.2em; font-family: var(--sans); font-weight: 200;
  font-size: clamp(2.6rem, 11vw, 4.6rem); letter-spacing: -.02em;
  color: rgba(var(--ink), .96); font-variant-numeric: tabular-nums; line-height: 1;
}
.tclose-cap{
  margin-top: 1.5em; font-size: 9.5px; letter-spacing: .3em;
  text-transform: uppercase; color: rgba(var(--ink), .42); line-height: 2.2;
}
.tdoors{ display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 3.4em; }
.tdoor{
  display: block; min-width: 210px; padding: 22px 24px; border-radius: 2px;
  border: 1px solid rgba(var(--ink), .22); text-align: left;
}
.tdoor:hover{ border-color: rgba(var(--ink), .6); }
.tdoor b{
  display: block; font-family: var(--serif); font-weight: 400;
  font-size: 1.3rem; letter-spacing: .04em; color: rgba(var(--ink), .96);
}
.tdoor span{
  display: block; margin-top: .5em; font-size: .8rem; line-height: 1.5;
  color: rgba(var(--ink), .45);
}

.tpush{ margin-top: 4em; text-align: left; }
.tpush h3{ margin-bottom: 1em; }

.thint{
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  z-index: 44; font-size: 9.5px; letter-spacing: .42em; text-transform: uppercase;
  color: rgba(var(--ink), .6); pointer-events: none;
  transition: opacity .7s ease; text-align: center;
}
.thint .arrow{
  display: block; margin: 12px auto 0; width: 1px; height: 30px;
  background: linear-gradient(to bottom, rgba(232,243,250,.7), rgba(232,243,250,0));
  animation: tfall 2.8s ease-in-out infinite;
}
@keyframes tfall{
  0%{ transform: scaleY(.2); transform-origin: top; opacity: 0 }
  35%{ transform: scaleY(1); transform-origin: top; opacity: 1 }
  70%{ transform: scaleY(1); transform-origin: bottom; opacity: 1 }
  100%{ transform: scaleY(.2); transform-origin: bottom; opacity: 0 }
}
@media (prefers-reduced-motion: reduce){ .thint .arrow{ animation: none } }

.tback{
  position: fixed; right: max(16px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom)); z-index: 45;
}

/* ------------------------------------------------------- event photographs */

.tfig{ margin: 1.8em 0 0; }
.tfig img{
  display: block;
  border: 1px solid rgba(232,243,250,.12);
  margin: 0 auto;

  /* WIDTH MUST BE DEFINITE, OR THE width/height ATTRIBUTES RESERVE NOTHING.
     The first version of this capped tall images with `max-height: 78vh;
     width: auto`, which looked right and quietly undid the fix it shipped
     beside. HTML width/height are PRESENTATIONAL HINTS: an author `width:
     auto` beats them. With both axes auto and no image data yet, the content
     box resolves to 0x0, so a lazy image still reserved two pixels, respace()
     still measured a text-only card, and the card still grew 400-700px on
     decode. An audit proved it by forcing width on an image with
     naturalWidth === 0:

         width: auto   ->   2 x 2
         width: 100%   ->   680 x 702      (correct final box, no pixels yet)

     So the width stays definite and the HEIGHT cap is expressed as a
     max-width instead, computed per image from its own aspect ratio in the
     template. Same visual result, and the browser can still reserve the box
     from the attributes before a single byte of image arrives. */
  width: 100%;
  height: auto;
}
