/* Hallmark · shape: stage · genre: playful · theme: custom · hero: stage · nav: masthead · footer: colophon · imagery: the shelf itself · signature: books that tilt out of the row · axes: niche, row, lamp, plank, bear · posture: committed · job: reading a maths book · contrast: pass · fold: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H4 E5 S5 R4 V4 · weakest: R, the row has no rhythm of its own; the fan of the six volumes was given a slow arc so the eye walks along the shelf instead of across it */
/* Hallmark · waive 29 · the lamp pool over the niche is the light the whole page is built around, not an effect on top of it · the pool is painted once, behind the books, and does not move */

/* ==========================================================================
   Das Regal — Mathebär's home page.

   The bookshelf pattern, in the chalkboard's own colours.

   The pattern comes from the lernregal.de course: a dark room, one lamp, a
   shelf in a niche, cloth-bound volumes standing in the light, a brass label
   on the shelf edge, and a drawer with everything that is not the book.

   What is borrowed is the shape: a place you walk into rather than a
   dashboard of cards. What is not borrowed is the colour: lernregal.de is
   warm paper and brown wood, Mathebär is a dark green chalkboard with chalk
   and amber. So the wall, the shelf and the drawers here are green-black, the
   brass is Mathebär's amber, and the cloth of each volume is one of the
   maths hues that the lessons themselves use for their families of angle.

   The colours come from brand.js, which pushes them into the custom
   properties below at load time. Nothing here owns a colour of its own.

   THE STAGE. The niche is a real 3D room, built from CSS transforms only:
   a perspective on the case, a preserve-3d inside it, and every book a
   volume with a front face, a fore-edge and a top edge. A book tilts out of
   the row when the pointer comes near it or when it takes the keyboard focus.

   Two rules hold that room together, and both were measured in a browser:

     1. Nothing that carries a 3D transform may have a filter on it. A
        filter flattens the whole scene around it: the back wall disappears
        behind the books and the volumes lose their perspective. The shadows
        are therefore box-shadow, and the one drop-shadow left in the file
        belongs to the bear, which is a flat picture with no 3D children.

     2. Nothing that carries a 3D transform may clip its children with
        overflow: hidden. That would flatten the scene just as a filter
        does. The book cover rounds its own corners instead of clipping them.
   ========================================================================== */

