/* ==========================================================================
   Martin Cabrera Marchán — tarjeta de contacto (cabrera.pe/tarjeta/)
   Misma paleta y tipografía que el sitio (styles.css): fondo blanco, tinta,
   azul IPOC, amarillo como resaltador y filete, rojo sangre en antetítulos.
   Pensada para el teléfono; en pantallas anchas muestra el QR al costado.
   ========================================================================== */

@font-face { font-family: 'Archivo'; src: url('../assets/fonts/archivo-variable.woff2') format('woff2'); font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: swap; }
@font-face { font-family: 'Public Sans'; src: url('../assets/fonts/public-sans-variable.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --ink: #15191e;
  --blue: #1f4e79;
  --blue-deep: #163a5a;
  --blue-pale: #d6e4f0;
  --paper: #f5f8fc;
  --white: #fff;
  --grey: #595959;
  --grey-dark: #33383e;
  --line: #d9dee4;
  --yellow: #f2b705;
  --yellow-soft: #ffd451;
  --blood: #8e1b1b;
  --display: 'Archivo', 'Arial Narrow', Arial, sans-serif;
  --sans: 'Public Sans', 'Segoe UI', Arial, sans-serif;
  --pad: 24px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--white); color: var(--ink); font: 1rem/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
p, h1, h2, h3, figure, ol { margin: 0; }
a { color: inherit; text-decoration: none; }
a, button { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--blood); outline-offset: 3px; }
.band :focus-visible { outline-color: var(--yellow); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.page { display: flex; justify-content: center; }
.card { width: 100%; max-width: 480px; background: var(--white); padding-bottom: env(safe-area-inset-bottom); }
.scan { display: none; }

/* Cabecera ---------------------------------------------------------------- */
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: calc(12px + env(safe-area-inset-top)) var(--pad) 12px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.monogram { font: 900 1.7rem/1 var(--display); font-stretch: 78%; letter-spacing: -.04em; border-right: 1px solid var(--line); padding-right: 12px; }
.monogram span { color: var(--blue); }
.brand-name { font: 800 1rem/1.15 var(--display); }
.brand-name > span { display: block; font: 600 .58rem/1.5 var(--sans); letter-spacing: .14em; margin-top: 3px; color: var(--grey); }
.masthead-link { display: inline-flex; align-items: flex-end; min-height: 44px; font-size: .85rem; font-weight: 700; border-bottom: 3px solid var(--yellow); padding-bottom: 6px; white-space: nowrap; }

.offline { padding: 10px var(--pad); background: var(--ink); color: var(--white); font-size: .82rem; line-height: 1.45; border-bottom: 3px solid var(--yellow); }

/* Retrato ----------------------------------------------------------------- */
.portrait { aspect-ratio: 1 / 1; background: #84868f; overflow: hidden; border-bottom: 6px solid var(--blue); }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 6%; }

/* Identidad --------------------------------------------------------------- */
.identity { padding: 26px var(--pad) 30px; }
.eyebrow { display: flex; align-items: center; gap: 12px; font: 700 .74rem/1.4 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--blood); }
.eyebrow::before { content: ''; width: 28px; height: 3px; background: var(--yellow); flex-shrink: 0; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; overflow-wrap: break-word; }
h1 { margin-top: 14px; font-weight: 900; font-stretch: 80%; font-size: clamp(2.5rem, 12.5vw, 3.4rem); line-height: .92; letter-spacing: -.02em; text-transform: uppercase; }
em { font-style: normal; background: linear-gradient(transparent 60%, var(--yellow) 60%, var(--yellow) 92%, transparent 92%); -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 .06em; }
.motto { margin-top: 16px; font: 800 1.12rem/1.35 var(--display); }
.motto em { white-space: nowrap; }
.roles { margin-top: 10px; font-size: .86rem; font-weight: 600; color: var(--grey); line-height: 1.5; }
.pitch { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--grey-dark); }

.button { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 54px; padding: 13px 20px; font: 700 1rem/1.2 var(--sans); letter-spacing: .01em; border: 2px solid transparent; transition: background .2s, color .2s; }
.button svg, .tool svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: square; }
.button.primary { margin-top: 24px; background: var(--blue); color: var(--white); }
.button.primary:hover { background: var(--blue-deep); }
.button.outline { margin-top: 10px; border-color: var(--ink); background: transparent; color: var(--ink); }
.button.outline:hover { background: var(--ink); color: var(--white); }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.actions a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 76px; padding: 10px 2px; border: 1px solid var(--line); font-size: .78rem; font-weight: 700; text-align: center; transition: background .2s, color .2s, border-color .2s; }
.actions .mark { font: 900 1.25rem/1 var(--display); font-stretch: 80%; color: var(--blue); transition: color .2s; }
.actions a:hover { background: var(--blue); border-color: var(--blue); color: var(--white); }
.actions a:hover .mark { color: var(--white); }
.actions .mark svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linejoin: round; }

