/* Clare Corporate flipbook viewer */
@font-face { font-family: "Raleway"; font-weight: 300; src: url(fonts/Raleway-300.woff) format("woff"); font-display: swap; }
@font-face { font-family: "Raleway"; font-weight: 400; src: url(fonts/Raleway-400.woff) format("woff"); font-display: swap; }
@font-face { font-family: "Raleway"; font-weight: 500; src: url(fonts/Raleway-500.woff) format("woff"); font-display: swap; }
@font-face { font-family: "Raleway"; font-weight: 600; src: url(fonts/Raleway-600.woff) format("woff"); font-display: swap; }

:root {
  --ink: #1c2430;
  --ink-2: #26303d;
  --ink-3: #2a2a2a;
  --paper: #f4f1ec;
  --brass: #b08d57;
  --brass-2: #c4a26f;
  --line: rgba(255, 255, 255, .10);
  --text: #f2f2f2;
  --muted: #a3a3a3;
  --bar: 56px;
  --pw: 400px;  /* page width, set by viewer.js */
  --ph: 566px;  /* page height */
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(ellipse at 50% 45%, #3a4656 0%, var(--ink) 70%);
  background-color: var(--ink);
  color: var(--text);
  font: 400 14px/1.45 "Raleway", system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}
button, input, a { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brass-2); outline-offset: 2px; }

