/* Digital calling card (card.html). Loads after site.css and reuses its tokens, buttons and chips. */

/* Version switch: <html data-view="card|full"> is set by scripts/card.js before first paint. */
[data-view="card"] .view-full, [data-view="full"] .view-card { display: none; }

.cardpage { overflow-x: hidden; overflow-x: clip; }
.cardpage :focus-visible { outline-color: var(--color-primary); }
.cardpage .band :focus-visible, .face--back :focus-visible { outline-color: var(--color-tertiary); }

/* Scroll progress: a gold hairline across the top. Gold only draws lines. */
.progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 60; background: var(--color-tertiary); transform: scaleX(0); transform-origin: 0 50%; }

/* Outline button on paper (no shadow, no gold fill). */
.btn--outline { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn--outline:hover { background: var(--color-neutral); color: var(--color-primary); }

/* ---------- Top bar ---------- */
.cbar__in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.cbar__mark { display: inline-flex; align-items: baseline; gap: 10px; color: var(--color-surface); text-decoration: none; font-family: var(--font-voice); font-weight: 600; font-size: 22px; letter-spacing: -0.01em; }
.cbar__mark:hover { color: var(--color-surface); }
.cbar__mark .crest-label { color: var(--color-tertiary); }

/* ---------- Stage: navy above the seam, ivory below ---------- */
.stage { background: linear-gradient(var(--color-primary) 0 calc(100% - 140px), var(--color-surface) calc(100% - 140px)); padding: 24px 0 56px; }
.stage__in { display: grid; justify-items: center; gap: 28px; }

.switch { display: inline-flex; padding: 4px; border: 1px solid rgba(206, 178, 126, .5); border-radius: var(--radius-full); }
.switch a { padding: 10px calc(18px - .22em) 10px 18px; border-radius: var(--radius-full); color: var(--color-on-primary-muted); text-decoration: none; }
.switch a:hover { color: var(--color-surface); }
.switch a[aria-current="page"] { background: var(--color-surface); color: var(--color-primary); }

.view-card, .view-full { display: grid; justify-items: center; gap: 22px; width: 100%; }
.hint { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; color: var(--color-secondary); margin: 0; }
.view-card .hint .btn { color: var(--color-primary); border-color: var(--color-primary); }
.view-card .hint .btn:hover { background: var(--color-neutral); }

/* ---------- Tilt (scripts/card.js sets --rx/--ry/--tx/--ty and the glare position) ---------- */
[data-tilt] {
  position: relative; touch-action: pan-y;
  transform: perspective(1000px) rotate(var(--rest, 0deg)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translate3d(var(--tx, 0px), var(--ty, 0px), 0);
  transform-style: preserve-3d; transition: transform 520ms cubic-bezier(.22, .61, .36, 1);
}
[data-tilt].is-tilting { transition: transform 80ms linear; }
[data-tilt].is-dragging { transition: none; cursor: grabbing; }
.glare { position: absolute; inset: 0; z-index: 5; border-radius: var(--radius-card); pointer-events: none; opacity: 0; transition: opacity 260ms ease-out; background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 55%); mix-blend-mode: soft-light; }
.is-tilting > .glare, .is-dragging > .glare { opacity: 1; }

/* ---------- Classic card: 3.5 × 2 landscape, front and back ---------- */
.flip { --rest: 1.5deg; width: min(100%, 640px); aspect-ratio: 3.5 / 2; cursor: pointer; }
.flip__inner { display: grid; height: 100%; transform-style: preserve-3d; transition: transform 700ms cubic-bezier(.2, .7, .2, 1); }
.flip.is-flipped .flip__inner { transform: rotateY(180deg); }
.face {
  grid-area: 1 / 1; position: relative; box-sizing: border-box; min-width: 0;
  border: 1px solid var(--color-tertiary); border-radius: var(--radius-card); box-shadow: var(--card-shadow);
  backface-visibility: hidden; -webkit-backface-visibility: hidden; padding: clamp(18px, 4vw, 30px);
}
/* Inner gold hairline: the printed frame of a trading card. */
.face::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(206, 178, 126, .55); border-radius: 6px; pointer-events: none; }

