/* =====================================================================
   The Lumenarium — the terrace that leads to the four libraries.

   Colours are taken off the paintings themselves (sampled from the
   left-hand sky of sideangle.png and the lamps in the station frames),
   so the page and the pictures agree.

   Layout follows the big app: a fixed 1280x900 stage, scaled to fit the
   window, so a line of writing breaks in exactly the same place on every
   screen. NO vw / vh units inside #stage — they would bring back the
   size-dependent reflow the owner dislikes. (vh outside the stage, and on
   the phone layout, is fine: there is no scaling there.)
   ===================================================================== */

:root {
  /* night, sampled top-to-bottom from the picture's own left-hand sky */
  --night-0:  #06061c;
  --night-1:  #0b0c29;
  --night-2:  #131337;
  --night-3:  #241f47;
  --night-4:  #3d2c54;
  --night-5:  #5c3a60;

  --lamp:     #6fe4dc;   /* the teal terrace lamps          */
  --lamp-dim: #2c6f78;
  --gold:     #f2d69a;   /* the warm light in the doorway   */
  --gold-deep:#c99a4e;
  --cloud:    #d59ab6;   /* the pink-violet cloud           */
  --ink:      #ecebf6;   /* writing                         */
  --ink-soft: rgba(236,235,246,.72);
  --ink-faint:rgba(236,235,246,.48);

  --hair:     rgba(242,214,154,.34);  /* thin gold hairline  */
  --hair-teal:rgba(111,228,220,.30);

  --glass:    rgba(12,14,38,.42);
  --glass-hi: rgba(12,14,38,.60);

  --turn: 620ms;         /* one station's worth of turning  */
  --ease: cubic-bezier(.42,.02,.24,1);
}

* { box-sizing: border-box; }

/* Several things on the welcome are shown or hidden by the `hidden`
   attribute, and a rule that gives one of them `display: flex` or
   `display: block` would otherwise quietly beat it. This is deliberate and
   goes first, so hidden always means hidden. */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--night-0);
  color: var(--ink);
  font-family: "EB Garamond", "Cormorant Garamond", Georgia, serif;
  overflow: hidden;                 /* nothing scrolls on desktop */
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- sky -- */

#sky {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(120% 80% at 8% 96%,
      rgba(214,120,110,.30) 0%, rgba(150,70,110,.16) 34%, transparent 66%),
    linear-gradient(to bottom,
      var(--night-0)  0%,
      var(--night-1) 22%,
      var(--night-2) 42%,
      var(--night-3) 62%,
      var(--night-4) 80%,
      var(--night-5) 94%,
      #12243f      100%);
}

#stars { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
#stars i {
  position: absolute;
  width: 2px; height: 2px; border-radius: 50%;
  background: #fff;
  animation: twinkle 7s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: .18; transform: translateY(0); }
  50%      { opacity: .85; transform: translateY(-2px); }
}

/* ------------------------------------------------------------- frames -- */

#frames { position: fixed; inset: 0; z-index: 2; overflow: hidden; }

.frame {
  position: absolute; inset: 0;
  opacity: 0;
  visibility: hidden;
  will-change: opacity, transform;
}
.frame.on { opacity: 1; visibility: visible; }

/* A turn: the leaving picture slides away and fades; the arriving one fades
   up from a small nudge in the same direction. They overlap in time but are
   never read as one continuous surface. */
.frame.turning { transition: opacity var(--turn) var(--ease),
                             transform var(--turn) var(--ease); }

.frame img {
  width: 100%; height: 100%;
  display: block;
  object-fit: cover;
  /* foyer.js sets --sy to 50% for a landscape picture (all nine are, since
     2026-08-21) and 60% for a portrait one, where the lower crop kept the
     clouds, horizon and terrace lamps in shot. */
  object-position: center var(--sy, 60%);
}

/* The landing picture: the owner's landscape original fills the window
   (foyer.js adds .wide) with the open sky on its left. The rules below are
   the portrait fallback — a tall picture is pinned to the right at full
   height and #sky paints the rest — so the "Welcome" sits in sky either way. */
