/* ==========================================================================
   project.css — project page layout (hero, facts, sections, gallery, media)
   ========================================================================== */

.section {
  padding: var(--s-section) 0;
}

.section--stone {
  background: var(--c-stone);
}

.section-head {
  margin-bottom: var(--s-5);
  max-width: 46rem;
}

.section-head h2 {
  font-size: var(--t-2xl);
  margin: 0;
}

.section-head p {
  margin: var(--s-2) 0 0;
  color: var(--c-muted);
}

/* --- hero -------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: min(86vh, 820px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: var(--c-slate);
  color: var(--c-white);
}

.hero-media {
  position: absolute;
  inset: -6% 0 0;
  will-change: transform;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(21, 39, 41, .25) 0%, rgba(21, 39, 41, .45) 45%, rgba(21, 39, 41, .9) 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  padding-top: var(--s-6);
  padding-bottom: var(--s-5);
}

.breadcrumb-sole {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  list-style: none;
  margin: 0 0 var(--s-4);
  padding: 0;
  font-size: var(--t-sm);
  color: rgba(255, 255, 255, .7);
}

.breadcrumb-sole li + li::before {
  content: "/";
  margin-inline-end: var(--s-2);
  color: rgba(255, 255, 255, .4);
}

.breadcrumb-sole a {
  color: rgba(255, 255, 255, .85);
}

.breadcrumb-sole a:hover {
  color: var(--c-white);
}

.hero-type {
  display: block;
  font-weight: 500;
  color: #bfe1e4;
  margin-bottom: var(--s-2);
}

.hero h1 {
  color: var(--c-white);
  font-size: var(--t-3xl);
  font-weight: 800;
  line-height: 1.3;
  margin: 0;
  max-width: 18ch;
}

.hero-sub {
  display: block;
  margin-top: var(--s-2);
  font-family: var(--f-body);
  font-size: var(--t-md);
  font-weight: 500;
  color: rgba(255, 255, 255, .85);
}

.hero-lead {
  font-size: var(--t-md);
  color: rgba(255, 255, 255, .9);
  margin: var(--s-4) 0 var(--s-5);
  max-width: 52ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
}

/* --- facts band -------------------------------------------------------- */
.facts {
  background: var(--c-slate);
  color: var(--c-white);
}

.facts-grid {
  display: grid;
  grid-template-columns: repeat(var(--facts, 4), 1fr);
  margin: 0;
}

.fact {
  padding: var(--s-4) var(--s-4) var(--s-4) 0;
}

.fact + .fact {
  border-inline-start: 1px solid rgba(255, 255, 255, .14);
  padding-inline-start: var(--s-4);
}

.fact dt {
  font-size: var(--t-sm);
  font-weight: 500;
  color: rgba(255, 255, 255, .6);
  margin-bottom: var(--s-1);
}

.fact dd {
  margin: 0;
  font-family: var(--f-display);
  font-size: var(--t-md);
  font-weight: 700;
  color: var(--c-white);
  line-height: 1.5;
}

@media (max-width: 767.98px) {
  .facts-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .fact,
  .fact + .fact {
    padding: var(--s-3);
    border-inline-start: 0;
  }

  .fact:nth-child(even) {
    border-inline-start: 1px solid rgba(255, 255, 255, .14);
  }

  .fact:nth-child(n+3) {
    border-top: 1px solid rgba(255, 255, 255, .14);
  }
}

/* --- in-page nav ------------------------------------------------------- */
.subnav {
  position: sticky;
  top: var(--nav-h);
  z-index: 1010;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--c-line);
}

