/* ===== Base variables ===== */
:root{
  --bg:#f4f6fb;
  --panel:#ffffff;
  --ink:#1f2330;
  --ink-soft:#626b7d;
  --line:#e7eaf0;
  --blue:#004D98;
  --garnet:#A50044;
  --gold:#EDBB00;
  --shadow:0 6px 16px rgba(0,0,0,.08);
  --shadow-hover:0 12px 24px rgba(0,0,0,.12);
}

/* Dark theme */
.theme-dark{
  --bg:#0b1220;
  --panel:#0f172a;
  --ink:#e7ebf5;
  --ink-soft:#a8b2c8;
  --line:#26314a;
  --shadow:0 8px 22px rgba(0,0,0,.35);
  --shadow-hover:0 16px 36px rgba(0,0,0,.45);
}

/* Light/dark background gradient */
body{
  background:
    linear-gradient(135deg, rgba(0,77,152,.06), rgba(165,0,68,.06)),
    var(--bg);
  color:var(--ink);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
  line-height:1.6;
  margin:0;
}

/* Layout containers */
.site-inner{max-width:1000px;margin:0 auto;padding:0 20px;}
.page{padding:28px 0 40px;}

/* Header */
.site-banner{
  position:sticky;top:0;z-index:10;
  background:linear-gradient(90deg,var(--blue),var(--garnet));
  background-size:200% 200%;
  animation:shift 12s ease-in-out infinite;
  color:#fff;
}
@keyframes shift{
  0%{background-position:0 50%}50%{background-position:100% 50%}100%{background-position:0 50%}
}
.site-banner .site-inner{display:flex;align-items:center;gap:14px;padding:12px 20px;}
.brand{color:#fff;font-weight:800;text-decoration:none;font-size:1.1rem;}
.nav{margin-left:auto;display:flex;gap:12px;flex-wrap:wrap;}
.nav__link{color:#fff;text-decoration:none;padding:6px 10px;border-radius:8px;font-weight:700;opacity:.9;}
.nav__link:hover{background:rgba(255,255,255,.12);opacity:1;}
.nav__link.is-active{background:rgba(255,255,255,.18);}
.theme-toggle{
  margin-left:8px;width:36px;height:36px;
  border:1px solid var(--line);border-radius:10px;
  background:var(--panel);color:var(--ink);cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  box-shadow:var(--shadow);
}
.theme-toggle:hover{transform:translateY(-2px);box-shadow:var(--shadow-hover);}
.theme-toggle__icon{font-size:18px;line-height:1;}

/* Cards */
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:18px;margin-top:.8rem;}
.card{background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:12px;
  box-shadow:var(--shadow);transition:all .25s ease;}
.card:hover{box-shadow:var(--shadow-hover);transform:translateY(-4px);}
.card h3{margin:8px 0 6px;font-size:1.03rem;color:var(--garnet);}
.card .meta{font-size:.9rem;color:var(--ink-soft);}
.card img{width:100%;border-radius:8px;}
.video{position:relative;width:100%;padding-top:56.25%;border-radius:8px;overflow:hidden;background:#000;margin-bottom:8px;}
.video video{position:absolute;inset:0;width:100%;height:100%;}

/* Buttons */
.btn{border:1px solid var(--blue);color:var(--blue);background:transparent;text-decoration:none;
  padding:8px 16px;border-radius:8px;font-weight:700;font-size:.95rem;display:inline-block;}
.btn:hover{background:var(--blue);color:#fff;transform:translateY(-2px);box-shadow:0 4px 12px rgba(0,77,152,.25);}

/* Footer */
.site-footer{border-top:1px solid var(--line);text-align:center;padding:20px 0;color:var(--ink-soft);}

/* Smooth transitions */
@media (prefers-reduced-motion:no-preference){
  *{transition:background-color .2s ease,color .2s ease,border-color .2s ease,box-shadow .2s ease,transform .2s ease;}
}

/* =================== Headshot styling =================== */
img.headshot{
  width:120px;               /* fixed size */
  height:120px;
  border-radius:50%;         /* circle */
  object-fit:cover;          /* keep proportions */
  display:block;
  margin:20px auto 10px;     /* center + spacing */
  border:3px solid var(--gold);
  box-shadow:0 4px 12px rgba(0,0,0,.15);
}

.theme-dark img.headshot{
  border-color:#1e2a44;      /* softer in dark mode */
  box-shadow:0 4px 12px rgba(0,0,0,.35);
}

/* ================= Masonry (Design & Logos) ================= */
.masonry{
  column-count: 3;
  column-gap: 24px;
}
@media (max-width: 980px){ .masonry{ column-count: 2; } }
@media (max-width: 620px){ .masonry{ column-count: 1; } }

.masonry .tile{
  break-inside: avoid;
  margin: 0 0 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  opacity: 0; transform: translateY(16px);
  animation: fadeUp .55s ease-out forwards;
}
.masonry .tile:nth-child(1){ animation-delay:.05s }
.masonry .tile:nth-child(2){ animation-delay:.10s }
.masonry .tile:nth-child(3){ animation-delay:.15s }
.masonry .tile:nth-child(4){ animation-delay:.20s }
.masonry .tile:nth-child(5){ animation-delay:.25s }
.masonry .tile:nth-child(6){ animation-delay:.30s }

.masonry .thumb{
  display:block;
  width:100%;
  height:auto;
}

.masonry figcaption{
  padding:10px 12px 12px;
  text-align:center;
}
.masonry figcaption h3{
  margin:6px 0 4px;
  font-size:1.02rem;
  color:var(--garnet);
}
.masonry figcaption .meta{
  margin:0;
  font-size:.9rem;
  color:var(--ink-soft);
}

/* Hover polish */
.masonry .tile:hover{ box-shadow: var(--shadow-hover); transform: translateY(-4px); }

/* ================= Lightbox ================= */
.lightbox{
  display:none; position:fixed; inset:0; z-index:9999;
  background: rgba(0,0,0,.92);
  align-items:center; justify-content:center;
  padding: 24px;
}
.lightbox:target{ display:flex; }

.lightbox img{
  max-width: min(92vw, 1400px);
  max-height: 92vh;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}

.lightbox__backdrop{ position:absolute; inset:0; display:block; }

.lightbox__close{
  position:absolute; top:18px; right:18px;
  width:36px; height:36px; border-radius:50%;
  background: #fff; color:#111; text-decoration:none;
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:20px; line-height:1;
  box-shadow:0 6px 16px rgba(0,0,0,.3);
}
.theme-dark .lightbox__close{ background:#0f172a; color:#e7ebf5; }

/* Reuse animation already defined earlier */
@keyframes fadeUp{
  from{opacity:0;transform:translateY(22px)}
  to{opacity:1;transform:translateY(0)}
}

/* Masonry-like responsive grid */
.masonry{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(320px, 1fr));
  gap:22px;
}

/* Tile base */
.tile{
  background:#fff;
  border:1px solid #e9ecf1;
  border-radius:14px;
  box-shadow:0 6px 20px rgba(0,0,0,.06);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  transition:transform .25s ease, box-shadow .25s ease, opacity .6s ease, translate .6s ease;
}

/* Fade-in on scroll */
.tile{opacity:0; translate:0 14px;}
.tile.visible{opacity:1; translate:0 0;}

/* Thumbnails: aligned height */
.tile .thumb{
  display:block;
  width:100%;
  height:220px;              /* keeps cards visually aligned */
  object-fit:cover;
  border-bottom:1px solid #eef1f6;
}

/* Logo tile: larger, centered, non-stretched */
.tile .thumb.logo{
  height:auto;
  max-width:220px;
  margin:42px auto 18px;
  object-fit:contain;
  filter:drop-shadow(0 3px 8px rgba(0,0,0,.10));
  transition:transform .25s ease, filter .25s ease;
}
.tile .thumb.logo:hover{transform:scale(1.06); filter:drop-shadow(0 5px 12px rgba(0,0,0,.14));}

/* Text area */
.tile figcaption{padding:14px 16px 18px;}
.tile h3{margin:4px 0 6px; font-size:1.06rem; color:var(--garnet);}
.tile .meta{margin:0; color:#5b6275;}

/* Hover lift */
.tile:hover{transform:translateY(-4px); box-shadow:0 10px 26px rgba(0,0,0,.10);}

/* Lightbox */
.lightbox{display:none;position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,.92);}
.lightbox:target{display:block;}
.lightbox img{max-width:92vw;max-height:92vh;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);border-radius:10px}
.lightbox__backdrop{position:absolute;inset:0;display:block}
.lightbox__close{position:absolute;top:18px;right:22px;color:#fff;text-decoration:none;font-size:36px;line-height:1}

/* --- Uniform thumbnail frame ------------------------------------------- */
.tile .thumb{
  width: 100%;
  aspect-ratio: 16 / 9;     /* consistent tile look */
  height: auto;
  object-fit: cover;         /* fills the frame (light crop when needed) */
  object-position: center;
  display: block;
  border-bottom: 1px solid #eef1f6;
}

/* Logo tile: show bigger, centered, no crop */
.tile .thumb.logo{
  aspect-ratio: 16 / 9;
  object-fit: contain;       /* no cropping for the logo */
  background: #fff;
  padding: 14px;             /* gives the logo breathing room */
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.10));
  transition: transform .25s ease, filter .25s ease;
}
.tile .thumb.logo:hover{
  transform: scale(1.06);
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.16));
}

