:root{
  --color-bg:#ffffff;
  --color-fg:#0f172a;
  --color-muted:#475569;
  --color-primary:#00548C;   /* brand deep blue */
  --color-accent:#0092F2;    /* brand bright blue */
  --color-compl:#FF7A00;     /* optional complementary accent */
  --color-border:#e5e7eb;
  --radius:14px;
  --shadow:0 8px 24px rgba(2, 6, 23, .06);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Inter", sans-serif;
  color:var(--color-fg); background:var(--color-bg);
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
}
.container{max-width:1120px;margin:0 auto;padding:2rem}

/* ---------- Header ---------- */
.site-header{
  position:sticky; top:0; z-index:10; backdrop-filter:saturate(180%) blur(6px);
  background:rgba(255,255,255,.85);
  display:flex; align-items:center; justify-content:space-between;
  padding:1rem 2rem; border-bottom:1px solid var(--color-border);
}
.brand{font-weight:800; letter-spacing:.2px; text-decoration:none; color:var(--color-primary); font-size:1.14rem}
.brand img{ display:block; height:48px; width:auto; } /* medium logo */
nav ul{list-style:none; display:flex; gap:1rem; margin:0; padding:0}
nav a{
  text-decoration:none; color:var(--color-fg); padding:.4rem .6rem; border-radius:8px;
  transition: color .15s ease;
}
nav a:hover{
  color:var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* Active link gradient underline in header */
.site-header nav a.active{
  position: relative;
  color: var(--color-primary);
  text-decoration: none;
}
.site-header nav a.active::after{
  content:"";
  position:absolute;
  left:0; right:0; bottom:-6px;
  height:3px; border-radius:3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  opacity:.95;
}

/* Hamburger → X */
.nav-toggle{
  display:none;
  background:transparent;
  border:0;
  padding:.4rem;
  margin-left:auto;
  cursor:pointer;
  color: var(--color-fg);
  width: 36px;
  height: 36px;
  position: relative;
}
.nav-toggle:focus{ outline: 2px solid var(--color-accent); outline-offset: 2px; }
.nav-toggle .bar{
  position:absolute;
  left:50%;
  width:26px;
  height:2.5px;
  background: currentColor;
  border-radius:2px;
  transform: translateX(-50%);
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle .bar:nth-child(1){ top: 10px; }
.nav-toggle .bar:nth-child(2){ top: 16px; }
.nav-toggle .bar:nth-child(3){ top: 22px; }
.nav-toggle.open .bar:nth-child(1){ transform: translateX(-50%) translateY(6px) rotate(45deg); }
.nav-toggle.open .bar:nth-child(2){ opacity: 0; }
.nav-toggle.open .bar:nth-child(3){ transform: translateX(-50%) translateY(-6px) rotate(-45deg); }

/* Desktop nav default */
.site-nav{ display:block; }
.site-nav ul{ display:flex; gap:1rem; margin:0; padding:0; list-style:none; }

/* Mobile dropdown */
@media (max-width: 900px){
  .nav-toggle{ display:block; }
  .site-nav{
    display:none;
    position:absolute;
    top:100%; left:0; right:0;
    background: rgba(255,255,255,.98);
    border-bottom:1px solid var(--color-border);
    box-shadow: 0 10px 28px rgba(2,6,23,.06);
  }
  .site-nav.open{ display:block; }
  .site-nav ul{
    flex-direction: column;
    gap:0;
    padding:.5rem 1rem 1rem;
  }
  .site-nav li a{
    display:block;
    padding:.75rem .25rem;
    border-radius:8px;
  }
}

/* ---------- Hero ---------- */
.hero{
  display:grid; gap:1.25rem; padding:2.5rem 0 1rem;
}
.hero h1{ margin:0; font-size: clamp(1.8rem, 2.8vw, 2.6rem) }
.hero p{ color:var(--color-muted); margin:.25rem 0 1rem }
.cta-row{ display:flex; gap:.75rem; flex-wrap:wrap }
.btn{
  display:inline-block; padding:.7rem 1rem; border-radius:10px; border:1px solid var(--color-accent);
  color:var(--color-accent); text-decoration:none; font-weight:600;
  transition: background .15s ease;
}
.btn.primary{ background:var(--color-accent); color:#fff; border-color:var(--color-accent) }
.btn.ghost{ background:transparent }
.btn.primary:hover{ filter:brightness(1.05); }

/* Match Home hero to Portfolio spacing */
.home .hero{ padding-top: 1.25rem !important; }
.home .hero h1{ margin-top: 0.5rem; }

/* ---------- Page headings & copy ---------- */
.page h1{
  margin-top:0;
  margin-bottom:.5rem;
  color:var(--color-primary);
  font-weight:800;
  letter-spacing:.2px;
  font-size: clamp(1.75rem, 2.4vw, 2.25rem);
  line-height:1.15;
  position:relative;
  display:inline-block;
}
.page h1::after{
  content:"";
  display:block;
  height:4px;
  width:100%;
  margin-top:.3rem;
  border-radius:3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  opacity:.9;
}
.page h2{
  margin-top:1.75rem;
  margin-bottom:.5rem;
  font-size: clamp(1.25rem, 1.6vw, 1.5rem);
  letter-spacing:.15px;
  color:var(--color-fg);
}
.page p{ line-height:1.65; }

/* ---------- Cards & grids ---------- */
.card-grid{ display:grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap:1.25rem }
.card{
  border:1px solid var(--color-border); border-radius:var(--radius); overflow:hidden; background:#fff; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease
}
.card:hover{ transform: translateY(-2px); box-shadow: 0 12px 28px rgba(2,6,23,.08) }
.card img{
  width:100%;
  aspect-ratio: 1 / 1;   /* square lock */
  object-fit: cover;     /* crop overflow cleanly */
  display:block;
}
.card .pad{ padding:1rem }
.card h3{ margin:.3rem 0 .4rem; font-size:1.05rem }
.card p{ margin:0; color:var(--color-muted) }

/* Portfolio + Gallery item title link color override */
.card h3 a{ color:#0092F2; text-decoration:none; }
.card h3 a:hover{
  color:var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ---------- Forms ---------- */
.contact-form label{ display:block; margin:.6rem 0 .25rem; font-weight:600 }
.contact-form input,
.contact-form textarea{
  width:100%; padding:.7rem .8rem; border:1px solid var(--color-border); border-radius:10px;
  outline:none; font:inherit
}
.contact-form textarea{ min-height:140px; resize:vertical }
.contact-form button{ margin-top:.6rem }

/* ---------- Portfolio item page ---------- */
.tags{ display:flex; gap:.5rem; flex-wrap:wrap; margin:.75rem 0 1rem; }
.tag{
  font-size:.8rem; line-height:1;
  padding:.3rem .6rem;
  border-radius:999px;
  background: linear-gradient(#fff,#fff) padding-box, linear-gradient(90deg, var(--color-primary), var(--color-accent)) border-box;
  border:1px solid transparent;
  color:var(--color-primary);
  white-space:nowrap;
}
.tag:hover{
  box-shadow: 0 0 6px rgba(0,146,242,0.4);
  transform: scale(1.03);
}
.project-image{ text-align:center; margin:2rem 0; }
.project-image img{ max-width:100%; height:auto; border-radius:12px; }

/* ---------- Gallery ---------- */
.gallery-grid .card{ padding:0; } /* pure image tiles */

/* Accessible focus: highlight the clickable card, not the pill */
.gallery-item:focus{ outline: none; }
.gallery-item:focus-visible{
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
  border-radius: 12px;
}

/* ---------- Lightbox (consolidated & conflict-free) ---------- */
.lightbox{
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.88);
  display: none;                 /* hidden by default */
  align-items: center;           /* centered when open */
  justify-content: center;
  padding: 2rem;
}
.lightbox.open{ display:flex; }

/* Inner container shrink-wraps to image width; text left-aligned */
.lightbox .lightbox-inner{
  display: inline-block;
  text-align: left;
  max-width: 90vw;
}

/* Image defines width; centered */
#lightbox-img{
  display: block;
  max-width: 90vw;
  max-height: 80vh;              /* leave room for text below */
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
}

/* Close button */
.lightbox-close{
  position: absolute; top: 14px; right: 16px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--color-border);
  background: rgba(255,255,255,.9); color: #111;
  cursor: pointer; font-size: 24px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.lightbox-close:hover{ border-color: var(--color-accent); }

/* Meta text under the image */
.lightbox-meta{ margin-top: .5rem; color: #f3f4f6; }
.lightbox-alt{
  font-weight: 700;
  font-size: 1rem;                 /* slightly larger than caption */
  line-height: 1.25; margin-bottom: .15rem;
}
.lightbox-caption{ font-style: italic; font-size: .95rem; opacity: .9; line-height: 1.4; }

/* ---------- Announcement ---------- */
.announce{
  margin: 1.25rem 0 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.announce::before{
  content:"";
  display:block;
  height:4px;
  width:100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
}
.announce-badge{
  position:absolute; top:10px; right:12px;
  font-size:.75rem; padding:.2rem .5rem; border-radius:999px;
  border:1px solid rgba(0,84,140,.18);
  background:rgba(0,84,140,.06); color:var(--color-primary);
}
.announce-body{ padding: 1rem 1.25rem 1.1rem; }
.announce-title{ margin:.2rem 0 .25rem; font-size:1.15rem; color:var(--color-primary); font-weight:800; }
.announce-date{ margin:.25rem 0 .25rem; color: var(--color-muted); font-size:.95rem; }
.announce-text p{ margin:.4rem 0; }

/* ---------- Footer ---------- */
.site-footer{
  margin-top: 3rem;
  padding-top: 2rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
}
.site-footer .social.with-labels{
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer .social.with-labels a{
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .8rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  text-decoration: none;
  color: var(--color-fg);
}
.site-footer .social.with-labels a:hover{ border-color: var(--color-accent); color: var(--color-primary); }
.site-footer .social.with-labels svg{ flex: 0 0 auto; }

/* Icons-only on small screens */
@media (max-width: 600px){
  .site-footer .social.with-labels span{ display:none; }
  .site-footer .social.with-labels a{
    padding:.5rem;
    border-radius:50%;
    width:42px; height:42px;
    justify-content:center;
  }
}

/* Category pill on gallery tiles */
.gallery-thumb { position: relative; }
.badge-cat{
  position: absolute; top: 8px; left: 8px;
  font-size: .75rem; line-height: 1;
  padding: .25rem .5rem;
  border-radius: 999px;
  background: linear-gradient(#fff,#fff) padding-box, linear-gradient(90deg, var(--color-primary), var(--color-accent)) border-box;
  border:1px solid transparent;
  color: var(--color-primary);
  white-space:nowrap;
}
.badge-cat:hover{
  box-shadow: 0 0 6px rgba(0,146,242,0.4);
  transform: scale(1.03);
}

/* Filter bar */
.portfolio-filter{ margin: .25rem 0 1rem; }
.portfolio-filter select{
  padding: .55rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}

/* Small category text under card titles */
.mini-cat { margin:.5rem 0 0; }
.sr-only{
  position:absolute !important;
  width:1px;height:1px;
  padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;
}

/* ---- Reveal-on-scroll (subtle, accessible) ---- */
@media (prefers-reduced-motion: no-preference){
  .reveal-init{
    opacity: 0;
    transform: translateY(14px) scale(.995);
  }
  .reveal-in{
    opacity: 1;
    transform: none;
    transition: opacity .6s ease, transform .6s cubic-bezier(.2,.65,.3,1);
    transition-delay: var(--delay, 0ms);
  }
}