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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Lato", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

/* Colour tokens */
:root {
  --bg: #0e1425;
  --surface: #111a2c;
  --card: #17243b;
  --text: #f5f8ff;
  --text-weak: #d6e2ff;
  --link: #b8d0ff;
  --link-visited: #d3b4ff;
  --brand: #7fb2ff;
  --brand-strong: #a9c6ff;
  --hero-home: url("img/darkmode_homepage.png");
  --hero-about: url("img/darkmode-about.png");
  --container-max: 72rem;
  --radius: 12px;
  --field: #101a2b;
  --field-border: #2b3f63;
  --focus: #ffd166;
  --nav: #101a2b;
  --nav-text: #e7eefc;
  --nav-border: #22365e;
  --nav-link-hover: #c9dbff;

  /* Button theme - defaults for dark mode */
  --btn-hover: #7fb2ff;
  --btn-glow: rgba(127,178,255,.45);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7faff;
    --surface: #ffffff;
    --card: #eef4ff;
    --text: #111827;
    --text-weak: #334155;
    --link: #0b5fff;
    --link-visited: #6b21a8;
    --brand: #4b6fb8;
    --brand-strong: #2f4d86;
    --hero-home: url("img/lightmode_homepage.png");
    --hero-about: url("img/lightmode-about.png");
    --field: #eef3ff;
    --field-border: #c6d4f3;
    --focus: #0b5fff;
    --nav: #eef3ff;
    --nav-text: #1b2c4a;
    --nav-border: #c6d4f3;
    --nav-link-hover: #0b5fff;

    --btn-hover: #0b5fff;
    --btn-glow: rgba(11,95,255,.35);
  }
}

/* Persistent theme overrides */
html[data-theme="light"] {
  --bg: #f7faff;
  --surface: #ffffff;
  --card: #eef4ff;
  --text: #111827;
  --text-weak: #334155;
  --link: #0b5fff;
  --link-visited: #6b21a8;
  --brand: #4b6fb8;
  --brand-strong: #2f4d86;
  --hero-home: url("img/lightmode_homepage.png");
  --hero-about: url("img/lightmode-about.png");
  --field: #eef3ff;
  --field-border: #c6d4f3;
  --focus: #0b5fff;
  --nav: #eef3ff;
  --nav-text: #1b2c4a;
  --nav-border: #c6d4f3;
  --nav-link-hover: #0b5fff;

  --btn-hover: #0b5fff;
  --btn-glow: rgba(11,95,255,.35);
}
html[data-theme="dark"] {
  --bg: #0e1425;
  --surface: #111a2c;
  --card: #17243b;
  --text: #f5f8ff;
  --text-weak: #d6e2ff;
  --link: #b8d0ff;
  --link-visited: #d3b4ff;
  --brand: #7fb2ff;
  --brand-strong: #a9c6ff;
  --hero-home: url("img/darkmode_homepage.png");
  --hero-about: url("img/darkmode-about.png");
  --field: #101a2b;
  --field-border: #2b3f63;
  --focus: #ffd166;
  --nav: #101a2b;
  --nav-text: #e7eefc;
  --nav-border: #22365e;
  --nav-link-hover: #c9dbff;

  --btn-hover: #7fb2ff;
  --btn-glow: rgba(127,178,255,.45);
}

/* Links and focus */
a { color: var(--link); }
a:visited { color: var(--link-visited); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

/* A11y helpers */
.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px; overflow: hidden;
  clip: rect(1px,1px,1px,1px);
  white-space: nowrap;
}

