/* Visitenkarte · shared stylesheet for / and /de/ (see REDESIGN.md) */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../assets/fonts/inter-latin-var.woff2") format("woff2");
}

:root {
  --bg: #E4E4E1;
  --paper: #FBFBF9;
  --text: #111111;
  --muted: #55555C;
  --quiet: #6A6A70;
  --line: #E8E8E4;
  /* card-only tokens (redefined by .is-dark below) */
  --emboss: #C4C4BF;
  --emboss-hover: #A8A8A3;
  --shadow: rgba(0, 0, 0, .18);
  --shadow-near: rgba(0, 0, 0, .08);
  --sheen-hi: rgba(255, 255, 255, .85);
  --sheen-band: rgba(255, 255, 255, .55);
  --sheen-lo: rgba(0, 0, 0, .05);
  --sheen-hi-back: rgba(255, 255, 255, .7);
  --sheen-lo-back: rgba(0, 0, 0, .04);
}

/* Dark card (easter egg: the dot on the front toggles it, js/card.js).
   Only the card changes; the page background stays light.
   Contrast on #171718: text 16:1, muted 7.8:1, quiet 5.5:1. */
.card.is-dark,
.face.is-dark {
  --paper: #171718;
  --text: #F2F2EE;
  --muted: #ABABB1;
  --quiet: #8E8E94;
  --line: #2C2C2E;
  --emboss: #3A3A3D;
  --emboss-hover: #55555A;
  --sheen-hi: rgba(255, 255, 255, .09);
  --sheen-band: rgba(255, 255, 255, .05);
  --sheen-lo: rgba(0, 0, 0, .2);
  --sheen-hi-back: rgba(255, 255, 255, .08);
  --sheen-lo-back: rgba(0, 0, 0, .16);
  color: var(--text);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Stage ---------- */

.stage {
  min-height: 100svh;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.scene {
  position: relative; /* anchor for the hidden turn button */
  width: 100%;
  max-width: 640px;
}

/* ---------- Card (base = no-JS: two flat cards stacked) ---------- */

.card {
  --rx: 0deg;
  --ry: 0deg;
  --gx: 50%;
  --gy: 50%;
  --band: 50%;
  --shx: 0px;
  --shy: 36px;
  --wiggle: 0deg;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.face {
  position: relative;
  aspect-ratio: 1.75 / 1;
  border-radius: 14px;
  overflow: clip; /* not a scroll container, so the card grows instead of cutting text */
  background: var(--paper);
  box-shadow: var(--shx) var(--shy) 60px var(--shadow), 0 2px 4px var(--shadow-near);
}

/* Sheen sits UNDER the content: only the paper shines, text stays black */
.sheen {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.face > :not(.sheen) {
  position: relative;
  z-index: 1;
}

.front .sheen {
  background:
    radial-gradient(circle at var(--gx) var(--gy), var(--sheen-hi) 0%, rgba(255, 255, 255, 0) 42%, var(--sheen-lo) 100%),
    linear-gradient(115deg, rgba(255, 255, 255, 0) calc(var(--band) - 18%), var(--sheen-band) var(--band), rgba(255, 255, 255, 0) calc(var(--band) + 18%));
}

/* Back is rotated, so the highlight is mirrored horizontally */
.back .sheen {
  background: radial-gradient(circle at calc(100% - var(--gx)) var(--gy), var(--sheen-hi-back) 0%, rgba(255, 255, 255, 0) 42%, var(--sheen-lo-back) 100%);
}

/* ---------- 3D (only with JS) ---------- */

.js .scene {
  perspective: 1600px;
}

.js .card {
  display: block;
  position: relative;
  aspect-ratio: 1.75 / 1;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(calc(var(--ry) + var(--wiggle)));
  transition: transform .2s ease-out;
}

.js .card.turning {
  transition: transform .9s cubic-bezier(.34, 1.3, .5, 1);
}

/* Opened on the back (#back, e.g. after switching language there): no turn on load.
   Set by the inline script in <head>, removed by js/card.js after the first frames. */
.js.start-back .card {
  --ry: 180deg;
  transition: none;
}

/* One-time turn hint (js/card.js adds .hint ~1s after load): a short swing
   about the Y axis that springs back. --wiggle is added on top of the tilt,
   so mouse movement during the hint does not make the card jump. */
@property --wiggle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes card-hint {
  0% { --wiggle: 0deg; }
  35% { --wiggle: 20deg; }
  62% { --wiggle: -5deg; }
  82% { --wiggle: 1.5deg; }
  100% { --wiggle: 0deg; }
}

.js .card.hint {
  animation: card-hint .9s cubic-bezier(.33, 0, .3, 1);
}

.js .face {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(1px);
}

.js .back {
  transform: rotateY(180deg) translateZ(1px);
}

/* The whole card turns on click/tap (js/card.js); links keep their own cursor.
   No grey/blue tap flash on Android/iOS, no double-tap zoom delay. */
.js .card {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.js .face {
  cursor: pointer;
}

/* The hidden face must not swallow hover and clicks */
.js .face[inert] {
  pointer-events: none;
}

/* Theme reveal (js/card.js): a dark copy of the front, just above the real front,
   clipped to a circle that grows out of the dot (to dark) or shrinks back into it
   (to light). Removed afterwards. The shadow is only drawn by the real face, so it
   stays exactly the same through the switch. */
.js .face.reveal {
  transform: translateZ(2px);
  box-shadow: none;
  pointer-events: none;
}

/* The moment the real card swaps its theme, nothing may fade (e.g. the ↻ colour) */
.js .card.theme-swap *,
.js .card.theme-swap {
  transition-property: transform !important;
}

/* ---------- Front ---------- */

.front {
  padding: 36px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.dot {
  position: relative;
  flex: none;
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

/* Invisible 40px hit area around the 14px dot */
.dot::before {
  content: "";
  position: absolute;
  inset: -13px;
  border-radius: 50%;
}

.js .dot {
  cursor: pointer;
  transition: transform .2s ease;
}

.dot:focus {
  outline: none;
}

.dot:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .js .dot:hover {
    transform: scale(1.2);
  }
}

.lang {
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--text);
}

.lang a {
  color: var(--quiet);
}

h1 {
  margin: 0;
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.1;
}

.role {
  margin: 0;
  color: var(--muted);
}

/* ---------- Back ---------- */

.back {
  /* extra room at the bottom keeps the contact row clear of the turn indicator */
  padding: 28px 32px 36px;
}

/* Language switch on the back: top-right, on the line of the "Things I make" label */
.back > .lang {
  position: absolute;
  top: 27px;
  right: 32px;
  z-index: 2; /* above .cols, which comes later and would otherwise catch its clicks */
  line-height: 1.5;
}

.cols {
  height: 100%;
  display: flex;
  gap: 28px;
}

.lcol {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding-right: 28px;
  border-right: 1px solid var(--line);
}

.rcol {
  flex: 1.2 1 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.photo {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(1);
  transition: filter .5s ease;
}

.photo:hover {
  filter: grayscale(0);
}

.lead {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -.01em;
  text-wrap: pretty;
}

.label {
  margin: 0;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--quiet);
}

.projects {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.projects ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.projects a {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.projects strong {
  font-weight: 600;
}

/* External-link arrow, drawn instead of the "↗" glyph (not in the Inter subset) */
.projects .ext {
  display: inline-block;
  width: .78em;
  height: .78em;
  vertical-align: -.04em;
}

.projects .desc {
  color: var(--muted);
  font-size: 13px;
}

.contact {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.contact .mail {
  font-weight: 600;
}

.contact .soc {
  display: flex;
  gap: 12px;
}

.contact .soc a {
  color: var(--muted);
}

/* Narrow landscape card (viewport 561-688px, card narrower than 640px): the fixed
   card height leaves less room for the lead, so step the type down, and below 640px
   also tighten padding, gaps and photo so the German lead still fits. */
@media (min-width: 561px) and (max-width: 688px) {
  .lead {
    font-size: 14px;
    line-height: 1.4;
  }
}

@media (min-width: 561px) and (max-width: 640px) {
  .back {
    padding: 24px 28px 34px;
  }

  .back > .lang {
    top: 23px;
    right: 28px;
  }

  .cols {
    gap: 22px;
  }

  .lcol {
    gap: 10px;
    padding-right: 22px;
  }

  .photo {
    width: 48px;
    height: 48px;
  }

  .lead {
    font-size: 13px;
  }
}

/* ---------- Turn indicator + hidden turn button (only with JS) ---------- */

/* Decorative ↻ in the bottom-right corner of each face, like a blind emboss.
   Not a control: clicks go straight through to the card. */
.turn-hint {
  display: none;
}

.js .face > .turn-hint {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 1;
  display: block;
  width: 15px;
  height: 15px;
  color: var(--emboss);
  pointer-events: none;
  transition: color .3s ease;
}

.turn-hint svg {
  display: block;
}

@media (hover: hover) and (pointer: fine) {
  .js .card:hover .turn-hint {
    color: var(--emboss-hover);
  }
}

/* One button for keyboard and screen-reader users. It lives outside both faces,
   so it is never inert; visually hidden until it gets keyboard focus. */
.turn-sr {
  display: none;
}

.js .turn-sr {
  display: block;
  position: absolute;
  top: 100%;
  left: 50%;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.js .turn-sr:focus-visible {
  display: inline-flex;
  align-items: center;
  width: auto;
  height: auto;
  min-height: 44px;
  margin: 16px 0 0;
  padding: 0 14px;
  overflow: visible;
  clip-path: none;
  transform: translateX(-50%);
  border-radius: 8px;
  outline: 2px solid var(--text);
  outline-offset: 0;
  color: var(--text);
}

/* ---------- Mobile ---------- */

@media (max-width: 560px) {
  .face,
  .js .card {
    aspect-ratio: .6 / 1;
  }

  /* Portrait card: stack both faces in one grid cell so the ratio acts as a
     minimum and longer text (e.g. German, 320px) grows the card instead of
     being cut off. */
  .js .card {
    display: grid;
  }

  .js .face {
    position: relative;
    inset: auto;
    grid-area: 1 / 1;
  }

  .cols {
    flex-direction: column;
    gap: 20px;
  }

  .lcol {
    flex: 0 0 auto;
    justify-content: flex-start;
    gap: 14px;
    border-right: 0;
    padding-right: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 20px;
  }

  .rcol {
    flex: 1 1 auto;
  }

  /* Keeps the card at its 0.6 ratio at 375/390px in both languages */
  .lead {
    font-size: 14px;
  }

  /* Touch targets >= 44px via padding, not bigger type */
  .lang a,
  .lang .current {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin: -15px 0;
  }

  .projects ul {
    gap: 0;
  }

  .projects a {
    min-height: 44px;
    padding: 5px 0;
    justify-content: center;
  }

  /* One line at 375/390px: tighter gaps between the links, same type size.
     At 320px it wraps; the social links then sit left-aligned under the mail. */
  .contact {
    padding-top: 0;
    column-gap: 6px;
    row-gap: 0;
  }

  .contact .soc {
    gap: 8px;
  }

  .contact a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .js .card,
  .js .card.turning,
  .photo,
  .turn-hint,
  .js .dot {
    transition: none;
  }

  .js .dot:hover {
    transform: none;
  }

  .js .card.hint {
    animation: none;
  }
}
