/* davidmt.dev — halftone portrait world. Newsprint paper, black ink, one orange for what is live. */

:root {
    --paper: #F4F4F1;
    --ink: #0B0B0B;
    --ink-2: #5B5B56;
    --accent: #FF3D00;
    --accent-text: #C42900;
    --rule: rgba(11, 11, 11, .16);
    --rule-strong: rgba(11, 11, 11, .9);
    --ease: cubic-bezier(.16, 1, .3, 1);
    --f-display: "Anybody", "Arial Narrow", sans-serif;
    --f-body: "Hanken Grotesk", system-ui, sans-serif;
    --f-mono: "JetBrains Mono", ui-monospace, monospace;
    --gut: clamp(20px, 4.5vw, 64px);
    color-scheme: light;
}

[data-theme="dark"] {
    --paper: #121211;
    --ink: #F2F1EC;
    --ink-2: #A8A8A1;
    --accent: #FF5A2B;
    --accent-text: #FF7A52;
    --rule: rgba(242, 241, 236, .18);
    --rule-strong: rgba(242, 241, 236, .85);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; scrollbar-color: var(--ink-2) var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.6 var(--f-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: var(--accent); color: #0B0B0B; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: var(--ink-2); border: 3px solid var(--paper); border-radius: 8px; }

a { color: inherit; text-underline-offset: .22em; text-decoration-thickness: 1px; }
p { margin: 0; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 800; font-stretch: 108%; line-height: .96; letter-spacing: -.03em; text-wrap: balance; margin: 0; }
.wrap { max-width: 1240px; margin-inline: auto; padding-inline: var(--gut); }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 14px; }
.skip:focus { top: 8px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 26px; cursor: pointer;
    font: 600 .9375rem/1 var(--f-body); text-decoration: none; border: 1.5px solid var(--ink);
    transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid:hover { background: var(--accent); border-color: var(--accent); color: #0B0B0B; }
.btn-line { background: transparent; color: var(--ink); }
.btn-line:hover { background: var(--ink); color: var(--paper); }
.btn:active { transform: translateY(1px); }

/* ---------- Top bar ---------- */
.bar { position: fixed; inset: 0 0 auto 0; z-index: 50; height: 58px; display: flex; align-items: center; gap: var(--gut); padding-inline: var(--gut); background: color-mix(in oklab, var(--paper) 90%, transparent); }
.brand { display: inline-flex; align-items: flex-start; gap: 3px; font: 800 1.4rem/1 var(--f-display); font-stretch: 112%; letter-spacing: -.03em; text-decoration: none; }
.brand i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 3px; }
.nav { display: flex; gap: clamp(14px, 2.4vw, 34px); margin-inline: auto; }
.nav a { font: 500 .9375rem/1 var(--f-body); text-decoration: none; padding: 8px 0; color: var(--ink-2); background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat; transition: color .2s, background-size .35s var(--ease); }
.nav a:hover, .nav a.on { color: var(--ink); background-size: 100% 2px; }
.tools { display: flex; gap: 6px; }
.tool { appearance: none; background: transparent; color: var(--ink); border: 1px solid var(--rule-strong); height: 36px; min-width: 36px; padding: 0 10px; font: 500 .75rem/1 var(--f-mono); letter-spacing: .04em; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 4px; transition: background .2s, color .2s; }
.tool:hover { background: var(--ink); color: var(--paper); }
.tool i { font-style: normal; opacity: .45; }
html[lang="es"] [data-lang-opt="es"], html[lang="en"] [data-lang-opt="en"] { color: var(--accent-text); font-weight: 500; }
.tool:hover [data-lang-opt] { color: inherit !important; }
.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: min(100svh, 920px); padding-top: 58px; display: grid; align-content: center; overflow: hidden; }
.portrait { position: absolute; top: 58px; bottom: 0; right: 0; width: min(56%, 860px); z-index: 0; }
.portrait canvas { width: 100%; height: 100%; display: block; }
.hero-copy { position: relative; z-index: 1; width: 100%; padding-block: clamp(40px, 7vw, 96px) clamp(72px, 9vw, 120px); }
.hero-copy h1 { font-size: clamp(2.5rem, 6.4vw, 6rem); font-stretch: 112%; max-width: 8.6ch; margin-bottom: clamp(24px, 3.4vw, 40px); }
.lede { font-size: clamp(1.08rem, 1.5vw, 1.3rem); line-height: 1.5; max-width: 46ch; text-wrap: pretty; }
.lede + .lede { margin-top: .75em; }
.lede-2 { color: var(--ink-2); }
.hero-copy .lede { max-width: 38ch; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.live { position: absolute; z-index: 1; left: 0; right: 0; bottom: 22px; display: flex; align-items: center; gap: 12px; font: 400 .75rem/1.2 var(--f-mono); letter-spacing: .04em; color: var(--ink-2); text-transform: uppercase; }
.live time { color: var(--ink); }

html[data-ai="online"] html[data-ai="offline"] 
/* ---------- Sections ---------- */
.sec { padding-block: clamp(80px, 11vw, 160px); border-top: 1px solid var(--rule); }
h2 { font-size: clamp(2rem, 3.9vw, 3.6rem); font-stretch: 100%; }
h2.wide { max-width: 15ch; margin-bottom: clamp(36px, 5vw, 72px); }
.two { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 112px); align-items: start; }
.two > h2, .two-head h2 { margin-bottom: 28px; }
.two-head .lede { color: var(--ink-2); }
.prose { max-width: 60ch; }
.prose p { margin-bottom: 1.25em; font-size: 1.125rem; text-wrap: pretty; }
.prose strong { font-weight: 700; }

.facts { margin: 36px 0 0; max-width: 64ch; }
.facts > div { display: grid; grid-template-columns: 10rem 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--rule); }
.facts > div:last-child { border-bottom: 1px solid var(--rule); }
.facts dt { font: 400 .75rem/1.6 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); padding-top: 3px; }
.facts dd { margin: 0; }

