/* ==========================================================================
   evgomes.github.io - portfolio stylesheet
   Dark-first design; honors prefers-color-scheme: light via token swap.
   ========================================================================== */

:root {
  /* Dark scheme (default) */
  --bg: #0a0e17;
  --bg-alt: #0d121f;
  --surface: #121828;
  --surface-2: #1a2236;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --accent: #f59e0b;
  --accent-soft: rgba(245, 158, 11, 0.12);
  --accent-border: rgba(245, 158, 11, 0.35);
  --accent-contrast: #0a0e17;
  --glow: rgba(245, 158, 11, 0.07);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);

  /* Ambient background effect */
  --grid-line: rgba(148, 163, 184, 0.06);
  --grid-scan-line: rgba(148, 163, 184, 0.2);

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --container: 1120px;

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --bg-alt: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --border: rgba(15, 23, 42, 0.1);
    --border-strong: rgba(15, 23, 42, 0.22);
    --text: #1e293b;
    --text-muted: #475569;
    --text-faint: #94a3b8;
    --accent: #b45309; /* darker amber: WCAG AA on white */
    --accent-soft: rgba(180, 83, 9, 0.1);
    --accent-border: rgba(180, 83, 9, 0.35);
    --accent-contrast: #ffffff;
    --glow: rgba(180, 83, 9, 0.05);
    --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);

    --grid-line: rgba(15, 23, 42, 0.05);
    --grid-scan-line: rgba(15, 23, 42, 0.14);

    color-scheme: light;
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  background: var(--bg);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: transparent; /* the fixed #bg-fx layer shows through */
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------- Ambient background layer ------------------------- */
#bg-fx {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 46px 46px;
}

/* Brighter grid revealed in a soft circle around the cursor (grid scan). The
   mask defaults off-screen, so nothing shows until main.js tracks the cursor
   (i.e. it stays hidden on touch devices, where the effect is skipped). */
#grid-scan {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--grid-scan-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-scan-line) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle 200px at var(--mx, -500px) var(--my, -500px), #000 0%, transparent 68%);
  mask-image: radial-gradient(circle 200px at var(--mx, -500px) var(--my, -500px), #000 0%, transparent 68%);
}

/* Particle + constellation canvas (rendered in main.js). */
#fx-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  margin: 0 0 0.6em;
  font-weight: 700;
  letter-spacing: -0.015em;
}

p {
  margin: 0 0 1em;
}

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

.mono {
  font-family: var(--font-mono);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.6rem 1rem;
  z-index: 200;
  border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
  left: 0;
}

/* Section scaffolding */
section {
  padding: 5rem 0;
}

/* Even sections (About, Projects, Skills, Contact) get a solid background so the
   grid stays hidden there; odd sections stay transparent and show the grid. */
section:nth-of-type(even) {
  background: var(--bg);
}

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.section-heading h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  margin: 0;
}

.section-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
  transform: translateY(-0.35rem);
}

.section-lede {
  color: var(--text-muted);
  max-width: 46rem;
  margin-bottom: 2.5rem;
}

/* Reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* Buttons & chips */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.35rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px var(--accent-soft), 0 0 0 4px var(--accent-soft);
}

.btn-ghost {
  border-color: var(--border-strong);
  color: var(--text);
  background: transparent;
}

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

.chip {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ------------------------------ Navigation ------------------------------- */
#site-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

#site-nav.scrolled {
  border-bottom-color: var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  color: var(--text);
  font-size: 1rem;
}

.brand:hover {
  text-decoration: none;
}

.brand .monogram {
  font-family: var(--font-mono);
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
}

#nav-menu {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

#nav-menu a {
  display: block;
  padding: 0.45rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

#nav-menu a:hover {
  color: var(--text);
  text-decoration: none;
}

#nav-menu a.active {
  color: var(--accent);
}

#nav-menu .nav-cta {
  margin-left: 0.5rem;
}

#nav-menu .nav-cta a {
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-weight: 600;
}

#nav-menu .nav-cta a:hover {
  background: var(--accent);
  color: var(--accent-contrast);
}

#nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  width: 42px;
  height: 42px;
  font-size: 1.1rem;
  cursor: pointer;
}

