/* — sometemple · house style — */
/* one stylesheet for every room. each room may override anything. */

:root{
  color-scheme: dark;

  /* palette: ink · bone · candlelight · oxide · moon · pine · sky · ash */
  --ink:     #0a0a0a;
  --char:    #141414;
  --soot:    #1a1a1a;
  --dust:    #2a2a2a;
  --ash:     #5a5a5a;
  --bone:    #e9e4d6;
  --linen:   #f4f1e8;
  --candle:  #c8b07a;
  --amber:   #e2b75c;
  --oxide:   #8a3a2a;
  --rust:    #6a2a1a;
  --moon:    #a8c0c8;
  --pine:    #6a8a5a;
  --sky:     #6a8aa8;
  --slate:   #4a5a6a;
  --plum:    #4a3a5a;

  /* type */
  --serif:   "Iowan Old Style", "Cormorant Garamond", "Times New Roman", Times, serif;
  --mono:    ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* scale */
  --xs: 4px;  --s: 8px;  --m: 16px;  --l: 32px;  --xl: 64px;  --xxl: 120px;
}

html, body{ margin: 0; }
html{ scroll-behavior: smooth; }
body{
  background: var(--ink);
  color: #c0bcb0;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a{ color: inherit; text-decoration: none; }
a.q{ border-bottom: 1px dotted var(--dust); padding: 2px 4px; }
a.q:hover{ color: var(--linen); border-color: var(--linen); }

::selection{ background: var(--candle); color: var(--ink); }

/* corner navigation, shared across rooms */
.crumb{
  position: fixed; top: 14px; left: 18px; z-index: 50;
  font-family: var(--mono); font-size: 10px;
  color: var(--dust); letter-spacing: .3em; text-transform: lowercase;
  user-select: none;
}
.crumb a{ color: var(--ash); }
.crumb a:hover{ color: var(--candle); }

.ret{
  position: fixed; bottom: 14px; right: 18px; z-index: 50;
  font-family: var(--mono); font-size: 10px;
  color: var(--dust); letter-spacing: .2em;
}
.ret a{ color: #8a8a8a; border-bottom: 1px dotted var(--dust); padding: 2px 4px; margin: 0 4px;}
.ret a:hover{ color: var(--linen); border-color: var(--linen); }

/* small persistent index in the top-right; rooms can omit */
.atlas-link{
  position: fixed; top: 14px; right: 18px; z-index: 50;
  font-family: var(--mono); font-size: 10px; letter-spacing: .3em;
  color: var(--ash);
}
.atlas-link a{ color: var(--ash); border-bottom: 1px dotted var(--dust); padding: 2px 4px;}
.atlas-link a:hover{ color: var(--candle); border-color: var(--candle); }

/* the bottom-left persistent breadcrumb of visited rooms */
.trail{
  position: fixed; bottom: 14px; left: 18px; z-index: 50;
  font-family: var(--mono); font-size: 10px; letter-spacing: .15em;
  color: var(--ash); max-width: 60vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: .7;
}
.trail .sep{ color: var(--dust); margin: 0 6px; }

/* common room scaffold */
.room{
  max-width: 720px; margin: 0 auto; padding: 80px 32px 120px;
}
.room.wide{ max-width: 1100px; }
.room.narrow{ max-width: 540px; }

h1.title{
  font-weight: 400; font-size: clamp(48px, 9vw, 96px);
  font-style: italic; letter-spacing: -.04em; line-height: .92;
  margin: 0 0 16px;
}
.title.sm{ font-size: clamp(28px, 5vw, 56px); }

.subtitle{
  color: var(--ash); font-size: 11px; letter-spacing: .35em;
  text-transform: uppercase; margin-bottom: 48px; font-family: var(--mono);
}

.lede{
  font-size: 18px; line-height: 1.8;
}

p.q a, .lines a{ border-bottom: 1px dotted var(--dust); padding: 2px 4px; }
p.q a:hover, .lines a:hover{ color: var(--linen); border-color: var(--linen); }

.rule{
  border: 0; border-top: 1px solid var(--soot);
  margin: var(--l) 0;
}

.glyph{
  display: inline-block; font-size: 14px; color: var(--ash);
  letter-spacing: .3em;
}

/* a row of small text links at the bottom of a room */
.exits{
  margin-top: var(--xl); text-align: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: .3em;
  text-transform: uppercase; color: var(--ash);
}
.exits a{ color: var(--bone); border-bottom: 1px dotted var(--dust); padding: 2px 6px; margin: 0 4px;}
.exits a:hover{ color: var(--linen); border-color: var(--linen); }

/* subtle grain that any room can opt into via class="grain" on body */
body.grain::after{
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 4px 4px;
  mix-blend-mode: screen; opacity: .55;
}
body.vignette::before{
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, transparent 30%, rgba(0,0,0,.7) 100%);
}

/* tonal variants — rooms set on <body class="…"> */
body.bone{ background: var(--linen); color: #1a1a1a; }
body.bone a.q{ border-color: #d4cfbf; } body.bone a.q:hover{ color:#000; border-color:#000; }
body.bone ::selection{ background:#1a1a1a; color: var(--linen); }
body.bone .crumb, body.bone .ret, body.bone .atlas-link, body.bone .trail{ color: #b5b0a0; }
body.bone .crumb a, body.bone .ret a, body.bone .atlas-link a{ color:#5a5a4a; border-color:#cfc9b8;}
body.bone .subtitle{ color: #8a8472; }

body.dusk{ background: #15101a; color: #c4b8c8; }
body.dawn{ background: #f2ead0; color:#2a2520; }
body.sea{  background: #050810; color: #a0b8d0; }
body.forest{ background: #060a08; color:#a8c0a8; }

/* faint sticky bar to surface the atlas + return everywhere — opt-in */
.dock{
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 60;
  display: flex; gap: 18px; align-items: center;
  padding: 7px 14px; border: 1px solid var(--soot);
  background: rgba(10,10,10,.7);
  backdrop-filter: blur(6px);
  font-family: var(--mono); font-size: 10px; letter-spacing: .25em; color: var(--ash);
}
.dock a{ color: #b8b8a8; border-bottom: 1px dotted transparent; padding: 2px 0; }
.dock a:hover{ color: var(--candle); border-color: var(--candle); }
body.bone .dock{ background: rgba(244,241,232,.7); border-color:#d4cfbf; }
body.bone .dock a{ color:#3a3a30; }

/* a small floating room-count meter — opt in by putting <div class="visited" id="visited"></div> -->
.visited{
  position: fixed; right: 18px; bottom: 38px; z-index: 50;
  font-family: var(--mono); font-size: 9px; letter-spacing: .3em;
  color: var(--ash); text-align: right; opacity: .8;
}
.visited b{ color: var(--candle); font-weight: 400; }

/* misc tone */
em{ font-style: italic; }
small{ font-size: 11px; letter-spacing: .15em; color: var(--ash); }

/* card-like panels rooms can use */
.card{
  border: 1px solid var(--soot);
  background: linear-gradient(180deg, #0c0c0c, #060606);
  padding: var(--l);
}
.card.warm{
  background: linear-gradient(180deg, #1a1408, #0a0806);
  border-color: #2a1f10;
}

/* breathing utility */
.breathe { animation: breathe 6s ease-in-out infinite; }
@keyframes breathe { 0%,100%{ opacity:.85; transform: scale(.98) } 50%{ opacity:1; transform: scale(1.02) } }

/* === mobile · everything below this line tightens the labyrinth for small screens === */
@media (max-width: 720px){
  .crumb{ top: 8px; left: 10px; font-size: 9px; letter-spacing: .22em; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
  .ret{ bottom: 8px; right: 10px; font-size: 9px; letter-spacing: .15em; padding: 2px 4px;
        background: rgba(10,10,10,.85); border-radius: 2px;}
  body.bone .ret{ background: rgba(244,241,232,.85);}
  .ret a{ margin: 0 3px; padding: 2px 3px;}
  .atlas-link{ top: 8px; right: 10px; font-size: 9px; letter-spacing: .22em;}
  .trail{ max-width: 50vw; font-size: 8.5px; left: 10px; bottom: 30px; opacity: .55;}
  .room{ padding: 56px 18px 80px;}
  .room.wide{ padding-left: 14px; padding-right: 14px;}
  h1.title{ font-size: clamp(40px, 14vw, 80px);}
  .subtitle{ font-size: 10px; letter-spacing: .25em; margin-bottom: 32px;}
  .lede{ font-size: 16px; line-height: 1.7;}
  .exits{ font-size: 10px; letter-spacing: .2em;}
  .exits a{ margin: 0 2px; padding: 2px 4px;}
  .dock{ font-size: 9px; gap: 12px; padding: 6px 12px; max-width: calc(100vw - 24px); overflow-x: auto;}
  .visited{ right: 10px; bottom: 30px; font-size: 8.5px;}
  .card{ padding: 22px;}
  /* protect against horizontal overflow from any room */
  body{ overflow-x: hidden;}
  /* tap targets — minimum comfortable size for finger taps */
  a{ -webkit-tap-highlight-color: rgba(200,176,122,.15);}
  /* wrap any white-space-nowrap subtitles */
  .sub{ white-space: normal !important; padding: 0 8px;}
  /* fixed-column grids should collapse on mobile (auto-fit grids already do) */
  [style*="grid-template-columns: 1fr 1fr 1fr"], [style*="grid-template-columns: 1fr 1fr"]{
    grid-template-columns: 1fr !important;
  }
}
@media (max-width: 380px){
  .trail{ display: none;}
  .crumb{ font-size: 8.5px;}
  h1.title{ font-size: clamp(36px, 13vw, 64px);}
}

/* === polish utilities (added v2) — opt-in via class on the element === */
/* gentle fade-and-rise on page load; respects reduced-motion */
@keyframes st-reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.reveal { animation: st-reveal .9s cubic-bezier(.2,.7,.2,1) both; }
.reveal.d1 { animation-delay: .12s; } .reveal.d2 { animation-delay: .24s; }
.reveal.d3 { animation-delay: .36s; } .reveal.d4 { animation-delay: .48s; }
.reveal.d5 { animation-delay: .60s; } .reveal.d6 { animation-delay: .72s; }

/* slow ambient drift for decorative motes / particles */
@keyframes st-drift { 0%{ transform:translate3d(0,0,0);} 50%{ transform:translate3d(2px,-3px,0);} 100%{ transform:translate3d(0,0,0);} }
.drift { animation: st-drift 11s ease-in-out infinite; }

/* subtle pulsing glow for "alive" objects (lamps, bulbs, embers) */
@keyframes st-ember { 0%,100% { filter: drop-shadow(0 0 6px rgba(255,200,120,.18)); }
                       50%    { filter: drop-shadow(0 0 14px rgba(255,200,120,.32)); } }
.ember { animation: st-ember 5s ease-in-out infinite; }

/* hover-able link with a soft underline that draws in */
.q-link { position: relative; color: inherit; text-decoration: none; padding-bottom: 1px; }
.q-link::after { content:""; position:absolute; left:0; right:0; bottom:0; height:1px;
                 background: currentColor; opacity:.25;
                 transform: scaleX(.4); transform-origin: left;
                 transition: transform .35s ease, opacity .35s ease; }
.q-link:hover::after { transform: scaleX(1); opacity:.7; }

/* visible focus ring for accessibility */
a:focus-visible, button:focus-visible {
  outline: 1px solid var(--candle); outline-offset: 3px; border-radius: 1px;
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .reveal, .drift, .ember, .breathe { animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}
