/* =====================================================================
   base.css — the shared building blocks for every page.

   Nothing in here sets a colour or font directly. Instead it uses
   variables such as var(--accent), which each theme (themes/*.css)
   defines. That's what makes the whole site switch theme in one click.

   Sections:  1 Fonts  2 Basics  3 Layout  4 Buttons & text
              5 Blocks (hero, cards, stats…)  6 Header & footer
              7 Animations
   ===================================================================== */

/* ---------- 1. Fonts (stored on this server, no Google calls) ---------- */
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('/assets/fonts/inter/inter-latin-wght-normal.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-display: swap; font-weight: 300 700; src: url('/assets/fonts/space-grotesk/space-grotesk-latin-wght-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fraunces'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('/assets/fonts/fraunces/fraunces-latin-wght-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-display: swap; font-weight: 100 800; src: url('/assets/fonts/jetbrains-mono/jetbrains-mono-latin-wght-normal.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('/assets/fonts/outfit/outfit-latin-wght-normal.woff2') format('woff2'); }

/* ---------- Default variables (themes override these) ---------- */
:root {
  --bg: #ffffff;  --bg-alt: #f5f6f8;  --surface: #ffffff;  --surface-2: #f0f2f5;
  --text: #1c2230;  --muted: #5d6676;  --heading: var(--text);
  --accent: #2563eb;  --accent-2: #0ea5e9;  --on-accent: #ffffff;
  --border: rgba(0, 0, 0, 0.1);
  --gradient: linear-gradient(120deg, var(--accent), var(--accent-2));
  --hero-bg: var(--bg);
  --header-bg: color-mix(in srgb, var(--bg) 80%, transparent);
  --font-body: 'Inter', system-ui, sans-serif;
  --font-heading: var(--font-body);
  --heading-weight: 700;  --heading-tracking: -0.02em;
  --radius: 12px;  --radius-lg: 20px;  --btn-radius: 999px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.25);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- 2. Basics ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
main { flex: 1; }
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3, h4 {
  font-family: var(--font-heading); font-weight: var(--heading-weight);
  letter-spacing: var(--heading-tracking); color: var(--heading);
  line-height: 1.12; margin: 0 0 0.6em;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.8rem); }
h3 { font-size: 1.3rem; letter-spacing: -0.01em; }
p { margin: 0 0 1.1em; }
::selection { background: var(--accent); color: var(--on-accent); }

/* ---------- 3. Layout ---------- */
.container { width: min(1140px, 100% - 2.5rem); margin-inline: auto; }
.container--narrow { width: min(760px, 100% - 2.5rem); margin-inline: auto; }
.section { padding-block: clamp(4rem, 9vw, 7.5rem); position: relative; }
.section--alt { background: var(--bg-alt); }
.section--tight { padding-block: clamp(2.5rem, 5vw, 4rem); }
.center { text-align: center; }
.center .lead, .center .section-head { margin-inline: auto; }
.grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.grid-2 { display: grid; gap: clamp(2rem, 5vw, 4.5rem); grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); align-items: center; }
.section-head { max-width: 680px; margin-bottom: 3rem; }

/* ---------- 4. Buttons & text ---------- */
.eyebrow {
  display: inline-block; margin-bottom: 1rem;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
}
.lead { font-size: clamp(1.1rem, 1.6vw, 1.3rem); color: var(--muted); max-width: 640px; }
.muted { color: var(--muted); }
.highlight { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.85rem 1.6rem; border-radius: var(--btn-radius); border: 1px solid transparent;
  background: var(--accent); color: var(--on-accent);
  font: 600 1rem/1 var(--font-body); text-decoration: none; cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -10px var(--accent); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--accent); box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2rem; }
.center .btn-row, .cta .btn-row { justify-content: center; }

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 1.5rem 0 0; list-style: none; }
.tags li {
  padding: 0.35rem 0.85rem; border-radius: 999px; font-size: 0.875rem;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}

/* ---------- 5. Blocks ---------- */

/* Hero — the big opening section of a page */
.hero {
  position: relative; overflow: hidden; background: var(--hero-bg);
  padding-block: clamp(6rem, 14vw, 11rem) clamp(5rem, 10vw, 8rem);
}
.hero h1 { max-width: 15ch; }
.hero.center h1 { margin-inline: auto; }
.hero .lead { margin-bottom: 0; }
.page-header { padding-block: clamp(5rem, 10vw, 8rem) clamp(2rem, 4vw, 3rem); background: var(--hero-bg); }

