/* Projects — page-specific CSS.
   Shared pieces (tokens, reset, buttons, page hero, .sec-title, CTA, footer) are in shell.css.
   Ported verbatim from the approved design, projects.html.

   TWO THINGS ON THIS PAGE NEED NO JAVASCRIPT AT ALL, and that is deliberate:
     - the category tabs are hidden radio inputs plus `:checked ~` sibling selectors
     - the track record is native <details>/<summary>
   So there is nothing here for a script to break, and both work with JS disabled.

   The consequence of the CSS-only tabs is that the five categories are baked into the
   selectors at the foot of this file. A client can add a project to an existing category
   freely, but adding a SIXTH category needs a CSS change as well as a new option in the
   field group. That trade was accepted for losing the JavaScript. */

/* ---------- OVERRIDE OF A SHELL DEFAULT ---------- */
/* shell.css carries About's hero crop; this page's banner is framed lower. */
.page-hero-bg img{object-position:center 58%}

/* ---------- CATEGORY TABS ---------- */
.tabs{position:relative}
/* The radios are the state. Kept in the layout but invisible and unclickable; NOT
   display:none, because a display:none input cannot receive focus and the keyboard would
   lose the tab strip entirely. */
.tab-in{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.tab-nav{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;max-width:900px;margin:32px auto 0}
.tab-nav label{
  display:inline-flex;align-items:center;gap:10px;cursor:pointer;
  font-family:'Poppins';font-weight:600;font-size:13px;letter-spacing:.2px;
  color:var(--brand);background:#fff;border:1px solid var(--line);
  border-radius:100px;padding:10px 11px 10px 20px;box-shadow:var(--shadow-sm);transition:.2s;
}
.tab-nav label:hover{border-color:var(--blue);color:var(--blue-dark);transform:translateY(-1px)}
/* the count bubble */
.tab-nav label .n{
  font-size:11px;line-height:1;min-width:21px;padding:5px 6px;border-radius:100px;
  background:var(--bg-gray);color:var(--slate);text-align:center;transition:.2s;
}
.tab-panel{display:none;flex-direction:column;gap:44px;margin-top:36px}

/* ---------- FEATURED PROJECTS ---------- */
.featured{background:var(--bg-gray)}
.pj{
  display:grid;grid-template-columns:1fr 1.3fr;gap:40px;align-items:center;background:#fff;
  border:1px solid var(--line);border-radius:var(--radius);padding:32px;
  box-shadow:var(--shadow-sm);transition:box-shadow .25s;
}
.pj:hover{box-shadow:var(--shadow-md)}
.pj--flip .pj-text{order:2}
.pj--flip .pj-media{order:1}
.pj .eyebrow{margin-bottom:10px;font-size:11.5px;letter-spacing:1.4px}
.pj h3{font-size:24px;font-weight:700;line-height:1.24;margin-bottom:6px}
.pj-place{font-size:13.5px;color:var(--slate);margin-bottom:20px}

/* The spec list is a <dl> of label/value rows, and the rows PRESENT VARY per project —
   some have an end client, some a completion year, some neither. So it is authored as
   "Label|Value" lines rather than fixed fields. */
.pj-spec{border-top:1px solid var(--line)}
.pj-spec > div{display:grid;grid-template-columns:104px 1fr;gap:14px;padding:10px 0;border-bottom:1px solid var(--line)}
.pj-spec dt{font-family:'Poppins';font-weight:600;font-size:11.5px;letter-spacing:.9px;text-transform:uppercase;color:var(--slate);padding-top:2px}
.pj-spec dd{font-size:14px;font-weight:500;color:var(--ink)}

.pj-lead{border-radius:var(--radius);overflow:hidden;margin-bottom:12px;background:var(--bg-blue)}
.pj-lead img{width:100%;height:300px;object-fit:cover;transition:transform .45s ease}
.pj:hover .pj-lead img{transform:scale(1.03)}

.pj-gal{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
/* Pulau Semakau has six photographs, not eight, so its grid is three across. */
.pj-gal--3{grid-template-columns:repeat(3,1fr)}
.pj-gal a{display:block;border-radius:5px;overflow:hidden;position:relative;background:var(--bg-blue)}
.pj-gal img{width:100%;aspect-ratio:4/3;object-fit:cover;transition:transform .35s ease,opacity .2s ease}
.pj-gal a:hover img{transform:scale(1.07);opacity:.9}
.pj-gal a::after{content:"";position:absolute;inset:0;border:2px solid var(--blue);border-radius:5px;opacity:0;transition:opacity .2s ease}
.pj-gal a:hover::after{opacity:1}

/* ---------- TRACK RECORD ---------- */
.record{background:#fff}
.acc{max-width:940px;margin:32px auto 0;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow-sm)}
.acc-item{border-bottom:1px solid var(--line)}
.acc-item:last-child{border-bottom:0}
.acc-head{display:flex;align-items:center;gap:14px;width:100%;cursor:pointer;padding:18px 22px;background:#fff;transition:background .2s;list-style:none}
.acc-head::-webkit-details-marker{display:none}
.acc-head:hover{background:var(--bg-gray)}
.acc-item[open] .acc-head{background:var(--bg-blue)}
.acc-title{font-family:'Poppins';font-weight:600;font-size:16px;color:var(--navy);flex:1}
/* a CSS chevron rather than an icon, so it can rotate on [open] */
.acc-ic{width:11px;height:11px;border-right:2px solid var(--blue);border-bottom:2px solid var(--blue);transform:rotate(45deg);margin:-4px 4px 0 2px;transition:transform .25s ease;flex:0 0 auto}
.acc-item[open] .acc-ic{transform:rotate(-135deg);margin-top:2px}
.proj-list{list-style:none;padding:4px 22px 20px}
.proj-list li{padding:9px 0;border-bottom:1px dashed var(--line);font-size:14px;color:var(--ink)}
.proj-list li:last-child{border-bottom:0}

/* ---------- TAB STATE ----------
   The five categories are enumerated here because a sibling selector cannot be generalised.
   Adding a sixth means adding it to all three groups below. */
#cat-water:checked ~ #p-water,
#cat-sewers:checked ~ #p-sewers,
#cat-industrial:checked ~ #p-industrial,
#cat-environmental:checked ~ #p-environmental,
#cat-private:checked ~ #p-private{display:flex}

#cat-water:checked ~ .tab-nav label[for="cat-water"],
#cat-sewers:checked ~ .tab-nav label[for="cat-sewers"],
#cat-industrial:checked ~ .tab-nav label[for="cat-industrial"],
#cat-environmental:checked ~ .tab-nav label[for="cat-environmental"],
#cat-private:checked ~ .tab-nav label[for="cat-private"]{background:var(--blue);border-color:var(--blue);color:#fff;box-shadow:0 6px 16px rgba(26,111,192,.30)}

#cat-water:checked ~ .tab-nav label[for="cat-water"] .n,
#cat-sewers:checked ~ .tab-nav label[for="cat-sewers"] .n,
#cat-industrial:checked ~ .tab-nav label[for="cat-industrial"] .n,
#cat-environmental:checked ~ .tab-nav label[for="cat-environmental"] .n,
#cat-private:checked ~ .tab-nav label[for="cat-private"] .n{background:rgba(255,255,255,.24);color:#fff}

/* The radio is invisible, so its focus ring has to be drawn on the label instead - otherwise
   a keyboard user moving through the tab strip gets no visible indication at all. */
#cat-water:focus-visible ~ .tab-nav label[for="cat-water"],
#cat-sewers:focus-visible ~ .tab-nav label[for="cat-sewers"],
#cat-industrial:focus-visible ~ .tab-nav label[for="cat-industrial"],
#cat-environmental:focus-visible ~ .tab-nav label[for="cat-environmental"],
#cat-private:focus-visible ~ .tab-nav label[for="cat-private"]{outline:2px solid var(--blue-bright);outline-offset:3px}

/* ---------- RESPONSIVE ---------- */
@media(max-width:1024px){
  .pj{grid-template-columns:1fr;gap:26px;padding:26px}
  /* stacked, every row reads text-then-images */
  .pj--flip .pj-text,.pj--flip .pj-media{order:0}
  .pj-lead img{height:260px}
}
@media(max-width:680px){
  .tab-nav{gap:8px;margin-top:26px}
  .tab-nav label{font-size:12px;padding:9px 9px 9px 16px;gap:8px}
  .tab-nav label .n{min-width:19px;padding:4px 5px;font-size:10.5px}
  .pj{padding:20px}
  .pj h3{font-size:20px}
  .pj-lead img{height:210px}
  /* three across even for the eight-image galleries: four would be under 70px wide */
  .pj-gal,.pj-gal--3{grid-template-columns:repeat(3,1fr);gap:7px}
  .pj-spec > div{grid-template-columns:1fr;gap:2px;padding:9px 0}
  .acc-head{padding:15px 16px;gap:10px}
  .acc-title{font-size:14.5px}
  .proj-list{padding:4px 16px 16px}
}

/* --- project lightbox ------------------------------------------------------
   Opens from any photograph in a project and steps through THAT project's set.
   Pattern follows crestial/project-references.html: a native <dialog>, because
   showModal() gives the focus trap, Esc-to-close and an inert background for
   free, and getting those three right by hand is most of the work in a lightbox.

   Nothing here renders until the dialog is opened, so the page's measured
   geometry is unchanged and tools/compare.py still sees the approved design. */
.pj-lead img,
.pj-gal a{cursor:zoom-in}

.lb{
  width:100%;max-width:100%;height:100%;max-height:100%;
  padding:0;border:0;background:transparent;color:#fff;overflow:hidden}
.lb::backdrop{background:rgba(8,23,36,.95)}

.lb-fig{
  margin:0;height:100%;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:20px;
  padding:clamp(56px,7vw,80px) clamp(56px,9vw,120px)}
.lb-fig img{
  max-width:100%;max-height:74vh;width:auto;height:auto;
  object-fit:contain;background:var(--navy-3);border-radius:4px}

.lb-cap{text-align:center;max-width:62ch}
.lb-title{display:block;font-size:15px;letter-spacing:.02em}
/* tabular-nums so "9 / 12" does not jiggle the counter as you step through */
.lb-count{display:block;margin-top:10px;font-size:10px;font-weight:600;
  letter-spacing:.22em;color:rgba(255,255,255,.55);font-variant-numeric:tabular-nums}

.lb-x,.lb-nav{
  position:absolute;z-index:2;display:grid;place-items:center;
  color:#fff;background:rgba(255,255,255,.10);border:1px solid rgba(255,255,255,.18);
  border-radius:50%;cursor:pointer;transition:background .25s ease}
.lb-x:hover,.lb-nav:hover{background:rgba(255,255,255,.24)}
.lb-x{top:clamp(14px,2vw,26px);right:clamp(14px,2vw,26px);width:42px;height:42px;
  font-size:22px;line-height:1}
.lb-nav{top:50%;transform:translateY(-50%);width:46px;height:46px;font-size:26px;
  line-height:1;padding-bottom:4px}
.lb-prev{left:clamp(10px,1.6vw,22px)}
.lb-next{right:clamp(10px,1.6vw,22px)}
/* A one-photograph project has nothing to step through. */
.lb[data-single] .lb-nav,.lb[data-single] .lb-count{display:none}
.lb-x:focus-visible,.lb-nav:focus-visible{outline:2px solid var(--blue-bright);outline-offset:3px}

/* Arrows move off the sides and under the picture, where a thumb can reach
   them, rather than sitting over the image on a narrow screen. */
@media(max-width:620px){
  .lb-fig{padding:62px 14px 22px;gap:14px}
  .lb-fig img{max-height:58vh}
  .lb-nav{width:40px;height:40px;top:auto;bottom:16px;transform:none}
  .lb-prev{left:22px}
  .lb-next{right:22px}
}
