/*
 * Follow the Paws — the app's own pixel-art system, ported to CSS.
 *
 * One art pixel is --px (3 px, as in `Px.unit`). Every border, inset, offset
 * and shadow snaps to that grid. No gradients, no blurred shadows, no rounded
 * corners: depth comes from a one-pixel bevel and a one-pixel hard drop
 * shadow, and texture from an ordered dither — the same rules as `PixelKit`.
 */

:root {
  color-scheme: light;

  --px: 3px;

  /* `Retro` palette, converted straight from RetroTheme.swift. */
  --bg: #F2E7D2;
  --card: #FDF7EA;
  --card-light: #FFFDF6;
  --card-shade: #E5DAC4;
  --paper: #E9DBC0;
  --sand: #DCCBAB;
  --sand-shade: #BCA886;
  --ink: #3B291D;
  --ink-soft: #75604C;
  --ink-faint: rgba(59, 41, 29, 0.22);
  --accent: #D06730;
  --accent-light: #EA8C4B;
  --accent-deep: #943F19;
  --teal: #31726C;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --serif: ui-serif, "New York", Georgia, "Times New Roman", serif;

  /* `PixelBox`: a rectangle with one art pixel bitten out of each corner. */
  --box: polygon(
    var(--px) 0, calc(100% - var(--px)) 0,
    calc(100% - var(--px)) var(--px), 100% var(--px),
    100% calc(100% - var(--px)), calc(100% - var(--px)) calc(100% - var(--px)),
    calc(100% - var(--px)) 100%, var(--px) 100%,
    var(--px) calc(100% - var(--px)), 0 calc(100% - var(--px)),
    0 var(--px), var(--px) var(--px)
  );
}

/* `PaperBackground`: flat paper under a 4x4 art-pixel ordered dither, so a
   large area has texture without a gradient. */
body {
  margin: 0;
  padding: calc(var(--px) * 10) calc(var(--px) * 6) calc(var(--px) * 14);
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12'><g fill='rgb(46,46,46)'><rect width='3' height='3' opacity='.055'/><rect x='6' y='6' width='3' height='3' opacity='.055'/><rect x='6' width='3' height='3' opacity='.022'/><rect y='6' width='3' height='3' opacity='.022'/><rect x='9' y='3' width='3' height='3' opacity='.03'/><rect x='3' y='9' width='3' height='3' opacity='.03'/></g></svg>");
  background-size: 12px 12px;
  background-blend-mode: multiply;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

/* The journal keeps a readable column instead of stretching across a desk
   display — `pageColumn()` does the same in the app. */
.column {
  max-width: 600px;
  margin: 0 auto;
}

/* Masthead ------------------------------------------------------------- */

.masthead {
  text-align: center;
  margin-bottom: calc(var(--px) * 8);
}

h1 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.55rem;
  line-height: 1.2;
  margin: 0 0 calc(var(--px) * 2);
}

.kicker {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
}

.lede {
  margin: calc(var(--px) * 4) auto 0;
  max-width: 44ch;
  color: var(--ink-soft);
}

/* `StampFrame`: checkpoint art mounted like a collected stamp, square
   perforations bitten out of every edge. */
.stamp {
  position: relative;
  width: 108px;
  height: 108px;
  margin: 0 auto calc(var(--px) * 5);
}