.frame[data-frame="landing"] img {
  width: auto; height: 100%;
  margin-left: auto;
  object-fit: contain;
  object-position: right center;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 100%);
}
.frame[data-frame="landing"].wide img {
  width: 100%; object-fit: cover; object-position: center 50%;
  -webkit-mask-image: none; mask-image: none;
}

#scrim {
  position: fixed; inset: 0; z-index: 3; pointer-events: none;
  background:
    linear-gradient(to right, rgba(6,6,26,.62) 0%, rgba(6,6,26,.22) 34%, transparent 62%),
    linear-gradient(to bottom, rgba(6,6,26,.34) 0%, transparent 26%,
                               transparent 62%, rgba(6,6,26,.50) 100%);
}

/* -------------------------------------------------------------- stage -- */

#stage {
  position: fixed;
  left: 50%; top: 50%;
  width: 1280px; height: 900px;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: 50% 50%;
  z-index: 4;
}
#stage > section { position: absolute; inset: 0; }
#stage > section[hidden] { display: none; }

/* ------------------------------------------------------------- typing -- */

.eyebrow {
  margin: 0 0 14px;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 12px; font-weight: 500;
  letter-spacing: .30em;
  text-transform: uppercase;
  color: rgba(242,214,154,.66);
}

h1 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 300; font-style: italic;
  font-size: 74px; line-height: 1.02;
  letter-spacing: .012em;
  color: #f6f2ff;
  text-shadow: 0 2px 26px rgba(6,6,26,.85), 0 0 60px rgba(111,228,220,.14);
}

.rule {
  width: 208px; height: 1px; margin: 26px 0 22px;
  background: linear-gradient(to right, var(--gold), rgba(242,214,154,0));
}

.lede {
  margin: 0 0 40px;
  max-width: 430px;
  font-family: "Cormorant Infant", Georgia, serif;
  font-size: 21px; font-style: italic; font-weight: 300;
  line-height: 1.62;
  color: var(--ink-soft);
  text-shadow: 0 1px 14px rgba(6,6,26,.9);
}

/* ------------------------------------------------------ landing panel -- */

#landing .welcome {
  position: absolute;
  left: 96px; top: 92px;
  width: 470px;
}
.libs-label { margin-bottom: 16px; }

.libs { display: flex; flex-direction: column; gap: 10px; }

.lib {
  position: relative;
  display: block; width: 100%;
  padding: 13px 18px 13px 20px;
  text-align: left;
  border: 1px solid var(--hair-teal);
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(9px) saturate(1.1);
          backdrop-filter: blur(9px) saturate(1.1);
  color: var(--ink);
  cursor: pointer;
  transition: background 260ms ease, border-color 260ms ease, transform 260ms var(--ease);
}
.lib::before {
  content: "";
  position: absolute; left: 20px; top: 50%;
  width: 4px; height: 22px; margin-top: -11px;
  border-radius: 2px;
  background: var(--accent, var(--lamp));
  box-shadow: 0 0 12px var(--accent, var(--lamp));
}
.lib .n {
  display: block; margin-left: 18px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 25px; font-weight: 400; line-height: 1.15;
  color: var(--ink);
}
.lib .c {
  display: block; margin-left: 18px; margin-top: 2px;
  font-family: "Cormorant Infant", Georgia, serif;
  font-size: 15px; font-style: italic;
  color: var(--ink-faint);
}
.lib:hover, .lib:focus-visible {
  background: var(--glass-hi);
  border-color: rgba(242,214,154,.46);
  transform: translateX(4px);
  outline: none;
}
.lib:focus-visible { box-shadow: 0 0 0 2px rgba(111,228,220,.45); }

/* -------------------------------------------------------- the sign-in --
   Signed out, this card stands exactly where the four library names stand:
   same left edge, same width, the same glass and the same gold hairline, so
   the composition in the sky does not lurch when one becomes the other. */

.gate { display: block; margin: 0; }