@media (max-width: 900px) {
  #nav-toggle {
    display: grid;
    place-items: center;
  }

  #nav-menu {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.25rem 1.25rem;
    display: none;
  }

  #nav-menu.open {
    display: flex;
  }

  #nav-menu .nav-cta {
    margin: 0.5rem 0 0;
  }

  #nav-menu .nav-cta a {
    text-align: center;
  }
}

/* --------------------------------- Hero ---------------------------------- */
.hero {
  padding: 10rem 0 6rem;
  position: relative;
}

.hero .container {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.9fr);
  gap: 3.5rem;
  align-items: center;
}

@media (max-width: 900px) {
  .hero {
    padding-top: 7.5rem;
  }
  .hero .container {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}

.badge-available {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
  background: var(--surface);
}

.badge-available .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

.hero h1 {
  font-size: clamp(2.3rem, 5.5vw, 3.6rem);
  margin-bottom: 0.35rem;
}

.hero .role {
  font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1.1rem;
}

.hero .pitch {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 34rem;
  margin-bottom: 1.8rem;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1.8rem;
}

.social-row {
  display: flex;
  gap: 0.6rem;
}

.social-row a {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 1.05rem;
  transition: all 0.15s ease;
}

.social-row a:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

/* Hero right column: portrait + metrics */
.hero-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
}

.hero-portrait {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hero-portrait img {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent-border);
  box-shadow: 0 0 0 8px var(--accent-soft);
}

.hero-portrait .meta {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  display: grid;
  gap: 0.35rem;
}

.hero-portrait .meta i {
  color: var(--accent);
  width: 1.1rem;
}

.badge-relocation {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  margin-top: 0.2rem;
  width: fit-content;
}

.badge-relocation i {
  width: auto;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  width: 100%;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.metric:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
}

.metric .value {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.metric .label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* -------------------------------- About ---------------------------------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 3rem;
}

@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}

.about-aside {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
}

.info-card h3 {
  font-size: 0.95rem;
  margin-bottom: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-card h3 i {
  color: var(--accent);
}

.info-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ------------------------------- Services -------------------------------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.service-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-3px);
}

.service-card .icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.service-card h3 {
  font-size: 1.08rem;
}

.service-card p {
  color: var(--text-muted);
  font-size: 0.93rem;
  margin: 0;
}

/* Fronteira Labs strip */
.fronteira-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  background: linear-gradient(120deg, var(--accent-soft), transparent 60%), var(--surface);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 1.6rem 1.9rem;
}

.fronteira-strip h3 {
  margin-bottom: 0.3rem;
  font-size: 1.2rem;
}

.fronteira-strip p {
  margin: 0;
  color: var(--text-muted);
  max-width: 40rem;
}

.fronteira-strip .lang-note {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  display: block;
  margin-top: 0.35rem;
}

/* ------------------------------- Projects -------------------------------- */
.projects-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

#projects-count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-bottom: 1.5rem;
}

#projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.4rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.project-card-btn {
  all: unset;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  cursor: pointer;
  box-sizing: border-box;
}

.project-card-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--radius);
}

.project-thumb {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.project-thumb img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  object-position: top;
  transition: transform 0.35s ease;
}

/* Missing screenshots show a centered "coming soon" placeholder, and skip the
   dark overlay so the placeholder text stays readable. */
.project-thumb.img-missing img,
.article-cover.img-missing img {
  object-fit: cover;
  object-position: center;
}

.project-thumb.img-missing::after,
.article-cover.img-missing::after {
  display: none;
}

.carousel-slide.img-missing img {
  object-fit: contain;
  width: 100%;
}

/* Shadow overlay on card imagery (not applied to gallery/carousel images) so
   badges keep contrast on bright screenshots. */
.project-thumb::after,
.article-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(2, 6, 15, 0.55) 0%, rgba(2, 6, 15, 0.08) 45%, rgba(2, 6, 15, 0.3) 100%);
  pointer-events: none;
}

.project-card:hover .project-thumb img {
  transform: scale(1.04);
}

.sector-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(6px);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.project-body {
  padding: 1.2rem 1.3rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}

.project-body h3 {
  font-size: 1.08rem;
  margin: 0;
}

.project-period {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-faint);
  margin: 0;
}

.project-summary {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0;
  flex: 1;
}

