/* ==========================================================================
   Digital Real Estate — Leon Wankum
   Built from Figma page 2 (file 6jvlwFQlUXN390QZlCrm3P, node 2:2).
   Desktop: every section is one 1280x764 Figma frame. --u is one Figma pixel,
   scaled so the frame fits the viewport, and all geometry is written in it.
   Mobile: the same components, stacked, sized in rem.
   ========================================================================== */

@font-face {
  font-family: 'Gothic CG No1';
  src: url('../fonts/GothicCGNo1.woff2') format('woff2'),
       url('../fonts/GothicCGNo1.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* --- Tokens -------------------------------------------------------------- */

:root {
  --orange: #f7931a;
  --orange-hover: #ff9f3f;
  --bg: #111111;
  --ink: #000000;
  --white: #ffffff;
  --font: 'Gothic CG No1', 'Franklin Gothic Demi Cond', 'Helvetica Neue', Arial, sans-serif;

  --u: min(calc(100vw / 1280), calc(100svh / 764));

  /* Type: three sizes, one leading. Every text element uses one of these;
     Figma values in between are rounded to the nearest step. */
  --fs-s: calc(24.518 * var(--u));  /* nav, footer */
  --fs-m: calc(34.805 * var(--u));  /* text, headings, header button */
  --fs-l: calc(49.646 * var(--u));  /* large buttons */
  --lh: 0.95;

  /* Header button in Figma: 55.72 tall, 34.18 type, 16.84 side pad. */
  --btn-gap: calc(14.8 * var(--u));
  --btn-pad: calc(13 * var(--u));
}

/* --- Base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font);
  font-weight: normal;
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; }
h1, h2, h3, p, blockquote { margin: 0; font-weight: normal; }
a { color: inherit; text-decoration: none; }

/* --- Button -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--orange);
  color: var(--ink);
  text-transform: uppercase;
  white-space: nowrap;
  /* Gothic CG No1 carries extra space under the baseline, so centred caps
     sit high. Pushing the content box down by 0.18em centres the caps. */
  padding-top: 0.18em;
  /* Every button uses the header button's padding around the caps, whatever
     its font size: cap height (0.765em in Gothic CG No1) plus a fixed gap
     above and below, a fixed pad at the sides. Sizes only set font-size. */
  height: calc(0.765em + 2 * var(--btn-gap));
  padding-inline: var(--btn-pad);
  transition: background-color 0.2s ease;
}

.btn:hover { background: var(--orange-hover); }

.btn--lg { font-size: var(--fs-l); }

.btn--sm { font-size: var(--fs-m); }

/* --- Chrome: frame + header ---------------------------------------------- */

/* Fixed to the viewport. The margin outside the line is filled solid (a
   spread shadow), so content scrolling underneath never shows there. */
.frame {
  position: fixed;
  inset: calc(13 * var(--u));
  box-shadow: 0 0 0 100vmax var(--bg);
  border: max(2px, calc(4 * var(--u))) solid var(--orange);
  pointer-events: none;
  z-index: 40;
}

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  pointer-events: none;
}

.site-header > * { pointer-events: auto; }

.logo {
  position: absolute;
  left: calc(49.78 * var(--u));
  top: calc(47.45 * var(--u));
  width: calc(228.02 * var(--u));
}

.logo img { width: 100%; height: auto; }

.nav {
  position: absolute;
  left: 50%;
  top: calc(43.5 * var(--u));
  transform: translateX(-50%);
  display: flex;
  gap: calc(23 * var(--u));
  color: var(--orange);
  text-transform: uppercase;
  white-space: nowrap;
  font-size: var(--fs-s);
}

.nav a {
  text-decoration-thickness: max(2px, calc(2.5 * var(--u)));
  text-underline-offset: calc(5 * var(--u));
}

.nav a:hover,
.nav a[aria-current] { text-decoration-line: underline; }

.lang-switch { display: inline-flex; gap: calc(8 * var(--u)); align-items: center; }
.lang-switch button {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: inherit; font: inherit; text-transform: uppercase;
}
.lang-switch button[aria-pressed="true"] { text-decoration-line: underline; text-decoration-thickness: max(2px, calc(2.5 * var(--u))); text-underline-offset: calc(5 * var(--u)); }
.lang-switch button:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }

.header-cta {
  position: absolute;
  right: calc(50.28 * var(--u));
  top: calc(47.45 * var(--u));
  transition: opacity 0.25s ease, visibility 0.25s;
}