:root {
  /* Fallback values, so the page still renders if brand.js fails to load.
     They are the same hexes brand.js carries. */
  --page:   #0f1613;
  --board:  #1d2b27;
  --panel:  #22322d;
  --edge:   #3a5047;
  --chalk:  #ece8dc;
  --dim:    #9aaba3;
  --faint:  #5d7068;
  --task:   #f0b45a;
  --quiz:   #86c9e8;
  --good:   #8fd6b0;
  --bad:    #f08c7a;

  --ui: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --book: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sign: "Bahnschrift", "DIN Alternate", "Arial Narrow", var(--ui);
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* ---- the room ---- */
  --wall-hi:    #1d2b27;
  --wall-mid:   #16211d;
  --wall-lo:    #0d1412;
  --wall-lamp:  rgba(240, 180, 90, .26);
  --wall-cool:  rgba(134, 201, 232, .07);
  --wall-deep:  rgba(15, 22, 19, .90);
  --wall-floor: rgba(0, 0, 0, .55);
  --grain:      rgba(236, 232, 220, .07);

  /* ---- the niche ---- */
  --niche-hi:         #24332e;
  --niche-mid:        #18231f;
  --niche-lo:         #121a17;
  --niche-shade-top:  rgba(0, 0, 0, .62);
  --niche-shade-mid:  rgba(0, 0, 0, .30);
  --niche-shade-soft: rgba(0, 0, 0, .04);
  --niche-shade-foot: rgba(0, 0, 0, .20);
  --niche-glow:       rgba(240, 180, 90, .10);

  /* ---- the frame and the board ---- */
  --wood-hi:         #2c3d37;
  --wood-mid:        #1d2b27;
  --wood-lo:         #131c19;
  --wood-grain:      rgba(6, 12, 10, .28);
  --wood-lamp:       rgba(240, 180, 90, .13);
  --wood-lamp-edge:  rgba(240, 180, 90, .20);
  --plank-hi:        #35473f;
  --plank-mid:       #23322c;
  --plank-lo:        #18231f;
  --plank-grain:     rgba(8, 16, 13, .30);
  --plank-lamp:      rgba(240, 180, 90, .05);
  --plank-top:       rgba(240, 180, 90, .20);
  --plank-lamp-edge: rgba(240, 180, 90, .22);

  /* ---- the lamp ---- */
  --lamp:      #f0b45a;
  --lamp-dim:  rgba(240, 180, 90, .42);
  --lamp-wash: rgba(240, 196, 120, .20);
  --lamp-cone: rgba(240, 180, 90, .09);
  --lamp-warm: rgba(255, 238, 202, .12);
  --lamp-hi:   #f5cd8b;
  --lamp-edge: #c2913f;
  --sheen:     rgba(255, 255, 255, .45);
  --sheen-lit: rgba(255, 255, 255, .50);

  /* ---- the cloth of the volumes ---- */
  --cloth-fallback: #4c6a60;
  --cloth-winkel:   #f0b45a;
  --cloth-zahlen:   #86c9e8;
  --cloth-verhaelt: #f4a48c;
  --cloth-figuren:  #e8a0c8;
  --cloth-algebra:  #bba8ee;
  --cloth-algebra2: #bba8ee;
  --weave-dark:  rgba(0, 0, 0, .05);
  --weave-light: rgba(255, 255, 255, .04);

  /* ---- the ink on the cloth ---- */
  --ink-bright:      #fbf4e4;
  --ink-soft:        rgba(251, 244, 228, .76);
  --ink-level:       rgba(255, 248, 232, .86);
  --ink-count:       rgba(255, 248, 232, .82);
  --ink-quiet:       rgba(255, 248, 232, .62);
  --ink-stand:       rgba(255, 248, 232, .58);
  --ink-shadow:      rgba(0, 0, 0, .55);
  --ink-shadow-soft: rgba(0, 0, 0, .50);
  --stamp-frame:     rgba(255, 240, 210, .26);
  --stamp-frame-dim: rgba(255, 240, 210, .16);
  --spine-hi:        rgba(255, 255, 255, .13);
  --spine-lo:        rgba(0, 0, 0, .60);
  --spine-edge:      rgba(0, 0, 0, .32);

  /* ---- the paper edges of a volume ---- */
  --paper:       #e9e2d0;
  --paper-line:  rgba(74, 60, 38, .30);
  --paper-shade: rgba(0, 0, 0, .40);

  /* ---- the brass ---- */
  --brass-hi:   #f6e6bd;
  --brass-mid:  #b9882f;
  --brass-lo:   #8d6524;
  --brass-edge: rgba(255, 246, 224, .55);
  --brass-lamp: rgba(240, 180, 90, .55);

  /* ---- the type ---- */
  --title-ink:      #f4efe1;
  --title-loud:     #fff3d8;
  --text-quiet:     rgba(236, 232, 220, .70);
  --text-faint:     rgba(236, 232, 220, .46);
  --text-faintest:  rgba(236, 232, 220, .40);
  --text-dim:       rgba(236, 232, 220, .50);
  --text-line:      rgba(236, 232, 220, .82);
  --text-line-soft: rgba(236, 232, 220, .74);
  --sign-ink:       #ecd9b2;
  --sign-ink-soft:  rgba(236, 232, 220, .74);
  --sign-face-hi:   #2f423a;
  --sign-face-lo:   #1e2c27;
  --sign-edge:      rgba(240, 180, 90, .32);
  --sign-edge-soft: rgba(240, 180, 90, .26);
  --label-ink:      #16211d;

  /* ---- the shadows, as a ladder ---- */
  --shade-95: rgba(0, 0, 0, .95);
  --shade-92: rgba(0, 0, 0, .92);
  --shade-90: rgba(0, 0, 0, .90);
  --shade-85: rgba(0, 0, 0, .85);
  --shade-82: rgba(0, 0, 0, .82);
  --shade-62: rgba(0, 0, 0, .62);
  --shade-60: rgba(0, 0, 0, .60);
  --shade-58: rgba(0, 0, 0, .58);
  --shade-55: rgba(0, 0, 0, .55);
  --shade-50: rgba(0, 0, 0, .50);
  --shade-48: rgba(0, 0, 0, .48);
  --shade-46: rgba(0, 0, 0, .46);
  --shade-45: rgba(0, 0, 0, .45);
  --shade-42: rgba(0, 0, 0, .42);
  --shade-40: rgba(0, 0, 0, .40);
  --shade-38: rgba(0, 0, 0, .38);
  --shade-36: rgba(0, 0, 0, .36);
  --shade-34: rgba(0, 0, 0, .34);
  --shade-32: rgba(0, 0, 0, .32);
  --shade-30: rgba(0, 0, 0, .30);
  --shade-28: rgba(0, 0, 0, .28);
  --shade-22: rgba(0, 0, 0, .22);
  --shade-20: rgba(0, 0, 0, .20);
  --shade-18: rgba(0, 0, 0, .18);
  --shade-16: rgba(0, 0, 0, .16);
  --shade-14: rgba(0, 0, 0, .14);
  --shade-12: rgba(0, 0, 0, .12);
  --shade-10: rgba(0, 0, 0, .10);
  --shade-06: rgba(0, 0, 0, .06);
  --shade-04: rgba(0, 0, 0, .04);

  /* ---- the drawer ---- */
  --drawer:      #16211d;
  --drawer-edge: rgba(240, 180, 90, .38);
  --scrim:       rgba(8, 13, 11, .62);
  --scrim-glass: rgba(8, 13, 11, .12);
  --glass-tint:  rgba(22, 33, 29, .28);

  /* ---- the depth of a volume ---- */
  --depth: 34px;
  --cover-h: 232px;
}

* { box-sizing: border-box; }

/* The page never scrolls sideways. The clip cuts the lamp's cone without
   opening a scroll area -- and it does not break the 3D stage: a clipped
   ancestor keeps the perspective and the occlusion of the scene below it. */
html, body { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100svh;
  font: 18px/1.55 var(--ui);
  color: var(--chalk);
  background: var(--board);
}

