/* ==========================================================================
   garethmcauley.com — bold & modern, mobile-first
   ========================================================================== */

:root {
  /* Rebrand the whole site by changing these three */
  --accent: #6c5ce7;        /* electric indigo */
  --accent-bright: #a29bfe;
  --bg: #0b0c15;            /* near-black */

  --bg-raised: #141623;
  --text: #f2f3f7;
  --text-muted: #9aa0b4;
  --border: #262a3d;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Fluid spacing & type */
  --space-section: clamp(4rem, 12vw, 9rem);
  --pad-x: max(1.25rem, env(safe-area-inset-left), env(safe-area-inset-right));
}

/* Scroll-driven colour themes: js/main.js interpolates --accent, --bg etc.
   from the scroll position each frame (palettes defined there). No CSS
   transitions here — the per-frame inline values ARE the animation, and a
   transition would lag behind the scroll. Without JS the site stays on the
   indigo :root palette. */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
}

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

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

.skip-link {
  position: absolute;
  top: -3rem;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 0.5rem 0.5rem;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

.accent { color: var(--accent-bright); }

/* ============ Header / nav ============ */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 64rem;
  margin-inline: auto;
  padding: 0.75rem var(--pad-x);
}

.brand {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
}
.brand-dot { color: var(--accent-bright); }

.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;   /* iOS minimum touch target */
  height: 44px;
  background: none;
  border: 0;
  cursor: pointer;
}

.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.nav-toggle-bar { position: relative; }
.nav-toggle-bar::before { position: absolute; top: -7px; }
.nav-toggle-bar::after  { position: absolute; top: 7px; }

.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after  { transform: translateY(-7px) rotate(-45deg); }

.nav-links {
  list-style: none;
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
}
.nav-links.open { display: flex; }

.nav-links a {
  display: block;
  padding: 0.9rem var(--pad-x);  /* generous tap area */
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.nav-links a:active,
.nav-links a:hover { color: var(--accent-bright); }

@media (min-width: 40rem) {
  .nav-toggle { display: none; }
  .nav-links {
    display: flex;
    position: static;
    flex-direction: row;
    gap: 0.25rem;
    background: none;
    border: 0;
  }
  .nav-links a { padding: 0.5rem 0.85rem; border-radius: 0.5rem; }
}

/* ============ Hero ============ */

.hero {
  min-height: 100svh;   /* small viewport height: stable on iOS Safari */
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6rem var(--pad-x) 3rem;
  max-width: 64rem;
  margin-inline: auto;
  background:
    radial-gradient(ellipse 80% 55% at 75% 15%, color-mix(in srgb, var(--accent) 28%, transparent), transparent),
    radial-gradient(ellipse 60% 45% at 10% 90%, color-mix(in srgb, var(--accent) 16%, transparent), transparent);
}

.hero-kicker {
  color: var(--accent-bright);
  font-weight: 700;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero-title {
  font-size: clamp(3.4rem, 16vw, 8.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-bottom: 1.5rem;
}

.hero-tagline {
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  color: var(--text-muted);
  max-width: 36ch;
  margin-bottom: 2.5rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;   /* comfortable thumb target */
  padding: 0.75rem 1.6rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-bright); color: var(--bg); }

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent-bright); color: var(--accent-bright); }

/* ============ Sections ============ */

.section {
  max-width: 64rem;
  margin-inline: auto;
  padding: var(--space-section) var(--pad-x) 0;
}

