/* ═══════════════════════════════════════════════════════
   ASTRONATIONS.WORLD — base.css
   Shared by every page: tokens, top bar, postcard, buttons, footer
   ═══════════════════════════════════════════════════════ */

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

:root {
  --paper:      #f4ede1;
  --ink:        #1b1712;
  --air-red:    #c23a2b;
  --air-blue:   #1f3f7a;
  --space:      #070914;
  --text:       #f4ede1;
  --text-dim:   rgba(244, 237, 225, 0.66);
  --text-faint: rgba(244, 237, 225, 0.38);

  --display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --sans:    'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --hand:    'Kalam', 'Segoe Print', 'Bradley Hand', cursive;

  --edge:    clamp(20px, 4vw, 64px);
}

html { background: var(--space); }

body {
  font: 400 16px/1.55 var(--sans);
  color: var(--text);
  background: var(--space);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; -webkit-user-drag: none; user-select: none; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--glow, var(--paper));
  outline-offset: 3px;
  border-radius: 3px;
}

/* ── TOP BAR ─────────────────────────────────────────── */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--edge);
  pointer-events: none;
}
.topbar a { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}
.brand img { width: 28px; height: 28px; }

.topnav { display: flex; gap: 26px; font-size: 14px; }
.topnav a { text-decoration: none; color: var(--text-dim); transition: color .2s; }
.topnav a:hover { color: var(--text); }

/* ── POSTCARD ──────────────────────────────────────── */
.pc {
  position: absolute;
  inset: 0;
  perspective: 1800px;
  transform-origin: 50% 70%;
  container-type: inline-size;
  will-change: transform;
}
.pc.is-active { cursor: pointer; }

.pc::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: #04050b;
  opacity: var(--shade, 0);
  pointer-events: none;
}

.pc-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .8s cubic-bezier(.2, .7, .2, 1);
}
.pc.is-flipped .pc-inner { transform: rotateY(180deg); }

.pc-face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 4px;
  background: var(--paper);
  box-shadow:
    0 40px 70px -28px rgba(0, 0, 0, 0.75),
    0 14px 26px -14px rgba(0, 0, 0, 0.55);
}

.pc-front { padding: 3.4cqw; }
.pc-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1px;
}

/* Postmark: drawn in ink, stamped when the card lands */
.postmark {
  position: absolute;
  color: var(--ink);
  pointer-events: none;
  overflow: visible;
}
.postmark--front {
  top: 1%;
  right: -16%;
  width: 62%;
  rotate: -12deg;
  opacity: 0;
}
.pc.is-stamped .postmark--front { animation: stamp .5s cubic-bezier(.3, 1.6, .5, 1) forwards; }

@keyframes stamp {
  0%   { opacity: 0;   scale: 1.7; }
  55%  { opacity: .8; }
  100% { opacity: .72; scale: 1; }
}

/* Back of the card */
.pc-back {
  transform: rotateY(180deg);
  padding: 2.2cqw;
  background:
    repeating-linear-gradient(135deg,
      var(--air-red) 0 4cqw, var(--paper) 4cqw 6cqw,
      var(--air-blue) 6cqw 10cqw, var(--paper) 10cqw 12cqw);
}

.pc-paper {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 6.5cqw 7cqw 5.5cqw;
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
}

.airmail {
  align-self: flex-start;
  padding: 1.1cqw 2cqw;
  border: .5cqw solid var(--air-blue);
  color: var(--air-blue);
  font: 700 2.7cqw / 1.2 var(--sans);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.stamp {
  position: absolute;
  top: 5.5cqw;
  right: 6cqw;
  width: 19.8cqw;
  height: 24.2cqw;
  padding: 1.4cqw;
  background: #fbf8f1;
  rotate: 2deg;
  -webkit-mask:
    radial-gradient(circle, transparent .7cqw, #000 .78cqw) -1.1cqw -1.1cqw / 2.2cqw 2.2cqw,
    linear-gradient(#000 0 0) content-box;
  mask:
    radial-gradient(circle, transparent .7cqw, #000 .78cqw) -1.1cqw -1.1cqw / 2.2cqw 2.2cqw,
    linear-gradient(#000 0 0) content-box;
  filter: drop-shadow(0 .4cqw .6cqw rgba(0, 0, 0, .18));
}
.stamp i {
  display: block;
  height: 100%;
  background-size: cover;
  background-position: 50% 28%;
}

.postmark--back {
  top: 9cqw;
  right: 13cqw;
  width: 46cqw;
  rotate: -7deg;
  opacity: .62;
}

.msg {
  margin-top: 15cqw;
  font: 400 4.8cqw / 1.34 var(--hand);
}
.msg p + p { margin-top: 2cqw; }
.msg-proverb { font-size: 5.8cqw; font-weight: 700; line-height: 1.25; }
.msg-proverb + p { margin-top: .4cqw !important; }

.addr {
  margin-top: auto;
  font: 400 4cqw / 1.2 var(--hand);
}
.addr span {
  display: block;
  padding: 1.4cqw 0 .5cqw;
  border-bottom: 1px solid rgba(27, 23, 18, .28);
}
.addr .addr-no {
  border: 0;
  padding-top: 2cqw;
  font: 500 2.7cqw / 1.2 var(--sans);
  color: rgba(27, 23, 18, .55);
}

/* ── BUTTONS ───────────────────────────────────────── */
.btn-paper {
  display: inline-flex;
  align-items: center;
  padding: 14px 18px;
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: background .25s, transform .25s;
}
.btn-paper:hover { background: color-mix(in srgb, var(--glow, #f0c14b) 55%, var(--paper)); transform: translateY(-1px); }

.btn-ghost {
  padding: 13px 18px;
  border: 1px solid rgba(244, 237, 225, .32);
  border-radius: 4px;
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  transition: border-color .2s, background .2s;
}
.btn-ghost:hover { border-color: var(--text); background: rgba(244, 237, 225, .06); }

/* ── FOOTER ──────────────────────────────────────────── */
.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 28px var(--edge);
  border-top: 1px solid rgba(244, 237, 225, .1);
  font-size: 13px;
  color: var(--text-faint);
}
.footer nav { display: flex; gap: 22px; }
.footer a { text-decoration: none; transition: color .2s; }
.footer a:hover { color: var(--text); }

.noscript { padding: 120px var(--edge); text-align: center; }

/* ── MOBILE ──────────────────────────────────────────── */
@media (max-width: 820px) {
  .topbar { padding: 14px 18px; }
  .topnav { gap: 18px; font-size: 13px; }
  .brand span { display: none; }
  .footer { flex-direction: column; align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  .pc-inner { transition: none; }
  .pc.is-stamped .postmark--front { animation: none; opacity: .72; }
  .btn-paper { transition: none; }
}