/* Optional “show everything” helper for one-off images */
.tile .thumb.fit{
  object-fit: contain;
  background: #fff;
}

/* ============================================= */
/* NAVBAR RESPONSIVE FIX & REBALANCE             */
/* ============================================= */
.navbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;   /* centers all nav links */
  align-items: center;
  gap: 12px;
  padding: 0.8rem 1rem;
  background: linear-gradient(90deg, var(--blue), var(--garnet));
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

/* Logo/title on left, menu on right for wide screens */
.navbar-brand {
  font-weight: 700;
  color: #fff;
  margin-right: auto;
  font-size: 1rem;
}

/* Menu links */
.navbar a {
  color: #fff;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  transition: background 0.2s ease;
  font-weight: 600;
}
.navbar a:hover,
.navbar a.active {
  background: rgba(255,255,255,0.2);
}

/* Toggle button (sun icon etc.) */
.navbar .toggle-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(255,255,255,0.6);
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  width: 34px;
  height: 34px;
}

/* ============================================= */
/* MOBILE TWEAKS (center and evenly space items) */
/* ============================================= */
@media (max-width: 600px) {
  .navbar {
    flex-direction: column;
    gap: 10px;
    padding: 1rem;
    text-align: center;
  }

  .navbar a {
    display: inline-block;
    width: auto;
    min-width: 120px;  /* keeps width consistent */
    background: rgba(255,255,255,0.15);
  }

  .navbar-brand {
    margin: 0;
    text-align: center;
    width: 100%;
  }

  .navbar .toggle-btn {
    margin: 0 auto;
  }
}

