/* =========================================================
   Portfolio — Estefanía Turín
   Fondo blanco, serif (Shippori Mincho), títulos en rojo y un
   único sello (hanko) como marca. Todo el color sale de las
   variables de abajo; el modo oscuro solo las redefine.
   ========================================================= */

:root {
  color-scheme: light;

  --paper: #fffefd;
  --paper-deep: #f3f1ec;      /* código, imágenes */
  --ink: #3b3630;
  --ink-strong: #26221d;
  --muted: #6f6557;
  --line: #e2dccd;
  --moss: #53634a;            /* enlaces */
  --moss-dark: #36432f;
  --seal: #b3382c;            /* hanko: títulos importantes y marcas */
  --ochre: #8a5a12;           /* números en el código */

  --serif: "Shippori Mincho", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: 42rem;

  --washi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.35 0 0 0 0 0.2 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1c1a17;
  --paper-deep: #26231f;
  --ink: #e4ded2;
  --ink-strong: #f4efe6;
  --muted: #a89e8d;
  --line: #3a362f;
  --moss: #a9bf99;
  --moss-dark: #c6d8b8;
  --seal: #e4766a;
  --ochre: #d9a85a;
  --washi: none;
}

/* Quien tiene el sistema en oscuro y JavaScript apagado */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --paper: #1c1a17;
    --paper-deep: #26231f;
    --ink: #e4ded2;
    --ink-strong: #f4efe6;
    --muted: #a89e8d;
    --line: #3a362f;
    --moss: #a9bf99;
    --moss-dark: #c6d8b8;
    --seal: #e4766a;
    --ochre: #d9a85a;
    --washi: none;
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.9;
  letter-spacing: 0.02em;
  color: var(--ink);
  background-color: var(--paper);
  background-image: var(--washi);
}

.wrap {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

main.wrap { padding-block: 1rem 4rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  background: var(--paper);
  color: var(--ink-strong);
  border: 1px solid var(--line);
}
.skip-link:focus { top: 1rem; }

/* ---------- Enlaces ---------- */

a {
  color: var(--moss);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  padding-bottom: 1px;
  transition: color 0.25s ease, background-size 0.25s ease;
}
a:hover { color: var(--moss-dark); background-size: 100% 2px; }

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 4px;
}

/* ---------- Cabecera ---------- */

.site-header {
  max-width: var(--measure);
  margin-inline: auto;
  padding: 1.75rem 1.5rem 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--ink-strong);
  background-image: none;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.brand:hover { color: var(--ink-strong); }

/* El sello: lo único "decorativo" del sitio */
.seal {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  background: var(--seal);
  color: var(--paper);
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transform: rotate(-4deg);
  transition: transform 0.3s ease;
}
.brand:hover .seal { transform: rotate(0deg); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}
.site-nav a {
  color: var(--muted);
  background-image: none;
  padding: 0.15rem 0;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover { color: var(--ink-strong); }
.site-nav a[aria-current="page"] {
  color: var(--seal);
  border-bottom-color: var(--seal);
}

.theme-toggle {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-right: -0.5rem;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.25s ease;
}
.theme-toggle:hover { color: var(--ink-strong); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Tipografía ---------- */

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink-strong);
  text-wrap: balance;
}

h1 {
  font-size: 1.9rem;
  letter-spacing: 0.06em;
  color: var(--seal);
  margin: 2rem 0 1.25rem;
}

/* pincelada corta bajo cada título principal */
h1::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 1px;
  background: var(--ink);
  margin-top: 1.25rem;
}
h1.visually-hidden::after { display: none; }

main h2 {
  position: relative;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  margin: 3.25rem 0 1.1rem;
  padding-left: 1.6rem;
  scroll-margin-top: 1.5rem;
}
/* sello como marca de sección */
main h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 0.7rem;
  height: 0.7rem;
  background: var(--seal);
  border-radius: 1px;
}

h3 {
  font-size: 1.2rem;
  letter-spacing: 0.03em;
  margin: 2.25rem 0 0.6rem;
}

h4 {
  font-size: 1.05rem;
  color: var(--moss-dark);
  letter-spacing: 0.03em;
  margin: 1.75rem 0 0.5rem;
}

p, li { text-wrap: pretty; }
p { margin: 0 0 1.35rem; }

