:root {
  --bg: #0f1419;
  --bg-elev: #161c24;
  --border: #262f3a;
  --text: #e8edf2;
  --text-muted: #9aa7b5;
  --accent: #5b9dd9;
  --accent-soft: rgba(91,157,217,0.12);
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }

/* Site nav — present on every page */
nav.site-nav {
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
}
nav.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
nav.site-nav .brand {
  font-weight: 600;
  color: var(--text);
}
nav.site-nav .tabs {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}
nav.site-nav .tabs a { color: var(--text); }
nav.site-nav .tabs a:hover,
nav.site-nav .tabs a.active { color: var(--text); text-decoration: none; }
nav.site-nav .tabs a.active { border-bottom: 2px solid var(--accent); padding-bottom: 2px; }

.lang-toggle { display: flex; gap: 6px; margin-left: 6px; }
.lang-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 36px;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.lang-toggle button svg { display: block; border-radius: 2px; width: 22px; height: 15px; }
.lang-toggle button:hover { opacity: 0.85; }
.lang-toggle button.active { opacity: 1; border-color: var(--border); background: var(--accent-soft); }

/* Bilingual content: [data-lang="es"] elements start hidden via the HTML `hidden`
   attribute. !important on both sides so this can't be silently overridden by a
   more specific component rule (e.g. ".quick-links a { display: block }") in
   either direction — neither "stay hidden by default" nor "show when active"
   should depend on winning an ordinary specificity fight. */
[data-lang="es"][hidden] { display: none !important; }
html[data-lang="es"] [data-lang="en"] { display: none !important; }
html[data-lang="es"] span[data-lang="es"][hidden] { display: inline !important; }
html[data-lang="es"] p[data-lang="es"][hidden] { display: block !important; }
html[data-lang="es"] a[data-lang="es"][hidden] { display: inline !important; }
html[data-lang="es"] div[data-lang="es"][hidden] { display: block !important; }

/* Page header (used on inner pages instead of the big hero) */
header.page-head {
  padding: 56px 0 32px;
  border-bottom: 1px solid var(--border);
}
header.page-head h1 { font-size: 2rem; margin: 0 0 10px; letter-spacing: -0.01em; }
header.page-head .dek { color: var(--text-muted); font-size: 1.05rem; max-width: 640px; margin: 0; }

/* Homepage hero */
header.hero {
  padding: 72px 0 48px;
}
.hero h1 { font-size: 2.4rem; margin: 0 0 6px; letter-spacing: -0.01em; }
.hero .role { color: var(--text-muted); font-size: 1.05rem; margin: 0 0 24px; }
.hero .pitch {
  font-size: 1.15rem;
  max-width: 640px;
  color: var(--text);
  margin: 0 0 28px;
}
.links { display: flex; gap: 14px; flex-wrap: wrap; }
.links a {
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.92rem;
}
.links a:hover { border-color: var(--accent); text-decoration: none; background: var(--accent-soft); }

/* Start Here quick-links */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 8px 0 0;
}
.quick-links a {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}
.quick-links a:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.quick-links .qtitle { font-weight: 600; margin-bottom: 4px; }
.quick-links .qdesc { color: var(--text-muted); font-size: 0.88rem; }

section { padding: 48px 0; }
section + section { border-top: 1px solid var(--border); }
section h2 { font-size: 1.5rem; margin: 0 0 8px; }
section h3 { font-size: 1.15rem; margin: 32px 0 12px; }
section .section-sub {
  color: var(--text-muted);
  margin: 0 0 28px;
  font-size: 0.98rem;
}
section p { color: var(--text-muted); }