.subnav ul {
  display: flex;
  gap: var(--s-1);
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.subnav ul::-webkit-scrollbar {
  display: none;
}

.subnav a {
  position: relative;
  display: block;
  white-space: nowrap;
  padding: 0 var(--s-3);
  line-height: var(--subnav-h);
  color: var(--c-muted);
  font-weight: 500;
}

.subnav a::after {
  content: "";
  position: absolute;
  inset-inline: var(--s-3);
  bottom: -1px;
  height: 2px;
  background: var(--c-teal);
  transform: scaleX(0);
  transition: transform .45s var(--ease-out);
}

.subnav a:hover,
.subnav a.is-active {
  color: var(--c-ink);
}

.subnav a.is-active::after {
  transform: scaleX(1);
}

/* --- about ------------------------------------------------------------- */
.about-figure {
  margin: 0;
  overflow: hidden;
  border-radius: var(--r-md);
}

.about-figure img {
  width: 100%;
  max-height: 640px;
  object-fit: cover;
}

.about-text h2 {
  font-size: var(--t-2xl);
}

.location {
  display: flex;
  gap: var(--s-3);
  margin-top: var(--s-4);
  padding-top: var(--s-4);
  border-top: 1px solid var(--c-line);
}

.location i {
  color: var(--c-teal);
  font-size: 1.15rem;
  margin-top: .45rem;
}

.location strong {
  display: block;
  color: var(--c-ink);
  font-weight: 700;
}

.location p {
  margin: 0;
}

/* --- specs (ruled list, numbers count up) ------------------------------ */
.specs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: var(--s-5);
}

.spec {
  padding: var(--s-4) 0;
  border-top: 1px solid var(--c-line);
}

.spec-value {
  display: block;
  font-family: var(--f-display);
  font-size: var(--t-xl);
  font-weight: 800;
  color: var(--c-teal-deep);
  line-height: 1.35;
}

.spec-label {
  display: block;
  font-weight: 700;
  color: var(--c-ink);
  margin: var(--s-1) 0;
}

.spec p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.8;
}

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

/* --- stages (a real sequence, so it is numbered) ----------------------- */
.stages {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: stage;
}

.stage {
  position: relative;
  padding-inline-start: 3.25rem;
  padding-bottom: var(--s-4);
  counter-increment: stage;
}

.stage::before {
  content: counter(stage);
  position: absolute;
  inset-inline-start: 0;
  top: .1rem;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--c-line);
  background: var(--c-white);
  font-family: var(--f-display);
  font-weight: 700;
  font-size: .95rem;
  color: var(--c-muted);
}

.stage::after {
  content: "";
  position: absolute;
  inset-inline-start: calc(1.125rem - .5px);
  top: 2.6rem;
  bottom: .35rem;
  width: 1px;
  background: var(--c-line);
}

.stage:last-child {
  padding-bottom: 0;
}

.stage:last-child::after {
  display: none;
}

.stage.is-done::before {
  content: "\2713";
  background: var(--c-teal);
  border-color: var(--c-teal);
  color: var(--c-white);
}

.stage.is-done::after {
  background: var(--c-teal);
}

.stage.is-current::before {
  border: 2px solid var(--c-teal);
  color: var(--c-teal-deep);
}

.stage h3 {
  font-size: var(--t-md);
  margin: 0 0 var(--s-1);
}

.stage-status {
  display: inline-block;
  font-family: var(--f-body);
  font-size: .8rem;
  font-weight: 700;
  color: var(--c-muted);
  margin-inline-start: var(--s-2);
}

.stage.is-done .stage-status { color: var(--c-teal-deep); }
.stage.is-current .stage-status { color: #8a5a00; }

.stage p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.8;
}

/* --- gallery ----------------------------------------------------------- */
.gallery-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-4);
  margin-bottom: var(--s-4);
  border-bottom: 1px solid var(--c-line);
}

.gallery-tab {
  position: relative;
  padding: var(--s-2) 0 var(--s-3);
  border: 0;
  background: none;
  color: var(--c-muted);
  font-family: var(--f-body);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.gallery-tab span {
  font-weight: 500;
  color: var(--c-muted);
  margin-inline-start: .3rem;
}

.gallery-tab::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -1px;
  height: 2px;
  background: var(--c-teal);
  transform: scaleX(0);
  transition: transform .45s var(--ease-out);
}

.gallery-tab:hover,
.gallery-tab[aria-pressed="true"] {
  color: var(--c-ink);
}

.gallery-tab[aria-pressed="true"]::after {
  transform: scaleX(1);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 200px;
  grid-auto-flow: dense;
  gap: .75rem;
}