ul, ol { padding-left: 1.3rem; margin: 0 0 1.5rem; }
li { margin-bottom: 0.55rem; }
li::marker { color: var(--muted); }

strong { font-weight: 600; color: var(--ink-strong); }

/* ---------- Portada ---------- */

.tagline {
  font-size: 1.2rem;
  line-height: 1.8;
  color: var(--ink-strong);
  margin: 2rem 0 0;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.5rem;
  margin: 2.25rem 0 0;
}

.filters button {
  appearance: none;
  position: relative;
  padding: 0.25rem 0 0.25rem 1.1rem;
  background: none;
  border: 0;
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease;
}
.filters button::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--seal);
  border-radius: 1px;
  transform: translateY(-50%) scale(0);
  transition: transform 0.2s ease;
}
.filters button:hover { color: var(--ink-strong); }
.filters button[aria-pressed="true"] { color: var(--ink-strong); }
.filters button[aria-pressed="true"]::before { transform: translateY(-50%) scale(1); }
.filters .count { font-size: 0.85em; color: var(--muted); }

.year-group { margin-top: 2.5rem; }

main h2.year {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--seal);
  margin: 0 0 0.35rem;
  padding-left: 0;
}
main h2.year::before { display: none; }

.post-list { list-style: none; margin: 0; padding: 0; }

.post {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 0 1.25rem;
  margin: 0;
  padding: 0.85rem 0;
}

.post time {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 2.1;
  white-space: nowrap;
}

.post-title {
  color: var(--seal);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.55;
  background-image: none;
}
.post-title:hover { color: var(--seal); text-decoration: underline; text-underline-offset: 0.2em; }

.post-summary {
  margin: 0.2rem 0 0;
  font-size: 0.98rem;
  line-height: 1.7;
}

.post-topics {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
}
.post-topics span { margin-right: 0.8rem; white-space: nowrap; }

/* ---------- Página de proyecto ---------- */

.back { margin: 1.5rem 0 0; }
.back a {
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  background-image: none;
}
.back a:hover { color: var(--seal); }

.project-head h1 { margin-top: 1rem; }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.meta li { margin: 0; }

.lead {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--ink-strong);
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1.5rem;
  margin: 1.75rem 0 2rem;
  padding: 1rem 0;
  border-block: 1px solid var(--line);
  font-size: 0.98rem;
  line-height: 1.7;
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.toc {
  margin: 0 0 2.5rem;
  padding-left: 1.1rem;
  border-left: 2px solid var(--line);
}
.toc summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.98rem;
  letter-spacing: 0.03em;
}
.toc[open] summary { color: var(--ink-strong); }
.toc ul { list-style: none; margin: 0.75rem 0 0.25rem; padding: 0; }
.toc li { margin: 0; font-size: 0.95rem; line-height: 1.9; }
.toc a { color: var(--ink); background-image: none; }
.toc a:hover { color: var(--seal); }

.prose { counter-reset: fig; }
.prose > :first-child { margin-top: 0; }

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 4.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  line-height: 1.6;
}
.pager a { display: block; background-image: none; color: var(--ink-strong); }
.pager a:hover { color: var(--seal); }
.pager small { display: block; margin-bottom: 0.15rem; color: var(--muted); font-size: 0.88rem; }
.pager-older { text-align: right; }

/* ---------- Figuras (capturas) ---------- */

figure { margin: 2rem 0 2.25rem; }

figure a.zoom {
  display: block;
  background-image: none;
  padding: 0;
  cursor: zoom-in;
}

figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
  padding: 0.5rem;
  border: 1px solid var(--line);
  background: var(--paper-deep);
}

figcaption {
  counter-increment: fig;
  margin-top: 0.7rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--muted);
}
figcaption::before {
  content: "Figura " counter(fig) ": ";
  font-weight: 600;
  color: var(--ink);
}

dialog.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 1.5rem;
  border: 0;
  background: transparent;
  overflow: auto;
  cursor: zoom-out;
}
dialog.lightbox::backdrop { background: rgb(20 18 15 / 0.88); }
dialog.lightbox[open] { display: grid; place-items: center; }
dialog.lightbox img {
  display: block;
  max-width: min(100%, 90rem);
  max-height: calc(100vh - 3rem);
  object-fit: contain;
  background: var(--paper);
}
.lightbox-close {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink-strong);
  font-size: 1rem;
  cursor: pointer;
}

