/* Layout & components. Colours/backgrounds come from theme.css. */

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--light-text);
  background: var(--light-bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Section shells ---------- */
.section {
  padding: 96px 0;
  background-size: cover;
  background-position: center;
}
.section--dark { color: var(--dark-text); }
.section--light { color: var(--light-text); }

#about      { background: var(--about-bg-image) center / cover no-repeat, var(--about-bg); }
#experience { background: var(--experience-bg-image) center / cover no-repeat, var(--experience-bg); }
#projects   { background: var(--projects-bg-image) center / cover no-repeat, var(--projects-bg); }
#skills     { background: var(--skills-bg-image) center / cover no-repeat, var(--skills-bg); }
#contact    { background: var(--contact-bg-image) center / cover no-repeat, var(--contact-bg); }

.section-head { margin-bottom: 48px; }
.section-kicker {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-strong);
  letter-spacing: 0.04em;
}
.section--dark .section-kicker { color: var(--accent); }
.section-title {
  margin: 6px 0 0;
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  line-height: 1.2;
}
.section-sub { margin: 10px 0 0; max-width: 640px; }
.section--light .section-sub { color: var(--light-muted); }
.section--dark .section-sub { color: var(--dark-muted); }

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  color: var(--dark-text);
  transition: background 0.25s, box-shadow 0.25s;
}
.nav.is-scrolled {
  background: rgba(15, 20, 25, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 var(--dark-border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}
.nav-brand {
  font-family: var(--font-mono);
  font-weight: 600;
  text-decoration: none;
}
.nav-brand span { color: var(--accent); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--dark-muted);
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--dark-text); }
.nav-right { display: flex; align-items: center; gap: 10px; }

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--dark-border);
  border-radius: 999px;
  overflow: hidden;
}
.lang-switch button {
  background: transparent;
  border: 0;
  color: var(--dark-muted);
  font: 600 0.8rem var(--font-mono);
  padding: 6px 10px;
  cursor: pointer;
}
.lang-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-contrast);
}

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  color: var(--dark-text);
  padding: 6px;
  cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: min(100vh, 820px);
  display: flex;
  align-items: center;
  color: var(--dark-text);
  background: var(--hero-bg);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--hero-bg-image) center / cover no-repeat;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--hero-overlay);
  opacity: 0;
}
.hero.has-image::after { opacity: 1; }
.hero .container { position: relative; z-index: 1; width: 100%; padding-top: 80px; padding-bottom: 60px; }

.hero-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 40px;
  align-items: center;
}
.avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  background: var(--avatar-bg);
  display: grid;
  place-items: center;
  font: 700 2.6rem var(--font-mono);
  color: #fff;
  border: 3px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.hero-hello {
  font-family: var(--font-mono);
  color: var(--accent);
  margin: 0 0 6px;
}
.hero-name {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.hero-role {
  margin: 12px 0 0;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  color: var(--dark-muted);
}
.hero-role strong { color: var(--dark-text); font-weight: 600; }
.hero-location {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--dark-muted);
  font-size: 0.95rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}
.socials {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}
.socials a {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--dark-border);
  color: var(--dark-muted);
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.socials svg { width: 18px; height: 18px; }

.scroll-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  color: var(--dark-muted);
  animation: bob 2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translate(-50%, 6px); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { border-color: var(--dark-border); color: var(--dark-text); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn[disabled] { opacity: 0.6; cursor: wait; transform: none; }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 48px;
  align-items: start;
}
.about-text p { margin: 0 0 16px; font-size: 1.05rem; }
.about-text p:first-child { font-size: 1.2rem; font-weight: 600; }
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.stat {
  background: var(--light-card);
  border: 1px solid var(--light-border);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-value {
  font: 700 1.8rem var(--font-mono);
  color: var(--accent-strong);
  line-height: 1.1;
}
.stat-label { font-size: 0.9rem; color: var(--light-muted); margin-top: 4px; }

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: linear-gradient(var(--accent), var(--light-border) 90%);
  transform: translateX(-50%);
}
.tl-item {
  position: relative;
  width: 50%;
  padding: 0 44px 40px 0;
}
.tl-item:nth-child(even) {
  margin-left: 50%;
  padding: 0 0 40px 44px;
}
.tl-dot {
  position: absolute;
  top: 22px;
  right: -9px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--light-bg-alt);
  border: 3px solid var(--accent);
  z-index: 1;
}
.tl-item:nth-child(even) .tl-dot { right: auto; left: -9px; }
.tl-item.is-current .tl-dot { background: var(--accent); box-shadow: 0 0 0 6px rgba(61, 220, 151, 0.2); }

