/* ==========================================================================
   Alex Joaquim Pereira — personal site
   Plain CSS, no framework. Light/dark via [data-theme] on <html>.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  --bg: #FBF7F2;
  --surface: #FFFDF9;
  --text: #24131F;
  --muted: #665C62;
  --border: #E6DDD8;
  --border-strong: #D3C5C8;

  --accent: #66023C;
  --accent-strong: #4B1740;
  --accent-alt: #9F2B68;
  --accent-soft: #F4E8EF;
  --accent-ink: #ffffff;

  --earth: #586747;
  --earth-soft: #EBEFE6;
  --gold: #8A6A24;
  --gold-soft: #F4EDD8;
  --warning: #A8562A;

  --shadow: 0 1px 2px rgba(36, 19, 31, 0.05);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-serif: Charter, Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas,
    monospace;

  --w-container: 66rem;
  --w-text: 44rem;
  --radius: 10px;
  --radius-sm: 6px;

  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4.5rem;

  --ease-out: cubic-bezier(0.22, 0.61, 0.28, 1);
  --ease-spring: cubic-bezier(0.18, 0.89, 0.32, 1.15);
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #121014;
  --surface: #1B161C;
  --text: #F3EDF1;
  --muted: #B8AAB4;
  --border: #342832;
  --border-strong: #473642;

  --accent: #D06A9E;
  --accent-strong: #E4A0BF;
  --accent-alt: #C7669F;
  --accent-soft: #34202E;
  --accent-ink: #121014;

  --earth: #AFC18A;
  --earth-soft: #242A20;
  --gold: #D7B55B;
  --gold-soft: #302A1B;
  --warning: #E0A35C;

  --shadow: none;
}

/* ---------- Reset & base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  margin: 0 0 var(--sp-4);
  font-weight: 650;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

p {
  margin: 0 0 var(--sp-4);
}

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

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-color: currentColor;
}

ul,
ol {
  margin: 0 0 var(--sp-4);
  padding-left: 1.4rem;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--sp-6) 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.35em;
}

pre {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-4);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

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

::selection {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
}

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

/* ---------- Utilities ---------- */
.container {
  width: min(var(--w-container), 100% - 2.5rem);
  margin-inline: auto;
}

.text-measure {
  max-width: var(--w-text);
}

.muted {
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 100;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
}

.skip-link:focus {
  top: 0.75rem;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-block: var(--sp-3);
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-1) var(--sp-4);
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  padding: var(--sp-1) 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--text);
}

.site-nav a[aria-current="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Theme toggle */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  margin-left: var(--sp-2);
}

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

.theme-toggle svg {
  width: 1.05rem;
  height: 1.05rem;
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* ---------- Sections ---------- */
.section {
  padding-block: var(--sp-8) 0;
}

.section:last-of-type {
  padding-bottom: var(--sp-8);
}

.section-head {
  position: relative;
  margin-bottom: var(--sp-6);
}

.section-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: var(--sp-2);
}

.eyebrow-num {
  color: var(--gold);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.eyebrow-sep {
  color: var(--border-strong);
  font-weight: 400;
}

.section-eyebrow::after {
  content: "";
  height: 1px;
  width: 2.5rem;
  background: var(--accent);
  opacity: 0.45;
}

/* Tiny technical label, aligned right of the eyebrow row (desktop only) */
.eyebrow-micro {
  display: none;
}

@media (min-width: 40em) {
  .eyebrow-micro {
    display: inline-block;
    position: absolute;
    top: 0.28rem;
    right: 1.5rem;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
  }
}

/* Registration mark: tiny crosshair at the section-head corner (desktop only) */
@media (min-width: 40em) {
  .section-head::after {
    content: "";
    position: absolute;
    top: 0.3rem;
    right: 0;
    width: 11px;
    height: 11px;
    background:
      linear-gradient(var(--border-strong), var(--border-strong)) center / 1px 100% no-repeat,
      linear-gradient(var(--border-strong), var(--border-strong)) center / 100% 1px no-repeat;
  }
}

.section-head h1,
.section-head h2 {
  font-size: 1.7rem;
  margin-bottom: var(--sp-2);
}

.section-head p {
  color: var(--muted);
  max-width: 60ch;
  margin: 0;
}

main {
  display: block;
}

/* ---------- Hero ---------- */
.hero {
  padding-block: var(--sp-8) var(--sp-7);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-5);
  justify-items: start;
}