/* Card — boxes used for services, features, testimonials */
.card {
  position: relative; padding: 2rem; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s;
}
.card h3 { margin-top: 1.25rem; }
.card p:last-child { margin-bottom: 0; }
.card__icon {
  width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
}
.card__icon svg { width: 26px; height: 26px; }
.card ul { padding-left: 1.1rem; color: var(--muted); margin: 0; }

/* Image + text side by side */
.media { position: relative; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.media img { width: 100%; aspect-ratio: 4 / 3.4; object-fit: cover; }

/* Stats — big numbers */
.stats { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); text-align: center; }
.stat__number { font: var(--heading-weight) clamp(2.6rem, 5vw, 3.6rem)/1 var(--font-heading); letter-spacing: var(--heading-tracking); color: var(--heading); }
.stat__number .highlight { display: inline-block; }
.stat__label { margin-top: 0.6rem; color: var(--muted); font-size: 0.95rem; }

/* Logo / technology strip */
.logos { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem 2.75rem; color: var(--muted); font: 600 1.05rem var(--font-heading); opacity: 0.85; }

/* Testimonial */
.quote { font-size: 1.1rem; }
.quote blockquote { margin: 0 0 1.5rem; color: var(--text); }
.quote cite { font-style: normal; font-weight: 600; color: var(--heading); display: block; }
.quote cite span { display: block; font-weight: 400; color: var(--muted); font-size: 0.9rem; }

/* Call-to-action band */
.cta {
  position: relative; overflow: hidden; text-align: center;
  padding: clamp(3rem, 7vw, 5rem) clamp(1.5rem, 5vw, 4rem);
  border-radius: var(--radius-lg); background: var(--gradient); color: var(--on-accent);
}
.cta h2, .cta p { color: inherit; }
.cta p { opacity: 0.9; max-width: 560px; margin-inline: auto; }
.cta .btn { background: var(--on-accent); color: var(--accent); }
.cta .btn--ghost { background: transparent; color: var(--on-accent); border-color: currentColor; }

/* Timeline (career history, process steps) */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.75rem; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding-bottom: 2.25rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ''; position: absolute; left: calc(-1.75rem - 7px); top: 0.35rem;
  width: 12px; height: 12px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}
.timeline .when { font-size: 0.85rem; color: var(--accent); font-weight: 600; letter-spacing: 0.04em; }
.timeline h3 { margin: 0.25rem 0 0.35rem; }
.timeline p { color: var(--muted); margin: 0; }

/* Numbered process steps */
.steps { counter-reset: step; }
.steps .card::before {
  counter-increment: step; content: '0' counter(step);
  font: 700 0.9rem var(--font-heading); color: var(--accent); letter-spacing: 0.1em;
}

/* Contact details */
.contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.contact-list li { display: flex; gap: 1rem; align-items: center; }
.contact-list .card__icon { flex: none; width: 44px; height: 44px; }
.contact-list a { color: var(--text); text-decoration: none; font-weight: 600; }
.contact-list a:hover { color: var(--accent); }

/* Decorative glowing blob, placed inside a hero */
.glow {
  position: absolute; z-index: 0; width: 520px; height: 520px; border-radius: 50%;
  background: var(--gradient); filter: blur(110px); opacity: 0.28; pointer-events: none;
  top: -180px; right: -140px;
}
.hero > .container, .cta > * { position: relative; z-index: 1; }

