/* =====================================================
   HERNÁN GALILEO — PORTFOLIO
   Dark / Light themes · Minimalist · Professional
   ===================================================== */

/* === 1. THEME VARIABLES === */
:root {
  --bg:           #0d1117;
  --surface:      #161b22;
  --surface-2:    #1c2130;
  --border:       #30363d;
  --text:         #e6edf3;
  --muted:        #7d8590;
  --accent-tech:  #58a6ff;
  --accent-gis:   #3fb950;
  --accent-warm:  #d29922;
  --photo-border: #0d1117;
  --shadow:       0 4px 32px rgba(0,0,0,.55);
  --shadow-sm:    0 2px 10px rgba(0,0,0,.3);
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;
  --radius:       8px;
  --radius-lg:    14px;
  --transition:   0.2s ease;
}

[data-theme="light"] {
  --bg:           #ffffff;
  --surface:      #f6f8fa;
  --surface-2:    #eaeef2;
  --border:       #d0d7de;
  --text:         #1f2328;
  --muted:        #57606a;
  --accent-tech:  #0969da;
  --accent-gis:   #1a7f37;
  --accent-warm:  #9a6700;
  --photo-border: #ffffff;
  --shadow:       0 4px 24px rgba(0,0,0,.08);
  --shadow-sm:    0 2px 8px rgba(0,0,0,.06);
}

/* === 2. RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background:  var(--bg);
  color:       var(--text);
  font-family: var(--font-body);
  font-size:   16px;
  line-height: 1.65;
  min-height:  100vh;
  transition:  background-color 0.3s ease, color 0.3s ease;
}

/* Smooth theme transitions on key surfaces */
.navbar, .focus-card, .skill-group, .post-card,
.project-card, .cert-item, .footer, .badge-item,
.book-card, .timeline-content {
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

a { color: var(--accent-tech); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: .78; }
img { max-width: 100%; display: block; }

/* === 3. TYPOGRAPHY === */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 600; color: var(--text); }
h1 { font-size: clamp(1.85rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.85rem); }
h3 { font-size: 1.1rem; }
p  { color: var(--muted); }
p.lead { color: var(--text); font-size: 1.05rem; }

code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--surface-2);
  padding: .15em .4em;
  border-radius: 4px;
  color: var(--accent-tech);
}

/* === 4. LAYOUT === */
.container  { max-width: 1080px; margin: 0 auto; padding: 0 1.5rem; }
.section    { padding: 4.5rem 0; }
.section-sm { padding: 2.75rem 0; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }

.section-header    { margin-bottom: 2.5rem; }
.section-header h2 { margin-bottom: .4rem; }
.section-header p  { max-width: 560px; }

.section-label {
  font-family: var(--font-mono);
  font-size: .76rem;
  color: var(--accent-tech);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: .4rem;
  display: block;
}

.divider { border: none; border-top: 1px solid var(--border); margin: 0; }

/* === 5. NAVIGATION === */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13,17,23,.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .navbar { background: rgba(255,255,255,.88); }

.nav-container {
  max-width: 1080px; margin: 0 auto; padding: 0 1.5rem;
  height: 60px; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem;
}

.nav-logo {
  display: flex; align-items: center; gap: .6rem;
  color: var(--text); font-weight: 600; font-size: .9rem;
  flex-shrink: 0;
}
.nav-logo:hover { opacity: 1; color: var(--text); }

.logo-badge {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-tech), var(--accent-gis));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .78rem; color: #fff; flex-shrink: 0;
}

.nav-links {
  display: flex; list-style: none; gap: .1rem; align-items: center;
  margin: 0 auto;
}
.nav-links a {
  color: var(--muted); padding: .32rem .65rem;
  border-radius: var(--radius); font-size: .855rem; font-weight: 500;
  transition: color var(--transition), background var(--transition);
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text); background: var(--surface); opacity: 1;
}

/* Nav right cluster */
.nav-right {
  display: flex; align-items: center; gap: .55rem; flex-shrink: 0;
}

/* Language toggle */
.lang-toggle {
  display: flex; border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden;
}
.lang-toggle a {
  padding: .26rem .5rem; font-size: .73rem;
  font-family: var(--font-mono); color: var(--muted);
  background: transparent; transition: all var(--transition); line-height: 1;
}
.lang-toggle a.active, .lang-toggle a:hover {
  background: var(--surface-2); color: var(--text); opacity: 1;
}
.lang-toggle a:first-child { border-right: 1px solid var(--border); }