/* Profile photo — editorial portrait with an offset frame */
.hero-media {
  margin: 0;
  position: relative;
  width: min(11rem, 46vw);
  aspect-ratio: 4 / 5;
}

.hero-media::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transform: translate(calc(0.55rem + var(--py, 0rem)), calc(0.55rem + var(--py, 0rem)));
  transition: transform 0.4s var(--ease-out);
}

.hero-photo,
.hero-photo-slot {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
}

/* Empty framed slot shown only while assets/images/profile.jpg doesn't exist */
.hero-photo-slot {
  background: linear-gradient(
    160deg,
    var(--accent-soft),
    var(--surface) 65%
  );
}

@media (hover: hover) {
  .hero-media:hover::before {
    transform: translate(calc(0.8rem + var(--py, 0rem)), calc(0.8rem + var(--py, 0rem)));
  }
}

/* Hero content rhythm: one cohesive block —
   name → introduction → facts → CTAs, connected by consistent gaps */
.hero-content {
  display: grid;
  gap: var(--sp-4);
  justify-items: start;
  align-content: center;
}

.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3rem);
  margin: 0;
}

.hero-intro {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 38rem;
  margin: 0;
}

.hero-intro strong {
  color: var(--text);
  font-weight: 600;
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  color: var(--muted);
}

.hero-facts li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.8rem;
}

.hero-facts li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* CTAs close the hero copy — a touch more air before them */
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-1);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  filter: brightness(1.08);
  text-decoration: none;
}

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

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

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--sp-5);
}

.card-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sp-4);
}

.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  height: 100%;
}

.card-link:hover {
  text-decoration: none;
  border-color: var(--border-strong);
}

a.card-link:focus-visible {
  outline-offset: 3px;
}

.card-link .go {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.card-link:hover .go {
  text-decoration: underline;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: 1fr;
}

.fact-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--sp-4);
  align-content: start;
}

.fact-list dt {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: var(--sp-1);
}

.fact-list dt::before {
  content: "// ";
  color: var(--accent-alt);
  font-weight: 600;
}

.fact-list dd {
  margin: 0;
  font-size: 0.98rem;
}

.fact-list dd ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 999px;
  padding: 0.12rem 0.7rem;
  font-size: 0.85rem;
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: 1fr;
}

.skill-group h3 {
  font-size: 1rem;
  margin-bottom: var(--sp-3);
}

.skill-group .tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- Projects ----------
   Editorial showcase: one featured project, supporting rows.
   Projects without images are the default, fully-supported state. */
.project-featured {
  position: relative;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: var(--sp-5) var(--sp-5) var(--sp-5) var(--sp-5);
  display: grid;
  gap: var(--sp-3);
  justify-items: start;
}

.project-featured h3 {
  font-size: 1.4rem;
  margin: 0;
}

.project-featured p {
  margin: 0;
  color: var(--muted);
  max-width: 62ch;
}

.project-featured .project-image {
  margin-bottom: var(--sp-2);
}

.project-rows {
  list-style: none;
  margin: var(--sp-4) 0 0;
  padding: 0;
}

.project-row {
  border-top: 1px solid var(--border);
  padding-block: var(--sp-4);
  display: grid;
  gap: var(--sp-2);
}

.project-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-3);
}

.project-row h4 {
  font-size: 1.02rem;
  margin: 0;
  font-weight: 650;
}

.project-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 68ch;
}

.project-row .project-links {
  margin-top: 0;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--muted);
}

.project-tags li {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.08rem 0.65rem;
}

.project-links {
  display: flex;
  gap: var(--sp-4);
  margin-top: var(--sp-1);
  font-size: 0.92rem;
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--warning);
  border: 1px solid var(--border-strong);
  border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.5rem;
  white-space: nowrap;
}

/* ---------- Articles ---------- */
.article-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sp-4);
}

.article-item {
  border-top: 1px solid var(--border);
  padding-block: var(--sp-5);
}

