/* ============================================================= *
 *  Ned Beauman — production stylesheet
 *  Self-hosted fonts only. No external requests.
 * ============================================================= */

/* ----------  Onlysans (licensed) — Regular only  ---------- */
@font-face {
  font-family: "Onlysans";
  src: url("../fonts/Onlysans-Regular.woff2") format("woff2"),
       url("../fonts/Onlysans-Regular.woff") format("woff");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

/* ----------  Hanken Grotesk (SIL OFL) — body / labels  ---------- */
@font-face {
  font-family: "Hanken Grotesk";
  src: url("../fonts/HankenGrotesk-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("../fonts/HankenGrotesk-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("../fonts/HankenGrotesk-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("../fonts/HankenGrotesk-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --bg: #ffffff;
  --font-body: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;

  --slab-face: #ffffff;
  --slab-top: #f1f1ef;
  --slab-side: #e7e7e4;
  --slab-bottom: #dededa;
  --line: #111;
  --line-soft: #c7c7c2;

  --ink: #1b1b1f;
  --ink-dim: #6b6b6b;
  --accent: #111;

  --font-display: "Onlysans", ui-sans-serif, sans-serif;
  --font-mono: "Onlysans", ui-monospace, monospace;

  /* finalized design tokens (formerly tweaks) */
  --wash: #9e6b86;
  --bob: 9px;
  --float-dur: 11s;
  --os-weight: 400;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#root { height: 100%; width: 100%; }

/* When the mobile reading layout is active, let the page scroll. */
html.is-mobile, body.is-mobile { height: auto; overflow-y: auto; overflow-x: hidden; }
body.is-mobile #root { height: auto; }

/* ---- Background wash ---- */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(155deg,
    var(--wash) 0%,
    color-mix(in srgb, var(--wash) 45%, #ffffff) 38%,
    #ffffff 82%);
}
.stage-inner { z-index: 1; }

/* ---- Stage ---- */
.stage {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  perspective: 3200px;
  perspective-origin: 50% 50%;
}
.stage-inner {
  position: relative;
  transform-style: preserve-3d;
  width: 1px;
  height: 1px;
  transition: transform 1.0s cubic-bezier(0.65, 0, 0.18, 1);
}

/* ---- Slab ---- */
.cube-anchor {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  transform-style: preserve-3d;
  will-change: transform;
  transition:
    transform 1.0s cubic-bezier(0.65, 0, 0.18, 1),
    opacity 0.6s ease;
}

.cube {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-style: preserve-3d;
  cursor: pointer;
  animation: float var(--float-dur) ease-in-out infinite;
  transform-origin: center center;
  will-change: transform;
}
.cube.no-float {
  animation: none;
  transform: rotateX(var(--static-rx)) rotateY(var(--static-ry)) rotateZ(var(--static-rz));
}

@keyframes float {
  0%, 100% { transform: translate3d(0, calc(-1 * var(--bob)), 0.01px) rotateX(-6deg) rotateY(-15deg); }
  50%      { transform: translate3d(0,  var(--bob), 0.01px) rotateX(-5deg) rotateY(-12deg); }
}

.cube.sway-vert { animation-name: floatVert; }
@keyframes floatVert {
  0%, 100% { transform: translate3d(0, calc(-1.1 * var(--bob)), 0.01px) rotateX(0deg) rotateY(0deg); }
  50%      { transform: translate3d(0,  calc(1.1 * var(--bob)), 0.01px) rotateX(0deg) rotateY(0deg); }
}

.cube.turn-left { animation-name: floatTurnLeft; }
@keyframes floatTurnLeft {
  0%, 100% { transform: translate3d(0, calc(-1 * var(--bob)), 0.01px) rotateX(-6deg) rotateY(-26deg); }
  50%      { transform: translate3d(0,  var(--bob), 0.01px) rotateX(-5deg) rotateY(-23deg); }
}

@media (prefers-reduced-motion: reduce) {
  .cube { animation: none; transform: rotateX(-6deg) rotateY(-14deg); }
  .cube.sway-vert { transform: rotateX(0deg) rotateY(0deg); }
  .cube.turn-left { transform: rotateX(-6deg) rotateY(-24deg); }
}

.face {
  position: absolute;
  left: 50%;
  top: 50%;
  overflow: hidden;
  background: var(--slab-face);
  border: 1px solid var(--line);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.face.face-front  {
  background: var(--slab-face);
  box-shadow: 0 22px 34px rgba(22,20,20,0.13), 0 3px 8px rgba(22,20,20,0.06);
}
.face.face-back   { background: var(--slab-face); }
.face.face-top    { background: var(--slab-top); }
.face.face-bottom { background: var(--slab-bottom); }
.face.face-left   { background: var(--slab-side); }
.face.face-right  { background: var(--slab-side); }

/* Dark slab — white-on-black variant (The Captive) */
.cube.dark-slab {
  --slab-face: #141416;
  --slab-top: #25252a;
  --slab-side: #1a1a1d;
  --slab-bottom: #0d0d0f;
  --ink: #f4f4f2;
  --accent: #c11414;
  --line: #2c2c30;
}
.cube.dark-slab.focused .face-front { box-shadow: 0 26px 44px rgba(0,0,0,0.5), 0 0 0 1px var(--accent); }
.cube.dark-slab .cover-img { border-color: #f4f4f2; box-shadow: 0 8px 22px rgba(0,0,0,0.45); }
.cube.dark-slab .face-content .body { color: #f4f4f2; }

/* Face content */
.face-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 11%;
  text-align: left;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: var(--os-weight);
  pointer-events: none;
  z-index: 2;
}
.face-content .kicker {
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.6em;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.1em;
}
.face-content .kicker.kicker-bottom {
  position: absolute;
  left: 11%;
  bottom: 9%;
  margin: 0;
  max-width: 60%;
}
.face-content .infobox {
  position: absolute;
  right: 14px;
  bottom: 14px;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  text-align: right;
  max-width: 56%;
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: var(--ink-dim);
}
.face-content > .marker {
  position: absolute;
  right: 11%;
  bottom: 9%;
  margin: 0;
  text-align: right;
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.6em;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
.face-content .title {
  font-size: 2.8em;
  line-height: 0.98;
  letter-spacing: -0.02em;
  font-weight: var(--os-weight);
  text-transform: none;
  text-wrap: pretty;
}
.face-content .sub {
  margin-top: 0.8em;
  font-size: 0.62em;
  color: var(--ink-dim);
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.04em;
}
.face-content .body {
  font-family: var(--font-body);
  font-size: 0.66em;
  line-height: 1.5;
  font-weight: 400;
  max-width: 100%;
  color: #36363a;
  text-align: left;
  text-wrap: pretty;
}
.face-content .body p { margin: 0 0 0.8em; }
.face-content .body em { font-style: italic; }
.face-content .year {
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.55em;
  color: var(--ink-dim);
  letter-spacing: 0.12em;
}
.face-content .extras {
  margin-top: 2em;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.64em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  pointer-events: auto;
}
.face-content .link-chip {
  padding: 4px 9px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  text-decoration: none;
  white-space: normal;
  max-width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.face-content .link-chip:hover { background: var(--accent); color: #fff; }
.face-content .link-chip em { font-style: italic; }

.face-content .caption {
  margin-top: 0.5em;
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.42em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-align: center;
}
.ph-col { display: flex; flex-direction: column; flex: 0 0 34%; align-self: center; }
.ph-col .placeholder { flex: 0 0 auto; width: 100%; margin-bottom: 0; max-height: none; }
.ph-col .cover-img { flex: 0 0 auto; width: 100%; margin-bottom: 0; max-height: none; }

.face-content .back-chip {
  position: absolute;
  top: 26px;
  right: 11%;
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.56em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.15s;
}
.face-content .back-chip:hover { color: var(--accent); }

.face-content .subscribe {
  margin-top: 1em;
  display: flex;
  gap: 6px;
  pointer-events: auto;
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
}
.face-content .subscribe input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: inherit;
  font-size: 0.6em;
  padding: 0.6em 0.75em;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.face-content .subscribe input:focus { outline: none; border-color: var(--accent); }
.face-content .subscribe button {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.6em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.6em 1em;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.placeholder {
  width: 52%;
  aspect-ratio: 2/3;
  background:
    repeating-linear-gradient(135deg,
      rgba(22,20,20,0.07) 0 7px,
      transparent 7px 14px);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.46em;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin-bottom: 1em;
}
.placeholder.wide { aspect-ratio: 4/5; width: 44%; }

.cover-img {
  width: 52%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(22,20,20,0.22);
  margin-bottom: 1em;
}
.cover-img.wide { aspect-ratio: 4/5; width: 44%; }
.ph-col:has(.cover-img.wide) { flex: 0 0 auto; align-self: stretch; justify-content: center; }
.ph-col .cover-img.wide { height: 100%; width: auto; aspect-ratio: 1791 / 2397; object-fit: cover; }

.cube.focused .face-front { box-shadow: 0 26px 44px rgba(22,20,20,0.18), 0 0 0 1px var(--accent); }

.scene-shift { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }

/* depth tiers */
.tier {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  transition: transform 1.0s cubic-bezier(0.65, 0, 0.18, 1), opacity 0.8s ease;
}
.tier-in {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  transform-style: preserve-3d;
}
.tier-back { pointer-events: auto; }
.tier-back .face-front { box-shadow: 0 14px 22px rgba(22,20,20,0.10); }

/* detail two-column (image + text) */
.detail-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8%;
  width: 100%;
  height: 100%;
}
.detail-text { flex: 1; text-align: left; }
.detail-text .body { max-width: 100%; }
.detail-text .kicker { text-align: left; }
.detail-row > .placeholder { flex: 0 0 30%; margin-bottom: 0; align-self: center; max-height: 84%; }
.detail-text .body { font-size: 0.56em; line-height: 1.5; }
.detail-text .body p { margin: 0 0 0.55em; }
.detail-text .extras { margin-top: 0.7em; }

/* ---- Buy panel ---- */
.buy-slab .face-content { justify-content: flex-start; padding: 5.5% 7% 8%; }
.buy-head { margin-bottom: 0.7em; max-width: 64%; }
.buy-book-title {
  font-family: var(--font-display);
  font-size: 1.12em;
  line-height: 1.02;
  letter-spacing: -0.01em;
  font-weight: var(--os-weight);
  text-wrap: pretty;
}
.buy-book-title em { font-style: italic; }
.buy-cols {
  display: flex;
  gap: 2em;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
}
.buy-cols.single { gap: 0; }
.buy-col { display: flex; flex-direction: column; }
.buy-region {
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.5em;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding-bottom: 0.4em;
  margin-bottom: 0.6em;
  border-bottom: 1px solid var(--line-soft);
  width: 100%;
}
.buy-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.34em;
}
.buy-list a {
  pointer-events: auto;
  white-space: nowrap;
  font-family: var(--font-body);
  font-size: 0.72em;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.buy-list a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.buy-slab .back-chip { white-space: nowrap; top: 7%; right: 7%; }

/* photo credit */
.photo-credit {
  position: fixed;
  bottom: 16px;
  right: 20px;
  z-index: 20;
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  opacity: 0.5;
  pointer-events: none;
}

/* ============================================================= */
/* Mobile reading layout                                          */
/* ============================================================= */
.m-site {
  min-height: 100%;
  background: linear-gradient(176deg,
    var(--wash) 0%,
    color-mix(in srgb, var(--wash) 40%, #ffffff) 30%,
    #ffffff 70%);
  color: var(--ink);
  font-family: "Onlysans", var(--font-body);
  padding: 0 22px calc(48px + env(safe-area-inset-bottom));
  max-width: 620px;
  margin: 0 auto;
}
.m-head { padding: 46px 0 8px; }
.m-name {
  margin: 0;
  font-family: "Onlysans", var(--font-display);
  font-weight: var(--os-weight);
  font-size: 40px;
  line-height: 1.0;
  letter-spacing: -0.01em;
}
.m-sub {
  margin-top: 10px;
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.m-section-title {
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 38px 0 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line-soft);
}
.m-body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 0.85em;
}
.m-body em { font-style: italic; }

.m-about { padding-top: 30px; }
.m-portrait {
  display: block;
  width: 100%;
  max-width: 340px;
  border-radius: 2px;
  box-shadow: 0 10px 30px rgba(22,20,20,0.16);
  margin-bottom: 10px;
}
.m-cover-credit {
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 6px 0 16px;
}

.m-book {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 18px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line-soft);
  align-items: start;
}
.m-cover {
  width: 96px;
  border-radius: 2px;
  box-shadow: 0 8px 20px rgba(22,20,20,0.18);
}
.m-cover-ph {
  display: flex;
  align-items: center;
  text-align: center;
  padding: 10px;
  min-height: 140px;
  background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: none;
  font-family: "Onlysans", var(--font-display);
  font-size: 15px;
  line-height: 1.1;
  color: var(--ink);
}
.m-eyebrow {
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.m-book-title {
  margin: 0;
  font-family: "Onlysans", var(--font-display);
  font-weight: var(--os-weight);
  font-size: 23px;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.m-year {
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
  margin: 5px 0 11px;
}
.m-book .m-body { font-size: 15px; }

.m-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.m-link, .m-buy-btn {
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding: 7px 12px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: none;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.m-buy-btn { background: var(--accent); color: #fff; }

.m-buy-cols {
  display: flex;
  gap: 30px;
  margin-top: 14px;
}
.m-buy-cols.single { gap: 0; }
.m-buy-region {
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.m-buy-cols ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.m-buy-cols a {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 1px;
}

.m-mailing { padding-bottom: 10px; }
.m-subscribe {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.m-subscribe input {
  flex: 1 1 180px;
  min-width: 0;
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.m-subscribe input:focus { outline: none; border-color: var(--accent); }
.m-subscribe button {
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 11px 18px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.m-foot {
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* shed canvas (particles) */
.shed-canvas { position: absolute; pointer-events: none; }
