/* ==========================================================================
   jmartingil.es — portfolio
   ========================================================================== */

@font-face { font-family: "Inter"; src: url("fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --bg: #f6f4ef;
  --bg-alt: #efece4;
  --surface: #ffffff;
  --ink: #16181d;
  --ink-2: #4a4f5a;
  --ink-3: #7c818c;
  --line: #e2ded4;
  --accent: #1f4fd1;
  --accent-ink: #ffffff;
  --accent-soft: #e5ebfb;
  --logo: #8a8e98;
  --shadow: 0 1px 2px rgba(20, 22, 28, .04), 0 8px 24px -12px rgba(20, 22, 28, .12);
  --radius: 14px;
  --maxw: 1120px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --bg-alt: #14171c; --surface: #191c22; --ink: #eceae4; --ink-2: #b4b7bf; --ink-3: #868a94;
    --line: #262a32; --accent: #7d9bff; --accent-ink: #0f1115; --accent-soft: #1b2238; --logo: #8d919b;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --bg-alt: #14171c; --surface: #191c22; --ink: #eceae4; --ink-2: #b4b7bf; --ink-3: #868a94;
  --line: #262a32; --accent: #7d9bff; --accent-ink: #0f1115; --accent-soft: #1b2238; --logo: #8d919b;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.65 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 600; letter-spacing: -.015em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Header ---------- */
.header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.header.scrolled { border-bottom-color: var(--line); }
.header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -.01em; }
.brand img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { text-decoration: none; color: var(--ink-2); font-size: 14px; font-weight: 500; padding: 8px 12px; border-radius: 999px; transition: color .15s, background .15s; }
.nav a:hover, .nav a.active { color: var(--ink); background: var(--bg-alt); }
.tools { display: flex; align-items: center; gap: 6px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; min-width: 36px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 12px/1 var(--font); letter-spacing: .04em; text-decoration: none; cursor: pointer; transition: border-color .15s; }
.icon-btn:hover { border-color: var(--ink-3); }
.icon-btn svg { width: 16px; height: 16px; }
.menu-btn { display: none; }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: block; }
}

@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }
  .nav { position: fixed; inset: 64px 0 auto 0; flex-direction: column; gap: 0; padding: 8px 16px 16px; background: var(--bg); border-bottom: 1px solid var(--line); transform: translateY(-8px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
  .nav.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav a { padding: 12px; font-size: 16px; border-radius: 10px; }
  .tools { margin-left: auto; }
}

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 999px; font: 600 15px/1 var(--font); text-decoration: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: transform .15s, border-color .15s, background .15s; }
.btn:hover { transform: translateY(-1px); border-color: var(--ink-3); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { border-color: var(--ink); }

/* ---------- Hero ---------- */
.hero { padding: 88px 0 72px; }
.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 56px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); padding: 6px 12px 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: #22a35a; box-shadow: 0 0 0 4px color-mix(in srgb, #22a35a 20%, transparent); }
.hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 7vw, 84px); letter-spacing: -.02em; line-height: 1.02; margin: 22px 0 18px; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .role { font-size: clamp(17px, 2vw, 20px); color: var(--ink); font-weight: 500; margin-bottom: 14px; }
.hero .lede { font-size: 17px; color: var(--ink-2); max-width: 600px; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.portrait { position: relative; width: 240px; height: 240px; }
.portrait img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; border: 6px solid var(--surface); box-shadow: var(--shadow); }
.portrait::before { content: ""; position: absolute; inset: -18px; border-radius: 50%; border: 1px dashed var(--line); }
@media (max-width: 760px) {
  .hero { padding: 48px 0 48px; }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .portrait { width: 120px; height: 120px; order: -1; }
  .portrait::before { inset: -10px; }
}

.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 64px; }
.stat { padding: 24px 20px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat b { display: block; font-family: var(--serif); font-weight: 400; font-size: 44px; line-height: 1; letter-spacing: -.02em; }
.stat span { display: block; margin-top: 8px; font-size: 14px; color: var(--ink-2); }
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, 1fr); margin-top: 40px; }
  .stat { padding: 20px 16px; }
  .stat:nth-child(odd) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stat b { font-size: 36px; }
}