.stamp-paper {
  position: absolute;
  inset: 0;
  background: var(--card);
  -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='108' height='108'><defs><mask id='m'><rect width='108' height='108' fill='white'/><rect x='-1.5' y='-1.5' width='3' height='3' fill='black'/><rect x='-1.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='-1.5' width='3' height='3' fill='black'/><rect x='106.5' y='-1.5' width='3' height='3' fill='black'/><rect x='4.5' y='-1.5' width='3' height='3' fill='black'/><rect x='4.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='4.5' width='3' height='3' fill='black'/><rect x='106.5' y='4.5' width='3' height='3' fill='black'/><rect x='10.5' y='-1.5' width='3' height='3' fill='black'/><rect x='10.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='10.5' width='3' height='3' fill='black'/><rect x='106.5' y='10.5' width='3' height='3' fill='black'/><rect x='16.5' y='-1.5' width='3' height='3' fill='black'/><rect x='16.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='16.5' width='3' height='3' fill='black'/><rect x='106.5' y='16.5' width='3' height='3' fill='black'/><rect x='22.5' y='-1.5' width='3' height='3' fill='black'/><rect x='22.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='22.5' width='3' height='3' fill='black'/><rect x='106.5' y='22.5' width='3' height='3' fill='black'/><rect x='28.5' y='-1.5' width='3' height='3' fill='black'/><rect x='28.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='28.5' width='3' height='3' fill='black'/><rect x='106.5' y='28.5' width='3' height='3' fill='black'/><rect x='34.5' y='-1.5' width='3' height='3' fill='black'/><rect x='34.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='34.5' width='3' height='3' fill='black'/><rect x='106.5' y='34.5' width='3' height='3' fill='black'/><rect x='40.5' y='-1.5' width='3' height='3' fill='black'/><rect x='40.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='40.5' width='3' height='3' fill='black'/><rect x='106.5' y='40.5' width='3' height='3' fill='black'/><rect x='46.5' y='-1.5' width='3' height='3' fill='black'/><rect x='46.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='46.5' width='3' height='3' fill='black'/><rect x='106.5' y='46.5' width='3' height='3' fill='black'/><rect x='52.5' y='-1.5' width='3' height='3' fill='black'/><rect x='52.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='52.5' width='3' height='3' fill='black'/><rect x='106.5' y='52.5' width='3' height='3' fill='black'/><rect x='58.5' y='-1.5' width='3' height='3' fill='black'/><rect x='58.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='58.5' width='3' height='3' fill='black'/><rect x='106.5' y='58.5' width='3' height='3' fill='black'/><rect x='64.5' y='-1.5' width='3' height='3' fill='black'/><rect x='64.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='64.5' width='3' height='3' fill='black'/><rect x='106.5' y='64.5' width='3' height='3' fill='black'/><rect x='70.5' y='-1.5' width='3' height='3' fill='black'/><rect x='70.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='70.5' width='3' height='3' fill='black'/><rect x='106.5' y='70.5' width='3' height='3' fill='black'/><rect x='76.5' y='-1.5' width='3' height='3' fill='black'/><rect x='76.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='76.5' width='3' height='3' fill='black'/><rect x='106.5' y='76.5' width='3' height='3' fill='black'/><rect x='82.5' y='-1.5' width='3' height='3' fill='black'/><rect x='82.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='82.5' width='3' height='3' fill='black'/><rect x='106.5' y='82.5' width='3' height='3' fill='black'/><rect x='88.5' y='-1.5' width='3' height='3' fill='black'/><rect x='88.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='88.5' width='3' height='3' fill='black'/><rect x='106.5' y='88.5' width='3' height='3' fill='black'/><rect x='94.5' y='-1.5' width='3' height='3' fill='black'/><rect x='94.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='94.5' width='3' height='3' fill='black'/><rect x='106.5' y='94.5' width='3' height='3' fill='black'/><rect x='100.5' y='-1.5' width='3' height='3' fill='black'/><rect x='100.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='100.5' width='3' height='3' fill='black'/><rect x='106.5' y='100.5' width='3' height='3' fill='black'/><rect x='106.5' y='-1.5' width='3' height='3' fill='black'/><rect x='106.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='106.5' width='3' height='3' fill='black'/><rect x='106.5' y='106.5' width='3' height='3' fill='black'/></mask></defs><rect width='108' height='108' fill='black' mask='url(%23m)'/></svg>");
  mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='108' height='108'><defs><mask id='m'><rect width='108' height='108' fill='white'/><rect x='-1.5' y='-1.5' width='3' height='3' fill='black'/><rect x='-1.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='-1.5' width='3' height='3' fill='black'/><rect x='106.5' y='-1.5' width='3' height='3' fill='black'/><rect x='4.5' y='-1.5' width='3' height='3' fill='black'/><rect x='4.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='4.5' width='3' height='3' fill='black'/><rect x='106.5' y='4.5' width='3' height='3' fill='black'/><rect x='10.5' y='-1.5' width='3' height='3' fill='black'/><rect x='10.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='10.5' width='3' height='3' fill='black'/><rect x='106.5' y='10.5' width='3' height='3' fill='black'/><rect x='16.5' y='-1.5' width='3' height='3' fill='black'/><rect x='16.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='16.5' width='3' height='3' fill='black'/><rect x='106.5' y='16.5' width='3' height='3' fill='black'/><rect x='22.5' y='-1.5' width='3' height='3' fill='black'/><rect x='22.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='22.5' width='3' height='3' fill='black'/><rect x='106.5' y='22.5' width='3' height='3' fill='black'/><rect x='28.5' y='-1.5' width='3' height='3' fill='black'/><rect x='28.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='28.5' width='3' height='3' fill='black'/><rect x='106.5' y='28.5' width='3' height='3' fill='black'/><rect x='34.5' y='-1.5' width='3' height='3' fill='black'/><rect x='34.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='34.5' width='3' height='3' fill='black'/><rect x='106.5' y='34.5' width='3' height='3' fill='black'/><rect x='40.5' y='-1.5' width='3' height='3' fill='black'/><rect x='40.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='40.5' width='3' height='3' fill='black'/><rect x='106.5' y='40.5' width='3' height='3' fill='black'/><rect x='46.5' y='-1.5' width='3' height='3' fill='black'/><rect x='46.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='46.5' width='3' height='3' fill='black'/><rect x='106.5' y='46.5' width='3' height='3' fill='black'/><rect x='52.5' y='-1.5' width='3' height='3' fill='black'/><rect x='52.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='52.5' width='3' height='3' fill='black'/><rect x='106.5' y='52.5' width='3' height='3' fill='black'/><rect x='58.5' y='-1.5' width='3' height='3' fill='black'/><rect x='58.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='58.5' width='3' height='3' fill='black'/><rect x='106.5' y='58.5' width='3' height='3' fill='black'/><rect x='64.5' y='-1.5' width='3' height='3' fill='black'/><rect x='64.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='64.5' width='3' height='3' fill='black'/><rect x='106.5' y='64.5' width='3' height='3' fill='black'/><rect x='70.5' y='-1.5' width='3' height='3' fill='black'/><rect x='70.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='70.5' width='3' height='3' fill='black'/><rect x='106.5' y='70.5' width='3' height='3' fill='black'/><rect x='76.5' y='-1.5' width='3' height='3' fill='black'/><rect x='76.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='76.5' width='3' height='3' fill='black'/><rect x='106.5' y='76.5' width='3' height='3' fill='black'/><rect x='82.5' y='-1.5' width='3' height='3' fill='black'/><rect x='82.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='82.5' width='3' height='3' fill='black'/><rect x='106.5' y='82.5' width='3' height='3' fill='black'/><rect x='88.5' y='-1.5' width='3' height='3' fill='black'/><rect x='88.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='88.5' width='3' height='3' fill='black'/><rect x='106.5' y='88.5' width='3' height='3' fill='black'/><rect x='94.5' y='-1.5' width='3' height='3' fill='black'/><rect x='94.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='94.5' width='3' height='3' fill='black'/><rect x='106.5' y='94.5' width='3' height='3' fill='black'/><rect x='100.5' y='-1.5' width='3' height='3' fill='black'/><rect x='100.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='100.5' width='3' height='3' fill='black'/><rect x='106.5' y='100.5' width='3' height='3' fill='black'/><rect x='106.5' y='-1.5' width='3' height='3' fill='black'/><rect x='106.5' y='106.5' width='3' height='3' fill='black'/><rect x='-1.5' y='106.5' width='3' height='3' fill='black'/><rect x='106.5' y='106.5' width='3' height='3' fill='black'/></mask></defs><rect width='108' height='108' fill='black' mask='url(%23m)'/></svg>");
  -webkit-mask-size: 108px 108px;
  mask-size: 108px 108px;
  filter: drop-shadow(var(--px) var(--px) 0 rgba(59, 41, 29, 0.3));
}

