/* PortHawk landing page · the paper ledger look, shared with the app.
   The page never scrolls: a fixed stage holds the copy scenes on the left and a
   persistent device on the right, and scrolling advances scenes instead. */
:root {
  --paper: #F7F3E9;
  --card: #FDFBF4;
  --paper-deep: #EFEADD;
  --ink: #1F1E1A;
  --ink-soft: #6F6A5C;
  --blue: #2D4B6F;
  --vermilion: #A3321C;
  --ochre: #966A1D;
  --hairline: rgba(31, 30, 26, 0.14);
  --serif: "New York", ui-serif, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --topbar-h: 52px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  /* The stage owns the viewport; nothing here may scroll. */
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); }
code {
  font-family: var(--mono); font-size: 0.9em;
  background: var(--paper-deep); padding: 1px 6px; border-radius: 4px;
}

/* --- Fixed chrome ------------------------------------------------------- */

.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
}
.topbar-inner {
  height: 100%; max-width: 1120px; margin: 0 auto; padding: 0 28px;
  display: flex; justify-content: space-between; align-items: center;
}
.brand { font-family: var(--serif); font-weight: 700; font-size: 18px; }
.topbar nav a {
  margin-left: 20px; color: var(--ink-soft);
  text-decoration: none; font-size: 14px;
}
.topbar nav a:hover { color: var(--blue); }

/* --- Stage: two persistent columns -------------------------------------- */

#stage {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  overflow: hidden;
  background: var(--paper);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  align-items: center;
  gap: 48px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 28px 60px;
}

/* --- Left column: copy scenes cross-fade in place ----------------------- */

#scenes {
  position: relative;
  min-height: 340px;
  display: flex;
  align-items: center;
}

.scene {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  opacity: 0;
  visibility: hidden;
  /* Copy slides on entry; the device counter-drifts, so the two layers separate
     and the swap reads as depth rather than a flat cross-fade. */
  transform: translate3d(0, var(--enter, 26px), 0);
  transition: opacity 0.42s ease, transform 0.58s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.scene.is-active {
  opacity: 1; visibility: visible;
  transform: translate3d(0, 0, 0);
  pointer-events: auto;
  z-index: 2;
}
.scene.is-before { --enter: -26px; }

.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ochre); margin-bottom: 14px;
}
h1 {
  font-family: var(--serif); font-weight: 900;
  font-size: clamp(28px, 3.1vw, 44px); line-height: 1.22;
}
h2 {
  font-family: var(--serif); font-weight: 900;
  font-size: clamp(23px, 2.4vw, 33px); line-height: 1.26;
  margin-top: 6px;
}
.sub { margin-top: 18px; color: var(--ink-soft); font-size: 15.5px; max-width: 44ch; }
.scene p { margin-top: 14px; color: var(--ink-soft); font-size: 15.5px; max-width: 44ch; }
.hero-actions { margin-top: 26px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero-meta { margin-top: 14px; font-size: 12.5px; color: var(--ink-soft); }

.btn {
  display: inline-block; padding: 11px 24px; border-radius: 8px;
  text-decoration: none; font-size: 15px; font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--vermilion); color: #FBF7EE;
  box-shadow: 0 2px 10px rgba(163, 50, 28, 0.28);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(163, 50, 28, 0.36); }
.btn-ghost { color: var(--blue); border: 1px solid var(--hairline); background: var(--card); }
.btn-ver { font-family: var(--mono); font-size: 12px; opacity: 0.85; margin-left: 4px; }

.fno {
  font-family: var(--mono); font-size: 11px; color: var(--vermilion);
  letter-spacing: 0.1em;
}

/* --- Install scene ------------------------------------------------------ */

.install-inner { max-width: 560px; }
.install-lead { margin-top: 14px; font-size: 15px; }
.cmd-box {
  margin-top: 14px; background: var(--card); border: 1px solid var(--hairline);
  border-radius: 8px; padding: 12px 16px; overflow-x: auto;
}
.cmd-box code { background: none; padding: 0; font-size: 13px; color: var(--blue); }
.build-note { margin-top: 14px; font-size: 13.5px; }
.build-note a { color: var(--blue); font-weight: 600; }
.fineprint { margin-top: 10px; font-size: 12px; color: var(--ink-soft); }
.fineprint code { font-size: 0.85em; }

/* --- Right column: the device, on screen the whole time ----------------- */

.device {
  grid-column: 2;
  display: flex; justify-content: center; align-items: center;
  /* Counter-drift against the copy: the panel lags slightly behind the text
     when a scene changes, which is the parallax. */
  transform: translate3d(0, calc(var(--device-enter, 26px) * -0.4), 0);
  transition: transform 0.58s cubic-bezier(0.22, 1, 0.36, 1);
}
#stage[data-direction="down"] .device { --device-enter: 26px; }
#stage[data-direction="up"] .device { --device-enter: -26px; }

.device video {
  width: 100%; max-width: 330px; height: auto;
  border: 1px solid var(--hairline); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(31, 30, 26, 0.16);
  background: var(--paper);
  display: block;
}

/* --- Chapter rail ------------------------------------------------------- */

#rail {
  position: fixed; right: 20px; top: 50%; transform: translateY(-50%);
  z-index: 25; display: flex; flex-direction: column; gap: 11px;
}
#rail button {
  display: flex; align-items: center; gap: 8px; justify-content: flex-end;
  background: none; border: 0; cursor: pointer; padding: 2px;
  font-family: var(--mono); font-size: 10px; color: var(--ink-soft);
  opacity: 0.45; transition: opacity 0.2s ease, color 0.2s ease;
}
#rail button:hover { opacity: 1; }
#rail button.is-current { opacity: 1; color: var(--vermilion); }
#rail .tick {
  width: 16px; height: 2px; background: currentColor; border-radius: 1px;
  transition: width 0.25s ease;
}
#rail button.is-current .tick { width: 28px; }
#rail .label {
  /* Labels appear only for the active chapter, keeping the rail quiet. */
  max-width: 0; overflow: hidden; white-space: nowrap;
  transition: max-width 0.3s ease;
}
#rail button.is-current .label { max-width: 92px; }

/* --- Scroll hint -------------------------------------------------------- */

#hint {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 25; font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-soft);
  animation: breathe 2.6s ease-in-out infinite;
}
#hint.is-hidden { opacity: 0; transition: opacity 0.4s ease; }
@keyframes breathe { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.85; } }

/* --- Narrow screens: stack, and let the page scroll normally ------------ */

@media (max-width: 880px) {
  /* Below the two-column breakpoint the page scrolls normally, so the fixed
     height and hidden overflow have to be released or the scenes would be
     clipped inside a viewport-tall body. */
  html, body { height: auto; overflow: visible; overscroll-behavior: auto; }
  #stage {
    position: static; inset: auto; overflow: visible;
    display: block; padding: 0; max-width: none;
  }
  .device { display: none; }
  #scenes { display: block; min-height: 0; }
  .scene {
    position: relative; inset: auto;
    opacity: 1; visibility: visible; transform: none;
    pointer-events: auto;
    min-height: calc(100vh - var(--topbar-h));
    padding: 28px 22px;
  }
  #rail, #hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .scene, .device { transition: opacity 0.2s ease; transform: none; }
  #hint { animation: none; }
}