.section-title {
  font-size: clamp(2rem, 7vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 2.25rem;
}

.section-number {
  color: var(--accent-bright);
  font-size: 0.5em;
  font-weight: 700;
  vertical-align: 0.55em;
  margin-right: 0.5em;
  letter-spacing: 0.1em;
}

.subsection-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 2rem 0 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ============ About ============ */

.about-grid {
  display: grid;
  gap: 2.5rem;
}

.lead {
  font-size: clamp(1.25rem, 4.5vw, 1.6rem);
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 1.25rem;
}

.about-text p + p { margin-top: 1rem; }
.about-text { color: var(--text-muted); }
.about-text .lead { color: var(--text); }

.about-side {
  display: grid;
  gap: 1.75rem;
  align-content: start;
}

/* Circular headshot with an accent ring that tints with the scroll theme */
.portrait {
  width: clamp(160px, 50vw, 220px);
  height: auto; /* the height="480" attribute would otherwise win and stretch it */
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  margin-inline: auto;
  border: 3px solid var(--accent);
  box-shadow:
    0 0 0 7px color-mix(in srgb, var(--accent) 22%, transparent),
    0 24px 48px -24px color-mix(in srgb, var(--accent) 65%, transparent);
}

.about-facts {
  list-style: none;
  display: grid;
  gap: 0.75rem;
  align-content: start;
}

.about-facts li {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.9rem 1.1rem;
  font-weight: 600;
}

.fact-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-bright);
  margin-bottom: 0.15rem;
}

@media (min-width: 48rem) {
  .about-grid { grid-template-columns: 1.6fr 1fr; }
}

/* ============ Experience timeline ============ */

.timeline {
  list-style: none;
  position: relative;
  padding-left: 1.75rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0.4rem;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 2px;
  background: linear-gradient(var(--accent), var(--border));
}

.timeline-item {
  position: relative;
  padding-bottom: 2.75rem;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.75rem;
  top: 0.45rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent);
}

.timeline-dates {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-bright);
}

.timeline-role {
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 0.2rem;
}

.timeline-company {
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.timeline-subroles {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: -0.4rem;
}

.timeline-points {
  color: var(--text-muted);
  padding-left: 1.1rem;
  display: grid;
  gap: 0.4rem;
}

.timeline-more {
  margin-top: 2.25rem;
  color: var(--text-muted);
}
.timeline-more a {
  color: var(--accent-bright);
  font-weight: 700;
  text-decoration: none;
}
.timeline-more a:hover { text-decoration: underline; }

/* ============ Skills chips ============ */

.chip-grid {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.chip {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-weight: 600;
  font-size: 0.95rem;
}

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

/* ============ Events ============ */

.events-intro {
  color: var(--text-muted);
  margin: -1.25rem 0 2rem;
}

.event-list {
  list-style: none;
  display: grid;
  gap: 1rem;
}

.event-card {
  display: grid;
  gap: 0.2rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem 1.4rem;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, border-color 0.2s;
}
.event-card:hover { border-color: var(--accent-bright); }
.event-card:active { transform: scale(0.98); }

.event-date {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-bright);
}

.event-name {
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.event-place {
  color: var(--text-muted);
  font-weight: 600;
}

@media (min-width: 40rem) {
  .event-list { grid-template-columns: 1fr 1fr; }
}

/* ============ Contact ============ */

.section-contact {
  text-align: center;
  padding-bottom: var(--space-section);
}

.contact-title {
  font-size: clamp(2.75rem, 11vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 1rem;
}

.contact-text {
  color: var(--text-muted);
  max-width: 44ch;
  margin: 0 auto 2.25rem;
  font-size: 1.1rem;
}

.section-contact .hero-actions { justify-content: center; }

/* LinkedIn QR connect code — white card so it scans reliably on the dark theme */
.qr-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-top: 2.5rem;
  padding: 1rem 1rem 0.8rem;
  background: #fff;
  border-radius: 1rem;
  text-decoration: none;
  transition: transform 0.15s;
}
.qr-card:active { transform: scale(0.97); }

.qr-card img {
  width: clamp(120px, 35vw, 160px);
  height: auto;
}

.qr-caption {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--bg);
}

/* ============ Footer ============ */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: var(--space-section);
  padding: 1.75rem var(--pad-x);
  padding-bottom: max(1.75rem, env(safe-area-inset-bottom));
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-credit {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  opacity: 0.75;
}
.footer-credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footer-credit a:hover { color: var(--accent-bright); }

/* ============ Scroll reveal ============
   JS adds .js to <html>, then .reveal-visible per element — so without JS
   nothing is ever hidden. */

.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .reveal-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ============ 404 page ============ */

.error-page {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem var(--pad-x);
}

.error-code {
  font-size: clamp(5rem, 30vw, 12rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.error-page p {
  color: var(--text-muted);
  margin: 1rem 0 2rem;
  font-size: 1.15rem;
}