.project-more {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.projects-footer {
  margin-top: 2rem;
  text-align: center;
}

/* Project dialog */
#project-dialog {
  width: min(860px, calc(100vw - 2rem));
  max-height: calc(100vh - 4rem);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow);
}

#project-dialog::backdrop {
  background: rgba(2, 6, 15, 0.7);
  backdrop-filter: blur(3px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}

.dialog-header h3 {
  margin: 0;
  font-size: 1.15rem;
}

.dialog-close {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.dialog-close:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.dialog-content {
  padding: 1.25rem 1.5rem 1.75rem;
}

.dialog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
}

.dialog-meta i {
  color: var(--accent);
  margin-right: 0.3rem;
}

.carousel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  margin-bottom: 1.25rem;
}

#carousel-track {
  display: flex;
  transition: transform 0.35s ease;
}

.carousel-slide {
  flex: 0 0 100%;
  display: grid;
  place-items: center;
  max-height: 430px;
}

.carousel-slide img {
  max-height: 430px;
  object-fit: contain;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border: 1px solid var(--border-strong);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.95rem;
  z-index: 1;
}

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

#carousel-prev {
  left: 0.75rem;
}

#carousel-next {
  right: 0.75rem;
}

#carousel-counter {
  position: absolute;
  bottom: 0.6rem;
  right: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  z-index: 2;
}

/* Caption bar for the current gallery image (dialog only). */
#carousel-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  z-index: 1;
  padding: 2.2rem 1.1rem 0.75rem;
  padding-right: 4.5rem; /* leave room for the counter */
  color: #f1f5f9;
  font-size: 0.85rem;
  line-height: 1.4;
  background: linear-gradient(transparent, rgba(2, 6, 15, 0.82) 55%);
  pointer-events: none;
}

#carousel-caption[hidden] {
  display: none;
}

.dialog-body p:last-child {
  margin-bottom: 0;
}

/* ---------------------------- Show-more toggle ----------------------------- */
.show-more {
  margin-top: 2rem;
}

/* -------------------------------- Writing --------------------------------- */
.writing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.article-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.article-cover {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.article-cover img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.article-card:hover .article-cover img {
  transform: scale(1.04);
}

.cover-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(6px);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.article-body {
  padding: 1.15rem 1.4rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.article-card .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
}

.article-card h3 {
  font-size: 1.02rem;
  margin: 0;
}

.article-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
  flex: 1;
}

.article-card .read {
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 600;
}

.writing-footer {
  margin-top: 2rem;
  text-align: center;
}

/* -------------------------------- Skills ---------------------------------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
}

.skill-card h3 {
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.skill-card h3 i {
  color: var(--accent);
  width: 1.4rem;
  text-align: center;
}

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: border-color 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.skill i {
  color: var(--accent);
  font-size: 0.95em;
  width: 1.05em;
  text-align: center;
}

.skill:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
}

/* ------------------------------ Credentials ------------------------------- */
.credentials-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 3rem;
}

@media (max-width: 900px) {
  .credentials-grid {
    grid-template-columns: 1fr;
  }
}

.credentials-grid h3 {
  font-size: 1.15rem;
  margin-bottom: 1.25rem;
}

.edu-item,
.cert-item {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin-bottom: 0.85rem;
}

.edu-item .period,
.cert-item .meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
}

.edu-item h4,
.cert-item h4 {
  font-size: 0.98rem;
  margin: 0.2rem 0 0.15rem;
  font-weight: 600;
}

.edu-item .org,
.cert-item .org {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.cert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.cert-item .cert-link {
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.cert-group-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin: 1.5rem 0 0.85rem;
}

/* ------------------------------- Contact ---------------------------------- */
.contact {
  text-align: center;
}

.contact h2 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
}

.contact .section-lede {
  margin-left: auto;
  margin-right: auto;
}

.contact .email-link {
  font-family: var(--font-mono);
  font-size: 1rem;
  display: inline-block;
  margin-top: 1.25rem;
  color: var(--text-muted);
}

.contact .social-row {
  justify-content: center;
  margin-top: 1.75rem;
}

/* -------------------------------- Footer ---------------------------------- */
footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0;
  color: var(--text-faint);
  font-size: 0.85rem;
}

footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

footer a {
  color: var(--text-muted);
}