/* ---------- 6. Header, menu & footer ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color 0.3s, box-shadow 0.3s;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.site-brand { font: 700 1.15rem var(--font-heading); letter-spacing: var(--heading-tracking); color: var(--heading); text-decoration: none; }
.site-nav { display: flex; gap: 2rem; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.97rem; transition: color 0.2s; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--heading); }
.nav-toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; margin: 5px 0; background: var(--heading); transition: transform 0.3s; }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .site-nav {
    position: absolute; top: 72px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    max-height: 0; overflow: hidden; transition: max-height 0.4s var(--ease);
  }
  .site-nav a { padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
  .site-header.nav-open .site-nav { max-height: 420px; }
  .site-header.nav-open .nav-toggle span:first-child { transform: translateY(3.5px) rotate(45deg); }
  .site-header.nav-open .nav-toggle span:last-child { transform: translateY(-3.5px) rotate(-45deg); }
}

.site-footer { border-top: 1px solid var(--border); padding-block: 2rem; color: var(--muted); font-size: 0.92rem; }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; }
.site-footer a { color: var(--muted); }

.admin-bar { background: #111; color: #ddd; font: 13px/1 system-ui, sans-serif; padding: 9px 16px; text-align: center; }
.admin-bar a { color: #fff; }

/* ---------- 7. Animations ----------
   Set in the editor (Settings ⚙ panel) or by hand with attributes:
     data-animate="fade-up"   which animation
     data-trigger="load"      start on page load (default: when scrolled into view)
     data-delay="200"         wait 200ms first
     data-hover="lift"        effect on mouse-over
   assets/site.js adds the class "is-in" at the right moment.            */

[data-animate] {
  opacity: 0;
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease), filter 0.9s var(--ease);
  transition-delay: var(--delay, 0ms);
}
[data-animate="fade-up"]     { transform: translateY(40px); }
[data-animate="fade-down"]   { transform: translateY(-40px); }
[data-animate="slide-left"]  { transform: translateX(60px); }
[data-animate="slide-right"] { transform: translateX(-60px); }
[data-animate="zoom-in"]     { transform: scale(0.88); }
[data-animate="zoom-out"]    { transform: scale(1.12); }
[data-animate="blur-in"]     { filter: blur(14px); }
[data-animate="flip-up"]     { transform: perspective(900px) rotateX(35deg) translateY(30px); transform-origin: bottom; }
[data-animate].is-in { opacity: 1; transform: none; filter: none; }

/* Mouse-over effects */
[data-hover="lift"]:hover  { transform: translateY(-6px); box-shadow: var(--shadow); }
[data-hover="glow"]:hover  { box-shadow: 0 0 0 1px var(--accent), 0 0 40px -6px var(--accent); }
[data-hover="grow"]:hover  { transform: scale(1.04); }
[data-hover="border"]:hover { border-color: var(--accent); }
/* Quick hover transitions — on animated elements, only once their entrance has finished. */
[data-hover]:not([data-animate]), [data-hover].anim-done {
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s;
}

/* Typewriter cursor */
[data-typewriter].is-typing::after { content: '▍'; margin-left: 2px; color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Respect visitors who have asked their device for less motion. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-animate] { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; }
}

/* ---------- Experience & skills page ----------
   (Added later, so it sits after the animation section.) */

/* Detailed timeline: each role with organisation and achievements */
.timeline--detailed li { padding-bottom: 3rem; }
.timeline--detailed .org { color: var(--muted); font-size: 0.95rem; margin: 0 0 0.75rem; }
.timeline--detailed p:not(.org) { color: var(--text); margin-bottom: 0.75rem; }
.timeline--detailed ul { margin: 0; padding-left: 1.1rem; color: var(--muted); display: grid; gap: 0.35rem; }
.timeline--detailed ul li { padding: 0; }
.timeline--detailed ul li::before { content: none; }

/* Skills grouped by area */
.skill-group h3 { margin-top: 0; }
.skill-group .tags { margin-top: 1rem; }

/* Certifications */
.certs { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.cert {
  display: flex; gap: 1rem; align-items: center; padding: 1.1rem 1.25rem;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
}
.cert .card__icon { flex: none; }
.cert h3 { font-size: 1.02rem; margin: 0 0 0.15rem; }
.cert p { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* Three columns max (keeps 6 cards as two even rows) */
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(min(310px, 100%), 1fr)); }

/* Ticked list (e.g. "What I put in place") */
.checklist { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 0.75rem; }
.checklist li { position: relative; padding-left: 2rem; color: var(--text); }
.checklist li::before {
  content: ''; position: absolute; left: 0; top: 0.2em; width: 1.25rem; height: 1.25rem; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.checklist li::after {
  content: ''; position: absolute; left: 0.45rem; top: 0.42em; width: 0.32rem; height: 0.62rem;
  border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* Even out heading line lengths, so a single word never sits alone on the last line. */
h1, h2, h3 { text-wrap: balance; }

/* Portrait photo (e.g. the About page) */
.media--portrait img { aspect-ratio: 4 / 5; object-position: center 25%; }
.media--portrait { max-width: 460px; justify-self: center; width: 100%; }
