:root{
  --bg:#ffffff;
  --ink:#111111;
  --muted:#666;
  --line:#eaeaea;

  --maxw:1120px;
  --gutter:28px;

  --brand-size: clamp(42px, 8vw, 92px);
  --nav-size: 15px;
  --h2: clamp(26px, 3.4vw, 40px);

  --radius:14px;
  --shadow:0 10px 28px rgba(0,0,0,.06);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial;
  line-height:1.6;
}

/* --- Global brand/navigation (unchanged) --- */
.brand{
  max-width:var(--maxw);
  margin:70px auto 10px;
  padding:0 var(--gutter);
  text-align:center;
}
.brand h1{
  margin:0;
  font-size:var(--brand-size);
  font-weight:800;
  letter-spacing:.02em;
  line-height:.95;
  text-transform:uppercase;
}
.brand h1 span{ display:block; }

.site-nav{
  margin:26px auto 0;
  display:flex;
  gap:28px;
  justify-content:center;
  font-size:var(--nav-size);
}
.site-nav a{
  position:relative;
  text-decoration:none;
  color:#000;
  opacity:.85;
  padding:6px 2px;
}
.site-nav a:hover{ opacity:1; }
.site-nav a.active::after{
  content:"";
  position:absolute; left:0; right:0; bottom:-6px;
  height:2px; background:#000;
}

/* --- Hero (index) --- */
.hero{
  max-width:var(--maxw);
  margin:46px auto 120px;
  padding:0 var(--gutter);
  display:grid;
  grid-template-columns: minmax(280px, 520px) 1fr;
  gap:60px;
  align-items:start;
}
.col.image img{
  width:100%;
  height:auto;
  display:block;
  box-shadow: var(--shadow);
}
.col.text h2{
  font-size:var(--h2);
  line-height:1.2;
  margin:6px 0 18px;
  letter-spacing:.01em;
}
.col.text p{
  margin:0 0 14px;
  color:#222;
}
.col.text p + p{ color:#333; }
.col.text p:last-of-type{ margin-bottom:26px; }

/* --- Buttons --- */
.btn{
  display:inline-block;
  border:1px solid #000;
  padding:10px 16px;
  border-radius:999px;
  text-decoration:none;
  color:#000;
  font-weight:600;
  font-size:14px;
  transition:transform .15s ease, background .15s ease, color .15s ease;
  cursor:pointer;
}
.btn:hover{ transform:translateY(-1px); }
.btn.primary{
  background:#000;
  color:#fff;
  margin-right:10px;
}
.btn.ghost{
  background:transparent;
  color:#000;
  border-color:#000;
}
.btn.ghost:hover{
  background:#000;
  color:#fff;
}

/* --- Responsive tweaks --- */
@media (max-width: 900px){
  .brand{ margin-top:54px; }
  .hero{
    grid-template-columns:1fr;
    gap:28px;
  }
  .col.image{ order:1; }
  .col.text{ order:2; }
}

/* --- Banner behind title --- */
.brand {
  position: relative;
  text-align: center;
  margin: 70px auto 10px;
  padding: 0 var(--gutter);
  max-width: var(--maxw);
}
.brand .banner {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  border-radius: var(--radius);
}
.brand .banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.25;
  filter: brightness(80%);
}
.brand h1 { position: relative; z-index: 1; }

/* --- Shared layout scaffolding (new) --- */
.section{
  padding: 10px var(--gutter) 80px;
}
.container{
  max-width: var(--maxw);
  margin: 0 auto;
}
.card{
  background:#fff;
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: clamp(16px, 3vw, 28px);
}

/* Snapshots: make the image fill the entire card */
.snapshot-card { padding: 0; }
.snapshot-card img{
  display: block;
  width: 100%;
  height: auto;            /* keeps natural aspect ratio */
  border-radius: inherit;  /* matches the card’s rounded corners */
}

