/* Paleta y jerarquía compartidas por todas las páginas. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --text: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --size-small: 0.875rem;
  --size-body: 1rem;
  --size-entry: 1.125rem;
  --size-section: 1.5rem;
  --size-title: 2.125rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0f17;
    --bg-subtle: #111827;
    --text: #f3f4f6;
    --text-body: #d1d5db;
    --text-muted: #9ca3af;
    --border: #334155;
    --accent: #93c5fd;
    --accent-hover: #bfdbfe;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f17;
  --bg-subtle: #111827;
  --text: #f3f4f6;
  --text-body: #d1d5db;
  --text-muted: #9ca3af;
  --border: #334155;
  --accent: #93c5fd;
  --accent-hover: #bfdbfe;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text-body);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--size-body);
  line-height: 1.65;
  text-align: left;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 860px;
  margin-inline: auto;
  padding: 3.5rem 1.75rem 5rem;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.utility-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-muted);
  font: inherit;
  font-size: var(--size-small);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

h1, h2, h3, .item-title, .category-title {
  color: var(--text);
  overflow-wrap: break-word;
}

h1 {
  font-size: var(--size-title);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

h2 {
  margin-bottom: 1.25rem;
  font-size: var(--size-section);
  font-weight: 600;
  line-height: 1.35;
}

h3, .item-title, .category-title {
  font-size: var(--size-entry);
  font-weight: 600;
  line-height: 1.4;
}

p, .item-bullets {
  color: var(--text-body);
  font-size: var(--size-body);
  line-height: 1.65;
}

p + p {
  margin-top: 1rem;
}

.subtitle, header > .meta {
  margin-top: 0.75rem;
}

.subtitle {
  font-size: var(--size-body);
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

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

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

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

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875em;
  padding: 0.15em 0.375em;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-subtle);
  font-size: var(--size-small);
  text-decoration: none;
}

.btn-link:hover {
  border-color: var(--accent);
}

.btn-link svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.back-link, .entry-link {
  font-size: var(--size-small);
}

.entry-link {
  display: inline-block;
  margin-top: 0.75rem;
}

section {
  margin-top: 2.75rem;
}

.timeline-item + .timeline-item,
.skills-category + .skills-category {
  margin-top: 1.5rem;
}

.item-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1rem;
}

/* Cada proyecto admite un enlace opcional en el extremo derecho. */
.project-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
}

.project-header .item-title {
  flex: 1 1 22rem;
  min-width: 0;
}

.project-header .entry-link {
  flex: 0 0 auto;
  margin-top: 0;
  margin-left: auto;
  white-space: nowrap;
}

.projects .item-desc {
  text-align: justify;
  text-justify: inter-word;
  -webkit-hyphens: auto;
  hyphens: auto;
  overflow-wrap: break-word;
}

.meta, .item-subtitle, .item-date {
  color: var(--text-muted);
  font-size: var(--size-small);
}

.item-date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.item-subtitle {
  margin-top: 0.25rem;
}

.item-desc, .category-desc {
  margin-top: 0.5rem;
}

.item-subtitle + .item-desc {
  margin-top: 0.75rem;
}

.item-bullets {
  padding-left: 1.25rem;
}

p + .item-bullets {
  margin-top: 0.75rem;
}

.item-bullets li + li {
  margin-top: 0.375rem;
}

.placeholder-box {
  margin-top: 2.75rem;
  padding: 0.75rem 1rem;
  border-left: 2px solid var(--border);
  background: var(--bg-subtle);
}

.project-quote {
  margin-block: 1.5rem;
  padding: 0.75rem 1rem;
  border-left: 2px solid var(--border);
  background: var(--bg-subtle);
}

.focus-card {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--bg-subtle);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--size-small);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  display: inline-block;
  flex-shrink: 0;
}

.project-figure {
  margin-top: 1.5rem;
}

.project-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.project-figure figcaption {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: var(--size-small);
  text-align: center;
}

.movie-chain {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
}

.movie-chain-node {
  padding: 0.75rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text);
  font-size: var(--size-small);
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  overflow-wrap: break-word;
}

.movie-chain-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.movie-chain-arrow::before {
  content: "→";
  font-size: 1.25rem;
  line-height: 1;
}

@media (max-width: 700px) {
  .movie-chain {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 0.375rem;
  }

  .movie-chain-node {
    width: min(100%, 20rem);
    padding: 0.5rem 0.75rem;
  }

  .movie-chain-arrow::before {
    content: "↓";
  }
}

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--size-small);
}

@media (max-width: 600px) {
  :root {
    --size-title: 1.75rem;
  }

  .container {
    padding: 1.5rem 1.25rem 3rem;
  }

  .item-header {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .focus-card {
    padding: 1rem 1.125rem;
  }
}

@media (pointer: coarse) {
  .btn-link, .theme-toggle, .back-link, .entry-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

@media print {
  :root, :root[data-theme] {
    color-scheme: light;
    --bg: #ffffff;
    --bg-subtle: #ffffff;
    --text: #0f172a;
    --text-body: #334155;
    --text-muted: #475569;
    --border: #cbd5e1;
    --accent: #1d4ed8;
  }

  .top-bar, .arrow {
    display: none;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  .timeline-item, .skills-category, .focus-card {
    break-inside: avoid;
  }

  h1, h2, h3 {
    break-after: avoid;
  }
}
