/* =========================================================
   Theme
   ========================================================= */
:root {
  --bg: #0e0a1f;
  --bg-soft: #1b1535;
  --text: #f3efff;
  --muted: #a49cc4;
  --line: rgb(var(--accent-rgb) / 0.16);
  --accent: #c4b5fd;
  --grid: rgb(var(--grid-rgb) / 0.09);
  --accent-rgb: 196 181 253;
  --grid-rgb: 167 139 250;
  --card-bg: rgba(27, 21, 53, 0.55);
  --nav-bg: rgba(14, 10, 31, 0.7);
  --code-bg: #08061a;
  --surface-1: #3b2a7a;
  --surface-2: #1b1535;
  --glow-1: #3b2a7a;
  --glow-2: #2a1b5c;
  --moon-opacity: 0.35;
  color-scheme: dark;
  --radius: 20px;
  --pad: clamp(20px, 5vw, 80px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font-display: "Times New Roman", Times, serif;
  --font-body: "Times New Roman", Times, serif;
}

*, *::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: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
em { font-style: normal; color: var(--accent); }
::selection { background: var(--accent); color: var(--bg); }

/* Film grain overlay */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 15px 30px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-weight: 600; font-size: 15px;
  transition: transform 0.3s var(--ease), background 0.3s;
}
.btn:hover { transform: translateY(-3px); background: var(--accent); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg-soft); border-color: var(--text); }
.btn-small { padding: 10px 20px; font-size: 14px; }

/* =========================================================
   Navigation
   ========================================================= */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px var(--pad);
  transition: background 0.4s, padding 0.4s, backdrop-filter 0.4s;
}
.nav.scrolled {
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding-block: 14px;
  border-bottom: 1px solid var(--line);
}
.logo { font-family: var(--font-display); font-weight: 800; font-size: 26px; letter-spacing: 0; }
.logo span { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 36px; font-size: 15px; }
.nav-links a:not(.btn) { position: relative; color: var(--muted); transition: color 0.3s; }
.nav-links a:not(.btn)::after {
  content: ""; position: absolute; left: 0; bottom: -4px; width: 100%; height: 1px;
  background: var(--text); transform: scaleX(0); transform-origin: right;
  transition: transform 0.4s var(--ease);
}
.nav-links a:not(.btn):hover { color: var(--text); }
.nav-links a:not(.btn):hover::after { transform: scaleX(1); transform-origin: left; }

.menu-toggle { display: none; background: none; border: 0; cursor: pointer; width: 32px; height: 20px; position: relative; }
.menu-toggle span {
  position: absolute; left: 0; width: 100%; height: 2px; background: var(--text);
  transition: transform 0.4s var(--ease), top 0.4s var(--ease);
}
.menu-toggle span:first-child { top: 4px; }
.menu-toggle span:last-child { top: 14px; }
.menu-toggle.open span:first-child { top: 9px; transform: rotate(45deg); }
.menu-toggle.open span:last-child { top: 9px; transform: rotate(-45deg); }

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 140px var(--pad) 100px;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 15px; margin-bottom: 28px;
}
.dot {
  width: 9px; height: 9px; border-radius: 50%; background: #3ddc84;
  box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 10px rgba(61, 220, 132, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); }
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(48px, 10vw, 150px);
  line-height: 0.95; letter-spacing: -0.01em; font-weight: 800;
}
.hero-title .line { display: block; }
.hero-sub { max-width: 520px; margin-top: 36px; color: var(--muted); font-size: clamp(17px, 1.6vw, 20px); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 40px; }

.scroll-hint {
  position: absolute; bottom: 40px; right: var(--pad);
  width: 26px; height: 42px; border: 1.5px solid var(--muted); border-radius: 20px;
}
.scroll-hint span {
  position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; border-radius: 2px;
  background: var(--text); transform: translateX(-50%);
  animation: scroll 1.8s infinite var(--ease);
}
@keyframes scroll { 0% { opacity: 1; top: 8px; } 100% { opacity: 0; top: 24px; } }

/* =========================================================
   Marquee
   ========================================================= */
