/* Pippin Brand Book viewer. Colors and type from the Brand Book (16 · Color, 18 · Type). */
:root {
  --ink-950: #0F1328;
  --ink-900: #191F43;
  --ink-800: #22294E;
  --ink-700: #3C456D;
  --ink-400: #949DBD;
  --ink-200: #D4D8EA;
  --blue-600: #37AADA;
  --blue-400: #76D0F4;
  --red-600: #D83040;
  --red-700: #A82D35;
  --white: #FFFFFF;
  --bar-h: 64px;
  --strip-h: 96px;
  --font-head: 'Poppins', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --focus: 0 0 0 2px var(--ink-950), 0 0 0 4px var(--blue-400);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  /* Same light as the website's ribbon drop: a soft Blue 400 spotlight at the top centre of the navy. */
  background: radial-gradient(ellipse 75% 46% at 50% 0, rgba(118, 208, 244, 0.24), rgba(118, 208, 244, 0.08) 45%, transparent 75%) fixed var(--ink-950);
  color: var(--white);
  font: 400 15px/1.4 var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
button, a { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: 8px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 300; background: var(--white); color: var(--ink-950); padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }

/* Bar */
.bar {
  position: relative; z-index: 200;
  height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  background: rgba(15, 19, 40, .18);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  flex: none;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.mark { width: 32px; height: 32px; flex: none; stroke: none; } /* not an icon: no outline from the svg rule above */
.eyebrow { font: 600 10px/1 var(--font-body); letter-spacing: .2em; text-transform: uppercase; color: var(--white); margin-bottom: 5px; }
.title { margin: 0; font: 600 18px/1.1 var(--font-head); letter-spacing: -.02em; white-space: nowrap; }
.year { color: var(--ink-400); font-weight: 500; }
.pager {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 14px; border-radius: 10px;
  max-width: min(46vw, 520px); min-width: 0;
}
.pager:hover { background: rgba(255, 255, 255, .06); }
.pager-label { font: 500 14px/1.2 var(--font-body); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager-count::after {
  content: ''; display: inline-block; width: 5px; height: 5px; margin: 0 0 2px 6px;
  border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.pager-count { white-space: nowrap; font: 600 10px/1 var(--font-body); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-400); }
.tools { display: flex; justify-content: flex-end; gap: 4px; }
.tool {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 999px;
  text-decoration: none; font-weight: 500; font-size: 14px; color: var(--ink-200);
}
.tool:hover { background: rgba(255, 255, 255, .08); color: var(--white); }
.tool.icon-only { width: 40px; padding: 0; justify-content: center; }
.tool-primary { background: var(--red-600); color: var(--white); padding: 0 16px; margin-left: 6px; }
.tool-primary:hover { background: var(--red-700); }

/* Stage */
.stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 28px 88px; }
.book-wrap { transition: transform .5s cubic-bezier(.3, .7, .2, 1), opacity .3s; will-change: transform; }
.book-wrap.pending { opacity: 0; }
.book { width: 100%; height: 100%; filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .45)); }
.page { background: var(--white); overflow: hidden; }
.page img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; opacity: 0; transition: opacity .25s; }
.page img.ready { opacity: 1; }
/* Spine: the paper darkens and curves into the gutter, with a soft highlight just off the fold. */
.page { position: relative; }
.page::after { content: ''; position: absolute; top: 0; bottom: 0; width: 14%; pointer-events: none; z-index: 2; mix-blend-mode: multiply; }
.page.left::after {
  right: 0;
  background: linear-gradient(to left, rgba(15, 19, 40, .30) 0%, rgba(15, 19, 40, .13) 16%, rgba(15, 19, 40, .05) 40%, transparent 100%);
}
.page.right::after {
  left: 0;
  background: linear-gradient(to right, rgba(15, 19, 40, .30) 0%, rgba(15, 19, 40, .13) 16%, rgba(15, 19, 40, .05) 40%, transparent 100%);
}
.page.cover::after { display: none; }
.stf__item { background: var(--white); }
.turn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .08); color: var(--white); transition: background .2s, opacity .2s;
}
.turn svg { width: 20px; height: 20px; }
.turn:hover { background: rgba(255, 255, 255, .18); }
.turn:disabled { opacity: .25; cursor: default; }
.turn-prev { left: 20px; }
.turn-next { right: 20px; }
/* Opening: the mark breathes while the book loads. */
.loading {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; color: var(--ink-400); pointer-events: none; transition: opacity .4s;
}
.loading[hidden] { display: flex; opacity: 0; visibility: hidden; transition: opacity .4s, visibility 0s .4s; }
.loading-mark { width: 56px; height: 56px; stroke: none; animation: breathe 1.6s ease-in-out infinite; }
.loading-text { font: 600 11px/1 var(--font-body); letter-spacing: .22em; text-transform: uppercase; }
@keyframes breathe { 0%, 100% { opacity: .45; transform: scale(.94); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .loading-mark { animation: none; } }
/* Page placeholder: the thumbnail, softened, until the sharp page fades in over it. */
.page .ph {
  position: absolute; inset: -8px; background-repeat: no-repeat; filter: blur(5px);
  animation: settle 1.4s ease-in-out infinite alternate;
}
@keyframes settle { from { opacity: .8; } to { opacity: 1; } }
.page img { position: relative; z-index: 1; }

/* Thumbnail strip */
.strip { flex: none; height: var(--strip-h); padding: 0 24px 14px; }
.strip-list {
  position: relative; list-style: none; margin: 0 auto; padding: 6px 4px; height: 100%; display: flex; gap: 10px; overflow-x: auto;
  scrollbar-width: thin; scrollbar-color: var(--ink-700) transparent; max-width: 1400px;
}
.strip-list li { flex: none; }
.strip-list button {
  display: block; height: 100%; border-radius: 4px; overflow: hidden; position: relative;
  opacity: .55; transition: opacity .2s, transform .2s;
}
.strip-list button:hover { opacity: .9; }
.strip-list button[aria-current="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--blue-600); }
.strip-list button:focus-visible { opacity: 1; box-shadow: var(--focus); }
.strip-list img { display: block; height: 100%; width: auto; }

/* Contents */
.contents {
  position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0;
  width: min(560px, 100%); max-width: 100%; height: 100%; max-height: 100%;
  border: 0; background: var(--ink-950); color: var(--white); box-shadow: -24px 0 60px rgba(0, 0, 0, .4);
}
.contents::backdrop { background: rgba(8, 10, 22, .6); }
.contents[open] { display: flex; flex-direction: column; animation: slide-in .25s ease-out; }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
.contents-head {
  display: flex; align-items: center; justify-content: space-between; padding: calc(16px + env(safe-area-inset-top)) 20px 12px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.contents-head h2 { margin: 0; font: 600 22px/1.2 var(--font-head); letter-spacing: -.02em; }
.close { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.close:hover { background: rgba(255, 255, 255, .08); }
.contents-list { list-style: none; margin: 0; padding: 8px 12px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; flex: 1; }
.contents-list button {
  width: 100%; display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 14px;
  padding: 8px 12px; border-radius: 10px; text-align: left;
}
.contents-list button:hover { background: rgba(255, 255, 255, .06); }
.contents-list button[aria-current="true"] { background: rgba(55, 170, 218, .14); }
.contents-list .thumb { width: 96px; height: 60px; border-radius: 3px; overflow: hidden; background: var(--ink-800); display: grid; place-items: center; }
.contents-list .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }.contents-list .name { font-size: 14px; color: var(--ink-200); line-height: 1.3; }
.contents-list .chapter .name { font: 600 15px/1.3 var(--font-head); color: var(--white); }
.contents-list .chapter-tag { display: block; font: 600 10px/1 var(--font-body); letter-spacing: .16em; text-transform: uppercase; color: var(--red-600); margin-bottom: 4px; }
.contents-list .num { font-size: 12px; color: var(--ink-400); font-variant-numeric: tabular-nums; }

/* Single-page (phone portrait) mode: PhotoSwipe fills the space under the bar. */
.hint {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 210;
  background: rgba(15, 19, 40, .82); color: var(--ink-200); font-size: 13px; padding: 8px 14px; border-radius: 999px;
  white-space: nowrap; pointer-events: none; transition: opacity .6s;
  display: flex; align-items: center; gap: 8px;
}
.hint svg { width: 18px; height: 18px; color: var(--blue-600); animation: tilt 2.4s ease-in-out infinite; }
@keyframes tilt { 0%, 30% { transform: rotate(0); } 55%, 80% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
.hint.gone { opacity: 0; }
body.single .only-spread, body.spread .only-single { display: none !important; }
/* One page wide window onto the open book: the book is twice the window's width and slides across. */
body.single .stage { padding: 12px 0 calc(56px + env(safe-area-inset-bottom)); overflow: hidden; }
body.single .stage { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
/* Arrows sit together under the page. */
body.single .turn {
  top: auto; transform: none; bottom: calc(14px + env(safe-area-inset-bottom));
  width: 40px; height: 40px; background: rgba(255, 255, 255, .1);
}
body.single .turn-prev { left: calc(50% - 50px); }
body.single .turn-next { right: auto; left: calc(50% + 10px); }
body.single .hint { bottom: calc(84px + env(safe-area-inset-bottom)); }
body.single .book-wrap { flex: none; transition-property: transform, opacity; transition-timing-function: cubic-bezier(.45, 0, .2, 1); }
/* Slide teaser: a small chevron at the inner corner, nudging outwards towards the other page. */
.peek {
  position: absolute; z-index: 6; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; pointer-events: none;
  background: rgba(15, 19, 40, .62); color: var(--white);
  box-shadow: 0 4px 14px rgba(15, 19, 40, .25);
  opacity: 0; transform: scale(.8); transition: opacity .2s, transform .2s;
}
.peek svg { width: 18px; height: 18px; stroke-width: 2.2; }
.peek[data-side="left"] svg { transform: scaleX(-1); }
.peek.on { opacity: 1; transform: none; }
.peek.on svg { animation: peek-nudge 1.1s ease-in-out infinite; }
.peek[data-side="left"].on svg { animation-name: peek-nudge-left; }
@keyframes peek-nudge { 0%, 100% { translate: 0; } 50% { translate: 3px; } }
@keyframes peek-nudge-left { 0%, 100% { translate: 0; } 50% { translate: -3px; } }
@media (prefers-reduced-motion: reduce) { .peek.on svg { animation: none; } }
.pswp { --pswp-bg: var(--ink-950); }
.pswp.pswp--inline { --pswp-root-z-index: 100; z-index: 100; }
.pswp--inline .pswp__top-bar { display: none; }
.pswp__img { background: var(--white); }
.pswp__top-bar { background: linear-gradient(rgba(15, 19, 40, .85), rgba(15, 19, 40, 0)); height: 72px; }
.pswp__counter { color: var(--white); opacity: 1; font: 500 14px/60px var(--font-body); }
.pswp__button--arrow .pswp__icn { filter: drop-shadow(0 0 4px rgba(15, 19, 40, .8)); }

@media (max-width: 899px) {
  .brand { gap: 10px; }
  :root { --bar-h: 56px; }
  .bar { grid-template-columns: auto 1fr auto; padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); gap: 8px; }
  .eyebrow { display: none; }
  .title { font-size: 16px; }
  .tool span { display: none; }
  .tool { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .tool-primary { margin-left: 2px; }
  .pager { max-width: none; padding: 6px 8px; }
  .stage { padding: 16px 64px; }
  .turn { width: 40px; height: 40px; }
  .turn-prev { left: 10px; }
  .turn-next { right: 10px; }
  #btn-contents { display: none; }
}
@media (max-width: 420px) {
  .title .year { display: none; }
}
/* Short landscape screens (a phone on its side): no strip, slimmer bar. */
@media (max-height: 520px) {
  :root { --bar-h: 48px; --strip-h: 0px; }
  .strip { display: none; }
  .eyebrow { display: none; }
  .stage { padding: 8px 64px; }
}
/* A phone on its side: the top bar becomes a slim rail on the left, so the book gets the full height.
   No side arrows (tap, swipe or drag the page); the page count opens the contents. */
@media (orientation: landscape) and (max-height: 500px) {
  body { flex-direction: row; }
  .bar {
    height: auto; width: calc(60px + env(safe-area-inset-left)); flex: none;
    padding: max(10px, env(safe-area-inset-top)) 0 max(10px, env(safe-area-inset-bottom)) env(safe-area-inset-left);
    display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 6px;
    border-bottom: 0; border-right: 1px solid rgba(255, 255, 255, .08);
  }
  .brand { gap: 0; }
  .brand-text { display: none; }
  .mark { width: 30px; height: 30px; }
  .pager { padding: 6px 2px; max-width: 56px; }
  .pager-label { display: none; }
  .pager-count { font-size: 10px; letter-spacing: .02em; display: flex; flex-direction: column; align-items: center; gap: 4px; }
  .pager-count::after { margin: 0; }
  .tools { flex-direction: column; justify-content: flex-end; gap: 2px; }
  .tool { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .tool span, #btn-contents { display: none; }
  .tool-primary { margin: 6px 0 0; }
  .stage { padding: 6px max(10px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) 10px; }
  .turn, .strip { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .book-wrap, .page img, .contents[open] { transition: none; animation: none; }
}
.noscript { position: fixed; inset: auto 0 0; padding: 16px; background: var(--white); color: var(--ink-950); text-align: center; }