.gallery-item {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--c-stone);
}

.gallery-item[hidden] {
  display: none;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .9s var(--ease-out), opacity .5s ease;
}

.gallery-item:hover img {
  transform: scale(1.04);
}

.gallery-item--lead {
  grid-column: span 2;
  grid-row: span 2;
}

.gallery-more {
  margin-top: var(--s-4);
}

@media (max-width: 991.98px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 170px;
  }
}

@media (max-width: 575.98px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 140px;
    gap: .5rem;
  }
}

/* --- videos ------------------------------------------------------------ */
.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--c-slate);
}

.video-frame iframe,
.video-frame video,
.video-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-frame video {
  object-fit: cover;
}

.video-poster {
  padding: 0;
  background: none;
  cursor: pointer;
}

.video-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .82;
  transition: opacity .5s ease, transform 1s var(--ease-out);
}

.video-poster:hover img {
  opacity: 1;
  transform: scale(1.03);
}

.video-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--c-teal);
  color: var(--c-white);
  font-size: 1.35rem;
  transition: transform .4s var(--ease-out);
}

.video-poster:hover .video-play {
  transform: scale(1.06);
}

.video-title {
  margin: var(--s-3) 0 0;
  font-weight: 700;
  color: var(--c-ink);
}

/* --- files (PDF / Drive) ----------------------------------------------- */
.files {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: var(--s-5);
}

.files a {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--c-line);
  color: var(--c-ink);
  font-weight: 500;
}

.files a i:first-child {
  color: var(--c-teal-deep);
  font-size: 1.2rem;
}

.files a i:last-child {
  margin-inline-start: auto;
  color: var(--c-muted);
  font-size: .85rem;
}

.files a:hover {
  color: var(--c-teal-deep);
}

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

/* --- enquiry band ------------------------------------------------------ */
.enquiry {
  background: var(--c-slate);
  color: var(--c-white);
  padding: var(--s-6) 0;
}

.enquiry h2 {
  color: var(--c-white);
  font-size: var(--t-xl);
  margin-bottom: var(--s-2);
}

.enquiry p {
  color: rgba(255, 255, 255, .78);
  margin: 0;
}

.enquiry .hero-actions {
  justify-content: flex-end;
}

@media (max-width: 991.98px) {
  .enquiry .hero-actions {
    justify-content: flex-start;
  }
}

/* ==========================================================================
   Motion layer — one orchestrated hero entrance, then quiet scroll reveals.
   Only transform/opacity animate. Disabled under prefers-reduced-motion.
   ========================================================================== */

/* hero entrance: image settles, then lines rise in order (--d) */
.js .hero-media img {
  transform: scale(1.14);
  transition: transform 2.6s cubic-bezier(.16, .7, .2, 1);
}

.js .hero.is-ready .hero-media img {
  transform: scale(1.02);
}

.js .hero-in {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
  transition-delay: calc(.35s + var(--d, 0) * .12s);
}

.js .hero.is-ready .hero-in {
  opacity: 1;
  transform: none;
}

.mask {
  display: block;
  overflow: hidden;
  padding-bottom: .08em;
}

.mask > span {
  display: block;
}

.js .hero-mask > span {
  transform: translateY(105%);
  transition: transform 1.1s cubic-bezier(.2, .75, .2, 1);
  transition-delay: calc(.35s + var(--d, 0) * .12s);
}

.js .hero.is-ready .hero-mask > span {
  transform: none;
}

/* facts band: cells rise after the title */
.js .fact {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
}

.js .facts.is-ready .fact {
  opacity: 1;
  transform: none;
}

.js .facts.is-ready .fact:nth-child(1) { transition-delay: 1.05s; }
.js .facts.is-ready .fact:nth-child(2) { transition-delay: 1.15s; }
.js .facts.is-ready .fact:nth-child(3) { transition-delay: 1.25s; }
.js .facts.is-ready .fact:nth-child(4) { transition-delay: 1.35s; }

/* section headings: text rises from its baseline, a short rule draws in */
.section-head::after {
  content: "";
  display: block;
  width: 64px;
  height: 3px;
  margin-top: var(--s-3);
  background: var(--c-teal);
  transform-origin: right;
}