a { color: inherit; }
a:focus-visible { outline: 3px solid var(--task); outline-offset: 3px; }
img { max-width: 100%; }

/* ============================================================ the room ==== */
/* The home page is the publisher's shop: a dark wall, one lamp, a shelf in a
   niche, six cloth-bound volumes standing in the light. It has to look like a
   place -- not like a dashboard with cards on it. */

.coverpage {
  min-height: 100vh;
  font-family: var(--ui);
  color: var(--chalk);
  /* No background-attachment: fixed -- that propagates the wall into the
     canvas and covers only the window, not the whole page. */
  background:
    radial-gradient(120% 70% at 16% -6%, var(--wall-lamp), transparent 58%),
    radial-gradient(80% 52% at 86% 4%, var(--wall-cool), transparent 70%),
    radial-gradient(76% 46% at 94% 76%, var(--wall-deep), transparent 72%),
    radial-gradient(150% 80% at 50% 116%, var(--wall-floor), transparent 62%),
    linear-gradient(180deg, var(--wall-hi) 0%, var(--wall-mid) 46%, var(--wall-lo) 100%);
}

/* the grain of the wall -- the same chalk dust the lesson stage has */
.coverpage::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .085;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
}

.shelfpage {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 110px;
}

.room { padding: 30px 0 0; text-align: center; }

.room-title {
  margin: 0 auto;
  font-family: var(--book);
  font-size: clamp(32px, 5.2vw, 54px);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -.018em;
  max-width: 17ch;
  text-wrap: balance;
  overflow-wrap: break-word;
  min-width: 0;
  color: var(--chalk);
}

.room-lede {
  margin: 20px auto 0;
  max-width: 56ch;
  font-size: 16.5px;
  line-height: 1.62;
  color: var(--text-quiet);
}

/* ============================================================= the case ==== */
/* The niche. It carries the perspective for the whole room: everything
   inside it that stands in a plane is seen from slightly above and in
   front, which is what turns a row of pictures into a row of books. */

.case {
  position: relative;
  margin: 58px auto 0;
  max-width: 1124px;
  padding: 0 16px;
  isolation: isolate;
  /* The lamp's cone reaches past the edge of the shelf. That looks good but
     gives the page a horizontal bar. The clip cuts it off without creating
     a scroll area. */
  overflow-x: clip;
  /* The room's viewpoint. 1400px is far enough that the volumes keep their
     size, and the origin sits a little above the middle so we look down on
     the shelf the way a person stands in front of it. */
  perspective: 1400px;
  perspective-origin: 50% 42%;
  /* The niche sits in the wall: the shadow belongs to the case itself, not
     to the frame inside it, because the frame is clipped to a ring. */
  box-shadow: 0 34px 52px -26px var(--shade-92);
}

/* the frame around the niche -- green-black wood, the shelf's own colour.
   It is a ring: the middle is cut away, so the back wall of the niche can
   be seen through it and the wall can carry the shadow of the whole case. */
.case::before {
  content: "";
  position: absolute;
  inset: -13px 2px -13px;
  z-index: 0;
  border-radius: 4px;
  background:
    linear-gradient(180deg, var(--wood-lamp), var(--shade-32) 58%, var(--shade-48)),
    repeating-linear-gradient(90deg, var(--wood-grain) 0 2px, transparent 2px 11px),
    linear-gradient(180deg, var(--wood-hi), var(--wood-mid) 60%, var(--wood-lo));
  box-shadow: inset 0 1px 0 var(--wood-lamp-edge);
  clip-path: inset(14px 16px 14px 16px);
}

/* The back wall of the niche. It stands 240px behind the row, and the
   perspective makes it smaller -- so it is scaled back up by the same
   factor, which keeps its footprint while it recedes. */
.case-back {
  position: absolute;
  inset: -8px 0;
  z-index: 1;
  border-radius: 2px;
  background:
    linear-gradient(180deg, var(--niche-shade-top) 0%, var(--niche-shade-mid) 20%,
                            var(--niche-shade-soft) 56%, var(--niche-shade-foot) 100%),
    radial-gradient(70% 40% at 42% 86%, var(--niche-glow), transparent 70%),
    url("../img/nische.webp") center / 100% 100% no-repeat,
    linear-gradient(180deg, var(--niche-hi), var(--niche-mid) 68%, var(--niche-lo));
  box-shadow:
    inset 0 34px 52px -24px var(--shade-95),
    inset 0 0 0 1px var(--shade-55),
    inset 20px 0 40px -30px var(--shade-90),
    inset -20px 0 40px -30px var(--shade-90);
  transform: translateZ(-240px) scale(1.171);
}

/* the lamp, from the upper left: a pool of light, not a cut-out wedge. It
   falls on the back wall of the niche, which is why the books stand in a
   pool of light and not in front of a picture of one. */
.case-light {
  position: absolute;
  inset: -26px -8% 0 -8%;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(58% 82% at 22% 4%, var(--lamp-wash), transparent 62%),
    linear-gradient(158deg, var(--lamp-cone) 0%, transparent 42%);
  transform: translateZ(-220px) scale(1.157);
}

/* Everything inside the niche shares one 3D room. */
.case-inner { position: relative; z-index: 3; padding-top: 30px; transform-style: preserve-3d; }