.marquee {
  position: relative; z-index: 1; overflow: hidden;
  border-block: 1px solid var(--line); padding: 26px 0;
}
.marquee-track {
  display: flex; gap: 40px; width: max-content;
  font-family: var(--font-display); font-size: clamp(28px, 4vw, 52px); font-weight: 700;
  white-space: nowrap; animation: marquee 28s linear infinite;
}
.marquee-track span:nth-child(even) { color: var(--accent); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* =========================================================
   Sections
   ========================================================= */
.section { position: relative; z-index: 1; padding: clamp(90px, 14vw, 180px) var(--pad); }
.section-label {
  color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: 0.15em;
  margin-bottom: 50px; padding-bottom: 18px; border-bottom: 1px solid var(--line);
}
h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(32px, 4.5vw, 62px); line-height: 1.08; letter-spacing: -0.01em;
}

/* About */
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(40px, 6vw, 100px); }
.about-text p { color: var(--muted); font-size: 19px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 50px; }
.stat strong {
  display: block; font-family: var(--font-display); font-size: clamp(36px, 4vw, 54px);
  line-height: 1; margin-bottom: 8px;
}
.stat strong::after { content: "+"; color: var(--accent); }
.stat:last-child strong::after { content: ""; }
.stat span { color: var(--muted); font-size: 14px; }

/* Work */
.work-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(24px, 3vw, 44px); }
.project:nth-child(even) { margin-top: 90px; }
.project-media {
  position: relative; aspect-ratio: 4 / 3.2; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  display: grid; place-items: center;
}
.project-media::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.35), transparent 50%);
  transition: transform 0.8s var(--ease);
}
.project-media span {
  position: relative; font-family: var(--font-display); font-weight: 800;
  font-size: clamp(40px, 6vw, 88px); color: rgba(0, 0, 0, 0.75); letter-spacing: -0.01em;
  transition: transform 0.8s var(--ease);
}
.project:hover .project-media span { transform: scale(1.1) rotate(-3deg); }
.project:hover .project-media::before { transform: scale(1.3); }
.project-info { display: flex; justify-content: space-between; align-items: baseline; margin-top: 18px; gap: 12px; }
.project-info h3 { font-size: 22px; font-weight: 600; }
.project-info p { color: var(--muted); font-size: 14px; }

/* Services */
.service-list { list-style: none; }
.service {
  display: grid; grid-template-columns: 80px 1fr 1fr; align-items: center; gap: 20px;
  padding: 40px 0; border-bottom: 1px solid var(--line);
  transition: padding 0.5s var(--ease), color 0.4s;
}
.service .num { color: var(--muted); font-size: 14px; }
.service h3 { font-family: var(--font-display); font-size: clamp(28px, 3.6vw, 48px); font-weight: 700; letter-spacing: 0; }
.service p { color: var(--muted); max-width: 420px; }
.service:hover { padding-left: 20px; }
.service:hover h3 { color: var(--accent); }

