/*
  ============================================================================
  PORTFOLIO STYLESHEET — Bennett Earle
  ============================================================================
  Design language: bold, high contrast, editorial.
  Syne (geometric, blocky) for display text.
  Mulish (humanist, readable) for body.

  Techniques:
    - CSS Grid masonry approximation for projects
    - CSS custom property animation (the grid art in hero)
    - :has() for smart parent targeting
    - CSS clip-path for the skill bar fill animation
    - scroll-driven animations using @keyframes + JS IntersectionObserver fallback
  ============================================================================
*/

:root {
  /* Dual palette: ink + electric lime 
  --color-bg:           #0e0e0e;
  --color-surface:      #181818;
  --color-surface-2:    #222222;
  --color-border:       #2a2a2a;
  --color-border-light: #383838;

  --color-accent:       #c8f23b;    electric linke
  --color-accent-dark:  #8fb020;
  --color-accent-glow:  #c8f23b20;

  --color-text:         #f5f5f5;
  --color-text-muted:   #888888;
  --color-text-faint:   #444444; 
  */
  
  /* Dual palette: ink + light blue */
  --color-bg:           #0a0f1a;
  --color-surface:      #111827;
  --color-surface-2:    #1a2436;
  --color-border:       #1e2d42;
  --color-border-light: #2a3f5a;

  --color-accent:       #5bc8f5;   /* light blue */
  --color-accent-dark:  #2a9fd4;
  --color-accent-glow:  #5bc8f520;

  --color-text:         #f0f4f8;
  --color-text-muted:   #7a9ab8;
  --color-text-faint:   #2a3f5a;

  --font-display: 'Syne', 'Arial Black', sans-serif;
  --font-body:    'Mulish', system-ui, sans-serif;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  clamp(1.875rem, 4vw, 2.5rem);
  --text-4xl:  clamp(2.5rem, 8vw, 5rem);

  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   16px;
  --radius-full: 9999px;

  --nav-h: 64px;
  --max-w: 1100px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
ul[role="list"] { list-style: none; }

/* ============================================================
   SKIP LINK — always first in DOM
   ============================================================ */
.skip-link {
  position: absolute; top: var(--space-4); left: var(--space-4);
  z-index: 9999;
  background: var(--color-accent); color: var(--color-bg);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-md);
  font-weight: 700; font-size: var(--text-sm);
  transform: translateY(-200%);
  transition: transform 200ms;
}
.skip-link:focus { transform: translateY(0); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body); font-size: var(--text-sm); font-weight: 700;
  border-radius: var(--radius-full); border: 2px solid transparent;
  cursor: pointer; text-decoration: none; transition: all 150ms;
  letter-spacing: 0.02em;
}
.btn--primary {
  background: var(--color-accent); color: var(--color-bg);
  border-color: var(--color-accent);
}
.btn--primary:hover {
  background: var(--color-accent-dark); border-color: var(--color-accent-dark);
  color: var(--color-bg); text-decoration: none;
}
.btn--ghost {
  background: transparent; color: var(--color-text);
  border-color: var(--color-border-light);
}
.btn--ghost:hover { border-color: var(--color-accent); color: var(--color-accent); text-decoration: none; }
.btn--outline {
  background: transparent; color: var(--color-accent);
  border-color: var(--color-accent);
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-4);
}
.btn--outline:hover { background: var(--color-accent); color: var(--color-bg); text-decoration: none; }

/* Tags */
.tag {
  display: inline-block;
  padding: 2px var(--space-3);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 600;
  color: var(--color-text-muted);
}

/* ============================================================
   NAVIGATION
   ============================================================ */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(14, 14, 14, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}
.nav__inner {
  display: flex; align-items: center; gap: var(--space-6);
  height: 100%; max-width: var(--max-w); margin: 0 auto;
  padding: 0 var(--space-6);
}
.nav__brand {
  font-family: var(--font-display); font-size: var(--text-xl); font-weight: 800;
  color: var(--color-accent); letter-spacing: -0.02em;
  text-decoration: none; flex-shrink: 0;
}
.nav__links {
  display: flex; gap: var(--space-6); list-style: none; flex: 1;
  justify-content: center;
}
.nav__link {
  font-size: var(--text-sm); font-weight: 500;
  color: var(--color-text-muted); transition: color 150ms;
}
.nav__link:hover { color: var(--color-text); text-decoration: none; }

/* ============================================================
   SECTION HEADERS (shared)
   ============================================================ */
