/*
  File: css/portfolio.css
  Purpose: Page styles for /portfolio (Views/public/portfolio.php, "Our Work")
           — the framing-stage photo hero (swaps the .wrapper2 band photo via
           [data-page="portfolio"]), the centred intro, the two-column layout
           (project-card grid + the filter SIDEBAR <aside class="work-side">,
           a sticky card like the blog's Categories box: list of options with
           counts, pressed state = aria-pressed written by js/portfolio.js, and
           a back-to-top link). At ≤1000px the same aside becomes the FIXED
           BOTTOM DOCK: a "Filter · <current>" toggle that opens the option
           list as a pop-up sheet above the bar (data-open on the aside) plus
           a round back-to-top button; the page and the footer pad their
           bottoms so nothing hides behind it. Cards: photo on an inner
           clipping wrapper, category chip, title, excerpt, arrow link;
           data-visible / data-empty filter states and the empty message.
           Replaces the horizontal carousel + inline <style> block the page
           carried until 2026-09-13. Motion = the shared [data-reveal] scroll
           reveal (states in css/site-shell.css, js/site-reveal.js). Loaded
           through layouts/public's renderSection('head') after
           bootstrap-4.4.1.css, main.css and site-shell.css, so every rule
           restates font/size/spacing and every class is prefixed work-.
           Design tokens (--band, --teal, --line, --display, --serif …) come
           from css/site-shell.css; the tall hero band is
           .banner3[data-hero="tall"] in css/main.css.
  Used by: Views/public/portfolio.php (via <?= $this->section('head') ?>)
*/

/* ── hero photo (the layout's .wrapper2 band, this page only) ── */
.wrapper2[data-page="portfolio"] {
  background-image: url(../images/home/hero-during.jpg);
  background-attachment: scroll;   /* fixed would frame only the sky in a 430px band */
  background-position: center 55%;
}

/* ── page frame ───────────────────────────────────────── */
.work-page {
  overflow-x: clip;            /* the reveal translate must not widen the page */
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--ink-soft);
  padding-bottom: clamp(4rem, 8vw, 6.5rem);
}

.work-page p {
  text-indent: 0;
  margin: 0 0 1.1rem;
}

.work-page h2 {
  font-family: var(--display);
  font-stretch: 112%;
  font-weight: 800;
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0 0 1.1rem;
}

.work-page h3 {
  font-family: var(--display);
  font-stretch: 112%;
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0 0 .6rem;
}

.work-rule {
  width: 72px;
  height: 3px;
  border: 0;
  background: var(--teal);
  margin: 0 auto 1.3rem;
}

.work-eyebrow {
  font-family: var(--display);
  font-weight: 600;
  font-size: .74rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--teal-deep);
  margin: 0 0 .9rem;
}

/* ── intro column ─────────────────────────────────────── */
.work-intro {
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 4.5rem) 1.25rem 0;
  text-align: center;
}

.work-intro .copy-link {
  font-weight: 600;
}

.work-tagline {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .02em;
  color: var(--ink);
}

/* ── two-column layout: grid + sidebar ────────────────── */
.work-layout {
  width: min(1180px, 92vw);
  margin: clamp(2rem, 4vw, 3rem) auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: clamp(2rem, 4vw, 3rem);
  align-items: start;
}

.work-main {
  min-width: 0;
}

/* ── sidebar (desktop): sticky card like the blog's Categories box ── */
.work-side {
  position: sticky;
  top: calc(62px + 1.25rem);   /* the shrunken header height + air */
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.work-side-toggle {
  display: none;               /* phone-only, see the ≤1000px block */
}

.work-side-title {
  margin: 0;
  padding: 1rem 1.25rem;
  background: var(--band);
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  font-size: .74rem;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.work-filter {
  list-style: none;
  margin: 0;
  padding: 0;
}

.work-filter li + li {
  border-top: 1px solid var(--line);
}

.work-filter-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  width: 100%;
  padding: .85rem 1.25rem .85rem calc(1.25rem - 3px);
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--display);
  font-weight: 600;
  font-size: .82rem;
  letter-spacing: .06em;
  text-align: left;
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}

.work-filter-btn:hover,
.work-filter-btn:focus-visible {
  background: var(--teal-tint);
  color: var(--teal-deep);
}

.work-filter-btn[aria-pressed="true"] {
  border-left-color: var(--teal);
  background: var(--teal-tint);
  color: var(--teal-deep);
}

.work-filter-count {
  font-family: var(--serif);
  font-size: .8rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
}

.work-side-top {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .9rem 1.25rem;
  border-top: 1px solid var(--line);
  font-family: var(--display);
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--teal-deep);
  text-decoration: none;
}

.work-side-top:hover,
.work-side-top:focus-visible {
  color: var(--teal-deep);
  background: var(--teal-tint);
  text-decoration: none;
}

.work-side-top svg {
  width: 14px;
  height: 14px;
}

.work-dock-top {
  display: none;               /* phone-only round button */
}