.js [data-reveal="heading"] {
  opacity: 1;
  transform: none;
}

.js [data-reveal="heading"] .mask > span {
  transform: translateY(105%);
  transition: transform 1s cubic-bezier(.2, .75, .2, 1);
}

.js [data-reveal="heading"]::after {
  transform: scaleX(0);
  transition: transform 1s var(--ease-out) .35s;
}

.js [data-reveal="heading"].is-in .mask > span,
.js [data-reveal="heading"].is-in::after {
  transform: none;
}

/* images: a slate panel wipes away (RTL: right → left) while the photo settles */
[data-reveal="image"] {
  position: relative;
}

.js [data-reveal="image"] {
  opacity: 1;
}

.js [data-reveal="image"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: var(--c-slate);
  transform-origin: left;
  transition: transform 1s cubic-bezier(.7, 0, .2, 1);
  transition-delay: var(--reveal-delay, 0ms);
  pointer-events: none;
}

.js [data-reveal="image"] img {
  transform: scale(1.18);
  transition: transform 1.6s cubic-bezier(.16, .7, .2, 1);
  transition-delay: var(--reveal-delay, 0ms);
}

.js [data-reveal="image"].is-in::before {
  transform: scaleX(0);
}

.js [data-reveal="image"].is-in img {
  transform: none;
}

.section--stone .js [data-reveal="image"]::before,
.js .section--stone [data-reveal="image"]::before {
  background: var(--c-stone);
}

/* spec rows: the top rule draws itself, the value rises */
.spec {
  position: relative;
  border-top: 0;
}

.spec::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 1px;
  background: var(--c-line);
  transform-origin: right;
}

.js .spec::before {
  transform: scaleX(0);
  transition: transform 1.1s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

.js .spec.is-in::before {
  transform: none;
}

/* stages: a teal line fills down the timeline as the section scrolls */
.stages-wrap {
  position: relative;
}

.stages-fill {
  position: absolute;
  inset-inline-start: calc(1.125rem - 1px);
  top: 1.2rem;
  bottom: 1.2rem;
  width: 3px;
  border-radius: 3px;
  background: var(--c-teal);
  transform-origin: top;
  transform: scaleY(var(--progress, 0));
  z-index: 0;
}

.stage::before {
  z-index: 1;
  transition: transform .5s var(--ease-out), background-color .5s ease, border-color .5s ease, color .5s ease;
}

.stage.is-current::before {
  animation: stagePulse 2.8s ease-in-out infinite;
}

@keyframes stagePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(76, 160, 168, .35); }
  50% { box-shadow: 0 0 0 9px rgba(76, 160, 168, 0); }
}

/* gallery: dark wash + expand cue on hover */
.gallery-cue {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(21, 39, 41, 0) 30%, rgba(21, 39, 41, .55));
  color: var(--c-white);
  font-size: 1.1rem;
  opacity: 0;
  transition: opacity .5s ease;
}

.gallery-cue i {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .7);
  transform: scale(.8);
  transition: transform .5s var(--ease-out);
}

.gallery-item:hover .gallery-cue,
.gallery-item:focus-visible .gallery-cue {
  opacity: 1;
}

.gallery-item:hover .gallery-cue i {
  transform: none;
}

.gallery-item:hover img {
  transform: scale(1.07);
}

/* blueprint texture on stone sections — a nod to construction drawings */
.section--stone {
  background-color: var(--c-stone);
  background-image:
    linear-gradient(rgba(30, 53, 56, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 53, 56, .045) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: center top;
}

/* enquiry band: slow drifting light */
.enquiry {
  position: relative;
  overflow: hidden;
}

.enquiry::before {
  content: "";
  position: absolute;
  width: 60vw;
  height: 60vw;
  max-width: 760px;
  max-height: 760px;
  inset-inline-end: -18vw;
  top: -30vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76, 160, 168, .28), rgba(76, 160, 168, 0) 65%);
  animation: enquiryDrift 14s ease-in-out infinite alternate;
  pointer-events: none;
}

