/* =========================================================
   CV Online — Propuesta "UML · Profesional"
   Paleta más contenida (navy profundo + bronce apagado), sombras
   mínimas de documento técnico y tipografía Public Sans + Roboto Mono.
========================================================= */

:root {
  --canvas: #f5f6f8;
  --dot: rgba(23, 37, 61, 0.07);
  --surface: #ffffff;
  --class-header: #e4e9f3;
  --line: #4a6690;
  --line-strong: #1f3a5c;
  --text: #16223a;
  --text-muted: #576277;
  --text-faint: #8993a6;
  --accent: #a8712f;
  --accent-soft: rgba(168, 113, 47, 0.12);
  --ok: #2e9e5b;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 2px 5px rgba(15, 23, 42, .06);
  --font-ui: 'Public Sans', system-ui, sans-serif;
  --font-mono: 'Roboto Mono', ui-monospace, monospace;
}

:root[data-theme="dark"] {
  --canvas: #0e1116;
  --dot: rgba(200, 214, 245, 0.06);
  --surface: #161b23;
  --class-header: #1c2434;
  --line: #5a7ba6;
  --line-strong: #9db3d6;
  --text: #dee3ee;
  --text-muted: #8993a6;
  --text-faint: #576277;
  --accent: #cf9a55;
  --accent-soft: rgba(207, 154, 85, 0.14);
  --ok: #52c987;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 6px rgba(0, 0, 0, .25);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0e1116;
    --dot: rgba(200, 214, 245, 0.06);
    --surface: #161b23;
    --class-header: #1c2434;
    --line: #5a7ba6;
    --line-strong: #9db3d6;
    --text: #dee3ee;
    --text-muted: #8993a6;
    --text-faint: #576277;
    --accent: #cf9a55;
    --accent-soft: rgba(207, 154, 85, 0.14);
    --ok: #52c987;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 6px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.6;
  transition: background-color .3s ease, color .3s ease;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.muted { color: var(--text-faint); }
strong { font-weight: 700; }

/* ---------- Toolbar ---------- */
.toolbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: 68px;
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--dot);
}
.toolbar-inner { width: min(1180px, 92%); margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1rem; color: var(--text); }
.brand-icon { width: 20px; height: 20px; color: var(--line-strong); }
.brand em { color: var(--accent); font-style: normal; }
.tabs { display: flex; gap: 1.6rem; }
.tab-link { font-size: .88rem; color: var(--text-muted); position: relative; padding: 6px 0; }
.tab-link::after { content: ""; position: absolute; left: 0; bottom: 0; width: 0; height: 2px; background: var(--accent); transition: width .25s ease; }
.tab-link:hover, .tab-link.active { color: var(--text); }
.tab-link:hover::after, .tab-link.active::after { width: 100%; }
.toolbar-actions { display: flex; align-items: center; gap: .7rem; }

.lang-switch { display: flex; align-items: center; gap: .25rem; font-family: var(--font-mono); font-size: .76rem; margin-right: .3rem; }
.lang-link { padding: .2rem .3rem; border-radius: 4px; color: var(--text-faint); }
.lang-link:hover { color: var(--text); }
.lang-link.active { color: var(--accent); font-weight: 700; }
.lang-sep { color: var(--text-faint); font-size: .7rem; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--dot); background: var(--surface); cursor: pointer; color: var(--text); }
.icon-btn .icon { width: 17px; height: 17px; }
.icon-btn .icon-moon { display: none; }
:root[data-theme="dark"] .icon-btn .icon-sun { display: none; }
:root[data-theme="dark"] .icon-btn .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-btn .icon-moon { display: block; }
}
.nav-toggle { display: none; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 6px; }
.nav-toggle span { width: 20px; height: 2px; background: var(--text); }

/* ---------- Canvas (dot grid) ---------- */
.canvas {
  padding-top: 68px;
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
}
main { width: min(1180px, 92%); margin-inline: auto; }

.diagram-block { padding: 2.6rem 0; scroll-margin-top: 80px; }
.block-label { font-family: var(--font-mono); font-size: .78rem; color: var(--text-faint); margin-bottom: 1rem; }
.section-hint { font-family: var(--font-mono); font-size: .78rem; color: var(--accent); margin: -.8rem 0 1.6rem; }