.section-header { text-align: center; margin-bottom: var(--space-12); }
.section-title {
  font-family: var(--font-display); font-size: var(--text-3xl); font-weight: 800;
  margin-bottom: var(--space-4); letter-spacing: -0.02em;
}
.section-subtitle { color: var(--color-text-muted); max-width: 52ch; margin: 0 auto; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  display: grid; grid-template-columns: 1fr 1fr;
  align-items: center; gap: var(--space-12);
  min-height: calc(100vh - var(--nav-h));
  max-width: var(--max-w); margin: 0 auto;
  padding: var(--space-16) var(--space-6);
}
.hero__greeting { color: var(--color-text-muted); font-size: var(--text-sm); margin-bottom: var(--space-3); }
.hero__name {
  font-family: var(--font-display); font-size: var(--text-4xl); font-weight: 800;
  line-height: 1.0; letter-spacing: -0.03em; margin-bottom: var(--space-4);
  display: flex; flex-direction: column;
}
.hero__name--first { color: var(--color-text); }
.hero__name--last { color: var(--color-accent); }

.hero__role {
  font-size: var(--text-xl); font-weight: 600; height: 2em;
  margin-bottom: var(--space-6); display: flex; align-items: center; gap: 2px;
  color: var(--color-text-muted);
}
.hero__role-text { font-style: italic; }
.hero__cursor {
  display: inline-block; color: var(--color-accent); font-weight: 300;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.hero__bio {
  color: var(--color-text-muted); line-height: 1.7; margin-bottom: var(--space-8);
  max-width: 48ch;
}
.hero__company { color: var(--color-text); font-weight: 600; }

.hero__actions { display: flex; gap: var(--space-4); margin-bottom: var(--space-8); flex-wrap: wrap; }

.hero__press {
  display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap;
}
.hero__press-label { font-size: var(--text-xs); color: var(--color-text-faint); }
.hero__press-logo {
  font-size: var(--text-xs); font-weight: 700; color: var(--color-text-muted);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-full);
}

/* Generative grid art */
.hero__visual { display: flex; align-items: center; justify-content: center; }
.hero__grid-art {
  display: grid; grid-template-columns: repeat(3, 80px); grid-template-rows: repeat(3, 80px);
  gap: 8px;
}
.grid-cell {
  border-radius: var(--radius-md);
  animation: gridPulse 3s ease-in-out infinite;
}
/* Each cell gets a different colour/delay for variety */
.grid-cell--1 { background: var(--color-accent); opacity: 0.9; animation-delay: 0s; }
.grid-cell--2 { background: var(--color-border-light); animation-delay: 0.2s; border-radius: var(--radius-full); }
.grid-cell--3 { background: var(--color-surface-2); animation-delay: 0.4s; }
.grid-cell--4 { background: var(--color-border-light); animation-delay: 0.6s; }
.grid-cell--5 { background: var(--color-accent); opacity: 0.4; animation-delay: 0.8s; border-radius: var(--radius-full); }
.grid-cell--6 { background: var(--color-accent); opacity: 0.7; animation-delay: 1.0s; }
.grid-cell--7 { background: var(--color-surface-2); animation-delay: 1.2s; border-radius: var(--radius-full); }
.grid-cell--8 { background: var(--color-border-light); animation-delay: 1.4s; }
.grid-cell--9 { background: var(--color-accent); opacity: 0.5; animation-delay: 1.6s; }

@keyframes gridPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.92); }
}
@media (prefers-reduced-motion: reduce) {
  .grid-cell { animation: none; }
  .hero__cursor { animation: none; }
}

/* ============================================================
   PROJECTS
   ============================================================ */
.work {
  padding: var(--space-24) var(--space-6);
  max-width: var(--max-w); margin: 0 auto;
}