.face--front { background: var(--color-surface); display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto; column-gap: 20px; }
.face__top { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; color: var(--color-secondary); }
.mono { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--color-primary); color: var(--color-surface); border: 1px solid var(--color-tertiary); font-family: var(--font-voice); font-weight: 600; font-size: 13px; letter-spacing: .04em; }
.face__main { align-self: center; min-width: 0; }
.face__name { font-family: var(--font-voice); font-weight: 600; font-size: clamp(30px, 6.4vw, 46px); line-height: .95; letter-spacing: -0.035em; color: var(--text-heading); }
.face__role { color: var(--text-gold-on-paper); margin-top: 6px; }
.lines { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 4px; }
.lines a { display: inline-flex; align-items: center; gap: 8px; color: var(--text-body); text-decoration: none; font-size: clamp(12px, 2.2vw, 15px); overflow-wrap: anywhere; }
.lines a:hover { color: var(--color-primary); text-decoration: underline; text-decoration-color: var(--color-tertiary); }
.lines svg { width: 15px; height: 15px; flex: none; fill: none; stroke: var(--color-tertiary-ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.face__photo { align-self: center; width: clamp(96px, 22vw, 168px); aspect-ratio: 3 / 4; border-radius: var(--radius-photo, 6px); overflow: hidden; border: 1px solid var(--color-tertiary); background: var(--color-neutral); }
.face__photo img, .plate__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face__foot { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 12px; color: var(--color-secondary); font-size: 10px; }

.face--back { background: var(--color-primary); color: var(--color-surface); transform: rotateY(180deg); display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; }
.face__eyebrow { color: var(--text-on-band-eyebrow); }
.face__big { font-family: var(--font-voice); font-weight: 600; font-size: clamp(28px, 6vw, 44px); line-height: 1; letter-spacing: -0.03em; margin: 6px 0 10px; }
.face__text { color: var(--color-on-primary-muted); max-width: 28ch; }
.face__url { display: block; margin-top: 14px; color: var(--color-tertiary); font-size: 10px; overflow-wrap: anywhere; }
.face__qr { display: grid; justify-items: center; gap: 8px; color: var(--color-on-primary-muted); font-size: 9px; }
.face__qr img { width: clamp(96px, 22vw, 148px); height: auto; padding: 8px; background: var(--color-surface); border-radius: 6px; }

/* ---------- Full details plate ---------- */
.plate {
  --rest: -1deg; box-sizing: border-box; width: min(100%, 980px);
  display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(24px, 4vw, 48px);
  padding: clamp(22px, 4vw, 40px); background: var(--color-surface); color: var(--color-on-surface);
  border: 1px solid var(--color-tertiary); border-radius: var(--radius-card); box-shadow: var(--card-shadow);
}
.plate__id { display: grid; gap: 16px; align-content: start; }
.plate__id > div { display: grid; gap: 4px; }
.plate__photo { width: 88px; aspect-ratio: 1; border-radius: 50%; overflow: hidden; border: 1px solid var(--color-tertiary); }
.badge { display: inline-flex; align-items: center; gap: 8px; color: var(--color-secondary); }
.badge i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--color-tertiary-ink); }
.plate__name { font-family: var(--font-voice); font-weight: 600; font-size: clamp(34px, 5vw, 52px); line-height: 1; letter-spacing: -0.035em; }
.plate__role { color: var(--text-gold-on-paper); }
.plate__statement { max-width: 44ch; }
.type-caret { display: inline-block; width: 1px; height: 1em; margin-left: 2px; vertical-align: -0.12em; background: var(--color-tertiary-ink); animation: caret 900ms steps(1) infinite; }
.type-caret.is-done { animation: none; opacity: 0; transition: opacity 300ms; }
@keyframes caret { 50% { opacity: 0; } }

.plate__side { display: grid; gap: 20px; align-content: space-between; border-left: 1px solid var(--color-border); padding-left: clamp(24px, 4vw, 48px); }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li + li { border-top: 1px solid var(--color-border); }
.contact-list a { display: grid; gap: 2px; padding: 12px 0; color: var(--text-body); text-decoration: none; }
.contact-list a:hover b { text-decoration: underline; text-decoration-color: var(--color-tertiary); }
.contact-list .crest-label { color: var(--color-secondary); }
.contact-list b { font-weight: 400; overflow-wrap: anywhere; }
.plate__foot { display: flex; align-items: center; gap: 18px; }
.plate__qr { width: 104px; height: auto; border: 1px solid var(--color-border); border-radius: 6px; padding: 6px; flex: none; }
.plate__btns { display: grid; gap: 10px; flex: 1; }