/* ========================================================== the shelf ==== */

.shelfrow { position: relative; margin: 0 0 36px; transform-style: preserve-3d; }

.shelfrow-books {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  /* Links steht Mathebär auf dem Brett, und er zeigt auf die Bände. Die Reihe
     rückt deshalb ein Stück nach rechts, damit er keinen Buchtitel zudeckt. */
  padding: 0 10px 0 152px;
  transform-style: preserve-3d;
}

/* ============================================================ the books ==== */
/* A book is a volume: a front face, a fore-edge on the right and a top edge.
   The three faces are real planes in the same 3D room, which is why the row
   has depth and not only shadows. */

.book {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  transform-style: preserve-3d;
  /* The books stand as they were put down, not as a printer set them: a
     shallow arc, so the row walks away from the reader instead of across. */
  /* Die Ruhewinkel stehen im Bogen weiter unten. Hier werden sie nur
     weitergegeben, damit Hover und Fokus sie zurueckgeben koennen. */
  --fan: var(--fan-r, -9deg);
  --tilt: var(--tilt-r, 0deg);
  transform: rotateY(var(--fan, -9deg)) rotateZ(var(--tilt, 0deg)) translateZ(var(--lift, 0px));
  transform-origin: 50% 100%;
  transition: transform .34s var(--ease);
}

/* Six volumes share the shelf. They have to fit into the case without
   being cut off: the case is as wide as the page allows (1124px), and the
   row -- six books, five gaps and the place the bear keeps on the left --
   has to fit into it. The height stays: a shelf of books is a shelf of
   books. The flex: none keeps them from being squeezed when the row no
   longer fits: a narrower book does not fit its own title either, and a
   row that is squeezed looks broken rather than full. */
.book--vol { width: 136px; flex: none; }
.book--vol .cover { height: var(--cover-h); }

/* The arc of the row. Each volume is turned a little towards the reader, so
   its fore-edge shows; the angle grows towards the left, where the bear
   stands and the row is deepest. */
.book--vol:nth-child(1) { --fan-r: -13deg;   --tilt-r: -.4deg; }
.book--vol:nth-child(2) { --fan-r: -11.5deg; --tilt-r: .3deg; }
.book--vol:nth-child(3) { --fan-r: -10deg;   --tilt-r: -.25deg; }
.book--vol:nth-child(4) { --fan-r: -8.5deg;  --tilt-r: .4deg; }
.book--vol:nth-child(5) { --fan-r: -7deg;    --tilt-r: -.35deg; }
.book--vol:nth-child(6) { --fan-r: -5deg;    --tilt-r: .2deg; }

.cover {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 2px 7px 7px 2px;
  /* The weave of the cloth is drawn with gradients and not with a picture.
     A raster background inside the 3D room is cut into vertical strips by
     the compositor, and the strips cut through the title; a gradient is
     painted into the cover's own layer and stays whole. */
  background-color: var(--cloth, var(--cloth-fallback));
  background-image:
    repeating-linear-gradient(38deg, var(--weave-dark) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(-38deg, var(--weave-light) 0 1px, transparent 1px 3px);
  background-size: auto;
  /* The cover is its own layer. Then cloth and type are rasterised together
     and stay whole when the volume is turned in the 3D room. */
  will-change: transform;
  /* Und der Deckel bekommt eine eigene Transformation dazu, damit der Browser
     ihn wirklich als Ebene im 3D-Raum anlegt. Ohne Transformation wird die
     flache Ebene im Raum des Buchs gerastert, und der Titel kommt in Stuecken
     heraus: auf den Kopien ohne diese Zeile war "Winkel & Geometrie"
     zerschnitten. */
  transform: translateZ(0);
  /* The cover stays a flat surface, and that is not a compromise: a flat
     surface keeps the faces of the volume -- its fore-edge and its top --
     behind the cloth, so the row has depth and not only shadows. The cover
     must also not clip, or the faces behind it would be cut away; the
     corners are rounded on the cloth instead. */
  transform-style: flat;
}

/* The depth of a volume: the paper on its fore-edge and the cloth on its
   top. Both are planes that fold away from the reader, so the book has a
   body and not only a picture of one. */
.cover-edge {
  position: absolute;
  top: 0;
  left: 100%;
  width: var(--depth);
  height: var(--cover-h);
  transform-origin: left center;
  transform: rotateY(90deg);
  background:
    repeating-linear-gradient(180deg, var(--paper) 0 3px, var(--paper-line) 3px 4px);
  box-shadow: inset -8px 0 12px var(--paper-shade);
}

.cover-top {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: var(--depth);
  transform-origin: top center;
  transform: rotateX(-90deg);
  background: var(--cloth, var(--cloth-fallback));
  box-shadow:
    inset 0 5px 9px var(--lamp-warm),
    inset 0 -9px 14px var(--shade-30);
}

/* The cloth: one weave, tinted per volume. The maths colour set -- the same
   hues the lessons use for their families of angle -- is the binding of each
   book, so the shelf is already a legend of the course. The weave itself is
   on the cover; this layer carries the light that falls on it. */
.cover-cloth {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.book--winkel  { --cloth: var(--cloth-winkel); }
.book--zahlen  { --cloth: var(--cloth-zahlen); }
.book--verhaelt { --cloth: var(--cloth-verhaelt); }
.book--algebra { --cloth: var(--cloth-algebra); }
.book--figuren { --cloth: var(--cloth-figuren); }

/* the lamp falls on the upper left of the cloth; the lower right goes dark */
.cover-cloth::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(110% 84% at 6% -8%, var(--lamp-warm), transparent 54%),
    linear-gradient(152deg, transparent 34%, var(--shade-46) 100%);
}

/* the spine: the board turns a little toward the reader */
.cover-spine {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 13px;
  z-index: 2;
  background: linear-gradient(90deg, var(--spine-lo), var(--spine-hi) 56%, var(--spine-edge));
  border-radius: 2px 0 0 2px;
  box-shadow: 3px 0 7px -3px var(--ink-shadow);
}

.cover-face {
  position: absolute;
  left: 13px; right: 0; top: 0; bottom: 40px;
  padding: 16px 13px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1;
}

/* a scrim so the type always reads, even where the lamp falls on the cloth */
.cover-face::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--shade-46), var(--shade-12) 32%, transparent 58%);
  pointer-events: none;
}

