/* Business card for jesstucker.com. The card uses the light palette; the page is a soft pink glow. */
:root {
  --sky: #fff6e6; --card: #ffffff; --fg: #1b1640; --soft: #5a5480;
  --pink: #e0186c; --cyan: #0a9ea2; --yellow: #f2b600; --edge: #1b1640;
  --row: 12px;          /* one row height shared by the sky, the sun and the back */
  --pad: max(16px, 4vmin);
  --radius: 0;
  --stroke: 4px;        /* = the pixel font's vertical stem at 16px (two font pixels) */
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; min-height: 100dvh; display: grid; place-items: center;
  padding: calc(var(--pad) + env(safe-area-inset-top)) calc(var(--pad) + env(safe-area-inset-right)) calc(var(--pad) + env(safe-area-inset-bottom)) calc(var(--pad) + env(safe-area-inset-left));
  /* One subtle circle centered behind the card: the scheme's pink at 10% over white. */
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--pink) 10%, #ffffff) 0%, #ffffff 75%);
  background-attachment: fixed;
  color: var(--fg); font-family: "Press Start 2P", ui-monospace, monospace;
  -webkit-font-smoothing: none; font-smooth: never;
  -webkit-tap-highlight-color: transparent;
}
.pixel { font-family: "Press Start 2P", monospace; font-weight: 400; }

/* ---------- sizing: landscape card by default, portrait card on narrow portrait screens ---------- */
.scene {
  --ratio: 1.75;
  width: min(40rem, calc(100vw - 2 * var(--pad)), calc((100dvh - 2 * var(--pad)) * var(--ratio)));
  aspect-ratio: var(--ratio);
  perspective: 1600px;
  container-type: inline-size;   /* lets the card faces size their own padding in card widths (cqw) */
}
@media (max-width: 600px) and (orientation: portrait) {
  .scene { --ratio: calc(1 / 1.75); width: min(24rem, calc(100vw - 2 * var(--pad)), calc((100dvh - 2 * var(--pad)) * var(--ratio))); }
}

/* ---------- the card ---------- */
.card { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; cursor: pointer;
  transition: transform .85s cubic-bezier(.2, .75, .2, 1); }
.card.flipped { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; border-radius: var(--radius); overflow: hidden; border: var(--stroke) solid var(--edge);
  backface-visibility: hidden; -webkit-backface-visibility: hidden; container-type: size;
  box-shadow: 8px 8px 0 var(--pink); transition: box-shadow .3s; }
.back { transform: rotateY(180deg); box-shadow: -8px 8px 0 var(--cyan); }
@media (hover: hover) { .card:hover .front { box-shadow: 11px 11px 0 var(--pink); } .card:hover .back { box-shadow: -11px 11px 0 var(--cyan); } }

/* ---------- front ---------- */
.front { display: grid; grid-template-rows: 54% 46%; background: var(--card); }
/* Sky and sun share one row grid (--row), measured from the top of .art,
   so every horizon line runs straight into a gap in the sun. */
.art { --gap: 4px; --r: 31cqh; --cy: 12.6cqh;
  position: relative; overflow: hidden;
  background:
    repeating-linear-gradient(to bottom, color-mix(in srgb, var(--pink) 35%, transparent) 0 1px, transparent 1px var(--row)),
    linear-gradient(180deg, var(--sky) 0%, color-mix(in srgb, var(--pink) 30%, var(--sky)) 100%);
  /* Stop the sky lines one short: the line layer ends at the last whole row above the
     bottom edge, so the bottom-most line (which read as a horizon rule) isn't drawn. */
  background-repeat: no-repeat, no-repeat;
  background-size: 100% round(down, calc(100% - 1px), var(--row)), 100% 100%; }