/* Frame on/off for comparison: ?frame=0 */
.no-frame .frame { display: none; }

/* The book section carries its own large CTA. */
body[data-active="book"] .header-cta {
  opacity: 0;
  visibility: hidden;
}

/* On scroll the header becomes a solid compact bar and the logo shrinks
   (STG-08 + user, 2026-11-25). Homepage only: appendix pages (body.v5)
   keep their static solid header. */
.site-header { transition: background-color 0.25s ease, box-shadow 0.25s ease, height 0.25s ease; }
.logo { transition: width 0.25s ease, top 0.25s ease; }
.nav { transition: top 0.25s ease; }

body:not(.v5).is-scrolled .site-header {
  background: var(--bg);
  box-shadow: 0 1px 0 rgba(247, 147, 26, 0.4);
  height: calc(118 * var(--u));
}
body:not(.v5).is-scrolled .logo { width: calc(124 * var(--u)); top: calc(31 * var(--u)); }
body:not(.v5).is-scrolled .nav { top: calc(42 * var(--u)); }
body:not(.v5).is-scrolled .header-cta { top: calc(31 * var(--u)); }

/* --- Sections ------------------------------------------------------------ */

.panel {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: start;
}

.canvas {
  position: relative;
  flex: none;
  width: calc(1280 * var(--u));
  height: calc(764 * var(--u));
}

.canvas > * { position: absolute; }

/* Book and author text share one left edge (the quote's, 69.95). */
:root { --text-left: calc(69.95 * var(--u)); }

/* Book */
.book-quotes {
  left: var(--text-left);
  top: calc(263.1 * var(--u));
  width: calc(701.74 * var(--u));
  font-size: var(--fs-m);
}

/* All quotes share one cell, so the block keeps the height of the longest
   and nothing below it jumps when they change. */
.quote-stack { display: grid; }

.quote {
  grid-area: 1 / 1;
  margin: 0;
  visibility: hidden;
}

.quote {
  opacity: 0;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.quote.is-active { visibility: visible; opacity: 1; }

/* Quotes that would push the block into the button below drop one step. */
.quote--long { font-size: var(--fs-s); }

.quote-nav {
  display: flex;
  margin-top: calc(14 * var(--u));
  /* Pull the first dot's tap padding back so the dot lines up with the text. */
  margin-left: calc(-4 * var(--u));
}

/* Dots: the button is the tap target, the ::before is the visible dot. */
.quote-dot {
  padding: calc(8 * var(--u)) calc(4 * var(--u));
  border: 0;
  background: none;
  cursor: pointer;
}

.quote-dot::before {
  content: '';
  display: block;
  width: max(9px, calc(13 * var(--u)));
  aspect-ratio: 1;
  border-radius: 50%;
  border: max(1.5px, calc(2 * var(--u))) solid var(--orange);
  transition: background-color 0.2s ease;
}

.quote-dot:hover::before,
.quote-dot[aria-current]::before { background: var(--orange); }

.quote-dot:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .quote { transition: none; }
}

.quote footer {
  color: var(--orange);
  margin-top: 1lh;
}

.book-cta {
  left: calc(69.46 * var(--u));
  top: calc(587 * var(--u));
}

/* Real 6x9in proportions (432 x 648pt). Same height as the Figma slot, right
   edge kept at 1182.84 so the portrait still lines up with it. */
.book-cover {
  left: calc((1182.84 - 356.24) * var(--u));
  top: calc(115.07 * var(--u));
  width: calc(356.24 * var(--u));
  height: calc(534.06 * var(--u));
  display: block;
  /* Everything in the 3D book is sized off the cover width (cqw), so it holds
     its proportions at every viewport. */
  container-type: inline-size;
}

/* --- 3D book --------------------------------------------------------------
   A box with four faces turning on the Y axis: front and back cover, spine
   on the left, page block on the right. Every face is centred in the box and
   pushed out along its own normal. Thickness from the print file: spine
   64.56pt on a 432pt cover = 14.94cqw.
   -------------------------------------------------------------------------- */

.book {
  --depth: 14.94cqw;
  --half: calc(var(--depth) / 2);
  --inset: 0.9cqw;     /* covers overhang the pages top and bottom */
  --overhang: 0.3cqw;  /* ...and barely at the fore edge */
  --page-w: calc(var(--depth) - 0.6cqw);
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  /* Start angle; book.js turns it (slow spin + drag). */
  transform: perspective(420cqw) rotateY(-28deg);
}