/* Theme toggle button */
.theme-toggle {
  background: none; border: 1px solid var(--border);
  color: var(--muted); width: 32px; height: 32px;
  border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color var(--transition), color var(--transition);
}
.theme-toggle:hover { border-color: var(--accent-tech); color: var(--accent-tech); }
.theme-toggle svg {
  width: 15px; height: 15px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
[data-theme="dark"]  .icon-sun  { display: none; }
[data-theme="dark"]  .icon-moon { display: block; }
[data-theme="light"] .icon-sun  { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* Mobile hamburger */
.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: .4rem;
}
.nav-toggle span {
  display: block; width: 21px; height: 2px;
  background: var(--text); border-radius: 2px; transition: all var(--transition);
}

/* === 6. BUTTONS === */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .58rem 1.15rem; border-radius: var(--radius);
  font-size: .865rem; font-weight: 500; font-family: var(--font-body);
  cursor: pointer; border: 1px solid transparent;
  transition: all var(--transition); white-space: nowrap;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent-tech); color: #fff; border-color: var(--accent-tech);
}
.btn-primary:hover { opacity: .84; color: #fff; }

.btn-gis {
  background: var(--accent-gis); color: #fff; border-color: var(--accent-gis);
}
.btn-gis:hover { opacity: .84; color: #fff; }

.btn-outline {
  background: transparent; color: var(--text); border-color: var(--border);
}
.btn-outline:hover { border-color: var(--accent-tech); color: var(--accent-tech); opacity: 1; }

.btn-sm { padding: .35rem .8rem; font-size: .79rem; }

/* === 7. HERO === */
.hero {
  padding: 5.5rem 0 4.5rem;
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; top: -30%; left: -5%;
  width: 55%; height: 110%;
  background: radial-gradient(ellipse, rgba(88,166,255,.07) 0%, transparent 65%);
  pointer-events: none;
}
.hero::after {
  content: ''; position: absolute; top: -10%; right: -5%;
  width: 45%; height: 85%;
  background: radial-gradient(ellipse, rgba(63,185,80,.05) 0%, transparent 65%);
  pointer-events: none;
}

.hero-inner {
  display: flex; align-items: center;
  justify-content: space-between; gap: 3.5rem;
}
.hero-content { flex: 1; min-width: 0; }

.hero-location {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--font-mono); font-size: .76rem;
  color: var(--muted); margin-bottom: 1.2rem;
}

.hero-title { margin-bottom: .75rem; }
.hero-title .name { display: block; }
.hero-title .role {
  display: block; font-size: clamp(.9rem, 2vw, 1.15rem);
  font-weight: 400; color: var(--muted); margin-top: .5rem;
}

.highlight-tech { color: var(--accent-tech); }
.highlight-gis  { color: var(--accent-gis); }

.hero-description {
  font-size: .97rem; color: var(--muted); line-height: 1.8;
  margin: 1.2rem 0 2rem; max-width: 540px;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: .6rem; }

/* Profile photo */
.hero-photo { flex-shrink: 0; }
.photo-ring {
  padding: 3px;
  background: linear-gradient(135deg, var(--accent-tech) 0%, var(--accent-gis) 100%);
  border-radius: 50%; display: inline-block;
  box-shadow: var(--shadow);
}
.photo-ring img {
  width: 205px; height: 205px; border-radius: 50%;
  object-fit: cover; object-position: center top;
  border: 4px solid var(--bg); display: block;
  transition: transform 0.4s ease, border-color 0.3s ease;
}
.photo-ring:hover img { transform: scale(1.03); }

/* === 8. FOCUS CARDS === */
.focus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.2rem;
}

.focus-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.65rem;
  position: relative; overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.focus-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-sm); }
.focus-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.focus-card.tech::before { background: var(--accent-tech); }
.focus-card.gis::before  { background: var(--accent-gis); }
.focus-card.warm::before { background: var(--accent-warm); }
.focus-card.tech:hover { border-color: var(--accent-tech); }
.focus-card.gis:hover  { border-color: var(--accent-gis); }
.focus-card.warm:hover { border-color: var(--accent-warm); }

.focus-icon { font-size: 1.65rem; margin-bottom: .85rem; }
.focus-card h3 { margin-bottom: .4rem; font-size: 1.02rem; }
.focus-card h3 a { color: var(--text); }
.focus-card p { margin-bottom: 1rem; font-size: .885rem; }
.focus-tags { display: flex; flex-wrap: wrap; gap: .32rem; }

.tag {
  font-family: var(--font-mono); font-size: .7rem;
  padding: .17rem .48rem; border-radius: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--muted);
}

/* === 9. SKILLS === */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.skill-group {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.35rem;
}
.skill-group-title {
  font-size: .74rem; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); margin-bottom: .85rem;
  padding-bottom: .45rem; border-bottom: 1px solid var(--border);
}
.skill-list { display: flex; flex-wrap: wrap; gap: .32rem; }