.field {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 13px 20px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 19px;
  color: var(--ink);
  background: var(--glass);
  -webkit-backdrop-filter: blur(9px) saturate(1.1);
          backdrop-filter: blur(9px) saturate(1.1);
  border: 1px solid var(--hair-teal);
  border-radius: 999px;
  outline: none;
  transition: border-color 260ms ease, background 260ms ease;
}
.field::placeholder { color: var(--ink-faint); font-style: italic; }
.field:hover { border-color: rgba(242,214,154,.34); }
.field:focus { border-color: rgba(242,214,154,.62); background: var(--glass-hi); }

.gate-go { margin-top: 4px; }

.note, .gate-wait, .gate-msg {
  font-family: "Cormorant Infant", Georgia, serif;
  font-size: 15px; font-style: italic; line-height: 1.5;
  color: var(--ink-faint);
  text-shadow: 0 1px 12px rgba(6,6,26,.9);
}
.note      { margin: 15px 0 0; max-width: 400px; }
.gate-wait { margin: 2px 0 0; }
.gate-msg  { margin: 13px 0 0; max-width: 430px; color: rgba(242,214,154,.86); }

/* The line ABOVE the card — a dead invitation link — and the greeting inside
   the choose-a-password card. Both are .note underneath, so they inherit its
   typography and the phone block's 16px; these only set the spacing, and are
   written after .note so they win. */
.gate-notice {
  margin: 0 0 15px; max-width: 430px;
  color: rgba(242,214,154,.86);
}
.pw-greeting { margin: 0 0 14px; max-width: 430px; }

/* Quiet, and under the fields where it belongs — not competing with the
   Sign in button above it. */
.gate-forgot { margin: 12px 0 0; }

/* Signed in: the quiet line under the four names. */
.who {
  margin: 14px 0 0;
  font-family: "Cormorant Infant", Georgia, serif;
  font-size: 15px; font-style: italic;
  color: var(--ink-faint);
  text-shadow: 0 1px 12px rgba(6,6,26,.9);
}
.linkish {
  padding: 0;
  font: inherit;
  color: rgba(242,214,154,.86);
  background: none;
  border: 0;
  border-bottom: 1px solid rgba(242,214,154,.34);
  cursor: pointer;
}
.linkish:hover, .linkish:focus-visible {
  color: var(--gold); border-bottom-color: var(--gold); outline: none;
}

/* The layout-only switch, ?demo=signedin: hidden unless it is asked for,
   and unmistakable when it is. */
#demoFlag { display: none; }
body.demo #demoFlag {
  display: block;
  position: fixed; z-index: 9; left: 0; right: 0; top: 0;
  margin: 0; padding: 7px 0;
  text-align: center;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 11px; letter-spacing: .26em; text-transform: uppercase;
  color: #1a1206;
  background: rgba(242,214,154,.9);
}

.aside {
  margin: 30px 0 10px;
  font-family: "Cormorant Infant", Georgia, serif;
  font-size: 16px; font-style: italic;
  color: var(--ink-faint);
}

.ghost {
  padding: 7px 20px;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 12px; letter-spacing: .22em; text-transform: uppercase;
  color: rgba(242,214,154,.80);
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 999px;
  cursor: pointer;
  transition: background 240ms ease, color 240ms ease;
}
.ghost:hover, .ghost:focus-visible {
  background: rgba(242,214,154,.12); color: var(--gold); outline: none;
}

/* -------------------------------------------------------------- doors -- */

.corner {
  position: absolute; left: 46px; top: 40px;
  padding: 7px 18px;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 12px; letter-spacing: .20em; text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--glass);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid var(--hair-teal);
  border-radius: 999px;
  cursor: pointer;
  transition: color 240ms ease, border-color 240ms ease;
}
.corner:hover, .corner:focus-visible { color: var(--gold); border-color: var(--hair); outline: none; }

.door {
  position: absolute;
  left: 96px; top: 278px;
  width: 452px;
  padding: 34px 36px 34px;
  border: 1px solid var(--hair-teal);
  border-radius: 3px;
  background: var(--glass-hi);
  -webkit-backdrop-filter: blur(13px) saturate(1.08);
          backdrop-filter: blur(13px) saturate(1.08);
  box-shadow: 0 24px 70px rgba(4,4,18,.55),
              inset 0 1px 0 rgba(255,255,255,.06);
  transition: opacity 340ms ease;
}
/* A door whose library `side` is 'right' (see LIBRARIES in foyer.js) stands
   the same 96px in from the other edge, so the painting's own library —
   left of centre in the Athenaeum's frame — is not hidden behind the card.
   On a phone the card is in the flow (see the phone block below), so this
   changes nothing there. */
