/* BRANSSERIE — no borders, no cards, no frame inside a frame.
   Type sits directly on the paper that the shader is generating.          */

:root{
  --ink:        #2b2118;
  --ink-soft:   rgba(43,33,24,.72);
  --ink-faint:  rgba(43,33,24,.46);
  --rule:       rgba(43,33,24,.22);
  --display:    'Marcellus', 'Iowan Old Style', Georgia, serif;
  --text:       'Inter', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

*{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

html,body{
  margin:0; padding:0;
  background:#e6dcc4;
  color:var(--ink);
  font-family:var(--text);
  -webkit-font-smoothing:antialiased;
  overscroll-behavior-y:none;
}

/* the whole page is the canvas; nothing else has a background */
#paper{
  position:fixed; inset:0;
  width:100%; height:100%;
  display:block; z-index:0;
}
/* scroll length only — never visible */
#scroll{ position:relative; z-index:1; pointer-events:none; }

/* read by machines and screen readers, not shown */
.sr{
  position:absolute; width:1px; height:1px;
  margin:-1px; padding:0; border:0;
  overflow:hidden; clip-path:inset(50%); white-space:nowrap;
}

/* ------------------------------- the way in --------------------------- */
/* The name is set in the title face, at the same tracking as the wordmark,
   so that when it lands it lands exactly on it.                           */
#intro{
  position:fixed; inset:0; z-index:6;
  pointer-events:none;
  font-family:var(--display);
  font-size:clamp(26px,8.2vw,118px);
  letter-spacing:.34em;
  text-transform:uppercase;
  color:var(--ink);
  line-height:1;
  opacity:1;
  transition:opacity .5s ease;
}
#intro.gone{ opacity:0; }
#iWord{ position:absolute; left:0; top:0; transform-origin:left top; }
#intro .ipiece{
  position:absolute; left:0; top:0;
  white-space:pre;
  will-change:transform,opacity;
}
#intro .ipiece span{
  display:inline-block;
  clip-path:inset(0 100% 0 0);
  opacity:0;
  transition:clip-path .42s cubic-bezier(.4,0,.2,1), opacity .2s ease;
}
#intro.writing .ipiece span{
  clip-path:inset(0 0 0 0);
  opacity:1;
}

/* the page holds still while the name is being written */
.top,.index,.plates,.cue{ transition:opacity .8s ease .05s; }
body.intro .top,
body.intro .index,
body.intro .plates,
body.intro .cue{ opacity:0; pointer-events:none; }

/* ------------------------------- chrome ------------------------------- */

.top{
  position:fixed; z-index:5;
  top:clamp(18px,3vh,34px); left:clamp(18px,4vw,52px);
  right:clamp(18px,4vw,52px);
  display:flex; align-items:baseline; justify-content:space-between;
  gap:16px; pointer-events:none;
}
.mark{
  margin:0;                      /* it is the page's h1 */
  font-weight:400;               /* Marcellus has one weight; never synthesise */
  font-family:var(--display);
  font-size:clamp(15px,1.35vw,20px);
  letter-spacing:.34em;
  text-transform:uppercase;
  line-height:1;
  color:var(--ink);
}
.mark small{
  display:block;
  font-family:var(--text);
  font-size:clamp(8.5px,.62vw,10px);
  letter-spacing:.26em;
  font-weight:400;
  color:var(--ink-faint);
  margin-top:.62em;
  text-transform:uppercase;
}
.lang{
  pointer-events:auto;
  display:flex; align-items:center; gap:.5em;
  font-family:var(--text);
  font-size:clamp(9.5px,.68vw,11px);
  letter-spacing:.2em;
  text-transform:uppercase;
  color:var(--ink-faint);
}
.lang button{
  appearance:none; border:0; background:none; padding:2px 0; margin:0;
  font:inherit; letter-spacing:inherit; color:var(--ink-faint);
  cursor:pointer; transition:color .35s ease;
}
.lang button[aria-pressed="true"]{
  color:var(--ink);
  box-shadow:0 1px 0 0 var(--rule);
}
.lang span{ opacity:.5; }

/* chapter index — hairline ticks, no box */
.index{
  position:fixed; z-index:5;
  right:clamp(16px,3.2vw,42px); top:50%;
  transform:translateY(-50%);
  display:flex; flex-direction:column; gap:14px;
  align-items:flex-end;
}
.index button{
  appearance:none; border:0; background:none; padding:0; margin:0;
  cursor:pointer; display:flex; align-items:center; gap:8px;
  font-family:var(--text); font-size:9px; letter-spacing:.18em;
  color:transparent; transition:color .4s ease;
}
.index i{
  display:block; width:20px; height:1px;
  background:var(--rule);
  transition:width .5s cubic-bezier(.2,.8,.2,1), background .5s ease;
}
.index button[aria-current="true"] i{ width:40px; background:var(--ink); }
.index button[aria-current="true"]{ color:var(--ink-soft); }