/* the blind-stamped frame of a cloth binding */
.cover-face::after {
  content: "";
  position: absolute;
  inset: 8px 7px 7px 7px;
  border: 1px solid var(--stamp-frame);
  border-radius: 2px;
  pointer-events: none;
}

.cover-level {
  font-family: var(--sign);
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-level);
  text-shadow: 0 1px 2px var(--ink-shadow);
}

/* The band under the level tells the volumes of the shelf apart. It is the
   maths hue of the book, lightened, so it reads on the cloth. */
.cover-level::after {
  content: "";
  display: block;
  width: 30px;
  height: 2px;
  margin-top: 7px;
  background: var(--cloth, var(--lamp));
  box-shadow: 0 0 8px var(--shade-50);
}

.cover-title {
  font-family: var(--book);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -.012em;
  overflow-wrap: break-word;
  min-width: 0;
  color: var(--ink-bright);
  text-shadow: 0 1px 2px var(--ink-shadow), 0 0 16px var(--shade-30);
}

.cover-sub {
  font-size: 10px;
  line-height: 1.4;
  color: var(--ink-soft);
  text-shadow: 0 1px 2px var(--ink-shadow-soft);
}

.cover-foot {
  position: absolute;
  left: 13px; right: 0; bottom: 0;
  z-index: 1;
  height: 40px;
  padding: 0 13px 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 2px;
}

.cover-count {
  font-family: var(--sign);
  font-size: 10px;
  color: var(--ink-count);
  text-shadow: 0 1px 2px var(--ink-shadow);
}

.cover-mark {
  font-family: var(--sign);
  font-size: 10px;
  color: var(--lamp);
  text-shadow: 0 1px 2px var(--ink-shadow);
}

/* The book that comes forward. It leaves the row towards the reader and
   straightens itself: the perspective does the rest, the volume grows and
   its fore-edge opens towards the light. The keyboard gets the same move,
   because the tilt is a CSS state and not a script. */
.book:hover,
.book:focus-visible { --lift: 78px; --fan: -4deg; --tilt: 0deg; }
.book:active { --lift: 92px; }
.book:focus-visible { outline: none; }
.book:focus-visible .cover { outline: 3px solid var(--lamp); outline-offset: 6px; }

/* A book that is not written yet stands in the shelf like the others, but its
   face is dimmed and it does not lift. It is not a link, and it does not
   pretend to be one. */
.book--soon .cover { background-color: var(--cloth-fallback); }
.book--soon .cover-face::after { border-color: var(--stamp-frame-dim); }
.book--soon .cover-count { color: var(--ink-quiet); }
.book--soon:hover { --lift: 0px; --fan: -9deg; --tilt: 0deg; }

/* ======================================================== shelf board ==== */

.plank {
  position: relative;
  z-index: 1;
  height: 30px;
  margin: -5px -26px 0;
  border-radius: 2px 2px 4px 4px;
  background:
    linear-gradient(180deg,
      var(--plank-top) 0 3px, var(--shade-12) 24%,
      var(--shade-42) 82%, var(--shade-58) 100%),
    repeating-linear-gradient(90deg,
      var(--plank-grain) 0 2px, transparent 2px 9px,
      var(--plank-lamp) 9px 11px, transparent 11px 19px),
    linear-gradient(180deg, var(--plank-hi), var(--plank-mid) 55%, var(--plank-lo));
  box-shadow:
    0 28px 36px -18px var(--shade-82),
    inset 0 1px 0 var(--plank-lamp-edge),
    inset 0 -2px 3px var(--shade-45);
}