.book-cover {
  cursor: grab;
  touch-action: pan-y;  /* vertical swipes still scroll, horizontal ones turn */
  -webkit-user-select: none;
  user-select: none;
}

.book-cover.is-dragging { cursor: grabbing; }

.book > * {
  position: absolute;
  display: block;
  backface-visibility: hidden;
}

.book__front,
.book__back {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book__front { transform: translateZ(var(--half)); }
.book__back  { transform: rotateY(180deg) translateZ(var(--half)); }

/* A hair wider than the book is thick, so its edges tuck under the covers
   and no seam shows at the corners. */
.book__spine {
  top: 0;
  left: calc(50% - var(--half) - 0.15cqw);
  width: calc(var(--depth) + 0.3cqw);
  height: 100%;
  object-fit: cover;
  transform: rotateY(-90deg) translateZ(50cqw);
}

/* Page block. The face is foreshortened to a few pixels, so hard sub-pixel
   stripes turn into moire bands. Soft paper shading plus barely-there lines
   instead. */
.book__pages {
  top: var(--inset);
  left: calc(50% - var(--page-w) / 2);
  width: var(--page-w);
  height: calc(100% - 2 * var(--inset));
  transform: rotateY(90deg) translateZ(calc(50cqw - var(--overhang)));
  background:
    repeating-linear-gradient(90deg, transparent 0 3px, rgba(0, 0, 0, 0.035) 3px 4px),
    linear-gradient(90deg, #cfccc4 0%, #fbfaf7 18%, #f3f1ec 55%, #fbfaf7 85%, #dedbd3 100%);
}

/* Scroll-down cue on the book panel: takes the reader to the author panel. */
.scroll-down {
  left: 50%;
  top: calc(692 * var(--u));
  transform: translateX(-50%);
  width: calc(52 * var(--u));
  height: calc(52 * var(--u));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--orange);
}
.scroll-down svg { width: 100%; height: auto; animation: scroll-cue 2.2s ease-in-out infinite; }
.scroll-down:hover { color: var(--orange-hover); }
.scroll-down:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }
@keyframes scroll-cue {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(calc(7 * var(--u))); }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-down svg { animation: none; }
}

/* Author */
/* Author: laid out as a grid, not absolutely, so the section grows with the
   bio instead of running out of the frame. Text column = quote width, the
   portrait's right edge lines up with the 3D book's (1178.1). */
.author-heading { text-transform: uppercase; font-size: var(--fs-m); }
.author-bio { font-size: var(--fs-m); }
.author-portrait { object-fit: cover; }

@media (min-width: 821px) and (min-aspect-ratio: 1001/1000) {
  .canvas--author {
    height: auto;
    min-height: calc(764 * var(--u));
    display: grid;
    grid-template-columns: calc(701.74 * var(--u)) 1fr calc(330.6 * var(--u));
    grid-template-rows: auto 1fr auto;
    align-content: start;
    row-gap: calc(26.3 * var(--u));
    padding: calc(236.16 * var(--u)) calc(101.9 * var(--u)) calc(80 * var(--u)) var(--text-left);
  }

  .canvas--author > * { position: static; }
  .author-heading { grid-column: 1; grid-row: 1; }
  .author-bio { grid-column: 1; grid-row: 2; }
  .author-socials { grid-column: 1; grid-row: 3; }

  .author-portrait {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: start;
    width: 100%;
    height: calc(460.83 * var(--u));
  }
}

/* Video */
.video-thumb {
  left: calc(326.71 * var(--u));
  top: calc(206.84 * var(--u));
  width: calc(626.58 * var(--u));
  height: calc(350.31 * var(--u));
}

.video-thumb img { width: 100%; height: 100%; object-fit: cover; }

.video-cta {
  left: 50%;
  top: calc(600.2 * var(--u));
  transform: translateX(-50%);
}

/* Extended appendix */
.appendix-text {
  left: 50%;
  top: calc(307 * var(--u));
  width: calc(942.87 * var(--u));
  transform: translateX(-50%);
  text-align: center;
  font-size: var(--fs-m);
}

.appendix-cta {
  left: 50%;
  top: calc(448.81 * var(--u));
  transform: translateX(-50%);
}

/* --- Video dialog -------------------------------------------------------- */