/* Contact */
.contact { text-align: center; }
.contact .section-label { text-align: left; }
.contact-title { font-size: clamp(40px, 7.5vw, 110px); line-height: 1; letter-spacing: -0.01em; font-weight: 800; }
.contact-mail {
  display: inline-block; margin-top: 50px;
  font-size: clamp(22px, 3vw, 36px); font-weight: 500;
  border-bottom: 2px solid var(--accent); padding-bottom: 6px;
  transition: color 0.3s;
}
.contact-mail:hover { color: var(--accent); }
.socials { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin-top: 50px; }
.socials a {
  padding: 12px 26px; border: 1px solid var(--line); border-radius: 999px; font-size: 15px;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.socials a:hover { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Footer */
.footer {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 30px var(--pad); border-top: 1px solid var(--line);
  color: var(--muted); font-size: 14px;
}
.footer a:hover { color: var(--text); }

/* =========================================================
   Scroll reveal animation
   ========================================================= */
.reveal {
  opacity: 0; transform: translateY(40px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
  transition-delay: var(--delay, 0s);
}
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
  .service { grid-template-columns: 50px 1fr; }
  .service p { grid-column: 2; }
}

@media (max-width: 720px) {
  .menu-toggle { display: block; z-index: 60; }
  .nav-links {
    position: fixed; inset: 0; flex-direction: column; justify-content: center; gap: 30px;
    background: var(--bg); font-size: 28px;
    opacity: 0; pointer-events: none; transition: opacity 0.4s;
  }
  .nav-links.open { opacity: 1; pointer-events: auto; }
  .nav-links a:not(.btn) { color: var(--text); font-family: var(--font-display); }
  .work-grid { grid-template-columns: 1fr; }
  .project:nth-child(even) { margin-top: 0; }
  .stats { grid-template-columns: 1fr 1fr; }
  .scroll-hint { display: none; }
}

/* =========================================================
   Moonlit purple background with coding grid
   ========================================================= */
body {
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, var(--glow-1) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 100% 100%, var(--glow-2) 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
/* Grid lines with small markers, like a code editor / blueprint */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(rgb(var(--grid-rgb) / 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgb(var(--grid-rgb) / 0.05) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, #000 40%, transparent 100%);
          mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, #000 40%, transparent 100%);
}
/* The moon */
body::after {
  content: ""; position: fixed; z-index: 0; pointer-events: none;
  top: 8vh; left: 50%; width: min(46vw, 460px); aspect-ratio: 1; transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.22), transparent 45%),
    radial-gradient(circle at 62% 58%, rgba(14, 10, 31, 0.25) 0 9%, transparent 10%),
    radial-gradient(circle at 40% 66%, rgba(14, 10, 31, 0.2) 0 6%, transparent 7%),
    radial-gradient(circle at 70% 32%, rgba(14, 10, 31, 0.18) 0 5%, transparent 6%),
    radial-gradient(circle, #8b7bd8 0%, #5b47b0 70%);
  opacity: var(--moon-opacity);
  box-shadow: 0 0 120px 40px rgba(139, 123, 216, 0.25), 0 0 300px 120px rgba(91, 71, 176, 0.18);
}
.nav, .footer, main { position: relative; z-index: 1; }
.nav { position: fixed; z-index: 50; }
.marquee-track span:nth-child(even) { color: var(--accent); }
.btn:hover { color: var(--bg); }

/* =========================================================
   Centered layout
   ========================================================= */
.hero { align-items: center; text-align: center; }
.hero-sub { margin-inline: auto; }
.hero-cta { justify-content: center; }
.scroll-hint { right: auto; left: 50%; transform: translateX(-50%); }

.section-label { text-align: center; }
.about-grid { grid-template-columns: 1fr; max-width: 900px; margin-inline: auto; text-align: center; }
.about-text p { max-width: 640px; margin-inline: auto; }
.stats { max-width: 640px; margin-inline: auto; }

.project-info { flex-direction: column; align-items: center; text-align: center; gap: 2px; }

.service {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  transition: transform 0.5s var(--ease), color 0.4s;
}
.service:hover { padding-left: 0; transform: translateY(-4px); }
.service p { max-width: 520px; }

.contact .section-label { text-align: center; }
.footer { justify-content: center; text-align: center; gap: 12px 40px; }

/* =========================================================
   About me page
   ========================================================= */
.nav-links a.active { color: var(--text); }
.nav-links a.active::after { transform: scaleX(1); }

.page-hero { min-height: 70vh; min-height: 70svh; padding-bottom: 40px; }

.intro-grid {
  display: grid; grid-template-columns: auto 1fr; align-items: center;
  gap: clamp(40px, 6vw, 90px); max-width: 1000px; margin-inline: auto;
}
.portrait {
  width: clamp(200px, 26vw, 320px); aspect-ratio: 4 / 5; border-radius: var(--radius);
  object-fit: cover; display: grid; place-items: center;
  background: linear-gradient(160deg, var(--surface-1), var(--surface-2));
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px -30px rgba(139, 123, 216, 0.5);
}
.portrait span { font-family: var(--font-display); font-size: 56px; font-weight: 700; color: var(--accent); }
.intro-text { text-align: left; }
.intro-text p { color: var(--muted); font-size: 19px; }
.intro-text p + p { margin-top: 20px; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.card {
  padding: 40px 30px; border-radius: var(--radius); text-align: center;
  background: var(--card-bg); border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  transition: transform 0.5s var(--ease), border-color 0.4s, opacity 1s var(--ease);
}
.card:hover { transform: translateY(-6px); border-color: var(--accent); }
.card-icon { font-size: 34px; display: block; margin-bottom: 18px; }
.card h3 { font-family: var(--font-display); font-size: 26px; margin-bottom: 10px; }
.card p { color: var(--muted); }

.toolbox { display: grid; grid-template-columns: repeat(2, 1fr); gap: 50px 40px; max-width: 1000px; margin-inline: auto; }
.tool-group { text-align: center; }
.tool-group h3 { font-family: var(--font-display); font-size: 28px; margin-bottom: 18px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.chips li {
  padding: 8px 18px; border-radius: 999px; font-size: 15px;
  border: 1px solid var(--line); background: rgb(var(--accent-rgb) / 0.06);
  transition: background 0.3s, color 0.3s;
}
.chips li:hover { background: var(--accent); color: var(--bg); }

.timeline { list-style: none; max-width: 640px; margin-inline: auto; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px;
  background: linear-gradient(var(--accent), transparent); transform: translateX(-50%);
}
.timeline li {
  position: relative; text-align: center; padding: 30px 24px; margin-bottom: 30px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
}
.timeline .year {
  display: inline-block; padding: 4px 14px; border-radius: 999px; margin-bottom: 12px;
  background: var(--accent); color: var(--bg); font-size: 13px; font-weight: 600;
}
.timeline h3 { font-family: var(--font-display); font-size: 24px; margin-bottom: 6px; }
.timeline p { color: var(--muted); }

@media (max-width: 900px) {
  .intro-grid { grid-template-columns: 1fr; justify-items: center; }
  .intro-text { text-align: center; }
  .cards { grid-template-columns: 1fr; }
  .toolbox { grid-template-columns: 1fr; }
}

/* =========================================================
   Experience page
   ========================================================= */
.xp-list { max-width: 1000px; margin-inline: auto; border-top: 1px solid var(--line); }
.xp { border-bottom: 1px solid var(--line); }
.xp summary {
  display: grid; grid-template-columns: 200px 1fr 40px; align-items: center; gap: 24px;
  padding: 34px 8px; cursor: pointer; list-style: none; text-align: left;
  transition: padding 0.5s var(--ease);
}
.xp summary::-webkit-details-marker { display: none; }
.xp summary:hover { padding-left: 20px; }
.xp summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
.xp-years { color: var(--muted); font-size: 15px; letter-spacing: 0.05em; }
.xp-role { font-family: var(--font-display); font-size: clamp(24px, 3vw, 38px); line-height: 1.15; transition: color 0.3s; }
.xp-role small { display: block; margin-top: 6px; font-family: var(--font-body); font-size: 16px; color: var(--muted); }
.xp summary:hover .xp-role, .xp[open] .xp-role { color: var(--accent); }
.xp-toggle {
  position: relative; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  transition: transform 0.4s var(--ease), background 0.3s;
}
.xp-toggle::before, .xp-toggle::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 1.5px;
  background: var(--text); transform: translate(-50%, -50%);
}
.xp-toggle::after { transform: translate(-50%, -50%) rotate(90deg); transition: transform 0.4s var(--ease); }
.xp[open] .xp-toggle { background: var(--accent); }
.xp[open] .xp-toggle::before, .xp[open] .xp-toggle::after { background: var(--bg); }
.xp[open] .xp-toggle::after { transform: translate(-50%, -50%) rotate(0deg); }
.xp-body {
  padding: 0 8px 36px calc(200px + 24px + 8px); text-align: left;
  animation: xp-open 0.5s var(--ease);
}
@keyframes xp-open { from { opacity: 0; transform: translateY(-8px); } }
.xp-body p { color: var(--muted); max-width: 620px; }
.xp-points { margin: 16px 0 22px 20px; color: var(--muted); }
.xp-points li + li { margin-top: 6px; }
.xp-body .chips { justify-content: flex-start; }

.cert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; max-width: 1000px; margin-inline: auto; }
.cert {
  padding: 32px 26px; border-radius: var(--radius); text-align: center;
  background: var(--card-bg); border: 1px solid var(--line);
  transition: transform 0.5s var(--ease), border-color 0.4s, opacity 1s var(--ease);
}
.cert:hover { transform: translateY(-6px); border-color: var(--accent); }
.cert-year { color: var(--accent); font-size: 14px; letter-spacing: 0.1em; }
.cert h3 { font-family: var(--font-display); font-size: 24px; margin: 10px 0 4px; }
.cert p { color: var(--muted); }

@media (max-width: 720px) {
  .xp summary { grid-template-columns: 1fr 40px; gap: 8px 16px; padding: 26px 0; }
  .xp summary:hover { padding-left: 0; }
  .xp-years { grid-column: 1 / -1; }
  .xp-body { padding: 0 0 30px; }
  .cert-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   News
   ========================================================= */
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 50px; }
.filter {
  font: inherit; font-size: 15px; color: var(--text); cursor: pointer;
  padding: 9px 20px; border-radius: 999px; border: 1px solid var(--line);
  background: rgb(var(--accent-rgb) / 0.06); transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.filter:hover { border-color: var(--accent); }
.filter.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

.news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; max-width: 1200px; margin-inline: auto; }
.news-card {
  display: flex; flex-direction: column; overflow: hidden; text-align: left;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--card-bg);
  transition: transform 0.5s var(--ease), border-color 0.4s, opacity 1s var(--ease);
}
.news-card:hover { transform: translateY(-6px); border-color: var(--accent); }
.news-cover {
  aspect-ratio: 16 / 9; display: grid; place-items: center; overflow: hidden;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(140deg, var(--surface-1), var(--surface-2));
}
.news-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease); }
.news-card:hover .news-cover img { transform: scale(1.05); }
.news-cover-label { font-family: var(--font-display); font-size: clamp(28px, 3vw, 40px); color: var(--accent); opacity: 0.9; }
.news-card-body { display: flex; flex-direction: column; gap: 10px; padding: 26px; flex: 1; }
.news-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--muted); font-size: 14px; }
.news-tag {
  padding: 3px 12px; border-radius: 999px; font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase;
  background: rgb(var(--accent-rgb) / 0.14); color: var(--accent);
}
.news-card h3 { font-family: var(--font-display); font-size: 26px; line-height: 1.2; transition: color 0.3s; }
.news-card:hover h3 { color: var(--accent); }
.news-summary { color: var(--muted); }
.news-more { margin-top: auto; padding-top: 8px; font-size: 15px; }