/* Project grid (About > Data Portfolio) */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card .industry { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.card h4 { margin: 0; font-size: 1.08rem; line-height: 1.35; color: var(--text); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.tags span {
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
}
.card-photo {
  position: relative;
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color 0.2s ease;
}
.card-photo:hover { border-color: var(--accent); }
.card-photo img {
  display: block;
  width: 100%;
  height: 190px;
  object-fit: cover;
}
.card-photo .finding {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 36px 14px 12px;
  background: linear-gradient(to top, rgba(6,9,13,0.97) 60%, rgba(6,9,13,0) 100%);
  color: #f4f7fa;
  font-size: 0.86rem;
  line-height: 1.45;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.card-photo:hover .finding,
.card-photo:focus-visible .finding {
  opacity: 1;
}

/* Simple list rows (MOOCs, and later Books/Podcasts/Articles) */
.item-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.item-list li {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  background: var(--bg-elev);
}
.item-list .item-title { color: var(--text); font-weight: 600; font-size: 0.95rem; }
.item-list a.item-title:hover { text-decoration: underline; }
.item-list .item-meta { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }
.item-list .item-quote {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-style: italic;
  line-height: 1.5;
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}
.category-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 28px 0 10px;
}
.category-label:first-child { margin-top: 0; }

/* Creator headers (Articles page) — larger name + their own Medium profile
   photo, for the followed creators specifically (not "My Writing" or
   "Recommended Reading", which stay plain .category-label text). */
.creator-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 32px 0 14px;
}
.creator-label:first-child { margin-top: 0; }
.creator-label img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}
.creator-label .creator-name {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}

/* Article cards — preview-thumbnail images pulled from each post; unlike the
   book/podcast covers, the title isn't printed on the art, so it stays visible. */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.article-card {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  transition: border-color 0.2s ease;
}
.article-card:hover,
.article-card:focus-visible { border-color: var(--accent); }
.article-media { position: relative; }
.article-card img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.article-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.35;
}
.article-card:hover .article-title { text-decoration: underline; }
/* Per-image contrast, picked from each photo's own brightness where the title sits. */
.article-card.is-dark .article-title { color: #ffffff; text-shadow: 0 1px 4px rgba(0,0,0,0.75), 0 0 2px rgba(0,0,0,0.6); }
.article-card.is-light .article-title {
  color: #14181f;
  font-weight: 800;
  -webkit-text-stroke: 0.6px #ffffff;
  text-shadow:
    -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff,
    0 -1px 0 #fff, 0 1px 0 #fff, -1px 0 0 #fff, 1px 0 0 #fff;
}
.article-card .article-meta { color: var(--text-muted); font-size: 0.8rem; padding: 8px 14px 12px; }

/* Cover grids (Books, Podcasts) — large, title-free art; the blurb reveals on
   hover like the project cards. .ratio-2-3 for book covers, .ratio-1-1 for
   square podcast artwork. */
.cover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 20px;
}
.cover-item {
  position: relative;
  display: block;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  transition: border-color 0.2s ease;
}
.cover-item.ratio-2-3 { aspect-ratio: 2 / 3; }
.cover-item.ratio-1-1 { aspect-ratio: 1 / 1; }
.cover-item:hover,
.cover-item:focus-visible { border-color: var(--accent); }
.cover-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}
.cover-item .cover-quote {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 16px;
  display: flex;
  align-items: center;
  background: #06090d;
  color: #f4f7fa;
  font-size: 0.84rem;
  font-style: italic;
  line-height: 1.5;
  opacity: 0;
  overflow-y: auto;
  transition: opacity 0.25s ease;
}
.cover-item:hover .cover-quote,
.cover-item:focus-visible .cover-quote { opacity: 1; }
/* The generic bilingual rule forces block display on shown <p> elements; restore
   flex here so the Spanish quote still vertically centers like the English one. */
html[data-lang="es"] .cover-item p.cover-quote[data-lang="es"][hidden] { display: flex !important; }

/* Honest "not built yet" placeholder */
.placeholder {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.about-page-content { max-width: 720px; }

/* Scroll reveal — cards fade/slide in as they enter the viewport */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

footer {
  border-top: 1px solid var(--border);
  padding: 40px 0 60px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
footer .links a { color: var(--text-muted); }