.enquiry .container {
  position: relative;
}

@keyframes enquiryDrift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-8vw, 6vw, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .js .hero-in,
  .js .fact,
  .js .hero-mask > span,
  .js [data-reveal="heading"] .mask > span,
  .js [data-reveal="heading"]::after,
  .js .spec::before,
  .js [data-reveal="image"] img,
  .js .hero-media img {
    opacity: 1;
    transform: none;
  }

  .js [data-reveal="image"]::before {
    display: none;
  }

  .stages-fill {
    transform: none;
  }

  .enquiry::before,
  .stage.is-current::before {
    animation: none;
  }
}

/* ==========================================================================
   decor layer (decor.js) — progress bar, blueprint lines, watermarks, shapes, tilt
   ========================================================================== */
.read-progress {
  position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 1040;
  background: linear-gradient(270deg, var(--c-teal-deep), var(--c-teal), #9fd3d8);
  transform-origin: right; transform: scaleX(0); pointer-events: none;
}

.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(circle 420px at var(--hx, 30%) var(--hy, 40%), rgba(76, 160, 168, .18), transparent 70%), linear-gradient(270deg, rgba(21, 39, 41, .55) 0%, rgba(21, 39, 41, .15) 70%), linear-gradient(180deg, rgba(21, 39, 41, .3) 0%, rgba(21, 39, 41, .5) 45%, rgba(21, 39, 41, .92) 100%);
}
.hero-content { position: relative; z-index: 2; }

.hero-lines {
  position: absolute; z-index: 1; pointer-events: none;
  top: 10%; bottom: 14%; left: 4%; width: min(36vw, 440px); opacity: .6;
}
.hero-lines svg { width: 100%; height: 100%; overflow: visible; }
.hero-lines path, .hero-lines circle {
  fill: none; stroke: rgba(255, 255, 255, .5); stroke-width: 1.2; vector-effect: non-scaling-stroke;
  stroke-dasharray: 2000; stroke-dashoffset: 2000;
}
.hero.is-ready .hero-lines path,
.hero.is-ready .hero-lines circle { animation: drawLine 3.4s var(--ease-out) .9s forwards; }
.hero.is-ready .hero-lines circle { animation-delay: 1.8s; stroke: rgba(76, 160, 168, .95); }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@media (max-width: 767.98px) { .hero-lines { opacity: .22; width: 70vw; } }

.hero-cue {
  position: absolute; z-index: 3; bottom: 1.6rem; left: 50%; margin-left: -13px;
  width: 26px; height: 42px; border: 2px solid rgba(255, 255, 255, .7); border-radius: 14px;
  opacity: 0; transition: opacity .8s ease 2.2s;
}
.hero.is-ready .hero-cue { opacity: 1; }
.hero-cue span {
  position: absolute; top: 8px; left: 50%; width: 4px; height: 8px; margin-left: -2px;
  border-radius: 2px; background: #fff; animation: cue 1.8s ease-in-out infinite;
}
@keyframes cue { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(14px); opacity: 0; } 100% { opacity: 0; } }

.section { position: relative; overflow: hidden; isolation: isolate; }
.sec-index {
  position: absolute; z-index: -1; top: 1.25rem; left: 3%;
  font-family: var(--f-head, inherit); font-weight: 800; line-height: 1;
  font-size: clamp(6rem, 16vw, 13rem); color: transparent;
  -webkit-text-stroke: 1.5px rgba(76, 160, 168, .25); pointer-events: none;
  transform: translateY(40px); opacity: 0; transition: transform 1.4s var(--ease-out), opacity 1.4s ease;
}
.section:has(.is-in) .sec-index { transform: none; opacity: 1; }

.float-shape {
  position: absolute; z-index: -1; pointer-events: none;
  width: 140px; height: 140px; bottom: 8%; right: 2%;
  border: 1.5px solid rgba(76, 160, 168, .28); animation: floaty 14s ease-in-out infinite;
}
.float-shape.is-alt { right: auto; left: 8%; top: 45%; bottom: auto; animation-duration: 18s; animation-direction: reverse; }
.float-shape--ci { border-radius: 50%; width: 110px; height: 110px; }
.float-shape--tri { border: 0; width: 0; height: 0; border-inline: 60px solid transparent; border-bottom: 104px solid rgba(76, 160, 168, .1); }
@keyframes floaty {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(18px, -26px) rotate(25deg); }
}