/* ============================== Mathebär, der auf das Regal zeigt ======== */
/* Er steht links auf dem Brett und zeigt mit der ausgestreckten Hand auf die
   Bände. Das Bild liegt im Brett, nicht in der Reihe: so bleibt er stehen,
   wenn die Reihe auf dem Telefon seitlich wegschiebbar ist -- und die Bücher
   schieben sich an ihm vorbei, genau wie er es meint.

   Seine Füße stehen auf der Oberkante des Bretts (bottom: 100%), nicht auf
   einer geratenen Höhe darüber.

   Der Bär reagiert. Er ist ein Bild aus Wachs, also kann er nicht blinken
   -- aber er kann sich beugen, wenn der Zeiger in seine Nähe kommt, und beim
   Überfahren ein Bein heben. Die Beugung sitzt auf dem Link, das Atmen auf
   dem Bild darin: zwei Ebenen, damit sich nichts gegenseitig wegschlägt. */
.guide {
  position: absolute;
  z-index: 5;
  left: 40px;
  bottom: 100%;
  width: 130px;
  display: block;
  text-decoration: none;
  transform-origin: 50% 100%;
  transform: translate3d(var(--dx, 0px), 0, 0) rotate(var(--neigung, 0deg));
  transition: transform .5s var(--ease);
}
.guide-img {
  display: block;
  width: 100%;
  height: auto;
  /* The one drop-shadow left in the file. It is safe here because the bear is
     a flat picture with no 3D children of its own: a filter only flattens
     what hangs below it. */
  filter: drop-shadow(0 18px 14px var(--shade-62));
  transform-origin: 50% 100%;
  animation: baer-atmen 6.5s ease-in-out infinite;
}
.guide:hover .guide-img,
.guide:focus-visible .guide-img { animation: baer-hop .7s var(--ease); }
.guide:focus-visible { outline: 3px solid var(--lamp); outline-offset: 8px; border-radius: 8px; }

@keyframes baer-atmen {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.004); }
}
@keyframes baer-hop {
  0% { transform: translateY(0) rotate(0deg); }
  28% { transform: translateY(-10px) rotate(-1.4deg); }
  58% { transform: translateY(0) rotate(0.7deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

/* Wer auf "bewegung reduziert" steht, bekommt einen stillen Bär. */
@media (prefers-reduced-motion: reduce) {
  .guide-img { animation: none; }
  .guide { transition: none; }
}

/* the shadow the books cast on the board */
.plank::before {
  content: "";
  position: absolute;
  left: 10%; right: 10%; top: -11px;
  height: 13px;
  background: linear-gradient(180deg, transparent, var(--shade-34));
  pointer-events: none;
}

/* ================================================== the sign on the wall ==== */

.sign {
  position: relative;
  width: fit-content;
  margin: 0 auto 30px;
  padding: 11px 34px 13px;
  background: linear-gradient(180deg, var(--sign-face-hi), var(--sign-face-lo));
  border: 1px solid var(--sign-edge);
  border-radius: 3px;
  box-shadow:
    0 18px 30px -14px var(--shade-90),
    inset 0 1px 0 var(--wood-lamp-edge);
  transform: rotate(-.5deg);
}

/* the two wires it hangs on */
.sign::before,
.sign::after {
  content: "";
  position: absolute;
  top: -30px;
  width: 1.5px;
  height: 32px;
  background: linear-gradient(180deg, var(--shade-22), var(--lamp-dim));
}
.sign::before { left: 22%; }
.sign::after  { right: 22%; }

.sign b {
  display: block;
  font-family: var(--book);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .12em;
  color: var(--lamp);
  text-align: center;
}

.sign span {
  display: block;
  font-family: var(--sign);
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 3px;
}

/* ============================================ the label on the edge ======== */
/* Die Leiste unter dem Regal sagt, was drinsteht -- und sie ist ein Filter.
   Wer nur die Baende fuer seine Klasse will, waehlt sie aus. Ohne JavaScript
   stehen alle Baende im Regal: der Filter ist eine Zutat, kein Fundament. */
.shelfbar {
  position: relative;
  z-index: 3;
  width: fit-content;
  max-width: 100%;
  margin: 16px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.shelflabel {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 9px 24px;
  background: linear-gradient(180deg, var(--plank-hi), var(--sign-face-lo));
  border: 1px solid var(--drawer-edge);
  border-radius: 2px;
  box-shadow: 0 16px 26px -12px var(--shade-85), inset 0 1px 0 var(--plank-lamp-edge);
  font-family: var(--sign);
  font-size: 11.5px;
  color: var(--sign-ink);
}
.shelffacts { margin: 0; display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.shelffacts span { white-space: nowrap; }
/* The facts are separated by a hairline, not by a dot. */
.shelffacts span + span { border-left: 1px solid var(--sign-edge-soft); padding-left: 18px; }

/* der Filter in der Leiste */
.shelffilter {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-left: 20px;
  border-left: 1px solid var(--sign-edge-soft);
}
.filterlabel {
  font-size: 11px;
  color: var(--lamp-dim);
}
.filterbtn {
  font-family: var(--sign);
  font-size: 11.5px;
  color: var(--text-line-soft);
  background: transparent;
  border: 1px solid var(--sign-edge);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.filterbtn:hover { color: var(--title-loud); border-color: var(--lamp); }
.filterbtn:active { background: var(--shade-28); }
.filterbtn:focus-visible { outline: 3px solid var(--lamp); outline-offset: 2px; }
.filterbtn[aria-pressed="true"] { background: var(--lamp); border-color: var(--lamp); color: var(--label-ink); }

.shelfcount {
  margin: 0;
  font-family: var(--sign);
  font-size: 11px;
  color: var(--faint);
}

/* Ein ausgeblendeter Band verschwindet ganz -- auch aus der Reihenfolge der
   Tastatur und aus dem Vorlesebild. */
.book[hidden] { display: none; }

/* the plate under the row: it names the shelf */
.plate {
  position: relative;
  z-index: 3;
  width: fit-content;
  margin: 12px auto 0;
  padding: 6px 20px;
  background: linear-gradient(180deg, var(--plank-hi), var(--sign-face-lo));
  border: 1px solid var(--drawer-edge);
  border-radius: 2px;
  box-shadow:
    0 12px 22px -12px var(--shade-85),
    inset 0 1px 0 var(--plank-lamp-edge);
}
.plate a, .plate span {
  font-family: var(--sign);
  font-size: 11.5px;
  color: var(--sign-ink);
  text-decoration: none;
  display: block;
}
.plate a:hover { color: var(--title-loud); }
.plate a:active { color: var(--lamp-dim); }

/* ============================================================== the CTA === */

.cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin: 46px 0 0;
}

.coverpage .cta .start {
  display: inline-block;
  font-family: var(--sign);
  font-size: 14px;
  font-weight: 600;
  color: var(--label-ink);
  background: linear-gradient(180deg, var(--lamp-hi), var(--lamp));
  border: 1px solid var(--lamp-edge);
  border-radius: 2px;
  padding: 15px 30px;
  text-decoration: none;
  box-shadow: 0 18px 28px -14px var(--shade-85), inset 0 1px 0 var(--sheen);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.coverpage .cta .start:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 34px -14px var(--shade-90), inset 0 1px 0 var(--sheen-lit);
}
.coverpage .cta .start:active { transform: none; }

/* the colophon under the shelf */
.room-foot {
  margin: 72px 0 0;
  font-family: var(--sign);
  font-size: 11.5px;
  color: var(--text-faintest);
}
.room-foot .sep {
  display: inline-block;
  width: 14px;
  height: 1px;
  margin: 0 10px;
  vertical-align: middle;
  background: var(--sign-edge-soft);
}

/* =========================================================== the masthead == */

.masthead {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px 18px;
  flex-wrap: wrap;
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 28px 14px;
}

.masthead .brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
  text-decoration: none;
  color: inherit;
}
.masthead .menu { margin-left: auto; }

/* Der Name traegt das Zeichen. Es ist derselbe Baer wie auf der Medaille
   neben dem Regal, nur kleiner -- wie das Siegel auf dem Briefkopf. */
.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--book);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--title-ink);
  line-height: 1;
}
.brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: block;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--sign-edge), 0 2px 8px var(--shade-55);
}
.brand-mark .tld { color: var(--lamp); }