/* ---------- Sections ---------- */
.section { padding: 96px 0; }
.section.alt { background: var(--bg-alt); }
.section-head { display: grid; grid-template-columns: 1fr 1.4fr; gap: 40px; align-items: end; margin-bottom: 48px; }
.kicker { font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.section h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 4.6vw, 54px); letter-spacing: -.02em; }
.section-head p { color: var(--ink-2); font-size: 17px; }
@media (max-width: 760px) {
  .section { padding: 64px 0; }
  .section-head { grid-template-columns: 1fr; gap: 14px; margin-bottom: 32px; }
}

/* ---------- Logo wall ---------- */
.logo-group + .logo-group { margin-top: 40px; }
.logo-label { display: flex; align-items: center; gap: 14px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 16px; }
.logo-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.logos { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; list-style: none; margin: 0; padding: 0; }
.logo { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 104px; padding: 18px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-align: center; transition: border-color .2s, transform .2s, box-shadow .2s; }
.logo:hover { border-color: color-mix(in srgb, var(--ink-3) 60%, var(--line)); transform: translateY(-2px); box-shadow: var(--shadow); }
@media (max-width: 1000px) { .logos { grid-template-columns: repeat(4, 1fr); } }
.logo img { max-height: 40px; max-width: 130px; width: auto; object-fit: contain; filter: grayscale(1); opacity: .75; transition: filter .2s, opacity .2s; }
.logo:hover img { filter: none; opacity: 1; }
.wordmark { font-size: 20px; font-weight: 700; letter-spacing: -.02em; color: var(--logo); line-height: 1.1; transition: color .2s; }
.wordmark.wm-serif { font-family: var(--serif); font-weight: 400; font-size: 24px; letter-spacing: 0; }
.wordmark.wm-caps { text-transform: uppercase; letter-spacing: .06em; font-size: 18px; font-weight: 800; }
.wordmark.wm-light { font-weight: 400; letter-spacing: .01em; }
.logo:hover .wordmark { color: var(--ink); }
.logo-more { background: transparent; border-style: dashed; }
.logo-more .wordmark { font-family: var(--serif); font-weight: 400; font-style: italic; font-size: 22px; letter-spacing: 0; color: var(--ink-2); }
.logo small { font-size: 12px; color: var(--ink-3); line-height: 1.3; }
@media (max-width: 600px) {
  .logos { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .logo:last-child:nth-child(odd) { grid-column: span 2; }
  .logo { min-height: 88px; padding: 14px 10px; }
  .wordmark { font-size: 18px; } .wordmark.wm-serif { font-size: 22px; } .wordmark.wm-caps { font-size: 15px; }
}

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.job { display: grid; grid-template-columns: 200px 1fr; gap: 40px; padding: 32px 0; border-top: 1px solid var(--line); }
.job:last-child { border-bottom: 1px solid var(--line); }
.job-when { font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 4px; }
.job-when .now { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 3px 10px; border-radius: 999px; }
.job h3 { font-size: 21px; }
.job .org { margin-top: 4px; color: var(--ink-2); font-weight: 500; }
.job .org a { text-decoration: none; border-bottom: 1px solid var(--line); transition: border-color .15s; }
.job .org a:hover { border-color: var(--ink); }
.job .desc { margin-top: 14px; color: var(--ink-2); max-width: 720px; }
.job ul.points { margin: 12px 0 0; padding-left: 18px; color: var(--ink-2); max-width: 720px; }
.job ul.points li { margin: 4px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; padding: 0; list-style: none; }
.chip { font-size: 12.5px; font-weight: 500; padding: 4px 10px; border-radius: 999px; background: var(--bg-alt); color: var(--ink-2); border: 1px solid var(--line); }
.section.alt .chip { background: var(--surface); }
.chip.client { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip-label { font-size: 12px; font-weight: 600; color: var(--ink-3); align-self: center; margin-right: 2px; }
@media (max-width: 760px) {
  .job { grid-template-columns: 1fr; gap: 8px; padding: 26px 0; }
  .job h3 { font-size: 19px; }
}

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; transition: transform .2s, box-shadow .2s, border-color .2s; }
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--ink-3) 50%, var(--line)); }
.card-media { aspect-ratio: 2 / 1; display: flex; align-items: center; justify-content: center; background: #fff; border-bottom: 1px solid var(--line); padding: 24px; }
.card-media img { max-height: 100%; width: auto; object-fit: contain; }
.card-media.cover { padding: 0; }
.card-media.cover img { width: 100%; height: 100%; object-fit: cover; }
.card-media.shot img { object-position: top center; }
.card-media.placeholder { background: repeating-linear-gradient(135deg, var(--bg-alt) 0 12px, var(--surface) 12px 24px); color: var(--ink-3); }
.card-media.placeholder svg { width: 44px; height: 44px; }
.private-note { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-weight: 600; }
.private-note svg { width: 15px; height: 15px; }
.card-body { padding: 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card h3 { font-size: 19px; display: flex; align-items: center; gap: 8px; }
.card h3 svg { width: 16px; height: 16px; color: var(--ink-3); transition: transform .2s, color .2s; }
a.card:hover h3 svg { transform: translate(2px, -2px); color: var(--accent); }
.card p { color: var(--ink-2); font-size: 15px; }
.card .chips { margin-top: auto; padding-top: 6px; }
.card-links { display: flex; gap: 14px; margin-top: auto; padding-top: 8px; font-size: 14px; font-weight: 600; }
.card-links a { color: var(--accent); text-decoration: none; }
.card-links a:hover { text-decoration: underline; }
@media (max-width: 600px) { .cards { grid-template-columns: 1fr; } }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.panel h3 { font-size: 17px; margin-bottom: 14px; }
.panel ul.list { list-style: none; margin: 0; padding: 0; color: var(--ink-2); }
.panel ul.list li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 15px; }
.panel ul.list li:first-child { border-top: 0; padding-top: 0; }
.panel .chips { margin-top: 0; }
.stack-group + .stack-group { margin-top: 16px; }
.stack-group h4 { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.fact { display: flex; gap: 16px; align-items: center; }
.fact-icon { flex: none; width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.fact-icon svg { width: 22px; height: 22px; }
.fact-icon img { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; }
.fact b { display: block; font-size: 15px; }
.fact span { display: block; font-size: 14px; color: var(--ink-2); }
@media (max-width: 900px) { .skills-grid, .facts { grid-template-columns: 1fr; } }

/* ---------- Quote ---------- */
.quote { font-family: var(--serif); font-size: clamp(26px, 3.4vw, 38px); line-height: 1.25; letter-spacing: -.01em; max-width: 860px; }
.quote cite { display: block; margin-top: 14px; font: 500 14px/1.4 var(--font); font-style: normal; color: var(--ink-3); }

/* ---------- Contact ---------- */
.contact { background: var(--ink); color: var(--bg); padding: 96px 0 40px; }
.contact h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 6vw, 72px); letter-spacing: -.02em; line-height: 1.05; max-width: 800px; }
.contact p.sub { color: color-mix(in srgb, var(--bg) 70%, transparent); margin-top: 16px; font-size: 17px; max-width: 560px; }
.contact .cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.contact .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 30%, transparent); }
.contact .btn:hover { border-color: var(--bg); }
.contact .btn-primary { background: var(--bg); color: var(--ink); border-color: var(--bg); }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 80px; padding-top: 24px; border-top: 1px solid color-mix(in srgb, var(--bg) 18%, transparent); font-size: 13px; color: color-mix(in srgb, var(--bg) 60%, transparent); }
.footer a { color: inherit; }

/* ---------- Reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  * { transition: none !important; }
}

@media print {
  .header, .contact .cta, .tools { display: none; }
  .section { padding: 32px 0; }
  .contact { background: none; color: #000; }
}