.stamp::after {
  content: "";
  position: absolute;
  inset: var(--px);
  border: 1px solid var(--ink-faint);
}

.stamp img {
  position: absolute;
  inset: calc(var(--px) * 2);
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
}

/* `RetroRule`: a dotted rule with a paw set in the middle of it. */
.rule {
  display: flex;
  align-items: center;
  gap: calc(var(--px) * 2);
  margin: calc(var(--px) * 8) 0;
}

.rule::before,
.rule::after {
  content: "";
  flex: 1;
  height: var(--px);
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='6' height='3'><rect width='3' height='3' fill='rgb(59,41,29)' opacity='.22'/></svg>");
  background-size: 6px 3px;
  background-repeat: repeat-x;
}

.rule span {
  font-size: 15px;
  line-height: 1;
}

/* Panels --------------------------------------------------------------- */

/* `.raise` carries the hard drop shadow — a notched plate one art pixel
   down and right, exactly as `PaperCard` puts one behind every card. The
   plate has to sit outside the clipped surface, hence the two elements. */
.raise {
  position: relative;
  display: block;
  margin-bottom: calc(var(--px) * 7);
}

.raise::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translate(var(--px), var(--px));
  background: rgba(59, 41, 29, 0.9);
  clip-path: var(--box);
}

/* `PixelSurface`: ink outline, flat body, lit top and left edges, shaded
   bottom and right. The bevel is what makes a flat colour read as raised. */