/* ===== Sticky navbar ===== */
:root{
  /* tweak if your navbar height changes */
  --nav-h: 64px;
}

/* keep space for iOS notch when sticky */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  padding-top: calc(0.5rem + env(safe)
  
  /* ========= NAVBAR (desktop) ========= */
.navbar{
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 12px;
  padding: 0.8rem 1rem;
  background: linear-gradient(90deg, var(--blue), var(--garnet));
  color: #fff;
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.navbar-brand{ margin-right: auto; }
.brand-link{ color:#fff; font-weight:700; text-decoration:none; }

.nav-links{
  display: flex; gap: 10px;
  justify-content: center; align-items: center;
  flex: 1 1 auto;                /* centers the link cluster */
}
.nav-link{
  color:#fff; text-decoration:none; font-weight:600;
  padding: 6px 14px; border-radius: 8px;
  background: transparent; transition: background .2s ease;
}
.nav-link:hover, .nav-link.active{ background: rgba(255,255,255,.18); }

.toggle-btn{
  display: inline-flex; align-items:center; justify-content:center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.6);
  background: rgba(255,255,255,.12); color:#fff;
}

/* hide hamburger on desktop */
.nav-toggle{ display:none; }

/* subtle shadow when scrolled (optional, JS toggles .is-scrolled) */
.navbar.is-scrolled{ box-shadow: 0 6px 18px rgba(0,0,0,.18); }

/* ========= NAVBAR (mobile) ========= */
@media (max-width: 600px){
  .navbar{
    flex-wrap: wrap;
    padding: 1rem;
    text-align: center;
  }
  .navbar-brand{ width:100%; margin:0; order:0; }
  .nav-toggle{ display:block; order:1; margin-left:auto; font-size:1.15rem;
               background: rgba(255,255,255,.18); color:#fff;
               border: 1px solid rgba(255,255,255,.35); border-radius:8px;
               padding: .35rem .6rem; }
  .toggle-btn{ order:2; } /* theme toggle stays visible on first row */

  /* 2-column tidy grid of links */
  .nav-links{
    order:3; width:100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 10px;
    margin-top: .5rem;
  }
  .nav-link{
    width: 100%;
    background: rgba(255,255,255,.16);
    padding: 10px 0;
    border-radius: 10px;
  }

  /* collapsed by default; opened with .is-open (JS below) */
  .nav-links{ display: none; }
  .nav-links.is-open{ display: grid; }
}

/* ensure anchor jumps don't hide under sticky bar */
:root{ --nav-h: 70px; }
@media (max-width:600px){ :root{ --nav-h: 86px; } }
html{ scroll-padding-top: var(--nav-h); }

/* --- TEMP: hide any older/legacy header bars --- */
.page-header,
.site-header,
.header,
.project-name,
.legacy-nav {
  display: none !important;
}