/* Trayectoria */
.cases { border-bottom: 1px solid var(--rule-strong); }
.case { border-top: 1px solid var(--rule-strong); }
.case summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: clamp(22px, 3vw, 36px) 0; }
.case summary::-webkit-details-marker { display: none; }
.case-name { display: grid; gap: 8px; }
.case-name b { font: 700 clamp(1.6rem, 3.6vw, 3rem)/1 var(--f-display); font-stretch: 108%; letter-spacing: -.03em; transition: color .25s; }
.case-name small { font: 400 .8125rem/1.3 var(--f-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
.case-name em { font-style: normal; color: var(--accent-text); }
.case summary:hover b, .case[open] b { color: var(--accent-text); }
.plus { position: relative; width: 28px; height: 28px; flex: none; transition: transform .4s var(--ease); }
.plus::before, .plus::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: currentColor; transform: translateY(-50%); }
.plus::after { transform: translateY(-50%) rotate(90deg); }
.case[open] .plus { transform: rotate(45deg); }
.case-body { margin: 0; padding: 0 0 clamp(32px, 4vw, 48px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 48px); }
.case-body dt { font: 400 .75rem/1.2 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 10px; }
.case-body dd { margin: 0; font-size: 1rem; line-height: 1.55; text-wrap: pretty; max-width: 40ch; }

/* Conocimientos */
.skills { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(24px, 3vw, 48px); }
.skill { border-top: 2px solid var(--ink); padding-top: 18px; }
.skill h3 { font-size: 1.35rem; font-stretch: 100%; margin-bottom: 14px; min-height: 2em; }
.skill p { color: var(--ink-2); font-size: .96875rem; line-height: 1.5; min-height: 8.5em; text-wrap: pretty; }
.skill ul { list-style: none; margin: 18px 0 0; padding: 0; }
.skill li { padding: 10px 0; border-top: 1px solid var(--rule); font-weight: 500; transition: color .2s, padding-left .3s var(--ease); }
.skill li:hover { color: var(--accent-text); padding-left: 8px; }

/* IA */
.ai-list { list-style: none; margin: 0; padding: 0; }
.ai-list li { padding: 26px 0; border-top: 1px solid var(--rule-strong); }
.ai-list h3 { font-size: clamp(1.4rem, 2.4vw, 2rem); margin-bottom: 10px; }
.ai-list p { max-width: 54ch; color: var(--ink-2); text-wrap: pretty; }
.labs { margin-top: 40px; }
.labs h3 { font: 400 .75rem/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 8px; }
.labs ul { list-style: none; margin: 0; padding: 0; }
.labs a { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; text-decoration: none; border-top: 1px solid var(--rule); transition: padding-left .3s var(--ease), color .2s; }
.labs li:last-child a { border-bottom: 1px solid var(--rule); }
.labs a:hover { padding-left: 10px; color: var(--accent-text); }
.labs b { font: 700 1.2rem/1.2 var(--f-display); font-stretch: 105%; letter-spacing: -.02em; }
.labs span { font: 400 .75rem/1.6 var(--f-mono); text-transform: uppercase; color: var(--ink-2); }


/* Contacto */
.sec-last { padding-bottom: 40px; }
.sec-last .lede { color: var(--ink-2); }
.mail { display: block; margin: clamp(28px, 4vw, 52px) 0 28px; font: 800 clamp(1.5rem, 5.4vw, 5rem)/1 var(--f-display); font-stretch: 112%; letter-spacing: -.03em; text-decoration: none; overflow-wrap: anywhere; background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 .09em no-repeat; transition: background-size .5s var(--ease), color .3s; padding-bottom: .12em; width: fit-content; max-width: 100%; }
.mail:hover { background-size: 100% .09em; }
.links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px 36px; }
.links a, .links button { appearance: none; background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--ink); font: 600 1.15rem/1.2 var(--f-display); font-stretch: 105%; letter-spacing: -.02em; text-decoration: none; background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat; transition: background-size .35s var(--ease); }
.links a:hover, .links button:hover { background-size: 100% 2px; }
.foot { margin-top: clamp(64px, 9vw, 128px); padding-top: 18px; border-top: 1px solid var(--rule); font: 400 .75rem/1.4 var(--f-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .skill p { min-height: 0; }
}
@media (max-width: 900px) {
    .menu-btn { display: inline-flex; }
    .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; margin: 0; flex-direction: column; gap: 0; background: var(--paper); padding: 8px var(--gut) 16px; border-bottom: 1px solid var(--rule-strong); }
    .nav.open { display: flex; }
    .nav a { padding: 15px 0; font-size: 1.125rem; border-bottom: 1px solid var(--rule); background-image: none; }
    .tools { margin-left: auto; }
    .hero { display: block; min-height: 0; padding-top: 58px; }
    .portrait { position: relative; top: 0; width: 100%; height: min(92vw, 560px); }
    .hero-copy { padding-block: 8px 72px; }
    .hero-copy h1 { max-width: 9ch; }
    .live { bottom: 20px; }
    .two { grid-template-columns: minmax(0, 1fr); }
    .case-body { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .facts > div { grid-template-columns: 7.5rem 1fr; }
}
@media (max-width: 640px) {
    .skills { grid-template-columns: minmax(0, 1fr); }
        .actions .btn { flex: 1 1 100%; }
    .live { flex-wrap: wrap; gap: 4px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { animation: none !important; transition-duration: .01ms !important; }
}

/* ---------- Printable CV ---------- */
.cv { display: none; }
@media print {
    @page { margin: 16mm; }
    html, body { background: #fff !important; color: #000 !important; }
    .bar, main, .skip { display: none !important; }
    .cv { display: block !important; font: 10.5pt/1.45 var(--f-body); max-width: 180mm; }
    .cv h1 { font-size: 26pt; margin: 0; letter-spacing: -.01em; }
    .cv .cv-role { font: 700 12pt var(--f-display); margin: 2pt 0 4pt; }
    .cv .cv-meta { color: #333; margin: 0 0 14pt; font-size: 9pt; }
    .cv h2 { font-size: 13pt; border-bottom: 1.2pt solid #000; padding-bottom: 2pt; margin: 14pt 0 6pt; }
    .cv h3 { font: 700 11pt var(--f-body); letter-spacing: 0; margin: 8pt 0 2pt; }
    .cv p { margin: 0 0 6pt; }
    .cv ul { margin: 0 0 6pt; padding-left: 16pt; }
}