/* ---------- UML class box ---------- */
.uml-class {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.uml-class-header { background: var(--class-header); padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); }
.stereotype { font-family: var(--font-mono); font-size: .74rem; color: var(--line-strong); font-style: italic; margin-bottom: .2rem; }
.class-name { font-size: 1.15rem; font-weight: 700; }
.uml-compartment { padding: .8rem 1.2rem; border-bottom: 1px solid var(--dot); font-family: var(--font-mono); font-size: .82rem; }
.uml-compartment:last-child { border-bottom: none; }
.uml-compartment p { margin-bottom: .35rem; color: var(--text-muted); }
.uml-compartment p:last-child { margin-bottom: 0; }
.uml-compartment .val { color: var(--text); }
.uml-compartment.methods-only p { color: var(--text-muted); }
.uml-compartment a { cursor: pointer; }
.uml-compartment a:hover .val { text-decoration: underline; color: var(--accent); }
.ok-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }

/* ---------- Hero ---------- */
.hero-row { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; padding-top: .3rem; }
.uml-actor { display: flex; flex-direction: column; align-items: center; color: var(--line-strong); flex-shrink: 0; }
.actor-head {
  width: 84px; height: 84px; border-radius: 50%;
  border: 2px solid var(--line-strong);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.actor-head img, .actor-head .photo-placeholder { width: 100%; height: 100%; object-fit: cover; }
.photo-placeholder { display: grid; place-items: center; color: var(--line-strong); font-weight: 700; font-size: 1.5rem; background: var(--class-header); }
.actor-tag { font-family: var(--font-mono); font-size: .68rem; font-style: italic; color: var(--line-strong); margin-top: .6rem; }
.actor-label { font-family: var(--font-mono); font-size: .72rem; color: var(--text-muted); margin-top: .1rem; }

.connector { display: flex; flex-direction: column; align-items: center; width: 100px; flex-shrink: 0; position: relative; color: var(--line); }
.conn-label { font-family: var(--font-mono); font-style: italic; font-size: .72rem; color: var(--text-muted); margin-bottom: 2px; }
.conn-svg { width: 100%; height: 20px; }
.conn-mult { position: absolute; bottom: -16px; font-family: var(--font-mono); font-size: .68rem; color: var(--text-faint); }
.conn-mult-l { left: 0; }
.conn-mult-r { right: 0; }

.hero-class-col { display: flex; flex-direction: column; gap: 1rem; width: min(420px, 100%); flex: 1; }

.uml-note {
  position: relative;
  background: var(--class-header);
  border: 1px solid var(--line);
  padding: 1.1rem 1.3rem;
  font-size: .92rem;
  color: var(--text-muted);
  border-radius: 2px;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
}
.uml-note::before {
  content: "";
  position: absolute; top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 18px 18px 0;
  border-color: transparent var(--canvas) transparent transparent;
}
.note-lg { max-width: 720px; font-size: 1rem; }
.note-lg p { margin-bottom: .9rem; color: var(--text-muted); }
.note-lg strong { color: var(--text); }

.constraint-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }
.constraint {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: .35rem .7rem;
  border-radius: 4px;
}

/* ---------- Packages (Skills) ---------- */
.package-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.3rem; }
.uml-package {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0 4px 4px 4px;
  padding: 1.3rem 1.2rem 1.2rem;
  margin-top: 14px;
  box-shadow: var(--shadow);
}
.uml-package::before {
  content: "";
  position: absolute; top: -14px; left: 0;
  width: 46%; height: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
}
.package-title { font-weight: 700; font-size: .98rem; margin-bottom: .9rem; position: relative; }

.iface-list { display: flex; flex-wrap: wrap; gap: .5rem .9rem; }
.iface-list.sm { margin-top: .8rem; padding: .8rem 1.2rem 1rem; border-top: 1px solid var(--dot); }
.iface { display: flex; align-items: center; gap: .4rem; font-size: .84rem; color: var(--text-muted); }
.iface i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--line); flex-shrink: 0; }

.constraint-list { display: grid; gap: .7rem; max-width: 640px; }
.constraint-row-line { display: flex; justify-content: space-between; align-items: center; font-size: .9rem; color: var(--text-muted); gap: 1rem; }