.small{ font-size: 0.92rem; color: var(--muted); }
.lede{ color:#222; }

.flex{ display:flex; }
.cta-row{ display:flex; gap:12px; align-items:center; }

/* --- Back button (shared) --- */
.back-btn {
  margin: 20px var(--gutter) 0;
}
.back-btn a {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid #000;
  border-radius: 999px;
  text-decoration: none;
  color: #000;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.back-btn a:hover {
  background: #000;
  color: #fff;
  transform: translateY(-1px);
}

/* --- Unified gallery grid (used on Experience, optional elsewhere) --- */
.gallery{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
  margin-top: 12px;
}
.gallery img, .gallery video{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  background:#f6f6f6;
  min-height: 140px;
}
/* 3 across on desktop, 2 on small screens */
.gallery > *{ grid-column: span 4; }
@media (max-width: 640px){
  .gallery{ grid-template-columns: repeat(6, 1fr); }
  .gallery > *{ grid-column: span 3; }
}

.exp-wrap .gallery video { height: auto; }          /* override height:100% */
.exp-wrap .gallery figure { overflow: visible; }    /* just in case */
.exp-wrap .gallery figcaption {
  margin-top: 6px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* --- Experience page styles --- */
.exp-wrap{ max-width: var(--maxw); margin: 0 auto; }
.exp-header{ margin-bottom: 18px; }
.timeline{
  display: grid;
  gap: 22px;
}
.role{
  border:1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(14px, 2.6vw, 22px);
  background:#fff;
  box-shadow: var(--shadow);
}
.role h3{ margin: 0 0 4px; }
.role .meta{
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 10px;
}
.role .body p{ margin: 0 0 10px; color:#222; }

/* --- Contact page styles --- */
.contact-wrap{
  max-width: 760px;
  margin: 0 auto;
}
.contact-wrap.card{ padding: clamp(18px, 3vw, 28px); }
#contact-form{
  display: grid;
  gap: 14px;
}
.row{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 640px){
  .row{ grid-template-columns: 1fr; }
}
label{
  display:block;
  font-weight:600;
  margin-bottom:6px;
}
input, textarea, select{
  width:100%;
  padding:12px 12px;
  border:1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  color:#111;
  background:#fff;
  outline: none;
  transition: border .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus{
  border-color:#111;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}
textarea{ min-height: 140px; resize: vertical; }
#form-status{ color:#111; opacity:.85; }

/* --- Utility visibility for any inline errors --- */
.error{ color: #b00020; }

/* --- End --- */

/* --- Performance helpers --- */
.section{
  /* Skip rendering work for off-screen sections */
  content-visibility: auto;
  /* Reserve space so layout doesn’t thrash while lazy items load */
  contain-intrinsic-size: 1000px 1200px; /* tweak if sections are taller/shorter */
}

figure, .gallery-item { overflow: hidden; border-radius: 12px; }
img { display:block; max-width:100%; height:auto; }
.lightbox.open { will-change: opacity; }  /* cheaper animation on the overlay */

/* Photo captions in experience cards */
.xp-shot { margin: 0; }
.xp-shot img { display:block; width:100%; height:auto; border-radius: 12px; }
.xp-shot figcaption{
  margin-top: 8px;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.35;
  color: #667085;            /* subtle, accessible grey */
}

/* Slightly smaller on phones */
@media (max-width: 640px){
  .xp-shot figcaption{ font-size: 0.88rem; margin-top: 6px; }
}

.hyrox-logo img {
  border-radius: 0 !important;
}

/* Open Source folder: small overrides */
#open-source { margin: 80px auto; max-width: var(--maxw); text-align: center; }
#open-source h2 { font-size: var(--h2); margin-bottom: 12px; }
#open-source p { color: var(--muted); margin-bottom: 22px; }

/* use your existing .gallery grid; just tweak the items */
#open-source .gallery > * { grid-column: span 4; } /* 3-across on desktop (uses your 12-col grid) */
@media (max-width: 640px){
  #open-source .gallery > * { grid-column: span 3; } /* 2-across on phones */
}

/* make each file feel like a card */
#open-source figure {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
#open-source figure:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0,0,0,.12);
}

/* show icons nicely (don’t crop like photos) */
#open-source figure img {
  width: 64px;
  height: 64px;
  object-fit: contain;   /* override gallery’s cover fit for icons */
  box-shadow: none;      /* remove image shadow your gallery gives photos */
  border-radius: 0;      /* icons shouldn’t be rounded */
  background: transparent;
  margin: 6px auto 8px;
}

#open-source figcaption {
  font-weight: 600;
  color: #222;
  font-size: 0.95rem;
}

/* nicer iframe sizing when opened in your lightbox */
.lightbox iframe {
  width: 100%;
  height: 80vh;
  border: 0;
}