/* Skip link */
.skip-link { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.skip-link:focus {
  left: 1rem; top: 1rem; width: auto; height: auto;
  padding: .5rem .75rem; background: var(--brand); color: #fff; border-radius: var(--radius); z-index: 2000;
}

/* Layout shell */
.canvas { width: min(100%, var(--container-max)); margin-inline: auto; padding-inline: 1rem; }
@media (min-width: 64em) { .canvas { padding-inline: 2rem; } }

/* Navigation */
.navigationArea {
  position: sticky; top: 0; z-index: 1000;
  background: var(--nav);
  border-bottom: 1px solid var(--nav-border);
  box-shadow: 0 2px 10px rgb(0 0 0 / 18%);
}
#navbar {
  width: min(100%, var(--container-max));
  margin-inline: auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  color: var(--nav-text);
}
.brand img { display: block; max-height: 36px; }
.hamburger { justify-self: end; display: inline-block; border: 0; background: transparent; padding: .4rem .25rem; cursor: pointer; color: var(--nav-text); }
.hamburger-box { width: 28px; height: 18px; display: inline-block; position: relative; }
.hamburger-inner, .hamburger-inner::before, .hamburger-inner::after { width: 28px; height: 2px; background-color: var(--nav-text); position: absolute; left: 0; transition: transform .2s ease, opacity .2s ease; }
.hamburger-inner { top: 8px; }
.hamburger-inner::before { content: ""; top: -8px; }
.hamburger-inner::after  { content: ""; top: 8px; }

.nav-list { list-style: none; margin: 0; padding: 0; grid-column: 1 / -1; display: flex; flex-direction: column; gap: .25rem; }
.nav-list[hidden] { display: none; }
.nav-list a { text-decoration: none; }
.nav-list .btn { display: inline-flex; align-items: center; }
.nav-actions { display: flex; gap: .5rem; padding: .25rem 0 .5rem; }

@media (min-width: 48em) {
  .hamburger { display: none; }
  .nav-list { display: grid !important; grid-auto-flow: column; align-items: center; justify-content: end; gap: .75rem; }
  .nav-actions { padding: 0; }
}