.skill-badge {
  font-size: .77rem; padding: .2rem .58rem;
  border-radius: 4px; font-family: var(--font-mono);
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); cursor: default;
  transition: border-color var(--transition), color var(--transition);
}
.skill-badge:hover { border-color: var(--accent-tech); color: var(--accent-tech); }
.skill-badge.gis  { color: var(--accent-gis);  border-color: rgba(63,185,80,.3); }
.skill-badge.tech { color: var(--accent-tech); border-color: rgba(88,166,255,.3); }

/* === 10. PROJECT CARD === */
.project-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.9rem;
  display: grid; grid-template-columns: 1fr auto;
  gap: 1.5rem; align-items: start;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.project-card:hover { border-color: var(--accent-gis); box-shadow: var(--shadow-sm); }
.project-card h3 { font-size: 1.2rem; margin-bottom: .4rem; }
.project-card h3 a { color: var(--text); display: flex; align-items: center; gap: .55rem; }
.project-card p { margin-bottom: .85rem; font-size: .89rem; }
.project-meta { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-top: .85rem; }
.project-link { color: var(--accent-tech); font-size: .84rem; font-weight: 500; }

.project-icon {
  width: 88px; height: 88px; border-radius: var(--radius-lg);
  object-fit: cover; border: 1px solid var(--border);
  background: var(--surface-2);
}

/* Book card */
.book-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  display: flex; gap: 1.25rem; align-items: flex-start;
  position: relative; overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.book-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent-warm);
}
.book-card:hover { border-color: var(--accent-warm); box-shadow: var(--shadow-sm); }
.book-cover {
  width: 72px; border-radius: 4px; object-fit: cover;
  flex-shrink: 0; box-shadow: 0 4px 12px rgba(0,0,0,.35);
}
.book-meta h4 { margin-bottom: .25rem; font-size: .97rem; }
.book-meta .book-author { color: var(--accent-warm); font-size: .82rem; margin-bottom: .4rem; font-weight: 500; }
.book-meta p { font-size: .875rem; }

/* === 11. BLOG POSTS === */
.blog-list { display: flex; flex-direction: column; gap: .85rem; }

.post-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.35rem;
  display: grid; grid-template-columns: 1fr auto;
  gap: 1rem; align-items: center;
  transition: border-color var(--transition), transform var(--transition);
}
.post-card:hover { border-color: var(--accent-tech); transform: translateX(4px); }
.post-card h3 { font-size: .93rem; margin-bottom: .2rem; }
.post-card h3 a { color: var(--text); }
.post-excerpt { font-size: .84rem; margin-bottom: .4rem; }
.post-meta { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.post-date { font-family: var(--font-mono); font-size: .73rem; color: var(--muted); }

.post-category {
  font-size: .7rem; padding: .14rem .48rem;
  border-radius: 4px; font-family: var(--font-mono);
  background: var(--surface-2); display: inline-block; margin-bottom: .28rem;
}
.post-category.tech  { color: var(--accent-tech); }
.post-category.gis   { color: var(--accent-gis); }
.post-category.urban { color: var(--accent-warm); }

/* === 12. CV PAGE === */
.cv-header-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem; align-items: start;
  padding: 3.5rem 0 2.5rem;
}
.cv-photo-sm .photo-ring img { width: 130px; height: 130px; }
.cv-downloads { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.5rem; }

.cv-section { margin-bottom: 3rem; }
.cv-section > h3 {
  color: var(--accent-tech); font-family: var(--font-mono);
  font-size: .8rem; text-transform: uppercase; letter-spacing: .1em;
  margin-bottom: 1.2rem; padding-bottom: .45rem; border-bottom: 1px solid var(--border);
}

.timeline { display: flex; flex-direction: column; gap: 1.5rem; }
.timeline-item { display: grid; grid-template-columns: 120px 1fr; gap: 1.5rem; }
.timeline-date {
  font-family: var(--font-mono); font-size: .77rem;
  color: var(--muted); padding-top: .15rem; text-align: right;
}
.timeline-content h4 { margin-bottom: .2rem; font-size: .95rem; }
.timeline-content .company { color: var(--accent-tech); font-size: .84rem; margin-bottom: .45rem; font-weight: 500; }
.timeline-content p { font-size: .875rem; }
.timeline-content ul { padding-left: 1.15rem; color: var(--muted); font-size: .875rem; }
.timeline-content ul li { margin-bottom: .3rem; }

.cert-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: .7rem;
}
.cert-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .95rem;
}
.cert-name { font-weight: 500; margin-bottom: .2rem; font-size: .88rem; color: var(--text); }
.cert-org  { color: var(--accent-tech); font-size: .77rem; }