.projects-grid {
  display: grid;
  /* Two columns; featured item will span both */
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.project {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 200ms, box-shadow 200ms;
  display: flex; flex-direction: column;
}
.project:hover { transform: translateY(-4px); box-shadow: 0 8px 32px rgba(0,0,0,0.4); }

.project--featured {
  grid-column: span 2;
  flex-direction: row;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.project--featured .project__image {
  width: 40%;
  min-height: 300px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 0;
}

.project__image {
  min-height: 200px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  flex-shrink: 0;
}

.project__image-placeholder {
  font-size: 0;
  width: 100%;
  height: 100%;
  min-height: 300px;
}

.project__image-placeholder span {
  display: block;
  width: 100%;
  height: 100%;
}

.project__image-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project__content {
  padding: var(--space-6);
  display: flex; flex-direction: column; flex: 1;
}
.project__tags { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.project__title { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; margin-bottom: var(--space-3); }
.project__desc { color: var(--color-text-muted); font-size: var(--text-sm); line-height: 1.7; margin-bottom: var(--space-4); flex: 1; }

.project__details { margin-bottom: var(--space-4); }
.project__details-toggle {
  font-size: var(--text-sm); color: var(--color-accent); cursor: pointer;
  font-weight: 600; list-style: none;
}
.project__details-toggle::-webkit-details-marker { display: none; }
.project__details-body {
  margin-top: var(--space-4); padding: var(--space-4);
  background: var(--color-surface-2); border-radius: var(--radius-md);
  font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.7;
  display: flex; flex-direction: column; gap: var(--space-3);
}

.project__links { display: flex; gap: var(--space-4); align-items: center; }
.project__link { font-size: var(--text-sm); font-weight: 600; color: var(--color-accent); }
.project__link--ghost { color: var(--color-text-muted); }

/* ============================================================
   SKILLS
   ============================================================ */
.skills {
  padding: var(--space-24) var(--space-6);
  background: var(--color-surface);
  text-align: center;
}
.skills-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-8);
  max-width: var(--max-w); margin: 0 auto;
}
.skill-group__title {
  font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700;
  margin-bottom: var(--space-6); text-align: left;
  color: var(--color-accent);
}
.skill-list { display: flex; flex-direction: column; gap: var(--space-4); }
.skill-item { display: flex; flex-direction: column; gap: var(--space-2); text-align: left; }
.skill-item__name { font-size: var(--text-sm); font-weight: 500; }
.skill-bar {
  width: 100%; height: 6px; border: none; border-radius: var(--radius-full);
  background: var(--color-surface-2);
  appearance: none; -webkit-appearance: none;
}
.skill-bar::-webkit-meter-bar { background: var(--color-surface-2); border: none; border-radius: var(--radius-full); }
.skill-bar::-webkit-meter-optimum-value { background: var(--color-accent); border-radius: var(--radius-full); }

/* ============================================================
   EXPERIENCE / TIMELINE
   ============================================================ */
.experience {
  padding: var(--space-24) var(--space-6);
  max-width: var(--max-w); margin: 0 auto;
  text-align: center;
}
.timeline {
  position: relative; list-style: none;
  max-width: 700px; margin: 0 auto;
  text-align: left;
}
/* The vertical line */
.timeline::before {
  content: ''; position: absolute;
  left: 12px; top: 8px; bottom: 8px; width: 2px;
  background: var(--color-border);
}
.timeline-item {
  position: relative; padding-left: var(--space-12);
  margin-bottom: var(--space-8);
}
.timeline-dot {
  position: absolute; left: 5px; top: 6px;
  width: 16px; height: 16px;
  background: var(--color-accent); border-radius: 50%;
  border: 3px solid var(--color-bg);
  box-shadow: 0 0 0 2px var(--color-accent);
}
.timeline-header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.timeline-date { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 500; }
.timeline-badge {
  font-size: var(--text-xs); font-weight: 700;
  background: var(--color-accent-glow); color: var(--color-accent);
  padding: 1px var(--space-2); border-radius: var(--radius-full);
}
.timeline-role { font-size: var(--text-lg); font-weight: 700; margin-bottom: var(--space-1); }
.timeline-company { font-size: var(--text-sm); color: var(--color-text-muted); margin-bottom: var(--space-3); }
.timeline-bullets {
  padding-left: var(--space-6); list-style: disc;
  display: flex; flex-direction: column; gap: var(--space-1);
}
.timeline-bullets li { font-size: var(--text-sm); color: var(--color-text-muted); }

/* ============================================================
   CONTACT
   ============================================================ */
.contact {
  padding: var(--space-24) var(--space-6);
  background: var(--color-surface);
}
.contact__content { text-align: center; }
.contact__address { margin: var(--space-6) auto; }
.contact__link {
  font-size: var(--text-xl); font-weight: 700;
  color: var(--color-text); text-decoration: none;
  font-family: var(--font-display);
}
.contact__link:hover { color: var(--color-accent); }

.social-links {
  display: flex; gap: var(--space-4); justify-content: center;
  margin-top: var(--space-6); flex-wrap: wrap;
}
.social-link {
  padding: var(--space-2) var(--space-6);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-full);
  font-size: var(--text-sm); font-weight: 600;
  color: var(--color-text); text-decoration: none;
  transition: all 150ms;
}
.social-link:hover { border-color: var(--color-accent); color: var(--color-accent); text-decoration: none; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  padding: var(--space-6);
  border-top: 1px solid var(--color-border);
  text-align: center;
}
.site-footer__text { font-size: var(--text-sm); color: var(--color-text-muted); }
.site-footer__legal {
  font-size: var(--text-xs);
  max-width: 60ch;
  margin: var(--space-3) auto 0;
  line-height: 1.5;
  color: var(--color-text-muted);
  opacity: 0.8;
}
.footer-link { color: var(--color-link); }