/* Newest post on the news page is shown big */
.news-card.featured { grid-column: 1 / -1; flex-direction: row; }
.news-card.featured .news-cover { flex: 1.2; aspect-ratio: auto; min-height: 340px; }
.news-card.featured .news-card-body { flex: 1; justify-content: center; padding: clamp(28px, 4vw, 56px); }
.news-card.featured h3 { font-size: clamp(30px, 3.4vw, 46px); }
.news-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); }
.news-all { text-align: center; margin-top: 50px; }

/* Single article */
.article-section { padding-top: 150px; max-width: 820px; margin-inline: auto; }
.back-link { color: var(--muted); font-size: 15px; transition: color 0.3s; }
.back-link:hover { color: var(--accent); }
.article-header { text-align: center; margin: 40px 0 50px; }
.article-meta { justify-content: center; margin-bottom: 22px; }
.article-title { font-family: var(--font-display); font-size: clamp(40px, 6vw, 76px); line-height: 1.05; }
.article-summary { color: var(--muted); font-size: 21px; margin-top: 20px; }
.article-cover { width: 100%; border-radius: var(--radius); margin-bottom: 50px; }

.prose { font-size: 19px; line-height: 1.75; }
.prose > * + * { margin-top: 1.2em; }
.prose h2 { font-size: clamp(26px, 3vw, 34px); margin-top: 1.8em; }
.prose a { color: var(--accent); border-bottom: 1px solid currentColor; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.4em; }
.prose code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.85em;
  padding: 2px 7px; border-radius: 6px; background: rgb(var(--accent-rgb) / 0.12);
}
.prose pre {
  padding: 22px; border-radius: 14px; overflow-x: auto;
  background: var(--code-bg); color: #f3efff; border: 1px solid var(--line);
}
.prose pre code { padding: 0; background: none; font-size: 15px; }
.prose blockquote {
  padding: 6px 0 6px 24px; border-left: 3px solid var(--accent);
  font-size: 22px; font-style: italic; color: var(--text);
}
.prose img { max-width: 100%; border-radius: 14px; }

