/* =========================================================
   yeismil.com — shared styles
   ========================================================= */

:root, [data-theme="dark"] {
  --bg: #0a0a0a; --fg: #f2f1ec; --muted: #8a8a84; --faint: #151515; --line: #242424; --accent: #2f6bff;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f4f3ee; --fg: #0a0a0a; --muted: #67675f; --faint: #e9e7df; --line: #d9d7ce; --accent: #0050ff;
  color-scheme: light;
}

/* language switching: content is written twice, only one is shown */
html[data-lang="en"] [lang="es"]:not(html),
html[data-lang="es"] [lang="en"]:not(html) { display: none !important; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font-family: 'Inter Tight', system-ui, sans-serif; font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }

/* page transitions between home and project pages */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }

/* ---------- Top bar ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.mail { display: inline-flex; align-items: center; gap: 8px; pointer-events: auto; color: var(--fg); min-width: 0; }
.mail a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; letter-spacing: .01em; font-size: 12.5px; transition: color .2s; }
.mail a:hover { color: var(--accent); }
.mail svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--muted); }
.copy { position: relative; width: 26px; height: 26px; display: grid; place-items: center; color: var(--muted); transition: color .2s; }
.copy:hover { color: var(--fg); }
.copy::after { content: attr(data-done); position: absolute; left: 100%; margin-left: 6px; font: 500 10.5px 'JetBrains Mono', monospace; text-transform: uppercase; color: var(--accent); white-space: nowrap; opacity: 0; transform: translateX(-4px); transition: opacity .2s, transform .2s; }
.copy.done::after { opacity: 1; transform: none; }

.controls { display: flex; gap: 8px; pointer-events: auto; flex-shrink: 0; }
.lang { display: flex; border: 1px solid var(--line); background: var(--bg); height: 34px; }
.lang button { padding: 0 10px; color: var(--muted); transition: color .2s, background .2s; }
.lang button[aria-pressed="true"] { color: var(--fg); background: var(--faint); }
.theme-btn { width: 34px; height: 34px; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line); transition: border-color .2s; }
.theme-btn:hover, .lang:hover { border-color: var(--accent); }
.theme-btn svg { width: 16px; height: 16px; }
[data-theme="dark"] .sun, [data-theme="light"] .moon { display: none; }

/* ---------- Cover ---------- */
.cover { position: relative; height: 230px; border-bottom: 1px solid var(--line); overflow: hidden; contain: strict; }
#field { position: absolute; inset: 0; width: 100%; height: 100%; }
.cover .topbar { position: absolute; top: 18px; left: 0; right: 0; pointer-events: none; }

/* ---------- Profile ---------- */
.profile { position: relative; margin-top: -58px; }
.avatar { position: relative; width: 116px; height: 116px; }
.avatar::before { content: ""; position: absolute; inset: 0; background: var(--accent); transform: translate(7px, 7px); }
.avatar img { position: relative; width: 100%; height: 100%; object-fit: cover; background: var(--faint); border: 3px solid var(--bg); }
h1.name { font-size: clamp(34px, 7vw, 46px); font-weight: 700; letter-spacing: -.035em; line-height: 1.05; margin-top: 28px; }
.role { color: var(--accent); font-weight: 600; font-size: 18px; margin-top: 6px; letter-spacing: -.01em; }
.bio { margin-top: 14px; font-size: 18px; line-height: 1.5; max-width: 56ch; letter-spacing: -.01em; }
.bio span { color: var(--muted); }
.facts { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 16px; color: var(--muted); }
.facts span { display: inline-flex; align-items: center; gap: 6px; }
.facts svg { width: 13px; height: 13px; }

.socials { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 24px; border: 1px solid var(--line); }
.social { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-right: 1px solid var(--line); position: relative; overflow: hidden; transition: color .25s; }
.social:last-child { border-right: 0; }
.social::before { content: ""; position: absolute; inset: 0; background: var(--accent); transform: translateY(101%); transition: transform .3s cubic-bezier(.7,0,.2,1); }
.social:hover { color: #fff; }
.social:hover::before { transform: translateY(0); }
.social svg, .social span { position: relative; }
.social svg { width: 18px; height: 18px; flex-shrink: 0; }
.social span { font-weight: 500; font-size: 14.5px; }
.social .arr { margin-left: auto; opacity: .5; font-size: 13px; }

/* ---------- Sections ---------- */
section { margin-top: 72px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--fg); padding-bottom: 10px; margin-bottom: 4px; }
.sec-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.sec-head .mono { color: var(--muted); }
.sub-head { color: var(--muted); margin: 34px 0 4px; }