/* ============================================================
   MARQUEE
   ============================================================ */
.marquee-section {
  padding: var(--space-12) 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
}
.marquee-label {
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-bottom: var(--space-6);
}
.marquee-track {
  display: flex;
  gap: 0;
  width: max-content;
  animation: marqueeScroll 28s linear infinite;
}
.marquee-track:hover { animation-play-state: paused; }
@keyframes marqueeScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.marquee-item {
  display: inline-flex;
  align-items: center;
  padding: var(--space-3) var(--space-8);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  white-space: nowrap;
  border-right: 1px solid var(--color-border);
  transition: color 200ms;
}
.marquee-item:hover { color: var(--color-accent); }
.marquee-item .marquee-dot {
  display: inline-block;
  width: 5px; height: 5px;
  background: var(--color-accent);
  border-radius: 50%;
  margin-right: var(--space-3);
  opacity: 0.5;
}
.marquee-track--logos {
  animation: marqueeScroll 32s linear infinite;
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}
.marquee-logo-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-8);
  border-right: 1px solid var(--color-border);
  height: 56px;
}
.marquee-logo-item img {
  height: 32px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  filter: brightness(0) invert(1) opacity(0.35);
  transition: filter 250ms;
}
.marquee-logo-item:hover img {
  filter: brightness(0) invert(1) opacity(0.85);
}
@media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; } }

/* ============================================================
   PROJECT GALLERY
   ============================================================ */
.gallery {
  padding: var(--space-24) var(--space-6);
  background: var(--color-surface);
}
.gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  max-width: var(--max-w);
  margin: 0 auto;
}
.gallery__item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  cursor: pointer;
  background: var(--color-surface-2);
  /* Force a minimum height so the grid cell has shape */
  min-height: 220px;
}
.gallery__item--wide { grid-column: span 2; }
.gallery__item--tall { grid-row: span 2; min-height: 460px; }

/* The real image — fills the entire card, edge to edge, no gaps */
.gallery__img {
  position: absolute;
  inset: 0;               /* top:0, right:0, bottom:0, left:0 in one line */
  width: 100%;
  height: 100%;
  object-fit: cover;      /* crops to fill without stretching */
  object-position: center;
  display: block;
  transition: transform 400ms ease;
}
.gallery__item:hover .gallery__img { transform: scale(1.05); }

/* Fallback placeholder shown when no real image is present */
.gallery__placeholder-bg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-8);
  transition: transform 400ms ease;
}
.gallery__item:hover .gallery__placeholder-bg { transform: scale(1.04); }
.gallery__placeholder-icon { font-size: 2.5rem; }
.gallery__placeholder-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  text-align: center;
}

/* Hover overlay with title + tag */
.gallery__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(7,12,22,0.92) 0%, transparent 55%);
  opacity: 0;
  transition: opacity 300ms;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-6);
  pointer-events: none;
}
.gallery__item:hover .gallery__overlay { opacity: 1; }
.gallery__overlay-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}
.gallery__overlay-tag {
  font-size: var(--text-xs);
  color: var(--color-accent);
  font-weight: 600;
  letter-spacing: 0.06em;
}
.gallery__note {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-6);
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
}
@media (max-width: 900px) {
  .gallery__grid { grid-template-columns: repeat(2, 1fr); }
  .gallery__item--wide { grid-column: span 2; }
  .gallery__item--tall { grid-row: auto; min-height: 220px; }
}
@media (max-width: 600px) {
  .gallery__grid { grid-template-columns: 1fr; }
  .gallery__item--wide { grid-column: auto; }
}

/* ============================================================
   CERTIFICATIONS
   ============================================================ */
.certs {
  padding: var(--space-24) var(--space-6);
  max-width: var(--max-w);
  margin: 0 auto;
}
.certs-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: center;
  margin-top: var(--space-8);
}
.cert-pill {
  padding: var(--space-3) var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero__visual { display: none; }
  .project--featured { grid-column: auto; flex-direction: column; }
  .project--featured .project__image { width: 100%; }
  .skills-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .projects-grid { grid-template-columns: 1fr; }
  .nav__links { display: none; }
}