.article-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin-top: 70px; padding-top: 40px; border-top: 1px solid var(--line);
}
.article-nav a { display: flex; flex-direction: column; gap: 4px; padding: 20px; border-radius: 14px; border: 1px solid var(--line); transition: border-color 0.3s; }
.article-nav a:hover { border-color: var(--accent); }
.article-nav small { color: var(--muted); }
.article-nav .newer { grid-column: 2; text-align: right; }

@media (max-width: 900px) {
  .news-grid { grid-template-columns: 1fr 1fr; }
  .news-card.featured { flex-direction: column; }
  .news-card.featured .news-cover { min-height: 0; aspect-ratio: 16 / 9; }
}
@media (max-width: 720px) {
  .news-grid { grid-template-columns: 1fr; }
  .article-section { padding-top: 120px; }
  .article-nav { grid-template-columns: 1fr; }
  .article-nav .newer { grid-column: auto; }
}

/* =========================================================
   Light theme  (activated by data-theme="light" on <html>)
   ========================================================= */
:root[data-theme="light"] {
  --bg: #f5f2ff;
  --bg-soft: #ebe5ff;
  --text: #17122e;
  --muted: #5d5680;
  --line: rgba(76, 56, 160, 0.16);
  --accent: #6a4bd1;
  --accent-rgb: 106 75 209;
  --grid-rgb: 106 75 209;
  --grid: rgba(106, 75, 209, 0.1);
  --card-bg: rgba(255, 255, 255, 0.7);
  --nav-bg: rgba(245, 242, 255, 0.8);
  --code-bg: #1b1535;
  --surface-1: #d9ceff;
  --surface-2: #f3efff;
  --glow-1: #ddd1ff;
  --glow-2: #e9e1ff;
  --moon-opacity: 0.22;
  color-scheme: light;
}
:root[data-theme="light"] .grain { opacity: 0.03; }