.face {
  position: relative;
  display: block;
  background: var(--card);
  border: var(--px) solid var(--ink);
  clip-path: var(--box);
  box-shadow:
    inset var(--px) 0 0 var(--card-light),
    inset calc(var(--px) * -1) 0 0 var(--card-shade),
    inset 0 var(--px) 0 var(--card-light),
    inset 0 calc(var(--px) * -1) 0 var(--card-shade);
}

.panel {
  padding: calc(var(--px) * 5) calc(var(--px) * 6);
}

.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }

h2 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.35;
  color: var(--ink);
  margin: 0 0 calc(var(--px) * 3);
}

p {
  margin: calc(var(--px) * 3) 0;
}

strong { font-weight: 700; }

a {
  color: var(--accent-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover { color: var(--accent); }

/* Lists are set like the journal's own: a mono marker in accent, prose body. */
.steps,
.points {
  list-style: none;
  margin: calc(var(--px) * 3) 0;
  padding: 0;
}

.steps li,
.points li {
  position: relative;
  padding-left: calc(var(--px) * 7);
  margin: calc(var(--px) * 3) 0;
}

.steps { counter-reset: step; }

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
}

.points li::before {
  content: "\25AA";
  position: absolute;
  left: var(--px);
  top: 0;
  color: var(--accent);
}

/* `RetroButtonStyle`, filled: accent body, lit top and left, deep shade
   under, and the same one-pixel plate behind it. */
.raise.inline {
  display: inline-block;
  vertical-align: top;
  margin: 0 calc(var(--px) * 2) calc(var(--px) * 3) 0;
}

.btn {
  padding: calc(var(--px) * 3) calc(var(--px) * 5);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  background: var(--accent);
  color: var(--card);
  box-shadow:
    inset var(--px) 0 0 var(--accent-light),
    inset calc(var(--px) * -1) 0 0 var(--accent-deep),
    inset 0 var(--px) 0 var(--accent-light),
    inset 0 calc(var(--px) * -1) 0 var(--accent-deep);
}

.btn:hover { color: var(--card); }

.btn.quiet {
  background: var(--card);
  color: var(--ink);
  box-shadow:
    inset var(--px) 0 0 var(--card-light),
    inset calc(var(--px) * -1) 0 0 var(--card-shade),
    inset 0 var(--px) 0 var(--card-light),
    inset 0 calc(var(--px) * -1) 0 var(--card-shade);
}

.actions {
  margin: calc(var(--px) * 6) 0 0;
}

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

footer {
  text-align: center;
  color: var(--ink-soft);
  margin-top: calc(var(--px) * 8);
}

.footer-note {
  font-family: var(--serif);
  font-style: italic;
}

.footer-links {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.6px;
}

.footer-links a { margin: 0 calc(var(--px) * 2); }

@media (max-width: 420px) {
  body { padding-left: calc(var(--px) * 4); padding-right: calc(var(--px) * 4); }
  h1 { font-size: 1.3rem; }
  .panel { padding: calc(var(--px) * 4) calc(var(--px) * 4); }
}