/* --------------------------------- text -------------------------------- */

.plates{ position:fixed; inset:0; z-index:3; pointer-events:none; }

.chapter{
  position:absolute;
  left:clamp(18px,6vw,86px);
  top:50%;
  width:min(29rem,37vw);
  transform:translateY(-50%);
  opacity:0;
  will-change:opacity,transform;
}
.chapter .num{
  font-family:var(--text);
  font-size:clamp(9px,.66vw,10.5px);
  letter-spacing:.3em; text-transform:uppercase;
  color:var(--ink-faint);
  margin:0 0 1.5em;
  display:flex; align-items:center; gap:.9em;
}
.chapter .num::after{
  content:''; flex:1; height:1px; background:var(--rule); max-width:70px;
}
.chapter h2{
  font-family:var(--display);
  font-weight:400;
  font-size:clamp(30px,4.1vw,62px);
  line-height:1.02;
  letter-spacing:.005em;
  margin:0 0 .62em;
}
.chapter p{
  font-size:clamp(13.5px,1.02vw,16px);
  line-height:1.72;
  font-weight:400;
  color:var(--ink-soft);
  margin:0;
  max-width:32em;
}

/* contact block — the "small type": credentials, hours, numbers */
.card{
  margin-top:2.1em;
  display:grid;
  grid-template-columns:auto 1fr;
  gap:.5em 1.4em;
  font-size:clamp(11px,.78vw,12.5px);
  line-height:1.5;
}
.card dt{
  font-size:.82em; letter-spacing:.2em; text-transform:uppercase;
  color:var(--ink-faint); padding-top:.18em;
}
.card dd{ margin:0; color:var(--ink); font-weight:400; }
.card a{ color:inherit; text-decoration:none; box-shadow:0 1px 0 0 var(--rule); }
.card a:hover{ box-shadow:0 1px 0 0 var(--ink); }
.note{
  margin-top:1.5em;
  font-size:clamp(10px,.7vw,11.5px);
  letter-spacing:.04em;
  color:var(--ink-faint);
  max-width:26em;
}

/* scroll cue */
.cue{
  position:fixed; z-index:5;
  left:50%; bottom:clamp(16px,3vh,30px);
  transform:translateX(-50%);
  font-size:9px; letter-spacing:.28em; text-transform:uppercase;
  color:var(--ink-faint);
  display:flex; flex-direction:column; align-items:center; gap:.7em;
  transition:opacity .6s ease;
}
.cue i{
  display:block; width:1px; height:34px;
  background:linear-gradient(to bottom,var(--ink-faint),transparent);
  animation:drip 2.6s ease-in-out infinite;
}
@keyframes drip{
  0%,100%{ transform:scaleY(.4); transform-origin:top; opacity:.5; }
  50%    { transform:scaleY(1);  transform-origin:top; opacity:1; }
}

/* --------------------------- portrait / mobile -------------------------
   The plate takes the upper third, the type sits under it. Nothing is
   inset in a panel, so no space is spent on containers.                  */
@media (max-aspect-ratio:105/100), (max-width:820px){
  .chapter{
    left:0; right:0; top:auto; bottom:clamp(58px,9vh,96px);
    width:auto; transform:none;
    padding:0 clamp(20px,7vw,44px);
  }
  .chapter .num{ margin-bottom:1em; font-size:9px; }
  .chapter h2{ font-size:clamp(28px,8.4vw,46px); margin-bottom:.5em; }
  .chapter p{ font-size:clamp(13px,3.7vw,15.5px); line-height:1.62; }
  .card{ margin-top:1.4em; gap:.35em 1.1em; font-size:12px; }
  .note{ margin-top:1em; font-size:10.5px; }
  .index{
    right:auto; left:clamp(20px,7vw,44px);
    top:auto; bottom:clamp(22px,3.4vh,34px);
    transform:none; flex-direction:row; gap:10px; align-items:center;
  }
  .index i{ width:14px; }
  .index button[aria-current="true"] i{ width:28px; }
  .index button{ font-size:0; }
  .cue{ left:auto; right:clamp(20px,7vw,44px); bottom:clamp(20px,3.2vh,32px); transform:none; }
  .cue span{ display:none; }
}

@media (prefers-reduced-motion:reduce){
  .cue i{ animation:none; }
}