.article-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.article-item .card,
.article-item.card {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: none;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--sp-2);
}

.article-item h2,
.article-item h3 {
  font-size: 1.25rem;
  margin: 0 0 var(--sp-2);
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.article-item h2 a,
.article-item h3 a {
  color: var(--text);
  text-decoration: none;
}

.article-item h2 a:hover,
.article-item h3 a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.article-item .summary {
  color: var(--muted);
  margin: 0 0 var(--sp-3);
  max-width: 62ch;
}

.article-item .tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.more-link {
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-block;
}

/* Serif headings give Writing its editorial voice */
#writing .section-head h1,
#writing .section-head h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Future Substack cross-link — renders only when enabled in _data/profile.yml */
.substack-link-row {
  margin: 0;
}

.substack-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  text-decoration-color: color-mix(in srgb, var(--gold) 45%, transparent);
}

.substack-link:hover {
  color: var(--text);
  text-decoration-color: currentColor;
}

/* ---------- Article page ---------- */
.article-header {
  padding-block: var(--sp-7) var(--sp-5);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-6);
}

.article-header h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  margin: var(--sp-3) 0 var(--sp-3);
}

.article-header .article-meta {
  margin-bottom: 0;
}

.breadcrumb {
  font-size: 0.9rem;
  color: var(--muted);
}

.prose {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  line-height: 1.75;
  max-width: 42rem;
}

.prose h2,
.prose h3 {
  font-family: var(--font-sans);
  margin-top: var(--sp-6);
}

.prose blockquote {
  margin: var(--sp-5) 0;
  padding-inline-start: var(--sp-4);
  border-inline-start: 3px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}

.prose img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.article-footer {
  margin-top: var(--sp-7);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
}

.notice {
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  font-size: 0.9rem;
  color: var(--text);
  margin: var(--sp-5) 0;
}

.notice strong {
  color: var(--accent);
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: 1fr;
}

.contact-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sp-2);
}

.contact-links li a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-block: 0.2rem;
  width: 100%;
}

.contact-links li a:hover {
  border-bottom-color: var(--accent);
}

.contact-links .platform {
  color: var(--muted);
  font-size: 0.85rem;
  min-width: 6.5rem;
}

/* ---------- Forms ---------- */
.contact-form {
  display: grid;
  gap: var(--sp-4);
}

.field {
  display: grid;
  gap: var(--sp-1);
}

.field label {
  font-size: 0.9rem;
  font-weight: 600;
}

.field .hint {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
}

.field input,
.field textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem;
  width: 100%;
}

.field textarea {
  resize: vertical;
  min-height: 7rem;
}

.field input:focus-visible,
.field textarea:focus-visible {
  outline-offset: 0;
  border-color: var(--accent);
}

/* Honeypot: hidden from humans, present for bots */
.hp-field {
  position: absolute !important;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-status {
  font-size: 0.95rem;
  margin: 0;
  min-height: 1.4em;
}

.form-status[data-status="success"] {
  color: var(--earth);
}

.form-status[data-status="error"] {
  color: #b42318;
}

[data-theme="dark"] .form-status[data-status="error"] {
  color: #f87171;
}

/* ---------- Decorative technical details ----------
   Registration marks, micro labels, one faint scanline motif.
   All purely decorative: no layout impact, no content claims. */

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--earth);
  margin-right: 0.55rem;
  vertical-align: 0.08em;
}

/* Faint horizontal scanlines behind the hero (desktop only) */
@media (min-width: 56em) {
  .hero {
    position: relative;
  }

  .hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
      0deg,
      transparent 0 39px,
      var(--border) 39px 40px
    );
    opacity: 0.35;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 25%, #000 75%, transparent);
    mask-image: linear-gradient(to bottom, transparent, #000 25%, #000 75%, transparent);
  }

  .hero-inner {
    position: relative;
    z-index: 1;
  }
}