.masthead .brandsub {
  font-family: var(--sign);
  font-size: 11px;
  color: var(--text-dim);
}
.masthead .brand:hover .brand-mark { color: var(--title-loud); }

/* ============================================================== the menu == */
/* A drawer from the right. Without JavaScript it still opens -- the details
   element knows how -- so nothing in it is ever unreachable. */

.menu { position: relative; }

.menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--ui);
  font-size: 13px;
  color: var(--text-line);
  background: transparent;
  border: 1px solid var(--sign-edge-soft);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  list-style: none;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.menu-toggle::-webkit-details-marker { display: none; }
.menu-toggle:hover { border-color: var(--lamp); color: var(--lamp); }
.menu-toggle:active { background: var(--shade-28); }
.menu[open] .menu-toggle { background: var(--lamp); border-color: var(--lamp); color: var(--label-ink); }

.menu-toggle .burger { position: relative; display: inline-block; width: 15px; height: 2px; background: currentColor; }
.menu-toggle .burger::before,
.menu-toggle .burger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
}
.menu-toggle .burger::before { top: -5px; }
.menu-toggle .burger::after  { top: 5px; }

.menu-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--scrim);
  animation: menu-fade .25s var(--ease);
}

/* A closed drawer is not there. Without this rule its box stays next to the
   window -- and the page gets a horizontal bar nobody needs. */
.menu:not([open]) .menu-panel { display: none; }

.menu-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 61;
  width: min(460px, 100%);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 26px 70px;
  color: var(--chalk);
  background: var(--drawer);
  border-left: 1px solid var(--edge);
  box-shadow: -24px 0 60px var(--shade-55);
  animation: menu-in .28s var(--ease);
}
@keyframes menu-in  { from { transform: translateX(100%); } to { transform: none; } }
@keyframes menu-fade { from { opacity: 0; } to { opacity: 1; } }

body.menu-open { overflow: hidden; }

/* ==================================================== die Glasscheibe ===== */
/* Hinter der Schublade steht eine Scheibe aus Glas. Die Bibliothek
   liquid-glass-js (MIT, Armagan Amcalar) nimmt ein Bild der Seite auf und
   biegt es um die Kanten der Scheibe, damit die Schublade im selben Raum
   steht wie das Regal und nicht davor schwebt.

   Die Scheibe ist ein Extra und nie eine Grundlage: ohne WebGL oder ohne die
   Bibliothek bleibt die Schublade die undurchsichtige Schublade, die sie war.
   Die Klasse "glass-ready" sagt, dass wirklich eine Scheibe dasteht; erst
   dann wird die Schublade durchsichtig, damit der Text nie auf einem Loch
   steht. */