/* ---------- Project rows ---------- */
.project { display: grid; grid-template-columns: 200px 1fr; gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.thumb { aspect-ratio: 16 / 10; background: var(--faint); border: 1px solid var(--line); overflow: hidden; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .6s cubic-bezier(.2,.8,.1,1); }
.thumb.logo { display: grid; place-items: center; }
.thumb.logo img { width: 26%; height: auto; object-fit: contain; }
.thumb::after { content: ""; position: absolute; inset: 0; border: 2px solid var(--accent); opacity: 0; transition: opacity .25s; }
a.project:hover .thumb img { transform: scale(1.04); }
a.project:hover .thumb::after { opacity: 1; }
.p-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.p-name { font-size: 21px; font-weight: 600; letter-spacing: -.025em; display: inline-flex; align-items: center; gap: 8px; }
.p-name .go { font-size: 16px; color: var(--muted); transition: transform .25s, color .25s; }
a.project:hover .p-name .go { transform: translate(3px, -3px); color: var(--accent); }
.p-state { color: var(--muted); white-space: nowrap; }
.p-state::before { content: "■ "; color: #22c55e; }
.p-state.building::before { color: #f59e0b; }
.p-desc { color: var(--muted); margin-top: 4px; font-size: 15.5px; }
.p-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 10px; }
.p-stack { opacity: .8; }
.p-more { color: var(--accent); white-space: nowrap; }

/* ---------- About ---------- */
.about-text { font-size: 18px; line-height: 1.6; letter-spacing: -.01em; margin-top: 20px; }
.about-text p + p { margin-top: 14px; }
.about-text em { font-style: normal; color: var(--accent); }
.timeline { margin-top: 28px; }
.tl-row { display: grid; grid-template-columns: 130px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.tl-row .mono { color: var(--muted); padding-top: 3px; }
.tl-row b { font-weight: 600; }
.tl-row .sub { color: var(--muted); }
.kv { margin-top: 28px; display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; }
.kv .mono { color: var(--muted); padding-top: 3px; }
.btn { display: inline-flex; align-items: center; gap: 10px; margin-top: 32px; padding: 14px 20px; border: 1px solid var(--fg); font-weight: 600; position: relative; overflow: hidden; transition: color .25s, border-color .25s; }
.btn::before { content: ""; position: absolute; inset: 0; background: var(--accent); transform: translateX(-101%); transition: transform .35s cubic-bezier(.7,0,.2,1); }
.btn:hover { color: #fff; border-color: var(--accent); }
.btn:hover::before { transform: translateX(0); }
.btn > * { position: relative; }

footer.site-foot { margin: 96px 0 0; padding: 22px 0 40px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); gap: 12px; flex-wrap: wrap; }
footer.site-foot a:hover { color: var(--accent); }

/* =========================================================
   Case study pages
   ========================================================= */
.cs-bar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.cs-bar .topbar { height: 60px; }
.back { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); transition: color .2s; }
.back:hover { color: var(--fg); }
.back span { transition: transform .2s; }
.back:hover span { transform: translateX(-3px); }

.cs-head { padding-top: 56px; }
.cs-kicker { color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.cs-kicker .p-state { color: var(--fg); }
.cs-title { font-size: clamp(44px, 10vw, 76px); font-weight: 700; letter-spacing: -.045em; line-height: .95; margin-top: 18px; }
.cs-tagline { font-size: clamp(20px, 3.4vw, 24px); font-weight: 500; letter-spacing: -.02em; line-height: 1.3; margin-top: 14px; color: var(--accent); }
.cs-summary { font-size: 18px; line-height: 1.6; margin-top: 16px; color: var(--fg); letter-spacing: -.01em; }
.cs-visit { margin-top: 26px; }

.cs-hero { margin: 44px auto 0; max-width: 1040px; padding: 0 20px; }
.cs-hero img { width: 100%; border: 1px solid var(--line); background: var(--faint); }

.cs-meta { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 44px; }
.cs-meta > div { padding: 16px 16px 16px 0; }
.cs-meta > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.cs-meta .mono { color: var(--muted); display: block; margin-bottom: 6px; }
.cs-meta p { font-size: 15px; line-height: 1.45; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 48px; border-top: 1px solid var(--fg); }
.metric { padding: 18px 12px 0 0; }
.metric b { display: block; font-size: clamp(26px, 5vw, 38px); font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.metric span { display: block; color: var(--muted); margin-top: 8px; line-height: 1.5; }

.cs-section { margin-top: 64px; }
.cs-section > h2 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; border-bottom: 1px solid var(--fg); padding-bottom: 10px; display: flex; justify-content: space-between; }
.cs-section > h2 .mono { color: var(--muted); font-weight: 400; }
.cs-list { list-style: none; margin-top: 8px; }
.cs-list li { position: relative; padding: 12px 0 12px 22px; border-bottom: 1px solid var(--line); font-size: 17px; line-height: 1.55; }
.cs-list li::before { content: "—"; position: absolute; left: 0; color: var(--accent); }
.steps { counter-reset: step; }
.step { display: grid; grid-template-columns: 48px 1fr; gap: 8px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.step::before { counter-increment: step; content: counter(step, decimal-leading-zero); font: 500 11.5px 'JetBrains Mono', monospace; color: var(--accent); padding-top: 5px; }
.step h3 { font-size: 17.5px; font-weight: 600; letter-spacing: -.02em; }
.step p { color: var(--muted); margin-top: 4px; font-size: 16px; }
.stack-line { margin-top: 18px; line-height: 2; }
.stack-line span { white-space: nowrap; }
.stack-line span + span::before { content: " / "; color: var(--muted); }
.cs-note { margin-top: 20px; padding: 16px 0 16px 18px; border-left: 2px solid var(--accent); font-size: 16px; color: var(--fg); }

.gallery { margin: 64px auto 0; max-width: 1040px; padding: 0 20px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.gallery figure { grid-column: span 6; }
.gallery figure.mobile { grid-column: span 2; }
.gallery figure.half { grid-column: span 3; }
.gallery img { width: 100%; border: 1px solid var(--line); background: var(--faint); }
.gallery figcaption { color: var(--muted); margin-top: 10px; }

.next { display: block; margin-top: 80px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 28px 0; }
.next .mono { color: var(--muted); }
.next b { display: flex; justify-content: space-between; align-items: baseline; font-size: clamp(30px, 7vw, 52px); font-weight: 700; letter-spacing: -.04em; margin-top: 6px; transition: color .25s; }
.next b span { transition: transform .3s; }
.next:hover b { color: var(--accent); }
.next:hover b span { transform: translateX(6px); }

/* ---------- Reveal ---------- */
.rv { opacity: 0; transform: translateY(14px); transition: opacity .7s cubic-bezier(.2,.8,.1,1), transform .7s cubic-bezier(.2,.8,.1,1); }
.rv.in { opacity: 1; transform: none; }
html.no-js .rv { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; transition: none; }
  @view-transition { navigation: none; }
  * { transition-duration: 0s !important; }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .cover { height: 180px; }
  .profile { margin-top: -48px; }
  .avatar { width: 96px; height: 96px; }
  .bio, .about-text, .cs-summary { font-size: 17px; }
  .socials { grid-template-columns: 1fr 1fr; }
  .social:nth-child(2) { border-right: 0; }
  .social:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .project { grid-template-columns: 1fr; gap: 14px; }
  .thumb.logo { aspect-ratio: 16 / 7; }
  .tl-row, .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv .mono { margin-top: 10px; }
  section { margin-top: 56px; }
  .mail a { font-size: 12px; }
  .lang button { padding: 0 8px; }

  .cs-head { padding-top: 40px; }
  .cs-hero, .gallery { padding: 0 16px; }
  .cs-meta { grid-template-columns: 1fr; }
  .cs-meta > div { padding: 14px 0; }
  .cs-meta > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .metrics { grid-template-columns: 1fr 1fr; row-gap: 20px; }
  .gallery { gap: 12px; }
  .gallery figure.half { grid-column: span 6; }
  .gallery figure.mobile { grid-column: span 3; }
  .step { grid-template-columns: 36px 1fr; }
}