/* ---- bars ---- */
.bar { position: fixed; left: 0; right: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 0 14px; height: var(--bar); background: rgba(28, 36, 48, .94); backdrop-filter: blur(8px); }
.bar.top { top: 0; border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); height: calc(var(--bar) + env(safe-area-inset-top)); }
.bar.bottom { bottom: 0; border-top: 1px solid var(--line); justify-content: center; padding-bottom: env(safe-area-inset-bottom); height: calc(var(--bar) + env(safe-area-inset-bottom)); }
.brand { display: flex; align-items: center; flex: none; }
.brand img { height: 34px; width: auto; display: block; }
.title { flex: 1; min-width: 0; margin: 0 0 0 10px; padding-left: 14px; border-left: 1px solid var(--line); font: 500 12px/1.1 "Raleway", sans-serif; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tools { display: flex; align-items: center; gap: 2px; flex: none; }
.tool { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; color: var(--text); text-decoration: none; }
.tool:hover { background: rgba(255, 255, 255, .08); }
.tool[aria-pressed="true"] { background: rgba(255, 255, 255, .14); }
.cta { display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin-left: 8px; padding: 0 18px; height: 38px; border-radius: 2px; background: var(--brass); color: #fff; font-weight: 600; font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; text-decoration: none; white-space: nowrap; }
.cta:hover { background: var(--brass-2); }
.cta.big { width: 100%; height: 48px; margin: 8px 0 0; font-size: 15px; }
.cta.ghost { background: transparent; border: 1px solid var(--line); }
.cta.ghost:hover { background: rgba(255, 255, 255, .06); }

.scrub { width: min(520px, 50vw); accent-color: var(--brass); }
.where { min-width: 92px; height: 36px; padding: 0 10px; border-radius: 8px; font-variant-numeric: tabular-nums; color: var(--muted); }
.where:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.where input { width: 56px; height: 28px; text-align: center; border: 1px solid var(--line); border-radius: 6px; background: var(--ink-2); }

/* ---- stage + book ---- */
.stage { position: fixed; inset: calc(var(--bar) + env(safe-area-inset-top)) 0 calc(var(--bar) + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.book { position: relative; width: calc(var(--pw) * 2); height: var(--ph); perspective: 2600px; user-select: none; -webkit-user-select: none; touch-action: none; cursor: grab; }
.book.ready { transition: transform .5s cubic-bezier(.4, 0, .2, 1); }
.book.single { width: var(--pw); }
.book.dragging { cursor: grabbing; }
.half, .face { position: absolute; top: 0; width: var(--pw); height: var(--ph); background-color: var(--paper); background-size: cover; overflow: hidden; }
.half.left { left: 0; }
.half.right { left: var(--pw); }
.book.single .half.left { display: none; }
.book.single .half.right { left: 0; }
.half.empty, .face.empty { background: transparent !important; box-shadow: none !important; }
.half.empty img, .face.empty img { display: none; }
.half { box-shadow: 0 18px 50px rgba(0, 0, 0, .35); }
.half img, .face img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.half img:not([src]), .face img:not([src]) { visibility: hidden; }

/* page-gutter shading (double mode only) */
.book:not(.single) .half.left::after, .book:not(.single) .half.right::after { content: ""; position: absolute; top: 0; bottom: 0; width: 9%; pointer-events: none; }
.book:not(.single) .half.left::after { right: 0; background: linear-gradient(to left, rgba(0, 0, 0, .18), transparent); }
.book:not(.single) .half.right::after { left: 0; background: linear-gradient(to right, rgba(0, 0, 0, .16), transparent); }
.half.empty::after { display: none; }

.leaf { position: absolute; top: 0; width: var(--pw); height: var(--ph); transform-style: preserve-3d; z-index: 5; will-change: transform; }
.face { left: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face.back { transform: rotateY(180deg); }
.face.blank { background: var(--paper); }
.face.blank img { display: none; }
.shade { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.face.front .shade { background: linear-gradient(to left, rgba(0, 0, 0, .05), rgba(0, 0, 0, .45)); }
.face.back .shade { background: linear-gradient(to right, rgba(0, 0, 0, .05), rgba(0, 0, 0, .45)); }
.leaf.from-left .face.front .shade { background: linear-gradient(to right, rgba(0, 0, 0, .05), rgba(0, 0, 0, .45)); }
.leaf.from-left .face.back .shade { background: linear-gradient(to left, rgba(0, 0, 0, .05), rgba(0, 0, 0, .45)); }
.spine { display: none; }

.arrow { position: absolute; top: 50%; z-index: 6; width: 48px; height: 48px; margin-top: -24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(28, 36, 48, .55); color: #fff; transition: opacity .2s, background .2s; }
.arrow:hover { background: rgba(28, 36, 48, .9); }
.arrow svg { width: 24px; height: 24px; }
.arrow.prev { left: 16px; }
.arrow.next { right: 16px; }
.arrow:disabled { opacity: 0; pointer-events: none; }

/* ---- side panels ---- */
.panel { position: fixed; z-index: 30; top: calc(var(--bar) + env(safe-area-inset-top)); bottom: 0; right: 0; width: min(380px, 100vw); display: flex; flex-direction: column; background: var(--ink); border-left: 1px solid var(--line); box-shadow: -20px 0 50px rgba(0, 0, 0, .35); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 8px 18px; }
.panel h2 { margin: 0; font: 600 12px/1 "Raleway", sans-serif; letter-spacing: .22em; text-transform: uppercase; }
.sections { list-style: none; margin: 0; padding: 0 10px 8px; }
.sections:empty { display: none; }
.sections button { display: flex; width: 100%; justify-content: space-between; gap: 12px; padding: 9px 8px; border-radius: 6px; text-align: left; }
.sections button:hover { background: rgba(255, 255, 255, .06); }
.sections span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.thumbs { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px 10px; padding: 8px 18px 24px; align-content: start; }
.thumb { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.thumb i { display: block; width: 100%; background-color: var(--ink-3); background-repeat: no-repeat; border-radius: 2px; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.thumb.current i { outline: 2px solid var(--brass); outline-offset: 2px; }
.thumb:hover { color: var(--text); }

.search-box { margin: 4px 18px 6px; height: 42px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--ink-2); font-size: 15px; }
.search-note { margin: 4px 18px 8px; color: var(--muted); font-size: 12px; min-height: 1em; }
.results { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 0 10px 24px; }
.results button { display: grid; grid-template-columns: 44px 1fr; gap: 12px; width: 100%; padding: 8px; border-radius: 6px; text-align: left; align-items: start; }
.results button:hover { background: rgba(255, 255, 255, .06); }
.results i { display: block; width: 44px; background-color: var(--ink-3); background-repeat: no-repeat; }
.results b { display: block; font-weight: 600; font-size: 12px; color: var(--brass-2); letter-spacing: .04em; }
.results mark { background: rgba(168, 135, 90, .45); color: #fff; border-radius: 2px; padding: 0 1px; }
.results small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; }

/* ---- enquire sheet ---- */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 14, 20, .6); }
.sheet-card { position: relative; width: min(400px, 100%); padding: 30px 26px 24px; border-radius: 4px; background: var(--ink); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.sheet-card h2 { margin: 0 0 10px; font: 300 26px/1.15 "Raleway", sans-serif; letter-spacing: .04em; text-transform: uppercase; }
.sheet-card .tie { display: block; height: 44px; margin-bottom: 18px; }
.sheet-card p { margin: 0 0 12px; color: var(--muted); }
.sheet-card .small { margin: 14px 0 0; font-size: 12px; text-align: center; }
.sheet-close { position: absolute; top: 10px; right: 10px; }

/* ---- zoom ---- */
.zoom { position: fixed; inset: 0; z-index: 50; background: #11161d; }
.zoom-scroll { position: absolute; inset: 0; overflow: auto; touch-action: pan-x pan-y; cursor: grab; }
.zoom-scroll.panning { cursor: grabbing; }
.zoom-inner { display: flex; margin: auto; padding: 24px; width: max-content; min-width: 100%; min-height: 100%; align-items: center; justify-content: center; }
.zoom-inner img { display: block; background: var(--paper); box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.zoom-tools { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; gap: 6px; padding: 6px; border-radius: 4px; background: rgba(28, 36, 48, .94); border: 1px solid var(--line); }

/* ---- toast ---- */
.toast { position: fixed; left: 50%; bottom: calc(var(--bar) + 18px + env(safe-area-inset-bottom)); z-index: 60; transform: translate(-50%, 20px); padding: 10px 16px; border-radius: 999px; background: var(--paper); color: var(--ink); font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.noscript { position: fixed; inset: 40% 16px auto; text-align: center; }

/* ---- small screens ---- */
@media (max-width: 720px) {
  :root { --bar: 52px; }
  .bar { padding: 0 8px; gap: 4px; }
  .brand img { height: 28px; }
  .title { display: none; }
  .tools { margin-left: auto; }
  .tool { width: 38px; height: 38px; }
  .hide-sm { display: none !important; }
  .cta { padding: 0 10px; margin-left: 4px; font-size: 11px; letter-spacing: .12em; height: 34px; }
  .tool { width: 34px; }
  .arrow { display: none; }
  .scrub { width: 40vw; }
}
@media (prefers-reduced-motion: reduce) {
  .book { transition: none; }
}

/* ---- Clare touches ---- */
.progress { position: absolute; left: 0; top: -1px; height: 2px; width: 0; background: var(--brass); transition: width .4s ease; }
.loader { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: var(--ink); transition: opacity .5s ease, visibility .5s; }
.loader img { height: 84px; animation: swing 1.6s ease-in-out infinite; transform-origin: 50% 0; }
.loader span { font: 600 11px/1 "Raleway", sans-serif; letter-spacing: .32em; text-transform: uppercase; color: var(--muted); }
.loader.done { opacity: 0; visibility: hidden; }
@keyframes swing { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.nudge { position: fixed; left: 50%; bottom: calc(var(--bar) + 18px + env(safe-area-inset-bottom)); z-index: 25; transform: translate(-50%, 20px); display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 18px; border-radius: 3px; background: var(--paper); color: var(--ink); box-shadow: 0 16px 40px rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; font-weight: 500; }
.nudge.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.nudge .cta { margin: 0; height: 34px; }
@media (prefers-reduced-motion: reduce) { .loader img { animation: none; } }
@media (max-width: 720px) { .nudge { width: calc(100% - 32px); justify-content: space-between; font-size: 13px; } }
