/* Pocket Gate - pocket-gate site
   Paper, ink, and one accent. Nothing else. */

:root {
  --paper: #f4f1e8;
  --paper-2: #ece7d9;
  --paper-3: #e3ddcc;
  --ink: #16150f;
  --ink-2: #3d3a30;
  --muted: #6f6a5b;
  --rule: #d3ccb6;
  --gold: #97783c;
  --aether: #2b3f4f;
  --aether-soft: #dfe4e4;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    "Hoefler Text", Georgia, serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --bezel: #26251f;

  --wrap: 74rem;
  --gutter: clamp(1.15rem, 5vw, 4rem);
  --section: clamp(4.5rem, 10vw, 9rem);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='0.055'/%3E%3C/svg%3E");
}

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

a {
  color: inherit;
  text-decoration-color: var(--gold);
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-color: var(--ink);
}

/* ---------------------------------------------------------------- typography */
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.012em;
  line-height: 1.12;
  margin: 0 0 0.55em;
}

h1 {
  font-size: clamp(2.4rem, 1.55rem + 3.9vw, 4.6rem);
}

h2 {
  font-size: clamp(1.85rem, 1.35rem + 2.1vw, 3rem);
}

h3 {
  font-size: clamp(1.2rem, 1.05rem + 0.7vw, 1.55rem);
}

p {
  margin: 0 0 1.1em;
  max-width: 42rem;
}

.lede {
  font-size: clamp(1.08rem, 1rem + 0.42vw, 1.32rem);
  color: var(--ink-2);
  max-width: 34rem;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.1rem;
  display: block;
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 1.9rem;
  height: 1px;
  background: var(--gold);
  vertical-align: 0.32em;
  margin-right: 0.7rem;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.86em;
  letter-spacing: 0.02em;
}

.muted {
  color: var(--muted);
}

/* ------------------------------------------------------------------- header */
.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.site-head.is-stuck {
  border-bottom-color: var(--rule);
}

.site-head .wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 4.25rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark img {
  width: 1.55rem;
  height: 1.55rem;
  display: block;
}

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.4vw, 2.1rem);
  font-size: 0.9rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--ink-2);
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -1px 0 var(--gold);
}

@media (max-width: 44rem) {
  .site-nav a.nav-hide {
    display: none;
  }
}

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.72em 1.35em;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease;
}

.btn:hover {
  background: #000;
  transform: translateY(-1px);
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
}

.btn.ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* -------------------------------------------------------------------- rules */
.rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0;
}

.section {
  padding-block: var(--section);
}

.section + .section {
  border-top: 1px solid var(--rule);
}

.section-head {
  max-width: 46rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

/* --------------------------------------------------------------------- hero */
.hero {
  padding-block: clamp(3rem, 7vw, 6rem) clamp(4rem, 8vw, 7rem);
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 6vw, 5.5rem);
  align-items: center;
}

@media (max-width: 56rem) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.hero h1 em {
  font-style: italic;
  color: var(--aether);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.8rem;
  margin-top: 2.6rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* -------------------------------------------------------------- device mock */
.device {
  display: grid;
  place-items: center;
  position: relative;
}

.device-shell {
  position: relative;
  padding: clamp(0.85rem, 2.2vw, 1.35rem);
  background: linear-gradient(160deg, #34332b, var(--bezel) 55%, #171611);
  border-radius: 1.5rem;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 26px 60px -28px rgba(22, 21, 15, 0.72),
    0 2px 6px rgba(22, 21, 15, 0.3);
  max-width: 20rem;
}

.device-screen {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.28rem;
  background: #f7f4ec;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 0 26px rgba(0, 0, 0, 0.35) inset;
  image-rendering: pixelated;
}

.device-dial {
  width: 2.5rem;
  height: 2.5rem;
  margin: 1.05rem auto 0.15rem;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #4a4840, #1c1b16 68%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.14) inset,
    0 4px 10px rgba(0, 0, 0, 0.45);
  position: relative;
}

.device-dial::after {
  content: "";
  position: absolute;
  inset: 0.72rem;
  border-radius: 50%;
  background: #2e2d26;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07) inset;
}

.device-key {
  position: absolute;
  top: 1.1rem;
  right: -0.5rem;
  width: 0.42rem;
  height: 2.2rem;
  border-radius: 0.3rem;
  background: linear-gradient(180deg, #3a3931, #1b1a15);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.device-caption {
  margin: 1.6rem auto 0;
  max-width: 30rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* --------------------------------------------------------------- stat strip */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.stat {
  background: var(--paper);
  padding: 1.5rem 1.35rem;
}

.stat dt {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.stat dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.15;
}

.stat dd small {
  display: block;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.3rem;
  letter-spacing: 0;
}

/* ------------------------------------------------------------------- steps */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: clamp(1.6rem, 3vw, 2.6rem);
  counter-reset: step;
}

.step {
  counter-increment: step;
  border-top: 1px solid var(--rule);
  padding-top: 1.1rem;
}

.step::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--gold);
  margin-bottom: 0.8rem;
}

.step h3 {
  margin-bottom: 0.4rem;
}

.step p {
  color: var(--ink-2);
  font-size: 0.95rem;
  margin-bottom: 0;
}

.step code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--paper-2);
  padding: 0.1em 0.36em;
  border-radius: 2px;
}