/* Corner tick on the featured project card (desktop only) */
@media (min-width: 40em) {
  .project-featured::before {
    content: "";
    position: absolute;
    top: -1px;
    right: -1px;
    width: 13px;
    height: 13px;
    border-top: 1px solid var(--accent);
    border-right: 1px solid var(--accent);
    border-top-right-radius: var(--radius);
  }
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: var(--sp-8);
  border-top: 1px solid var(--border);
  padding-block: var(--sp-6);
  font-size: 0.92rem;
  color: var(--muted);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
}

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

.site-footer a:hover {
  color: var(--text);
}

.site-footer .footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-4);
}

/* ---------- 404 ---------- */
.error-page {
  min-height: 70vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: var(--sp-4);
  padding: var(--sp-6);
}

.error-page h1 {
  font-size: clamp(2rem, 6vw, 3rem);
  margin: 0;
}

/* ---------- Responsive ---------- */
@media (min-width: 40em) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .contact-grid {
    grid-template-columns: 3fr 2fr;
  }

  .skills-grid.is-three-col {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 56em) {
  .about-grid {
    grid-template-columns: 3fr 2fr;
    gap: var(--sp-7);
  }

  .hero {
    padding-block: var(--sp-8) var(--sp-7);
  }

  .hero-inner {
    grid-template-columns: minmax(0, 1.2fr) minmax(15rem, 0.85fr);
    gap: var(--sp-7);
    align-items: center;
    justify-items: stretch;
  }

  .hero-media {
    grid-column: 2;
    grid-row: 1;
    width: min(19rem, 100%);
    justify-self: end;
  }

  .hero-content {
    grid-column: 1;
    grid-row: 1;
  }

  .section {
    padding-block: var(--sp-8) 0;
  }
}

/* ---------- Motion: page load ----------
   Gated behind html.js + no-preference, so content is never
   hidden for no-JS visitors or reduced-motion users. */
@media (prefers-reduced-motion: no-preference) {
  html.js [data-load] {
    opacity: 0;
    animation: rise 0.65s var(--ease-out) both;
    animation-delay: var(--d, 0ms);
  }

  html.js .hero-media[data-load] {
    animation-name: rise-in;
    animation-duration: 0.75s;
    animation-timing-function: var(--ease-spring);
  }

  html.js [data-reveal] {
    opacity: 0;
    transform: translateY(16px);
    transition:
      opacity 0.6s ease,
      transform 0.6s var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
  }

  html.js [data-reveal].is-revealed {
    opacity: 1;
    transform: none;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Theme toggle micro-interaction ---------- */
.theme-toggle svg {
  transition: transform 0.35s var(--ease-spring);
}

.theme-toggle:active svg {
  transform: rotate(40deg) scale(0.92);
}

/* ---------- Card hover polish ---------- */
.project-featured,
.skill-group,
.stat-card {
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.project-featured:hover,
.skill-group:hover,
.stat-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 8px 24px -16px rgba(36, 19, 31, 0.35);
}

/* ---------- Projects ---------- */
.project-image {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ---------- Empty states ---------- */
.empty-state {
  border-style: dashed;
  color: var(--muted);
}

/* ---------- GitHub section ---------- */
.after-list {
  margin-top: var(--sp-5);
}

.github-grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: 1fr;
}

.stat-card {
  margin: 0;
  padding: var(--sp-4);
  display: grid;
  place-items: center;
  min-height: 14rem;
}

.stat-card img,
.stat-card object {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.stat-card.is-failed img,
.stat-card.is-failed object {
  display: none;
}

.stat-card.is-failed {
  place-items: center;
}

.stat-fallback {
  margin: 0;
  display: grid;
  gap: var(--sp-2);
  justify-items: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.stat-fallback[hidden] {
  display: none;
}

@media (min-width: 56em) {
  .github-grid {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
}

/* ---------- Article reading: progress + prev/next ---------- */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 90;
  pointer-events: none;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.post-nav {
  display: grid;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.post-nav-link {
  display: grid;
  gap: 0.15rem;
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.3s ease;
}

.post-nav-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.post-nav-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.post-nav-title {
  font-weight: 600;
}

.tag-list-inline {
  text-transform: lowercase;
}

/* ---------- Misc ---------- */
.contact-subtitle {
  font-size: 1rem;
  margin-bottom: var(--sp-3);
}

.more-link {
  display: inline-block;
}
