/* egallardo.cl — sistema editorial
   Paper, tinta, serifa y línea fina. Ver docs/design.md */

:root {
  --bg: #faf9f7;
  --ink: #211f1a;
  --muted: #6f6a60;
  --faint: #767168;
  --hairline: #e4e1d9;
  --wash: #f1efe8;
  --accent: #c05a1c;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", -apple-system, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  font-feature-settings: "tnum";
  -webkit-font-smoothing: antialiased;
}

::selection { background: #f3dcc9; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 3px;
}

a:hover { text-decoration-color: var(--accent); }

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

.skip-link:focus { left: 0; }

.masthead, main, footer {
  max-width: 1020px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 1020px;
  margin: 0 auto;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}

.topbar-links {
  display: flex;
  gap: 36px;
  font-size: 13.5px;
  letter-spacing: 0.02em;
}

.topbar-links a {
  text-decoration: none;
  color: var(--muted);
  padding: 2px 0;
  border-bottom: 1.5px solid transparent;
}

.topbar-links a:hover { color: var(--ink); }

.topbar-links a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

@media (max-width: 640px) {
  .topbar { padding: 12px 20px; }
  .topbar-links { gap: 22px; font-size: 13px; }
}

/* ---------- masthead ---------- */

.masthead { padding-top: 56px; }

.kicker {
  margin: 0 0 20px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

h1 {
  margin: 0 0 24px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(34px, 5.4vw, 54px);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

h1 span { font-weight: 400; font-style: italic; color: var(--muted); }

/* subtítulo del about: nombre grande, oficio en menor escala */
.masthead--split h1 span {
  display: block;
  margin-top: 6px;
  font-size: clamp(19px, 3vw, 27px);
  line-height: 1.2;
  letter-spacing: 0;
}

.byline {
  margin: -8px 0 26px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.byline a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
}

.byline a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.lede {
  max-width: 620px;
  margin: 0 0 32px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--muted);
}

.masthead-meta {
  margin: 0 0 48px;
  font-size: 14px;
  color: var(--muted);
}

.masthead-meta .sep { color: var(--hairline); padding: 0 6px; }

.available {
  color: var(--accent);
}

.available::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 7px;
  vertical-align: 1px;
}

/* masthead con retrato (about) */

.masthead--split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 48px;
  align-items: start;
}

.masthead-portrait {
  margin-top: 14px;
  border: 1px solid var(--hairline);
  padding: 8px;
  background: #fff;
}

.masthead-portrait img {
  display: block;
  width: 100%;
  height: auto;
  filter: saturate(0.92);
}

.masthead-portrait figcaption {
  padding: 10px 2px 4px;
  font-size: 12px;
  color: var(--faint);
}

@media (max-width: 760px) {
  .masthead--split { grid-template-columns: 1fr; gap: 8px; }
  .masthead-portrait { max-width: 300px; }
}

/* ---------- cifras ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0 24px;
  margin: 0;
  border-top: 1px solid var(--ink);
}

.stats > div { padding: 18px 0 26px; }

.stats dt {
  margin: 0 0 6px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.stats dd {
  margin: 0;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.15;
}

.stats dd small {
  display: block;
  margin-top: 4px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

/* ---------- secciones ---------- */

section { padding: 56px 0 8px; }
section + section { border-top: 1px solid var(--hairline); margin-top: 48px; }
main { padding-bottom: 48px; }

h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.005em;
}

h2 .n {
  display: inline-block;
  margin-right: 16px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--faint);
  letter-spacing: 0.1em;
  transform: translateY(-4px);
}

.note {
  max-width: 640px;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 14px;
}

.section-link {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- áreas de trabajo ---------- */

.areas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 56px;
  margin-top: 28px;
}

.area {
  padding: 22px 0 26px;
  border-top: 1px solid var(--hairline);
}

.area h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
}

.area h3 .n {
  margin-right: 12px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--faint);
  letter-spacing: 0.1em;
}

.area p {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--muted);
}

.area .tags {
  margin: 0;
  font-size: 12.5px;
  color: var(--faint);
}

@media (max-width: 720px) {
  .areas { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- stack por categoría ---------- */

.stack-rows { margin-top: 28px; }

.stack-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  padding: 14px 0;
  border-top: 1px solid var(--hairline);
  font-size: 14px;
}

.stack-row dt {
  margin: 0;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  padding-top: 2px;
}

.stack-row dd { margin: 0; color: var(--muted); }

@media (max-width: 640px) {
  .stack-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- tablas ---------- */

.table-wrap { overflow-x: auto; margin-bottom: 28px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: left;
  padding: 0 14px 10px 0;
  border-bottom: 1px solid var(--ink);
}

td {
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--hairline);
  vertical-align: baseline;
}

td.period { color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
td.status { text-align: right; color: var(--faint); font-size: 13px; }
td.status .current { color: var(--accent); font-weight: 500; }
th.right { text-align: right; padding-right: 0; }
td:last-child { padding-right: 0; }

/* ---------- proyectos (acordeón editorial) ---------- */

.project {
  border-top: 1px solid var(--hairline);
  scroll-margin-top: 64px;
}

.project:first-of-type { border-top: none; }

.project summary {
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding: 26px 0;
  cursor: pointer;
}

.project summary::-webkit-details-marker { display: none; }

.project-num {
  flex: 0 0 40px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--faint);
}

.project summary h2 {
  margin: 0;
  flex: 1;
  font-size: 20px;
  transition: color 0.15s ease;
}

.project summary:hover h2 { color: var(--accent); }

.project summary .chev {
  flex: 0 0 auto;
  align-self: center;
  color: var(--faint);
  transition: transform 0.15s ease;
}

.project[open] summary .chev { transform: rotate(180deg); }

.project-body {
  padding: 2px 0 40px;
}

.project-body > p {
  max-width: 680px;
  margin: 0 0 16px;
  font-size: 15px;
  color: var(--muted);
}

.project-meta {
  max-width: 680px;
  margin: 24px 0 0;
  border-top: 1px solid var(--ink);
}

.project-meta > div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 13.5px;
}

.project-meta dt {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  padding-top: 2px;
}

.project-meta dd { margin: 0; color: var(--muted); }

@media (max-width: 640px) {
  .project summary { gap: 14px; padding: 22px 0; }
  .project summary h2 { font-size: 18px; }
  .project-meta > div { grid-template-columns: 100px minmax(0, 1fr); gap: 12px; }
}

/* ---------- contacto ---------- */

.contact-mail {
  margin: 8px 0 28px;
}

.contact-mail a {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: -0.01em;
  text-decoration: none;
  border-bottom: 2px solid var(--hairline);
  padding-bottom: 3px;
  transition: border-color 0.15s ease, color 0.15s ease;
  overflow-wrap: anywhere;
}

.contact-mail a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--ink);
  margin-top: 24px;
  padding-top: 36px;
  padding-bottom: 80px;
}

footer h2 { font-size: 18px; }

footer p {
  max-width: 680px;
  font-size: 13.5px;
  color: var(--muted);
}

.colophon {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--faint);
}

@media (max-width: 640px) {
  .masthead { padding-top: 44px; }
  .stats dd { font-size: 22px; }
  section { padding-top: 40px; }
}