.tl-card {
  background: var(--light-card);
  border: 1px solid var(--light-border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: 0 1px 2px rgba(16, 24, 32, 0.04);
  transition: box-shadow 0.2s, transform 0.2s;
}
.tl-card:hover { box-shadow: 0 8px 24px rgba(16, 24, 32, 0.08); transform: translateY(-2px); }
.tl-date {
  font: 600 0.82rem var(--font-mono);
  color: var(--accent-strong);
}
.tl-title { margin: 6px 0 2px; font-size: 1.15rem; line-height: 1.3; }
.tl-org { color: var(--light-muted); font-size: 0.95rem; }
.tl-card ul { margin: 12px 0 0; padding-left: 18px; }
.tl-card li { margin-bottom: 6px; font-size: 0.95rem; }
.tl-card li:last-child { margin-bottom: 0; }

.tl-more {
  margin-top: 10px;
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent-strong);
  font: 600 0.88rem var(--font-sans);
  cursor: pointer;
}
.tl-card .is-collapsed { display: none; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag {
  font: 500 0.75rem var(--font-mono);
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(31, 183, 122, 0.1);
  color: var(--accent-strong);
}
.section--dark .tag { background: rgba(61, 220, 151, 0.12); color: var(--accent); }

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}
.project {
  display: flex;
  flex-direction: column;
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}
.project:hover { transform: translateY(-3px); border-color: var(--accent); }
.project-media {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #1f2b35, #13202a);
  display: grid;
  place-items: center;
  color: var(--dark-muted);
  font-family: var(--font-mono);
}
.project-media img { width: 100%; height: 100%; object-fit: cover; }
.project-media img.is-contain { object-fit: contain; background: #fff; padding: 12px; }
.project-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.project-title { margin: 0; font-size: 1.15rem; }
.project-desc { color: var(--dark-muted); margin: 8px 0 0; font-size: 0.95rem; flex: 1; }
.project-links { display: flex; gap: 16px; margin-top: 16px; }
.project-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}
.project-links a:hover { text-decoration: underline; }
.project-links svg { width: 16px; height: 16px; }
.project.is-placeholder { border-style: dashed; }
.project.is-placeholder:hover { transform: none; border-color: var(--dark-border); }

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.skill-group {
  background: var(--light-card);
  border: 1px solid var(--light-border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.skill-group h3 { margin: 0 0 10px; font-size: 1rem; }
.skill-group .tags { margin-top: 0; }

.certs { margin-top: 40px; }
.certs h3 { margin: 0 0 14px; font-size: 1.1rem; }
.cert {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--light-card);
  border: 1px solid var(--light-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  max-width: 560px;
}
.cert-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: #e8f1fb;
  color: #2b6cb0;
  font: 700 0.75rem var(--font-mono);
  flex-shrink: 0;
}
.cert-name { font-weight: 600; }
.cert-meta { color: var(--light-muted); font-size: 0.88rem; }
.cert-status {
  margin-left: auto;
  font: 600 0.75rem var(--font-mono);
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1f3f5;
  color: var(--light-muted);
  white-space: nowrap;
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 48px;
}
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.contact-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  color: var(--accent);
  flex-shrink: 0;
}
.contact-icon svg { width: 18px; height: 18px; }
.contact-label { font-size: 0.82rem; color: var(--dark-muted); }
.contact-value { color: var(--dark-text); text-decoration: none; word-break: break-word; }
a.contact-value:hover { color: var(--accent); }

.form {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: var(--radius);
  padding: 26px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.88rem; color: var(--dark-muted); }
.field input, .field textarea {
  font: inherit;
  color: var(--dark-text);
  background: var(--dark-bg);
  border: 1px solid var(--dark-border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  transition: border-color 0.2s;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-status { margin: 14px 0 0; font-size: 0.92rem; min-height: 1.4em; }
.form-status.is-ok { color: var(--accent); }
.form-status.is-error { color: #ff8a80; }

/* ---------- Footer ---------- */
.footer {
  background: var(--footer-bg);
  color: var(--dark-muted);
  padding: 28px 0;
  font-size: 0.88rem;
}
.footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.footer a { color: var(--dark-muted); }
.footer a:hover { color: var(--accent); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .scroll-hint { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .section { padding: 72px 0; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; gap: 32px; }

  .timeline::before { left: 9px; }
  .tl-item, .tl-item:nth-child(even) { width: 100%; margin-left: 0; padding: 0 0 32px 40px; }
  .tl-dot, .tl-item:nth-child(even) .tl-dot { left: 0; right: auto; }
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 20px 16px;
    background: rgba(15, 20, 25, 0.97);
    border-bottom: 1px solid var(--dark-border);
    display: none;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { display: block; padding: 10px 0; }

  .hero-grid { grid-template-columns: 1fr; gap: 24px; text-align: left; }
  .form-row { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
}