.video-dialog {
  width: min(92vw, 1100px);
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.video-dialog::backdrop { background: rgba(0, 0, 0, 0.88); }

.video-frame {
  aspect-ratio: 16 / 9;
  background: var(--ink);
}

.video-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-close {
  position: absolute;
  right: 0;
  bottom: 100%;
  padding: 0.25rem 0 0.5rem 1rem;
  border: 0;
  background: none;
  color: var(--orange);
  font: inherit;
  font-size: var(--fs-l);
  cursor: pointer;
}

.video-close:hover { color: var(--orange-hover); }

/* --- Footer -------------------------------------------------------------- */

.site-footer {
  max-width: 48rem;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
  text-align: center;
  font-size: var(--fs-s);
  color: var(--white);
  /* Without its own snap point, proximity snapping pulls the page back up to
     the last section as soon as you scroll into the footer. */
  scroll-snap-align: end;
}

.site-footer p + p { margin-top: 1rem; }
.site-footer a { text-decoration: underline; }
.site-footer a:hover { color: var(--orange); }

/* Quote byline author links (STG-01) */
.quote footer a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.quote footer a:hover { color: var(--orange); }

/* Social rows (STG-16, STG-18): X and LinkedIn as brand glyphs, Nostr as a
   wordmark (no simple official glyph). */
.socials-row { display: flex; align-items: center; gap: 1.3rem; }
.socials-row a { display: inline-flex; text-decoration: none; }
.socials-row svg { width: 22px; height: 22px; fill: var(--white); transition: fill 0.2s ease; }
.socials-row a:hover svg { fill: var(--orange); }
.socials-row .socials-text { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.82em; color: var(--white); }
.socials-row .socials-text:hover { color: var(--orange); }
.author-socials { margin-top: 1.6rem; }
.footer-socials { justify-content: center; margin-bottom: 2.4rem; }

/* Newsletter block in the footer (STG-10) */
.footer-news { margin-bottom: 2.4rem; }
.footer-news-title { text-transform: uppercase; color: var(--orange); margin-bottom: 0.6rem; }
.site-footer .footer-news-btn { margin-top: 1.1rem; text-decoration: none; }

/* --- Mobile: stack the frames -------------------------------------------- */

@media (max-width: 820px), (max-aspect-ratio: 1/1) {
  :root {
    --u: 0.34px;
    /* Two sizes on mobile: every button matches the header one. */
    --fs-s: 1.05rem;
    --fs-m: 1.45rem;
    --fs-l: var(--fs-m);
    /* Book and portrait share one width on mobile. */
    --media-w: min(64%, 17rem);
    --btn-gap: 0.63rem;
    --btn-pad: 0.55rem;
  }

  html { scroll-snap-type: none; }

  /* A viewport-fixed frame fights iOS Safari's floating toolbar (content
     scrolls out under it, below the frame). On mobile the frame wraps the
     whole page and scrolls with it instead. */
  body { position: relative; }
  /* No top edge (the sticky header draws it) and below the header, so
     nothing of the scrolling frame shows through it. */
  .frame {
    position: absolute;
    inset: 8px;
    border-width: 2px;
    border-top: 0;
    box-shadow: none;
    z-index: 20;
  }

  .site-header {
    position: sticky;
    top: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    row-gap: 0.9rem;
    padding: 1.6rem 1.5rem 1rem;
    background: var(--bg);
  }

  /* The sticky header carries the frame's top edge, so it stays put on
     scroll while the side lines run with the page. */
  .site-header::before {
    content: '';
    position: absolute;
    inset: 8px 8px 0;
    border: 2px solid var(--orange);
    border-bottom: 0;
    pointer-events: none;
  }

  .site-header > * { position: static; transform: none; }

  .logo { width: 6.5rem; }

  /* Compact sticky header on scroll: tighter padding, smaller logo. */
  .site-header { transition: padding 0.25s ease, row-gap 0.25s ease; }
  body:not(.v5).is-scrolled .site-header { height: auto; padding: 0.8rem 1.5rem 0.6rem; row-gap: 0.5rem; }
  body:not(.v5).is-scrolled .logo { width: 4.4rem; }

  .header-cta { justify-self: end; }
  body[data-active="book"] .header-cta { opacity: 1; visibility: visible; }

  .nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: center;
    gap: 1.1rem;
  }


  .panel {
    min-height: 0;
    display: block;
    padding: 3rem 1.5rem;
    scroll-margin-top: 7rem;
  }

  .canvas {
    width: auto;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.75rem;
  }

  .canvas > * {
    position: static;
    transform: none;
  }

  /* Buttons keep their own height; resetting it here is what flattened them. */
  /* :where() keeps this at .canvas specificity so the element rules below win. */
  .canvas > :where(:not(.btn)) {
    width: auto;
    height: auto;
  }

  /* inset: auto drops the desktop left/top offsets. */
  .book-cover { position: relative; inset: auto; order: -1; width: var(--media-w); aspect-ratio: 432 / 648; }

  .canvas:has(.book-cta),
  .canvas:has(.author-bio) { align-items: center; text-align: center; }
  .quote-nav { justify-content: center; margin: 0.75rem 0 0; }
  .quote-dot { padding: 10px 5px; }


  .scroll-down { align-self: center; width: 2.75rem; height: 2.75rem; }

  .author-portrait { order: -1; width: var(--media-w); aspect-ratio: 330.6 / 460.83; }

  .video-thumb { width: 100%; aspect-ratio: 626.58 / 350.31; }
  .canvas:has(.video-cta) { align-items: center; }

  .canvas:has(.appendix-cta) { align-items: center; text-align: center; }
  .appendix-text br { display: none; }
}