/* Microsoft Learn badges */
.badge-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .6rem;
}
.badge-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .8rem;
  display: flex; align-items: center; gap: .7rem;
  transition: border-color var(--transition);
}
.badge-item:hover { border-color: #0078d4; }
.badge-icon {
  width: 30px; height: 30px; border-radius: 6px;
  background: linear-gradient(135deg, #0078d4, #50e6ff);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; flex-shrink: 0;
}
.badge-info { min-width: 0; }
.badge-label { color: var(--text); font-weight: 500; font-size: .82rem; line-height: 1.3; margin-bottom: .15rem; }
.badge-item a { color: var(--accent-tech); font-size: .73rem; display: inline-flex; align-items: center; gap: .2rem; }

/* === 13. BLOG POST LAYOUT === */
.post-layout { max-width: 700px; margin: 0 auto; }
.post-header { padding: 3rem 0 2rem; border-bottom: 1px solid var(--border); margin-bottom: 2.5rem; }
.post-header h1 { margin-bottom: .9rem; }
.post-body { line-height: 1.85; }
.post-body h2, .post-body h3 { margin: 2rem 0 .85rem; }
.post-body p   { margin-bottom: 1.2rem; }
.post-body ul, .post-body ol { padding-left: 1.5rem; color: var(--muted); margin-bottom: 1.2rem; }
.post-body li  { margin-bottom: .32rem; }
.post-body pre {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem; overflow-x: auto; margin-bottom: 1.2rem;
}
.post-body blockquote {
  border-left: 3px solid var(--accent-tech); padding-left: 1rem;
  color: var(--muted); font-style: italic; margin-bottom: 1.2rem;
}

/* Post language toggle */
.post-lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 2rem;
}
.post-lang-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 600;
  padding: .3rem .75rem;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
  letter-spacing: .04em;
}
.post-lang-btn.active {
  background: var(--surface-2);
  color: var(--text);
}
.post-lang-btn:first-child { border-right: 1px solid var(--border); }

.post-lang { display: none; }
.post-lang.active { display: block; }

/* === 14. FOOTER === */
.footer {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 2.2rem 0; margin-top: 4rem;
}
.footer-inner {
  display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 1rem;
}
.footer p { font-size: .84rem; }
.footer-links { display: flex; gap: 1.2rem; }
.footer-links a { color: var(--muted); font-size: .84rem; }
.footer-links a:hover { color: var(--text); opacity: 1; }

/* === 15. UTILITIES === */
.page-hero { padding: 4rem 0 2rem; }
.page-hero h1 { margin-bottom: .4rem; }

.back-link {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--muted); font-size: .875rem; margin-bottom: 2rem;
}
.back-link:hover { color: var(--text); opacity: 1; }

/* Scroll reveal */
.reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* === 16. RESPONSIVE === */
@media (max-width: 860px) {
  .hero-inner { flex-direction: column-reverse; align-items: flex-start; gap: 2rem; }
  .photo-ring img { width: 148px; height: 148px; }
  .cv-header-grid { grid-template-columns: 1fr; }
  .cv-photo-sm { display: none; }
}

@media (max-width: 768px) {
  .nav-links {
    display: none; position: absolute; top: 60px;
    left: 0; right: 0; background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column; padding: .7rem 1rem; gap: .15rem;
    z-index: 99;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }
  .hero { padding: 3.5rem 0 3rem; }
  .section { padding: 3.25rem 0; }
  .timeline-item { grid-template-columns: 1fr; gap: .35rem; }
  .timeline-date { text-align: left; }
  .project-card { grid-template-columns: 1fr; }
  .project-icon { display: none; }
  .post-card { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  h1 { font-size: 1.65rem; }
  .hero-cta .btn { min-width: 140px; }
  .focus-grid { grid-template-columns: 1fr; }
  .cv-downloads { flex-direction: column; }
  .cv-downloads .btn { justify-content: center; }
  .lang-toggle { display: none; }
}

/* === 17. SYNTAX HIGHLIGHT === */
.highlight { background: var(--surface) !important; border-radius: var(--radius); padding: 1rem; border: 1px solid var(--border); overflow-x: auto; }
.highlight .c, .highlight .c1 { color: #7d8590; font-style: italic; }
.highlight .k, .highlight .kd { color: #ff7b72; }
.highlight .s, .highlight .s1, .highlight .s2 { color: #a5d6ff; }
.highlight .n  { color: var(--text); }
.highlight .nf { color: #d2a8ff; }
.highlight .mi { color: #79c0ff; }
.highlight .o  { color: var(--muted); }