/* Bloques ----------------------------------------------------------------- */
.block { padding: 30px var(--pad); border-top: 1px solid var(--line); }
.block > .eyebrow { margin-bottom: 20px; }
.services { list-style: none; padding: 0; display: grid; gap: 20px; }
.services li { display: flex; gap: 16px; align-items: flex-start; }
.services .num { flex: none; width: 2ch; font: 900 1.5rem/1.1 var(--display); font-stretch: 80%; color: var(--blue); }
.services h3 { font-weight: 800; font-size: 1.08rem; line-height: 1.25; }
.services p { margin-top: 4px; font-size: .93rem; line-height: 1.55; color: var(--grey); }
.more { margin-top: 10px; }
.text-link { display: inline-flex; align-items: flex-end; min-height: 44px; font-size: .9rem; font-weight: 700; border-bottom: 3px solid var(--yellow); padding-bottom: 5px; }
.text-link:hover { color: var(--blue); }

/* Última columna: franja azul ---------------------------------------------- */
.band { background: var(--blue); color: var(--white); padding: 32px var(--pad) 34px; }
.band:empty { display: none; }
.band .eyebrow { color: var(--yellow); }
.band h2 { margin-top: 14px; font-weight: 900; font-stretch: 80%; font-size: clamp(1.8rem, 8.4vw, 2.3rem); line-height: .98; letter-spacing: -.015em; text-transform: uppercase; }
.band h2 a:hover { text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.band-dek { margin-top: 12px; font-size: .95rem; line-height: 1.55; color: #e8eef5; }
.band-links { display: flex; flex-wrap: wrap; gap: 0 24px; margin-top: 6px; }
.band .text-link:hover { color: var(--yellow-soft); }

/* Lista de contacto -------------------------------------------------------- */
.contact-list { display: grid; font-size: .95rem; }
.contact-list > * { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 50px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.contact-list > :last-child { border-bottom: 0; }
.contact-list span:first-child { flex: none; color: var(--grey); font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.contact-list span:last-child { font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.contact-list a:hover span:last-child { color: var(--blue); }

/* QR y compartir ----------------------------------------------------------- */
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; padding: 0 var(--pad) 30px; }
.tool { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-weight: 700; font-size: .9rem; transition: background .2s, color .2s, border-color .2s; }
.tool:hover { background: var(--ink); border-color: var(--ink); color: var(--white); }

.card-foot { padding: 22px var(--pad) 28px; border-top: 6px solid var(--ink); font-size: .78rem; line-height: 1.6; color: var(--grey); }
.card-foot p + p { margin-top: 0; }
.card-foot a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; color: var(--ink); text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 2px; text-underline-offset: 4px; }

dialog { margin: auto; padding: 0; border: 0; width: min(92vw, 380px); background: var(--white); color: var(--ink); border-top: 6px solid var(--blue); }
dialog::backdrop { background: rgba(21, 25, 30, .78); }
.qr-wrap { padding: 26px 24px 24px; text-align: center; }
.qr-wrap h2 { font-weight: 800; font-size: 1.15rem; line-height: 1.25; }
.qr-wrap img { width: 100%; max-width: 280px; height: auto; margin: 16px auto 0; }
.scan-url { margin-top: 10px; font-size: .9rem; font-weight: 700; letter-spacing: .02em; }
.qr-wrap .button { margin-top: 18px; }
.qr-wrap .scan-url { font-weight: 600; font-size: .86rem; line-height: 1.45; min-height: 2.9em; text-wrap: balance; }
.qr-modes { display: grid; grid-template-columns: 1fr 1fr; margin-top: 16px; border: 2px solid var(--ink); }
.qr-modes button { min-height: 46px; padding: 8px 6px; border: 0; background: var(--white); color: var(--ink); font-weight: 700; font-size: .84rem; line-height: 1.2; }
.qr-modes button[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.qr-modes button:focus-visible { outline-offset: -5px; outline-color: var(--yellow); }

/* Pantallas pequeñas ------------------------------------------------------- */
@media (max-width: 360px) {
  :root { --pad: 18px; }
  .brand-name > span { display: none; }
  .actions { gap: 6px; }
}

/* Pantallas anchas: la tarjeta a la izquierda y el QR al costado ----------- */
@media (min-width: 620px) {
  body { background: var(--paper); }
  .page { padding: 40px 24px 56px; }
  .card { border: 1px solid var(--line); }
}
@media (min-width: 960px) {
  .page { align-items: flex-start; gap: 72px; }
  .scan { display: block; position: sticky; top: 40px; width: 320px; padding-top: 48px; }
  .scan h2 { margin-top: 18px; font-weight: 900; font-stretch: 80%; font-size: 2.7rem; line-height: .98; letter-spacing: -.02em; text-transform: uppercase; }
  .scan > p:not(.eyebrow):not(.scan-url) { margin-top: 20px; color: var(--grey-dark); }
  .scan img { margin-top: 26px; width: 220px; height: 220px; background: var(--white); border: 1px solid var(--line); padding: 14px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media print {
  .tools, .scan, dialog { display: none !important; }
  .page { padding: 0; }
  .card { border: 0; }
}