.sun { position: absolute; inset: 0; opacity: .96;
  background: linear-gradient(var(--yellow), var(--pink)) no-repeat;
  background-size: calc(2 * var(--r)) calc(2 * var(--r));
  background-position: 50% calc(100% + var(--r) - var(--cy));
  -webkit-mask:
    radial-gradient(circle var(--r) at 50% calc(100% - var(--cy)), #000 calc(var(--r) - .5px), transparent var(--r)),
    repeating-linear-gradient(to bottom, transparent 0 var(--gap), #000 var(--gap) var(--row));
  -webkit-mask-composite: source-in;
  mask:
    radial-gradient(circle var(--r) at 50% calc(100% - var(--cy)), #000 calc(var(--r) - .5px), transparent var(--r)),
    repeating-linear-gradient(to bottom, transparent 0 var(--gap), #000 var(--gap) var(--row));
  mask-composite: intersect; }
.info { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3.5cqh; padding: 0 6cqw; text-align: center; }
.name { margin: 0; font-size: min(5.2cqw, 9cqh); line-height: 1.25; color: var(--fg); text-shadow: 2px 2px 0 var(--pink), 4px 4px 0 var(--edge); white-space: nowrap; }
/* Pixel text snaps to whole 2px steps so the glyphs stay crisp (falls back to the raw size where round() is unsupported). */
.contact { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .6em 2em; line-height: 1.6;
  font-size: min(2.2cqw, 4cqh); font-size: round(down, min(2.2cqw, 4cqh), 2px); }
.contact a { color: var(--fg); text-decoration: none; border-bottom: var(--stroke) solid var(--cyan); padding-bottom: .25em; transition: color .15s, border-color .15s; }
.contact a:hover { color: var(--cyan); border-color: var(--yellow); }

/* ---------- back ---------- */
/* Ruled back: every line of text is exactly two teal rows tall (--line = 2 × --row),
   and every gap is a whole number of rows. A small script shifts the rules so they
   line up with the text wherever the centered block happens to land. */
.back { --line: calc(2 * var(--row)); --text: 16px;
  background: var(--card); display: flex; flex-direction: column; justify-content: center; gap: var(--line);
  /* Side margins take whatever the widest stat line (~520px at 16px) leaves over, so all four stay on one line. */
  padding: 0 max(4cqw, calc((100cqw - 2 * var(--stroke) - 520px) / 2));
  background-image: repeating-linear-gradient(to bottom, color-mix(in srgb, var(--cyan) 22%, transparent) 0 1px, transparent 1px var(--row)); }
.headline { margin: 0; font-weight: 400; font-size: var(--text); line-height: var(--line); }
.stats { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: var(--row) 1em; align-items: center; font-size: var(--text); line-height: var(--line); }
.stats div { display: contents; }
.stats dt { color: var(--edge); background: var(--cyan); padding: 0 .55em; box-shadow: 3px 3px 0 var(--edge); text-align: center; }
.stats div:nth-child(2) dt { background: var(--yellow); }
.stats div:nth-child(3) dt { background: var(--pink); color: #fff; }
.stats div:nth-child(4) dt { background: var(--fg); color: var(--card); }
.stats dd { margin: 0; }

/* Very small cards (320px phones): slightly smaller type, still two rows per line. */
@container (max-width: 260px) { .headline, .stats { --text: 14px; } }

/* ---------- focus ---------- */
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.card:focus-visible { outline-offset: 8px; }

/* ---------- portrait card overrides ---------- */
@media (max-width: 600px) and (orientation: portrait) {
  .front { grid-template-rows: 50% 50%; }
  .art { --r: 41cqw; --cy: calc(41cqw - 15cqh); }
  .info { gap: 4cqh; padding: 0 8cqw; }
  .name { font-size: 7.2cqw; white-space: normal; }
  .contact { flex-direction: column; font-size: 3.6cqw; font-size: round(down, 3.6cqw, 2px); }
  .back { padding: 0 8cqw; }
  .stats { grid-template-columns: 1fr; gap: 0; }
  .stats dt { justify-self: start; }
  .stats dd { margin-bottom: var(--row); }
  .stats div:last-child dd { margin-bottom: 0; }
}

/* ---------- entrance ---------- */
@media (prefers-reduced-motion: no-preference) {
  .scene { animation: enter .9s cubic-bezier(.2, .8, .2, 1) both; }
  .sun { animation: rise 1.3s .25s cubic-bezier(.2, .8, .2, 1) both; }
  @keyframes enter { from { opacity: 0; transform: translateY(28px) scale(.96) rotateX(10deg); } }
  @keyframes rise { from { translate: 0 35%; opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) {
  .scene { animation: fade .4s ease-out both; } @keyframes fade { from { opacity: 0; } }
  .card { transition-duration: .01s; }
}
@media print { body { background: #fff; } .face { box-shadow: none; } .card { transform: none !important; } .back { display: none; } }