.has-frame { position: relative; isolation: isolate; }
.has-frame::before {
  content: ""; position: absolute; z-index: -1; inset: 0;
  border: 2px solid var(--c-teal); border-radius: 6px;
  transform: translate(-18px, 18px); opacity: 0; transition: opacity 1s ease .6s, transform 1.2s var(--ease-out) .6s;
}
.has-frame:has(.is-in)::before { opacity: .65; transform: translate(-18px, 18px); }

.gallery-item, .about-figure {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .5s var(--ease-out), box-shadow .5s ease;
}
.gallery-item:hover, .about-figure:hover { box-shadow: 0 22px 44px -18px rgba(21, 39, 41, .45); }
.gallery-item::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0;
  background: radial-gradient(circle 220px at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .28), transparent 70%);
  transition: opacity .4s ease;
}
.gallery-item:hover::after { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .float-shape, .hero-cue span { animation: none; }
  .hero-lines path, .hero-lines circle { stroke-dashoffset: 0; animation: none; }
  .sec-index { transform: none; opacity: 1; transition: none; }
  .gallery-item, .about-figure { transform: none; }
}

/* ==========================================================================
   LTR (English pages): mirror direction-dependent decoration
   ========================================================================== */
[dir="ltr"] .section-head::after,
[dir="ltr"] .spec::before,
[dir="ltr"] .read-progress,
[dir="ltr"] .btn-sole::before { transform-origin: left; }
[dir="ltr"] .js [data-reveal="image"]::before, .js [dir="ltr"] [data-reveal="image"]::before { transform-origin: right; }
[dir="ltr"] .hero-lines { left: auto; right: 4%; }
[dir="ltr"] .sec-index { left: auto; right: 3%; }
[dir="ltr"] .float-shape { right: auto; left: 2%; }
[dir="ltr"] .float-shape.is-alt { left: auto; right: 8%; }
[dir="ltr"] .has-frame::before,
[dir="ltr"] .has-frame:has(.is-in)::before { transform: translate(18px, 18px); }
[dir="ltr"] .hero::after {
  background:
    radial-gradient(circle 420px at var(--hx, 70%) var(--hy, 40%), rgba(76, 160, 168, .18), transparent 70%),
    linear-gradient(90deg, rgba(21, 39, 41, .55) 0%, rgba(21, 39, 41, .15) 70%),
    linear-gradient(180deg, rgba(21, 39, 41, .3) 0%, rgba(21, 39, 41, .5) 45%, rgba(21, 39, 41, .92) 100%);
}

/* ==========================================================================
   files: clear cards with an "open" button
   ========================================================================== */