/* ── project grid ─────────────────────────────────────── */
.work-grid {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1.5rem, 3vw, 2.25rem);
}

.work-card {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}

.work-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 34px 60px -30px rgba(15, 26, 25, .45);
}

/* filter state written by js/portfolio.js — the card stays in the DOM */
.work-card[data-visible="false"] {
  display: none;
}

.work-card-media {
  position: relative;
  display: block;
  overflow: hidden;
}

.work-card-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 1.2s var(--ease);
}

.work-card:hover .work-card-media img {
  transform: scale(1.04);
}

/* category chip on the photo */
.work-card-tag {
  position: absolute;
  top: .9rem;
  left: .9rem;
  z-index: 1;
  padding: .42rem .7rem .38rem;
  background: rgba(15, 26, 25, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  font-size: .64rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  line-height: 1.2;
}

.work-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.5rem 1.5rem 1.4rem;
}

.work-card-body h3 a {
  color: inherit;
  text-decoration: none;
}

.work-card-body h3 a:hover,
.work-card-body h3 a:focus {
  color: var(--teal-deep);
  text-decoration: none;
}

.work-card-body p {
  flex: 1;
  font-size: .97rem;
  line-height: 1.65;
  color: var(--muted);
  margin-bottom: 1.2rem;
}

/* arrow link, same as the services hub */
.work-link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: .74rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--teal-deep);
  padding: .5rem 0;
  border-bottom: 1.5px solid rgba(42, 139, 130, .35);
  transition: border-color .25s var(--ease), color .25s var(--ease);
}

.work-link svg {
  width: 14px;
  height: 14px;
  transition: transform .25s var(--ease);
}

.work-link:hover,
.work-link:focus {
  color: var(--teal-deep);
  border-bottom-color: var(--teal-deep);
  text-decoration: none;
}

.work-link:hover svg {
  transform: translateX(3px);
}

/* ── empty state (no project matches the filter) ──────── */
.work-empty {
  display: none;
  margin: 0;
  padding: 3rem 1.25rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.work-grid[data-empty="true"] + .work-empty {
  display: block;
}

/* ── ≤1000px: single column; the aside becomes the bottom dock ── */
@media (max-width: 1000px) {
  .work-layout {
    grid-template-columns: 1fr;
  }

  .work-side {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 40;               /* under the fixed header (50) and the popup dialog */
    top: auto;
    border: 0;
    border-top: 1px solid rgba(87, 193, 182, .3);
    border-radius: 0;
    overflow: visible;
    background: rgba(15, 26, 25, .94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: .6rem 4vw max(.6rem, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: .9rem;
    color: #fff;
  }

  /* "Filter · All ⌄" toggle */
  .work-side-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    gap: .6rem;
    min-width: 0;
    padding: .7rem 1rem;
    border-radius: 999px;
    border: 1.5px solid rgba(255, 255, 255, .3);
    background: transparent;
    color: #fff;
    font-family: var(--display);
    font-weight: 600;
    font-size: .7rem;
    letter-spacing: .13em;
    text-transform: uppercase;
    line-height: 1;
    cursor: pointer;
  }

  .work-side-toggle-label {
    color: rgba(255, 255, 255, .6);
  }

  .work-side-toggle-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--teal);
  }

  .work-side-toggle svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    transition: transform .25s var(--ease);
  }

  .work-side[data-open="true"] .work-side-toggle {
    border-color: var(--teal);
  }

  .work-side[data-open="true"] .work-side-toggle svg {
    transform: rotate(180deg);
  }

  /* the option list becomes a sheet that pops up above the bar */
  .work-side-panel {
    position: absolute;
    left: 4vw;
    right: 4vw;
    bottom: calc(100% + .6rem);
    max-height: min(60vh, 480px);
    overflow: auto;
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 -18px 50px -20px rgba(15, 26, 25, .6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
  }

  .work-side[data-open="true"] .work-side-panel {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .work-side-top {
    display: none;             /* the round button takes over on phones */
  }

  .work-dock-top {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, .3);
    color: rgba(255, 255, 255, .85);
    transition: background .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease);
  }

  .work-dock-top svg {
    width: 16px;
    height: 16px;
  }

  .work-dock-top:hover,
  .work-dock-top:focus-visible {
    background: var(--teal);
    border-color: var(--teal);
    color: var(--band);
    text-decoration: none;
  }

  /* keep the last cards and the footer's copyright row clear of the dock */
  .work-page {
    padding-bottom: calc(clamp(4rem, 8vw, 6.5rem) + 4rem);
  }

  /* sandbox only: CodeIgniter's dev debug-toolbar icon (absent in production)
     sits in the same corner as the back-to-top button and eats the tap */
  #debug-icon {
    bottom: 4.6rem;
  }

  .work-page ~ .footer {
    padding-bottom: 4.5rem;
  }
}

@media (max-width: 620px) {
  .work-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .work-side-panel,
  .work-side-toggle svg,
  .work-card,
  .work-card-media img {
    transition: none;
  }
}