.glass-sheet {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 60;
  width: min(460px, 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .28s var(--ease);
}
.glass-sheet .glass-container {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  gap: 0;
}
html.drawer-open .glass-sheet { opacity: 1; }
html.glass-ready .menu-panel { background: var(--glass-tint); }
html.glass-ready .menu-scrim { background: var(--scrim-glass); }

@media (prefers-reduced-motion: reduce) {
  .menu-panel, .menu-scrim { animation: none; }
  .book, .coverpage .cta .start { transition: none; }
  /* Und es bewegt sich gar nicht: Wer auf "bewegung reduziert" steht,
     kann einer bewegten Bilderfolge nicht folgen. Ein Sprung ist auch
     eine Bewegung, also gibt Hover und Fokus die Ruhewinkel zurueck.
     Der Fokusring bleibt, denn ein Ring ist kein Bild. */
  .book:hover,
  .book:focus-visible,
  .book:active { --lift: 0px; --fan: var(--fan-r, -9deg); --tilt: var(--tilt-r, 0deg); }
  .glass-sheet { transition: none; }
}

.menu-sec { padding: 20px 0; border-top: 1px solid var(--edge); }
.menu-sec:first-of-type { border-top: none; padding-top: 2px; }

/* The drawer covers the button that opened it -- so it needs one of its own
   to close it. */
.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
}
.menu-h--top { margin: 0; color: var(--faint); }
.menu-close {
  font-family: var(--ui);
  font-size: 13px;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.menu-close:hover { border-color: var(--lamp); color: var(--lamp); }
.menu-close:active { background: var(--shade-28); }
.menu-close:focus-visible { outline: 3px solid var(--lamp); outline-offset: 3px; }

.menu-h {
  margin: 0 0 12px;
  font-family: var(--sign);
  font-size: 13px;
  color: var(--lamp);
}

.menu-lede { margin: 0 0 14px; font-size: 16px; line-height: 1.6; color: var(--dim); }

.menufacts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
  font-size: 13.5px;
  color: var(--dim);
}
.menufacts li { position: relative; padding-left: 16px; }
/* A hairline instead of a dot: the line says "part of the same list". */
.menufacts li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: .65em;
  width: 6px;
  height: 1px;
  background: var(--lamp);
}

.menu-foot { margin: 22px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--faint); }

.menu-aboutlink { margin: 14px 0 0; font-size: 13px; line-height: 1.6; color: var(--dim); }

/* the method, the route and the gifts -- all of them live in the drawer */

.steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
  background: var(--edge);
  border: 1px solid var(--edge);
  border-radius: 8px;
  overflow: hidden;
}
.steps li {
  background: var(--board);
  padding: 13px 16px 14px;
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  display: block;
  font-family: var(--sign);
  font-size: 12px;
  color: var(--lamp);
  margin-bottom: 5px;
}
.steps .st { display: block; font-weight: 600; font-size: 14.5px; }
.steps .sd { display: block; font-size: 13px; color: var(--dim); margin-top: 2px; }

/* the publisher's own site, named in the section about him */
.publink {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--lamp-dim);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.publink:hover { color: var(--lamp); }

/* ========================================================== responsive ==== */

/* Auf einem schmalen Bildschirm stehen sechs Baende nicht nebeneinander. Sie
   bleiben auf einem Brett, und das Brett schiebt sich seitlich weg: ein Regal,
   an dem man entlangschieben kann, liest sich immer noch als Regal -- ein
   Raster aus Karten nicht.

   Der Platz links ist fuer Mathebär reserviert. Er steht auf dem Brett, und
   weil er nicht in der Reihe steht, bleibt er stehen, wenn die Reihe
   wegschiebt: die Bücher wandern an seiner Hand vorbei.

   Die Sicht wird hier neu gesetzt: ein Bildschirm, der scrollt, darf keine
   Kinder in einer 3D-Ebene schneiden, sonst flacht die Szene ab. Das Brett
   bekommt deshalb seine eigene Perspektive. */
@media (max-width: 980px) {
  .case { margin-top: 128px; }
  .shelfrow-books {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: thin;
    padding-left: 126px;
    perspective: 900px;
  }
  .book--vol { width: 132px; }
  .book--vol { --cover-h: 210px; }
  .cover-title { font-size: 16px; }
  /* Der Rueckentitel passt auf einem schmalen Ruecken nicht: er laeuft in den
     Fuss der Seite und ueberdeckt den Titel. Auf dem breiten Schirm steht er
     auf dem Ruecken, auf dem Telefon traegt der Ruecken nur den Titel. */
  .cover-sub { display: none; }
  .guide { width: 104px; left: 38px; }
}

@media (max-width: 560px) {
  .shelfpage { padding: 0 18px 80px; }
  .masthead { padding: 20px 18px 10px; }
  .room-title { font-size: 34px; }
  .case { margin-top: 108px; }
  .guide { width: 84px; left: 34px; }
  .shelfrow-books { padding-left: 106px; }
}