/* ---------- Experience: inheritance ---------- */
.inherit-chain { display: flex; flex-direction: column; align-items: center; max-width: 560px; }
.inherit-chain .uml-class { width: 100%; }
.inherit-arrow { position: relative; width: 2px; height: 2.1rem; background: var(--line); margin: 2px 0; }
.inherit-arrow::before, .inherit-arrow::after {
  content: ""; position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 9px solid transparent; border-right: 9px solid transparent;
}
.inherit-arrow::before { border-bottom: 14px solid var(--line); }
.inherit-arrow::after { border-bottom: 10px solid var(--canvas); margin-top: 2px; }
.arrow-label { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-family: var(--font-mono); font-size: .72rem; font-style: italic; color: var(--text-faint); white-space: nowrap; }
.role-desc { margin: .6rem 0 0; padding: 0 1.2rem; color: var(--text-muted); font-size: .85rem; }
.role-note { margin: .4rem 0 0; padding: 0 1.2rem; color: var(--text-faint); font-size: .78rem; font-style: italic; }

/* ---------- Components (Projects) ---------- */
.component-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; }
.uml-component { scroll-margin-top: 90px; transition: border-color .3s ease, box-shadow .3s ease; }
.uml-component:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.uml-component {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1.1rem 1.2rem 1.1rem 1.4rem;
  box-shadow: var(--shadow);
  transition: transform .2s ease;
}
.uml-component:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.uml-component::before, .uml-component::after {
  content: ""; position: absolute; left: -6px; width: 16px; height: 8px;
  background: var(--surface); border: 1px solid var(--line);
}
.uml-component::before { top: 18px; }
.uml-component::after { top: 38px; }
.uml-component h3 { font-size: 1rem; margin: .25rem 0 .4rem; }
.comp-desc { color: var(--text-muted); font-size: .86rem; margin-bottom: .6rem; }
.comp-link { font-family: var(--font-mono); font-size: .8rem; color: var(--accent); display: inline-block; margin-top: .6rem; }

/* ---------- Education ---------- */
.edu-columns { display: grid; grid-template-columns: 1fr 1.6fr; gap: 2.6rem; align-items: start; }
.edu-col-title { font-family: var(--font-mono); font-size: .78rem; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 1.1rem; }
.edu-col-list { display: grid; gap: 1.1rem; }
.edu-col-list.certs { grid-template-columns: repeat(2, 1fr); align-content: start; }
.uml-class.sm .uml-class-header { padding: .7rem 1rem; }
.uml-class.sm .class-name { font-size: 1rem; }
.uml-class.sm .uml-compartment { padding: .65rem 1rem; }
.uml-class.sm .iface-list.sm { padding-left: 1rem; padding-right: 1rem; }

/* ---------- Contact ---------- */
.iface-class { max-width: 640px; }
.iface-class .uml-class-header { background: var(--accent-soft); border-bottom-color: var(--accent); padding: 1.3rem 1.7rem; }
.iface-class .stereotype { color: var(--accent); font-size: .84rem; }
.iface-class .class-name { font-size: 1.4rem; }
.iface-class .uml-compartment.methods-only { padding: 1.5rem 1.7rem; font-size: .94rem; }
.iface-class .uml-compartment.methods-only p { margin-bottom: .8rem; }
.iface-class .uml-compartment.methods-only p:last-child { margin-bottom: 0; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--dot); padding: 1.6rem 0; background: var(--canvas); }
.footer-inner { width: min(1180px, 92%); margin-inline: auto; font-family: var(--font-mono); font-size: .78rem; color: var(--text-faint); }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .reveal { transition: none; opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .package-grid { grid-template-columns: repeat(2, 1fr); }
  .component-grid { grid-template-columns: repeat(2, 1fr); }
  .edu-columns { grid-template-columns: 1fr; }
  .edu-col-list.certs { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .tabs {
    position: fixed; top: 68px; left: 0; right: 0; flex-direction: column;
    background: var(--canvas); border-bottom: 1px solid var(--dot); padding: 1.2rem 0; gap: 0;
    transform: translateY(-130%); transition: transform .3s ease;
  }
  .tabs.open { transform: translateY(0); }
  .tab-link { padding: .8rem 1.5rem; width: 100%; }
  .nav-toggle { display: flex; }
  .lang-switch { margin-right: 0; font-size: .7rem; }
  .hero-row { flex-direction: column; align-items: flex-start; }
  .connector { flex-direction: row; width: auto; height: 40px; transform: rotate(90deg); margin: -4px 0; }
  .conn-label { display: none; }
  .conn-mult { display: none; }
  .hero-class-col { width: 100%; }
  .package-grid, .component-grid { grid-template-columns: 1fr; }
}

@media print {
  .toolbar, .nav-toggle, #theme-toggle { display: none !important; }
  .canvas { padding-top: 0; }
  body { background: #fff; color: #000; }
}