/* Smooth colour change when switching theme */
body, .nav, .card, .cert, .news-card, .xp, .chips li, .filter, .btn, .socials a {
  transition-property: background-color, color, border-color, transform, opacity, padding;
}

/* =========================================================
   Theme toggle button
   ========================================================= */
.nav { gap: 24px; }
.nav-links { margin-left: auto; }
.nav-actions { display: flex; align-items: center; gap: 14px; position: relative; z-index: 60; }
.theme-toggle {
  position: relative; width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: var(--text);
  background: rgb(var(--accent-rgb) / 0.08); border: 1px solid var(--line);
  transition: background-color 0.3s, border-color 0.3s, transform 0.5s var(--ease);
}
.theme-toggle:hover { border-color: var(--accent); transform: rotate(-20deg); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-toggle svg { width: 20px; height: 20px; position: absolute; transition: opacity 0.3s, transform 0.5s var(--ease); }
.theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }
:root[data-theme="light"] .theme-toggle .icon-sun { opacity: 1; transform: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }

/* RSS button */
.rss-link svg { color: #f99b3d; }

/* Project card colours (kept as classes, not inline styles, so the
   Content-Security-Policy can block all inline styles) */
.pm-orange { --c1: #ff6b3d; --c2: #ffb347; }
.pm-violet { --c1: #5b5bff; --c2: #a07bff; }
.pm-green  { --c1: #1fbf8f; --c2: #9be15d; }
.pm-pink   { --c1: #e64980; --c2: #ff8ec7; }

/* 404 page */
.notfound { min-height: 100vh; min-height: 100svh; }
.notfound-code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 15px; text-align: left;
  max-width: 560px; margin: 36px auto 0; padding: 22px 24px; border-radius: 14px;
  background: var(--code-bg); color: #f3efff; border: 1px solid var(--line); overflow-x: auto;
}
.notfound-code .err { color: #ff8e8e; }
.notfound-code .ok { color: #9be15d; }