/* ---------- Below the card ---------- */
.sheet { display: grid; gap: clamp(64px, 9vw, 112px); padding-top: 8px; padding-bottom: clamp(72px, 10vw, 128px); max-width: 980px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tiles { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 4px; }
.tile { position: relative; display: grid; gap: 4px; padding: 20px 44px 20px 20px; border: 1px solid var(--color-border); border-radius: var(--radius-card); color: var(--text-body); text-decoration: none; transition: border-color var(--dur-hover) var(--ease-hover); }
.tile:hover { border-color: var(--color-tertiary); color: var(--text-body); }
.tile b { color: var(--text-heading); }
.tile span:not(.tile__arr) { color: var(--color-secondary); overflow-wrap: anywhere; }
.tile__arr { position: absolute; top: 18px; right: 18px; color: var(--color-tertiary-ink); }

.csec { display: grid; gap: 18px; }
.csec__head { display: flex; align-items: center; gap: 14px; color: var(--text-gold-on-paper); }
.csec__head .crest-label::after { content: ""; display: inline-block; width: 48px; height: 1px; margin-left: 14px; vertical-align: middle; background: var(--color-tertiary); }
.csec__title, .next__title { font-family: var(--font-voice); font-weight: 300; font-size: clamp(32px, 5vw, 48px); line-height: 1.1; letter-spacing: -0.02em; color: var(--text-heading); }
.csec__body { max-width: 60ch; color: var(--color-secondary); }
.chips--lg .chip { min-height: 34px; padding-inline: 16px calc(16px - .22em); }

.links { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--color-border); }
.links a { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 4px; border-bottom: 1px solid var(--color-border); color: var(--text-body); text-decoration: none; }
.links a > span:first-child { display: grid; }
.links small { color: var(--color-secondary); }
.links a:hover { border-bottom-color: var(--color-tertiary); }

.share { display: flex; gap: 28px; align-items: center; }
.share__qr { width: 148px; height: auto; flex: none; border: 1px solid var(--color-tertiary); border-radius: var(--radius-card); padding: 10px; background: var(--color-surface); }
.share code { display: inline-block; margin-top: 12px; color: var(--color-primary); overflow-wrap: anywhere; }
.share__row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.share__status { min-height: 1.5em; margin-top: 8px; color: var(--color-secondary); }

.next { padding-block: clamp(80px, 11vw, 140px); }
.next .csec__head { color: var(--text-on-band-eyebrow); }
.next__title { color: var(--color-surface); margin-top: 18px; font-weight: 600; font-size: clamp(40px, 10.5vw, 96px); line-height: 1; letter-spacing: -0.04em; }
.next__text { color: var(--color-on-primary-muted); margin-top: 18px; max-width: 52ch; }
.next .share__row { margin-top: 28px; }

.cfoot { border-top: 1px solid var(--color-tertiary); }
.cfoot__in { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-block: 28px; color: var(--color-on-primary-muted); }
.cfoot a { color: var(--color-on-primary-muted); text-decoration: none; }
.cfoot a:hover { color: var(--color-surface); }

.totop { position: fixed; right: 16px; bottom: 16px; z-index: 50; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--color-tertiary); background: var(--color-primary); color: var(--color-surface); font-size: 18px; cursor: pointer; opacity: 0; visibility: hidden; transition: opacity 200ms, visibility 200ms; }
.totop.is-shown { opacity: 1; visibility: visible; }
.totop:focus-visible { outline-color: var(--color-tertiary); }

/* Fade-ups, once, as blocks enter (classes added by scripts/card.js, so no-JS shows everything). */
.motion-ok .rv { opacity: 0; translate: 0 18px; transition: opacity 600ms var(--ease-draw), translate 600ms var(--ease-draw); }
.motion-ok .rv.is-in { opacity: 1; translate: 0 0; }

/* ---------- Tablet & phone ---------- */
@media (max-width: 900px) {
  .plate { grid-template-columns: 1fr; --rest: 0deg; }
  .plate__side { border-left: 0; padding-left: 0; border-top: 1px solid var(--color-border); padding-top: 8px; }
  .flip { --rest: 0deg; }
}
/* Phones: the card stands upright (2 × 3.5) so the details stay readable. */
@media (max-width: 560px) {
  .stage { background: linear-gradient(var(--color-primary) 0 calc(100% - 180px), var(--color-surface) calc(100% - 180px)); }
  .flip { width: min(100%, 340px); aspect-ratio: 2 / 3.3; }
  .face--front { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto; row-gap: 14px; }
  .face__photo { grid-row: 2; width: 46%; justify-self: start; }
  .face__main { align-self: end; }
  .face__name { font-size: 40px; }
  .lines a { font-size: 14px; }
  .face--back { grid-template-columns: 1fr; align-content: center; justify-items: start; }
  .face__qr { justify-self: center; }
  .face__qr img { width: 150px; }
  .actions, .tiles { grid-template-columns: 1fr; }
  .share { flex-direction: column; align-items: flex-start; }
  .plate__foot { flex-direction: column; align-items: stretch; }
  .plate__qr { align-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  [data-tilt], .flip__inner { transition: none; }
  .type-caret { animation: none; }
}
@media print {
  .cbar, .switch, .hint, .sheet, .next, .cfoot, .totop, .progress { display: none; }
  [data-tilt] { transform: none !important; }
}