/* --- Platform page, intake form, Substack embed --------------------------- */
.substack-embed { width: 100%; max-width: 480px; height: 172px; border: 0; background: var(--white); margin-top: 1.1rem; }
.platform-main { padding: calc(170 * var(--u)) 1.5rem 0; }
.platform-wrap { max-width: 880px; margin: 0 auto; }
.plat-kicker { color: var(--orange); text-transform: uppercase; font-size: var(--fs-s); margin: 0 0 1rem; }
.plat-title { font-size: calc(var(--fs-l) * 1.35); line-height: 1.02; margin: 0 0 1.2rem; text-transform: uppercase; }
.plat-pitch { font-size: var(--fs-m); line-height: 1.25; margin: 0 0 2.6rem; max-width: 46ch; }
.plat-props { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6rem; margin-bottom: 2.6rem; }
.plat-prop { border-top: 3px solid var(--orange); padding-top: 0.9rem; }
.plat-prop h2 { font-size: var(--fs-m); margin: 0 0 0.6rem; text-transform: uppercase; }
.plat-prop p { line-height: 1.3; margin: 0; }
.plat-member { font-size: var(--fs-s); margin: 0 0 1.6rem; }
.intake-form { max-width: 560px; }
.intake-form .field { margin-bottom: 1.1rem; }
.intake-form label { display: block; text-transform: uppercase; color: var(--orange); margin-bottom: 0.45rem; font-size: var(--fs-s); }
.intake-form input, .intake-form select, .intake-form textarea { width: 100%; background: #1b1b1b; border: 1px solid #3a3a3a; color: var(--white); font: inherit; padding: 0.7rem 0.8rem; }
.intake-form input:focus, .intake-form select:focus, .intake-form textarea:focus { outline: 2px solid var(--orange); border-color: var(--orange); }
.intake-form .hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.form-status { color: var(--orange); min-height: 1.2em; margin-top: 0.9rem; }
.intake-done { max-width: 560px; border: 1px solid var(--orange); padding: 1.2rem 1.4rem; font-size: var(--fs-m); line-height: 1.25; }
@media (max-width: 820px), (max-aspect-ratio: 1/1) {
  .platform-main { padding: 2rem 1.5rem 0; }
  .plat-props { grid-template-columns: 1fr; }
  .plat-title { font-size: 2rem; }
  .plat-pitch { font-size: 1.3rem; }
}

/* --- Core stats grid (platform page) -------------------------------------- */
.stats-title { font-size: var(--fs-m); text-transform: uppercase; margin: 0 0 1.2rem; }
.stats-grid { display: grid; grid-template-columns: 1.1fr 1fr 1fr; margin-bottom: 3rem; border-bottom: 1px solid rgba(247, 147, 26, .45); }
.stats-grid > div { padding: 0.85rem 0.8rem 0.85rem 0; border-top: 1px solid rgba(247, 147, 26, .45); line-height: 1.2; }
.sg-head { color: var(--orange); text-transform: uppercase; letter-spacing: 0.08em; font-size: var(--fs-s); border-top: 0 !important; }
.sg-label { color: #9a9a9a; }
@media (max-width: 820px), (max-aspect-ratio: 1/1) {
  .stats-grid { font-size: 0.92rem; }
  .stats-grid > div { padding: 0.7rem 0.45rem 0.7rem 0; }
}