.files { gap: .9rem var(--s-4); }
.files li a.file-card {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem;
  background: var(--c-white); border: 1px solid var(--c-line); border-radius: 6px;
  box-shadow: 0 10px 26px -22px rgba(21, 39, 41, .5);
  transition: border-color .3s ease, transform .4s var(--ease-out), box-shadow .4s ease;
}
.files li a.file-card:hover { border-color: var(--c-teal); transform: translateY(-3px); box-shadow: 0 18px 34px -24px rgba(21, 39, 41, .55); color: var(--c-ink); }
.file-ico { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 6px; background: rgba(76, 160, 168, .12); color: var(--c-teal-deep); font-size: 1.5rem; }
.files a i:first-child { color: inherit; font-size: inherit; }
.file-name { flex: 1; min-width: 0; font-weight: 700; font-size: 1.05rem; line-height: 1.5; }
.file-name small { display: block; font-weight: 400; font-size: .82rem; color: var(--c-muted); }
.file-open { flex: none; display: inline-flex; align-items: center; gap: .4rem; padding: .55rem .9rem; border-radius: 4px; background: var(--c-teal); color: #fff; font-weight: 700; font-size: .9rem; white-space: nowrap; }
.files a .file-open i { margin: 0; color: #fff; font-size: .8rem; }
.file-card:hover .file-open { background: var(--c-teal-deep); }

/* ==========================================================================
   phones
   ========================================================================== */
@media (max-width: 767.98px) {
  /* every section link visible at once: wrap into chips instead of a sideways scroll */
  .subnav { position: static; }
  .subnav ul { flex-wrap: wrap; gap: .5rem; padding: .8rem 0; overflow: visible; }
  .subnav a { line-height: 1.2; padding: .55rem .9rem; border: 1px solid var(--c-line); border-radius: 99px; font-size: .92rem; background: #fff; }
  .subnav a::after { display: none; }
  .subnav a.is-active, .subnav a:hover { background: var(--c-teal); border-color: var(--c-teal); color: #fff; }

  .sec-index { font-size: 4.2rem; top: .6rem; opacity: .6; }
  .section:has(.is-in) .sec-index { opacity: .55; }
  .has-frame::before, .has-frame:has(.is-in)::before { display: none; }
  .row.g-5 { --bs-gutter-x: 2rem; --bs-gutter-y: 2rem; }

  .hero { min-height: auto; padding-bottom: 2.5rem; }
  .hero-cue { display: none; }
  .hero-lead { font-size: 1rem; line-height: 1.8; }
  .hero-actions { gap: .6rem; }
  .hero-actions .btn-sole { flex: 1 1 100%; justify-content: center; }

  .files li a.file-card { flex-wrap: wrap; }
  .file-open { flex: 1 1 100%; justify-content: center; padding: .7rem; }
}

@media (max-width: 575.98px) {
  /* gallery: one photo per row at its real shape, nothing cropped */
  .gallery-grid { grid-template-columns: 1fr; grid-auto-rows: auto; gap: .8rem; }
  .gallery-item, .gallery-item--lead { grid-column: auto; grid-row: auto; }
  .gallery-item img { height: auto; aspect-ratio: auto; }
}

/* touch screens: no hover, so give tiles a gentle zoom when they scroll into view */
@media (hover: none) and (prefers-reduced-motion: no-preference) {
  .gallery-item.is-in img { animation: settle 1.6s var(--ease-out) both; }
  @keyframes settle { from { transform: scale(1.12); } to { transform: scale(1); } }
}
@media (max-width: 575.98px) {
  .facts dd { font-size: 1.05rem; line-height: 1.5; }
  .facts dt { font-size: .8rem; }
  .facts .fact { padding: .9rem .8rem; }
  .files li a.file-card { padding: .8rem .9rem; gap: .7rem; }
  .file-ico { width: 44px; height: 44px; font-size: 1.25rem; }
  .file-open { padding: .55rem; }
}

/* touch screens: decor.js marks the card in the middle of the screen .is-hot (desktop hover look)
   and .is-press for a moment on tap */
@media (hover: none) and (prefers-reduced-motion: no-preference) {
  .project-tile, .service, .mv-card, .news-card, .file-card, .video-poster { transition: transform .5s var(--ease-out), box-shadow .5s ease, background .4s ease; }
  .project-tile { transform: perspective(900px) rotateX(var(--rx, 0deg)); }
  .is-press { transform: scale(.97) !important; transition-duration: .15s !important; }
}
@media (hover: none) and (prefers-reduced-motion: no-preference) {
  .gallery-item.is-hot, .about-figure.is-hot { box-shadow: 0 22px 44px -18px rgba(21, 39, 41, .45); }
  .gallery-item.is-hot::after { opacity: 1; }
  .gallery-item.is-hot .gallery-cue { opacity: 1; }
  .files li a.file-card.is-hot { border-color: var(--c-teal); transform: translateY(-3px); box-shadow: 0 18px 34px -24px rgba(21, 39, 41, .55); }
  .file-card.is-hot .file-open { background: var(--c-teal-deep); }
  .video-poster.is-hot .video-play { transform: scale(1.08); }
  .gallery-item.is-hot img { transform: scale(1.05); }
}