/* Hero */
.hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-block: 1rem;
  border-radius: var(--radius);
  overflow: hidden;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: 0 12px 28px rgb(0 0 0 / 25%);
}
.hero.home  { background-image: var(--hero-home); }
.hero.about { background-image: var(--hero-about); }
.hero-overlay { position: absolute; inset: 0; background: radial-gradient(120% 90% at 20% 70%, rgb(0 0 0 / 0.35), transparent 60%), linear-gradient(180deg, rgb(0 0 0 / 0.15), transparent 35%, rgb(0 0 0 / 0.25) 100%); }
.hero-content { position: absolute; inset: auto 0 1.2rem 1.2rem; color: #fff; text-shadow: 0 2px 6px rgb(0 0 0 / 55%); max-width: 46rem; padding-right: 1rem; }
.hero-content h1 { margin: 0 0 .2rem 0; font-size: clamp(1.6rem, 4.2vw, 2.6rem); line-height: 1.1; }
.tagline { font-weight: 700; font-size: clamp(1.05rem, 2.8vw, 1.25rem); margin: 0 0 .9rem 0; }
@supports not (aspect-ratio: 16/9) { .hero { height: 56.25vw; } }

/* Sections and chips */
.stackArea, .contentArea { padding-block: 1.5rem 2rem; }
.stackArea h2, .contentArea h2 { color: var(--text); margin: 0 0 .6rem; }
.stackArea p, .contentArea p { margin: 0 0 1.25rem; color: var(--text-weak); }
.chips { list-style: none; padding: 0; margin: .25rem 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.chip { background: var(--card); color: var(--text); border: 1px solid var(--field-border); border-radius: 999px; padding: .35rem .75rem; }

/* Grid and cards */
.grid-1-3-4 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 48em) { .grid-1-3-4 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 80em) { .grid-1-3-4 { grid-template-columns: repeat(4, 1fr); } }

.project { background: var(--card); border-radius: var(--radius); padding: 1rem; box-shadow: 0 10px 20px rgb(0 0 0 / 25%); display: grid; justify-items: center; gap: .75rem; text-align: center; }
.project img { width: 100%; height: auto; border-radius: 8px; display: block; }

/* BUTTON SYSTEM - applies to all buttons */
.btn {
  display: inline-block;
  padding: .68rem 1rem;
  border-radius: .75rem;
  font-weight: 700;
  text-decoration: none;
  background: #fff;
  color: #000;
  border: 2px solid #000;
  box-shadow: 0 0 0 rgba(0,0,0,0);
  transition: transform .12s ease, background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.btn.small { padding: .45rem .75rem; font-weight: 600; }
.btn.outline { background: #fff; color: #000; border: 2px solid #000; }
.btn:hover,
.btn:focus-visible {
  background: var(--btn-hover);
  color: #fff;
  border-color: var(--btn-hover);
  box-shadow:
    0 0 0 4px var(--btn-glow),
    0 8px 18px rgba(0,0,0,.28);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0) scale(.98); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .6; cursor: not-allowed; pointer-events: none; }

/* Ensure nav buttons also use the global button style */
.navigationArea .btn,
.navigationArea .btn.outline {
  background: #fff; color: #000; border: 2px solid #000;
}

/* About and education lists */
.aboutGrid { display: grid; gap: 1rem; padding-block: 2rem; align-items: start; }
.aboutCard { background: var(--card); border-radius: var(--radius); padding: 1rem; text-align: center; box-shadow: 0 10px 20px rgb(0 0 0 / 25%); }
.avatar { width: 160px; height: auto; border-radius: 50%; display: block; margin: 0 auto .75rem; }
.aboutText { padding: .5rem; text-align: center; }

/* Timeline shared styles */
.experienceArea, .educationArea { width: min(100%, var(--container-max)); margin: 0 auto; padding: 1rem; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--field-border); }
.timeline li { position: relative; padding: .55rem 0 .55rem 1rem; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 1rem; width: 10px; height: 10px; background: var(--brand); border-radius: 50%; }
.tl-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.tl-meta { color: var(--text-weak); }

/* Force timeline CONTENT to be left-aligned even though sections are centred */
.experienceArea .timeline,
.experienceArea .timeline *,
.educationArea .timeline,
.educationArea .timeline * { text-align: left; }

/* Preferred contact */
.preferredCard { padding: 1rem; }
.pref-inner {
  background: var(--surface);
  border: 1px solid var(--field-border);
  border-radius: 16px;
  padding: 2rem 1rem;
  display: grid;
  justify-items: center;
  gap: 1rem;
  box-shadow: 0 12px 28px rgba(0,0,0,.35);
}
.pref-avatar { width: 180px; height: auto; display: block; }
.pref-links { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; }

/* Contact form */
.contactArea { padding-block: 2rem 3rem; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; max-width: 48rem; margin-inline: auto; }
.form-field { display: grid; gap: .35rem; }
.form-field input, .form-field textarea {
  width: 100%; border: 1px solid var(--field-border); background: var(--field);
  padding: .7rem .8rem; border-radius: 8px; color: var(--text);
}
.form-full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .6rem; align-items: center; }
.form-status { margin-top: .5rem; min-height: 1.25rem; color: var(--text-weak); }
@media (min-width: 48em) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-field:nth-child(3) { grid-column: 1 / -1; }
}

/* Replace your existing .footerArea block with this */
.footerArea {
  background: var(--nav);
  color: var(--nav-text);         
  text-align: center;
  padding: 1rem;
  margin-top: 2rem;
  border-top: 1px solid var(--nav-border);
}

/* Optional: keep link colours consistent if you add links later */
.footerArea a { color: var(--link); }
.footerArea a:visited { color: var(--link-visited); }

/* Optional: tiny spacing tidy-up */
.footerArea p { margin: .25rem 0; }

/* High contrast preference */
@media (prefers-contrast: more) { .btn { box-shadow: none; } .nav-list a, .nav-list button.btn { font-weight: 700; } }

/* Contact form — keep headings centred but left-align all fields on all breakpoints */
.contactArea .form-grid,
.contactArea .form-field,
.contactArea .form-field label,
.contactArea .form-field input,
.contactArea .form-field textarea,
.contactArea .form-status {
  text-align: left;
}

/* Ensure the grid stretches items to the left edge */
.contactArea .form-grid { justify-items: stretch; align-items: start; }
.contactArea .form-field { justify-self: stretch; }

/* If you also want the submit button row left aligned */
.contactArea .form-actions { justify-content: flex-start; }