/* ---------- Código ---------- */

pre {
  margin: 1.5rem 0 2rem;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  background-color: var(--paper-deep);
  border-left: 2px solid var(--moss);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.65;
  letter-spacing: 0;
  tab-size: 2;
}
pre code { padding: 0; background: transparent; font-size: inherit; }

code {
  font-family: var(--mono);
  font-size: 0.85em;
  letter-spacing: 0;
  background-color: var(--paper-deep);
  padding: 0.1em 0.4em;
  overflow-wrap: anywhere;
}
pre code { overflow-wrap: normal; }

/* Colores del resaltado de sintaxis (Prism) */
.token.comment, .token.prolog { color: var(--muted); font-style: italic; }
.token.keyword, .token.important, .token.atrule { color: var(--seal); }
.token.string, .token.attr-value, .token.regex { color: var(--moss); }
.token.number, .token.boolean, .token.constant, .token.symbol { color: var(--ochre); }
.token.function, .token.class-name, .token.builtin { color: var(--ink-strong); font-weight: 600; }
.token.variable, .token.property, .token.parameter { color: var(--ink-strong); }
.token.operator, .token.punctuation { color: var(--muted); }

/* ---------- Tablas ---------- */

table {
  width: 100%;
  margin: 1.5rem 0 2rem;
  border-collapse: collapse;
  font-size: 0.98rem;
}
th, td {
  padding: 0.6rem 0.5rem;
  text-align: left;
  vertical-align: top;
  border: 0;
  border-bottom: 1px solid var(--line);
}
th {
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom-color: var(--ink);
}

/* ---------- Sobre mí ---------- */

.profile {
  display: grid;
  grid-template-columns: 13.75rem 1fr;
  gap: 2rem;
  align-items: start;
  margin: 1.5rem 0 0;
}
.profile img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
}
.profile-text p { font-size: 0.98rem; line-height: 1.75; letter-spacing: 0.015em; }
.profile-text p:last-child { margin-bottom: 0; }

.skills { margin: 0; }
.skills dt { margin-top: 1.1rem; font-weight: 600; color: var(--ink-strong); }
.skills dd { margin: 0; }

.degree h3 { margin: 1.75rem 0 0.2rem; }
.degree .period { margin-left: 0.5rem; font-size: 0.95rem; font-weight: 400; color: var(--muted); }

.course-year {
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: 0 1rem;
  margin: 0 0 1.75rem;
}
.course-year h3 { margin: 0; font-size: 1rem; font-weight: 500; color: var(--muted); letter-spacing: 0.08em; }
.course-list { list-style: none; margin: 0; padding: 0; }
.course-list li { margin: 0 0 1.1rem; }
.course-title { display: block; font-weight: 600; color: var(--ink-strong); line-height: 1.6; }
.course-meta { display: block; font-size: 0.92rem; color: var(--muted); line-height: 1.7; }
.course-meta a { margin-left: 0.9rem; }

/* ---------- Pie ---------- */

.site-footer {
  max-width: var(--measure);
  margin-inline: auto;
  padding: 0 1.5rem 3.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* separador: pincelada que se afina en los extremos */
.brush {
  height: 3px;
  width: min(70%, 24rem);
  margin: 1rem auto 2.5rem;
  background: radial-gradient(ellipse at center, var(--muted) 0%, transparent 72%);
  opacity: 0.7;
}

/* ---------- Móvil ---------- */

@media (max-width: 40rem) {
  body { font-size: 1rem; line-height: 1.85; }
  h1 { font-size: 1.55rem; letter-spacing: 0.04em; }
  main h2 { font-size: 1.3rem; }

  .post { grid-template-columns: 1fr; padding: 0.7rem 0; }
  .post time { line-height: 1.6; }

  .profile { grid-template-columns: 1fr; }
  .profile img { max-width: 12rem; }

  .course-year { grid-template-columns: 1fr; }
  .course-year h3 { margin-bottom: 0.4rem; }

  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 0.6rem; }

  .pager { grid-template-columns: 1fr; }
  .pager-older { text-align: left; }
}

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