.door.right { left: auto; right: 96px; }

/* While the terrace is turning, the door gets out of the way. It also stops
   accepting clicks — otherwise you could press Enter halfway round and be
   shown into whichever library happened to be sliding past. */
body.turning .door { opacity: 0; pointer-events: none; }

.door::before {          /* a thin accent hairline along the top edge */
  content: "";
  position: absolute; left: 0; right: 0; top: -1px; height: 1px;
  background: linear-gradient(to right,
    var(--accent, var(--gold)) 0%, rgba(242,214,154,0) 78%);
}
.door.plain {            /* a station with no door: a caption only */
  border-color: transparent;
  background: transparent;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: none;
  padding-left: 0;
}
.door.plain::before { display: none; }

.door h2 {
  margin: 0 0 12px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 300; font-style: italic;
  font-size: 42px; line-height: 1.08;
  color: var(--doorInk, #f6f2ff);
  text-shadow: 0 2px 22px rgba(6,6,26,.8);
}
.door .caption {
  margin: 0 0 26px;
  font-family: "Cormorant Infant", Georgia, serif;
  font-size: 19px; font-style: italic; font-weight: 300;
  line-height: 1.6;
  color: var(--ink-soft);
}
/* With no panel behind it, the writing has to carry its own shade —
   station 0 is the lit front of the Lumenarium, and it is bright. */
.door.plain .caption,
.door.plain .eyebrow { text-shadow: 0 1px 3px rgba(4,4,18,.95), 0 2px 18px rgba(4,4,18,.9); }
.door.plain .caption { margin-bottom: 0; }

.enter {
  padding: 11px 40px;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 13px; letter-spacing: .26em; text-transform: uppercase;
  color: #1a1206;
  background: linear-gradient(to bottom, var(--gold), var(--gold-deep));
  border: 1px solid rgba(242,214,154,.75);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 26px rgba(242,214,154,.30);
  transition: box-shadow 300ms ease, transform 240ms var(--ease);
}
.enter:hover, .enter:focus-visible {
  box-shadow: 0 0 42px rgba(242,214,154,.55);
  transform: translateY(-1px);
  outline: none;
}
.enter[disabled] {
  cursor: default;
  color: var(--ink-faint);
  background: transparent;
  border-color: rgba(236,235,246,.22);
  box-shadow: none;
}
.enter[disabled]:hover { transform: none; box-shadow: none; }

.closed {
  margin: 12px 0 0;
  font-family: "Cormorant Infant", Georgia, serif;
  font-size: 15px; font-style: italic;
  color: var(--ink-faint);
}
.closed[hidden] { display: none; }

/* Signed out, this stands where Enter would have been: the way back to the
   welcome, where the sign-in card is. */
.door-back { margin-top: 4px; }

/* ------------------------------------------------------------ arrows -- */

.arrow {
  position: absolute; top: 50%;
  width: 54px; height: 54px; margin-top: -27px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 34px; line-height: 1;
  color: var(--ink-soft);
  background: var(--glass);
  -webkit-backdrop-filter: blur(9px); backdrop-filter: blur(9px);
  border: 1px solid var(--hair-teal);
  border-radius: 50%;
  cursor: pointer;
  transition: color 260ms ease, border-color 260ms ease, background 260ms ease;
}
.arrow.left  { left: 34px; }
.arrow.right { right: 34px; }
.arrow:hover, .arrow:focus-visible {
  color: var(--gold);
  border-color: rgba(242,214,154,.5);
  background: var(--glass-hi);
  outline: none;
}

/* -------------------------------------------------------------- dots -- */

.dots {
  position: absolute; left: 0; right: 0; bottom: 42px;
  display: flex; justify-content: center; gap: 13px;
}
.dots button {
  width: 8px; height: 8px; padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(236,235,246,.34);
  background: transparent;
  cursor: pointer;
  transition: background 300ms ease, border-color 300ms ease, box-shadow 300ms ease;
}
.dots button.door-here { border-color: rgba(242,214,154,.62); }
.dots button.here {
  background: var(--lamp);
  border-color: var(--lamp);
  box-shadow: 0 0 12px var(--lamp);
}
.dots button:focus-visible { outline: 2px solid rgba(111,228,220,.5); outline-offset: 3px; }

/* ============================== the phone ============================== */
/* Below 700px there is no stage and no scaling — just an unscaled column
   that scrolls, the way the big app does it. Sizes are set here with
   !important for the same reason the app does: they must beat the values
   the desktop rules put on the same elements. */

@media (max-width: 700px) {
  html, body { overflow: auto !important; height: auto !important; }
  body { min-height: 100%; }

  #sky   { position: fixed !important; }
  #stars { position: fixed !important; }

  #frames {
    position: relative !important;
    inset: auto !important;
    height: 56vh; min-height: 300px;
    z-index: 2;
  }
  .frame[data-frame="landing"] img {
    width: 100% !important; height: 100% !important;
    object-fit: cover !important;
    object-position: right center !important;
    -webkit-mask-image: none !important; mask-image: none !important;
  }
  #frames::after {                     /* fade the picture into the column */
    content: "";
    position: absolute; left: 0; right: 0; bottom: 0; height: 110px;
    background: linear-gradient(to bottom, transparent, var(--night-1));
    pointer-events: none;
  }

  #scrim { display: none !important; }

  /* relative, not static: the picture above is a positioned layer, and a
     static stage would be painted underneath it. */
  #stage {
    position: relative !important;
    left: auto !important; top: auto !important;   /* the desktop rule's
       left:50% would otherwise shove the whole column half a screen right */
    transform: none !important;
    width: auto !important; height: auto !important;
    z-index: 4;
    padding: 10px 20px calc(38px + env(safe-area-inset-bottom));
  }
  #stage > section { position: static !important; inset: auto !important; }

  #landing .welcome {
    position: static !important;
    width: auto !important;
    margin-top: 8px;
  }
  h1 { font-size: 44px !important; }
  .lede { font-size: 18px !important; max-width: none !important; margin-bottom: 30px !important; }
  .rule { margin: 18px 0 16px !important; }

  .lib { padding: 12px 16px 12px 18px !important; }
  .lib .n { font-size: 22px !important; }

  /* 17px keeps iOS from zooming the page when a field is tapped, and the
     field is a comfortable thumb's height either way. */
  .field { font-size: 17px !important; padding: 14px 18px !important; }
  .note, .who, .gate-msg, .gate-wait { font-size: 16px !important; max-width: none !important; }
  .door-back { width: 100%; margin-top: 12px; }

  .corner {
    position: static !important;
    display: inline-block;
    margin: 16px 0 22px;
  }
  .door {
    position: static !important;
    width: auto !important;
    margin: 0 0 26px;
    padding: 24px 22px !important;
  }
  .door.plain { padding: 0 !important; }
  .door h2 { font-size: 34px !important; }
  .door .caption { font-size: 17px !important; }
  .enter { width: 100%; padding: 14px 0 !important; }

  .arrow {
    position: static !important;
    margin: 0 !important;
    width: 50px !important; height: 50px !important;
  }
  .phone-turn {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; margin: 4px 0 22px;
  }
  .dots { position: static !important; margin: 0; }
}

/* Where a phone is holding the picture, the turn is a swipe. */
@media (min-width: 701px) { .phone-turn { display: contents; } }

/* ===================== people who ask for less motion ================== */

@media (prefers-reduced-motion: reduce) {
  .frame.turning { transition: opacity 200ms linear !important; }
  .frame { transform: none !important; }
  #stars i { animation: none !important; opacity: .5 !important; }
  .lib, .enter, .arrow, .corner, .ghost { transition: none !important; }
  .lib:hover { transform: none !important; }
  .enter:hover { transform: none !important; }
}