/* ------------------------------------------------------------------- gates */
.gates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

@media (min-width: 62rem) {
  .gates {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gate {
  background: var(--paper);
  padding: 1.6rem 1.5rem 1.75rem;
  transition: background 0.25s ease;
}

.gate:hover {
  background: var(--paper-2);
}

.gate-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

.gate.is-ninth .gate-num {
  background: var(--ink);
  color: var(--paper);
}

.gate h3 {
  font-size: 1.22rem;
  margin-bottom: 0.3rem;
}

.gate-cond {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  margin-bottom: 0.6rem;
}

.gate p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-2);
}

/* -------------------------------------------------------------------- deck */
.deck {
  display: flex;
  gap: 0.9rem;
  overflow-x: auto;
  padding: 0.5rem 0 1.4rem;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.deck img {
  height: 15rem;
  width: auto;
  image-rendering: pixelated;
  border: 1px solid var(--rule);
  background: #f7f4ec;
  padding: 0.35rem;
  scroll-snap-align: start;
  flex: 0 0 auto;
}

/* ------------------------------------------------------------------ tables */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table caption {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 0.8rem;
}

.table th,
.table td {
  text-align: left;
  padding: 0.72rem 1rem 0.72rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.table th {
  font-weight: 500;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table td:last-child,
.table th:last-child {
  padding-right: 0;
}

.table code {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

/* --------------------------------------------------------------------- faq */
.faq {
  max-width: 46rem;
}

.faq details {
  border-bottom: 1px solid var(--rule);
  padding: 0.15rem 0;
}

.faq summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.15rem 0;
  font-family: var(--font-display);
  font-size: 1.14rem;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  font-family: var(--font-mono);
  color: var(--muted);
  flex: 0 0 auto;
}

.faq details[open] summary::after {
  content: "\2212";
}

.faq details p {
  margin: 0 0 1.3rem;
  color: var(--ink-2);
}

/* ---------------------------------------------------------------- waitlist */
.waitlist {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: clamp(1.75rem, 4vw, 3rem);
  max-width: 44rem;
}

.waitlist-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.4rem;
}

.waitlist-form input[type="email"] {
  flex: 1 1 16rem;
  padding: 0.72em 0.9em;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 0;
}

.waitlist-form input[type="email"]:focus {
  outline: 2px solid var(--aether);
  outline-offset: 1px;
  border-color: var(--aether);
}

.form-note {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 0.9rem;
  min-height: 1.2em;
}

.form-note.ok {
  color: #3f6b4a;
}

.form-note.err {
  color: #8c3a2e;
}

/* ------------------------------------------------------------------ footer */
.site-foot {
  border-top: 1px solid var(--rule);
  padding-block: 3.5rem 4rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.site-foot .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  align-items: baseline;
  justify-content: space-between;
}

.site-foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.site-foot a {
  text-decoration: none;
}

.site-foot a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------- utilities */
.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}

.callout {
  border-left: 2px solid var(--gold);
  padding: 0.15rem 0 0.15rem 1.15rem;
  color: var(--ink-2);
  font-size: 0.95rem;
}

.callout strong {
  color: var(--ink);
  font-weight: 500;
}

pre {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.6;
  margin: 0 0 1.5rem;
}

code {
  font-family: var(--font-mono);
}

.inline-code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--paper-2);
  padding: 0.12em 0.38em;
  border-radius: 2px;
}

.reveal {
  opacity: 1;
  transform: none;
}

/* Only hide content for the reveal effect when scripting is running, so a
   failed or blocked script can never leave the page blank. */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------- simulated e-paper screen */
.epd-frame {
  width: 244px;
  height: 500px;
  margin-inline: auto;
  overflow: hidden;
  border-radius: 0.28rem;
  background: #f7f4ec;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 0 26px rgba(0, 0, 0, 0.35) inset;
}

.epd {
  width: 122px;
  height: 250px;
  transform: scale(2);
  transform-origin: top left;
  background: #f7f4ec;
  color: #16150f;
  font-family: var(--font-mono);
  font-size: 6px;
  line-height: 8px;
  letter-spacing: 2.4px;
  overflow: hidden;
  position: relative;
}

.epd div,
.epd img {
  position: absolute;
  left: 4px;
}

.epd-head {
  top: 4px;
}

.epd-sub {
  top: 18px;
}

.epd-rule {
  left: 2px;
  top: 30px;
  width: 118px;
  border-top: 1px solid #16150f;
}

.epd-card {
  top: 33px;
  left: 13px;
  width: 96px;
  height: 160px;
  image-rendering: pixelated;
}

.epd-rule.bottom {
  top: 196px;
}

.epd-name {
  top: 200px;
}

.epd-orient {
  top: 214px;
}

.epd-keys {
  top: 228px;
}
