/* Brescia Works (projects.html): island map, photo strip, filters, project grid and the project sheet. */
.works-page { background: var(--limestone); }
.display em { font-style: italic; color: var(--terracotta); }

/* ---------------- hero ---------------- */
.works-hero { display: grid; grid-template-columns: 0.9fr 1.1fr; grid-template-areas: "copy map" "strip strip"; align-items: center; gap: clamp(20px, 3vw, 50px) clamp(24px, 4vw, 70px);
  padding: calc(var(--header-h) + clamp(30px, 5vw, 70px)) var(--gutter) 0; overflow: hidden;
  background: radial-gradient(70% 70% at 80% 30%, #fbf8f2, var(--limestone) 70%); }
.works-hero-copy { grid-area: copy; }
.works-hero .display { font-size: clamp(46px, 6vw, 100px); margin: 14px 0 18px; }
.works-stats { display: flex; gap: clamp(22px, 3.6vw, 50px); margin: 30px 0 0; padding-top: 20px; border-top: 1px solid var(--line); }
.works-stats dt { font-family: var(--mono); font-weight: 600; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--mute); }
.works-stats dd { margin: 6px 0 0; font-family: var(--serif); font-size: clamp(32px, 3.2vw, 48px); line-height: 1; }

.works-map { grid-area: map; position: relative; min-width: 0; }
.bali { display: block; width: 100%; height: auto; color: rgba(27, 28, 26, 0.18); overflow: visible; }
.bali-land { fill: #fbf9f5; stroke: rgba(27, 28, 26, 0.35); stroke-width: 1.5; filter: drop-shadow(0 26px 30px rgba(40, 30, 18, 0.16));
  stroke-dasharray: 4200; stroke-dashoffset: 4200; animation: coast 2.6s var(--ease) forwards; }
@keyframes coast { to { stroke-dashoffset: 0; } }
.bali-dots { pointer-events: none; opacity: 0.55; }
.pin { cursor: pointer; outline: none; transition: opacity 0.4s; }
.pin-in { opacity: 0; animation: pin-in 0.7s var(--ease) forwards; animation-delay: calc(1.2s + var(--d)); }
@keyframes pin-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
.pin-dot { fill: var(--terracotta); stroke: #fff; stroke-width: 3; transition: r 0.3s var(--ease); }
.pin-pulse { fill: var(--terracotta); opacity: 0; transform-box: fill-box; transform-origin: center; animation: pulse 2.6s ease-out infinite; animation-delay: calc(2s + var(--d)); }
@keyframes pulse { 0% { opacity: 0.35; transform: scale(0.4); } 100% { opacity: 0; transform: scale(1.6); } }
.pin-n { font: 700 14px/1 var(--sans); fill: #fff; text-anchor: middle; pointer-events: none; }
.pin:hover .pin-dot, .pin:focus-visible .pin-dot, .pin.is-on .pin-dot { fill: var(--ink); }
.pin.is-dim { opacity: 0.18 !important; }
.map-card { position: absolute; z-index: 3; width: 260px; transform: translate(-50%, calc(-100% - 18px)); padding: 12px; background: #fbf9f5; border: 1px solid var(--line);
  box-shadow: 0 24px 50px -22px rgba(30, 22, 12, 0.6); animation: card-in 0.35s var(--ease); }
.map-card[hidden] { display: none; }
@keyframes card-in { from { opacity: 0; transform: translate(-50%, calc(-100% - 8px)); } }
.map-card > .mono { display: block; margin: 0 0 8px; color: var(--terracotta); }
.map-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.map-card button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 4px; text-align: left; border: 0; background: none; cursor: pointer; }
.map-card button:hover { background: var(--bone); }
.map-card img { width: 54px; height: 40px; object-fit: cover; flex: none; }
.map-card strong { display: block; font-family: var(--serif); font-weight: 520; font-size: 15px; line-height: 1.15; }
.map-card small { font-size: 11.5px; color: var(--mute); }
.map-note { position: absolute; right: 0; bottom: 4px; font-size: 9.5px; color: var(--mute); }

.works-strip { grid-area: strip; margin: clamp(10px, 2vw, 30px) calc(-1 * var(--gutter)) 0; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.strip-track { display: flex; gap: 10px; width: max-content; padding: 0 0 clamp(28px, 4vw, 50px); animation: strip 90s linear infinite; }
.strip-track img { height: clamp(110px, 13vw, 180px); width: auto; aspect-ratio: 3 / 2; object-fit: cover; }
@keyframes strip { to { transform: translateX(-50%); } }

/* ---------------- filters ---------------- */
.works-filter { position: sticky; top: var(--header-h); z-index: 20; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; padding: 14px var(--gutter);
  background: rgba(244, 240, 233, 0.9); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.filter-group { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-group button { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fbf9f5;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: background-color 0.3s, color 0.3s, border-color 0.3s; }
.filter-group button span { font-size: 11px; color: var(--mute); transition: color 0.3s; }
.filter-group button:hover { border-color: var(--ink); }
.filter-group button[aria-pressed="true"] { background: var(--ink); color: var(--limestone); border-color: var(--ink); }
.filter-group button[aria-pressed="true"] span { color: rgba(244, 240, 233, 0.6); }

/* ---------------- grid ---------------- */
.works-grid-wrap { padding: clamp(26px, 3.4vw, 50px) var(--gutter) clamp(50px, 6vw, 90px); }
.works-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: clamp(260px, 25vw, 400px); gap: clamp(12px, 1.6vw, 22px); grid-auto-flow: dense; }
.work .work-card { height: 100%; }
.work-wide { grid-column: span 2; }
.work { opacity: 0; transform: translateY(26px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.work.is-seen { opacity: 1; transform: none; }
.work.is-in.is-seen { animation: work-in 0.7s var(--ease) both; animation-delay: var(--d); }
@keyframes work-in { from { opacity: 0; transform: translateY(18px) scale(0.98); } }
.work[hidden] { display: none; }
.work-card { position: relative; display: block; width: 100%; padding: 0; border: 0; background: var(--sand); text-align: left; cursor: pointer; overflow: hidden; color: #fff; isolation: isolate; }
.work-media { display: block; position: absolute; inset: 0; }
.work-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.04); transition: opacity 0.5s var(--ease), transform 1.6s var(--ease); }
.work-media img.is-on { opacity: 1; }
.work-card:hover .work-media img.is-on { transform: scale(1.09); }
.work-card::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(14, 10, 6, 0) 40%, rgba(14, 10, 6, 0.72)); transition: opacity 0.5s; }
.work-bars { position: absolute; z-index: 2; left: 16px; right: 16px; top: 14px; display: flex; gap: 4px; opacity: 0; transition: opacity 0.4s; }
.work-bars i { flex: 1; height: 2px; background: rgba(255, 255, 255, 0.4); }
.work-bars i.is-on { background: #fff; }
.work-card:hover .work-bars { opacity: 1; }
.work-meta { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; display: grid; gap: 4px; padding: clamp(14px, 1.6vw, 22px); transition: transform 0.6s var(--ease); }
.work-meta .mono { color: #e8c88c; font-size: 10.5px; }
.work-meta strong { font-family: var(--serif); font-weight: 480; font-size: clamp(22px, 2vw, 32px); line-height: 1.05; }
.work-wide .work-meta strong { font-size: clamp(28px, 2.8vw, 44px); }
.work-meta small { font-size: 13px; color: rgba(255, 255, 255, 0.8); }
.work-card:hover .work-meta { transform: translateY(-6px); }
.work-badge { position: absolute; z-index: 2; right: 14px; top: 26px; padding: 5px 10px; border-radius: 999px; background: var(--terracotta); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.work-card:focus-visible { outline: 3px solid var(--terracotta); outline-offset: 3px; }
.works-empty { text-align: center; color: var(--mute); }

/* ---------------- end ---------------- */
.works-end { padding: clamp(60px, 8vw, 120px) var(--gutter); text-align: center; background: var(--bone); }
.works-end .display { font-size: clamp(40px, 5vw, 80px); margin: 12px 0 14px; }
.works-end .lede { margin: 0 auto; }
.works-end-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.projects-application-link { margin: 26px auto 0; font-size: 13.5px; color: var(--mute); max-width: 60ch; }
.projects-application-link a { color: var(--ink); }

/* ---------------- the project sheet ---------------- */
.sheet { width: min(1180px, calc(100vw - 32px)); max-height: calc(100svh - 32px); padding: 0; border: 0; background: #fbf9f5; color: var(--ink); overflow: auto;
  box-shadow: 0 50px 100px -30px rgba(0, 0, 0, 0.6); }
.sheet::backdrop { background: rgba(24, 20, 14, 0.55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.sheet[open] { animation: sheet-in 0.5s var(--ease); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(26px) scale(0.98); } }
.sheet-inner { position: relative; display: grid; grid-template-columns: 1.5fr 1fr; }
.sheet-close { position: absolute; z-index: 3; right: 12px; top: 12px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(251, 249, 245, 0.92); font-size: 24px; cursor: pointer; }
.sheet-gallery { position: relative; background: #1a1714; display: grid; grid-template-rows: 1fr auto; min-height: min(70svh, 640px); }
.sheet-gallery > img { width: 100%; height: 100%; max-height: 72svh; object-fit: contain; animation: shot-in 0.5s var(--ease); }
@keyframes shot-in { from { opacity: 0.2; } }
.sheet-nav { position: absolute; top: 45%; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(251, 249, 245, 0.85); font-size: 24px; line-height: 1; cursor: pointer; }
.sheet-prev { left: 12px; }
.sheet-next { right: 12px; }
.sheet-thumbs { list-style: none; margin: 0; padding: 10px; display: flex; gap: 8px; justify-content: center; background: #110f0d; }
.sheet-thumbs button { padding: 0; border: 2px solid transparent; background: none; cursor: pointer; opacity: 0.55; transition: opacity 0.3s, border-color 0.3s; }
.sheet-thumbs button[aria-current="true"] { opacity: 1; border-color: #e8c88c; }
.sheet-thumbs img { width: 76px; height: 52px; object-fit: cover; display: block; }
.sheet-info { display: flex; flex-direction: column; gap: 12px; padding: clamp(24px, 3vw, 44px); }
.sheet-info .mono { color: var(--terracotta); }
.sheet-info .display { font-size: clamp(32px, 3vw, 50px); margin: 0; }
.sheet-info p { margin: 0; font-size: 15.5px; line-height: 1.6; color: var(--ink-soft); }
.sheet-note { font-size: 12.5px !important; color: var(--mute) !important; padding: 8px 10px; background: var(--bone); }
.sheet-cta { display: grid; gap: 12px; justify-items: start; margin-top: 10px; }
.sheet-step { display: flex; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.sheet-step button { border: 0; background: none; font-size: 13px; font-weight: 600; cursor: pointer; padding: 8px 0; }
.sheet-step button:hover { color: var(--terracotta); }

@media (max-width: 1000px) {
  .works-hero { grid-template-columns: 1fr; grid-template-areas: "copy" "map" "strip"; }
  .works-grid { grid-template-columns: 1fr 1fr; }
  .sheet-inner { grid-template-columns: 1fr; }
  .sheet-gallery { min-height: 0; }
  .sheet-gallery > img { max-height: 52svh; }
}
@media (max-width: 620px) {
  .works-hero { padding-top: calc(var(--header-h) + 18px); }
  .works-hero .display { font-size: clamp(40px, 11vw, 54px); }
  .works-filter { padding: 10px 14px; gap: 8px; }
  .filter-group { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
  .filter-group::-webkit-scrollbar { display: none; }
  .filter-group button { flex: none; min-height: 34px; padding: 0 12px; font-size: 12.5px; }
  .works-grid { grid-template-columns: 1fr; }
  .work-wide { grid-column: auto; }
  .works-grid { grid-auto-rows: 300px; }
  .map-card { width: 220px; }
  .map-note { display: none; }
  .sheet { width: 100vw; max-width: 100vw; max-height: 100svh; height: 100svh; margin: 0; }
  .sheet-thumbs img { width: 60px; height: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  .strip-track, .pin-pulse, .bali-land { animation: none; }
  .bali-land { stroke-dashoffset: 0; }
  .pin-in { animation: none; opacity: 1; }
  .work { opacity: 1; transform: none; transition: none; }
}

/* ---------------- desktop: story extras stay hidden ---------------- */
.work-desc, .work-actions { display: none; }
.works-fab { display: none; }
.work { position: relative; }

/* ---------------- phone: the portfolio plays like stories ---------------- */
@media (max-width: 760px) {
  html:has(.works-page) { scroll-snap-type: y proximity; }
  /* the island leads, large, with the title over the sea */
  .works-hero { gap: 14px; padding-bottom: 0; }
  .works-hero .lede { font-size: 15px; }
  .works-stats { margin-top: 20px; padding-top: 14px; }
  .works-stats dd { font-size: 32px; }
  .works-map { margin: 4px -10px 0; }
  .pin-dot { r: 19px; stroke-width: 5; }
  .pin-pulse { r: 34px; }
  .pin-n { font-size: 22px; }
  .bali-land { stroke-width: 4; }
  .map-card { position: fixed; z-index: 60; left: 12px !important; right: 12px; top: auto !important; bottom: 12px; width: auto; transform: none; animation: card-up 0.4s var(--ease); }
  @keyframes card-up { from { opacity: 0; transform: translateY(20px); } }
  .map-card img { width: 72px; height: 52px; }
  .map-card strong { font-size: 17px; }
  .strip-track img { height: 96px; }

  .works-filter { top: var(--header-h); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 6px; padding: 10px 14px; }
  .works-filter::-webkit-scrollbar { display: none; }
  .works-filter .filter-group { flex: none; overflow: visible; margin: 0; padding: 0; }
  .filter-group + .filter-group { padding-left: 8px; border-left: 1px solid var(--line); }
  .works-grid-wrap { padding: 0 0 30px; }
  .works-grid { display: block; }
  .works-grid > li { height: calc(100svh - var(--header-h) - 70px); min-height: 460px; margin: 0 0 10px; scroll-snap-align: start; scroll-margin-top: calc(var(--header-h) + 58px);
    opacity: 1; transform: none; }
  .work .work-card { border-radius: 0; }
  .work-media img { transform: scale(1.02); }
  .work.is-live .work-media img.is-on { animation: kenburns 6s ease-out forwards; }
  @keyframes kenburns { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.16) translate(-2%, -2%); } }
  .work-card::after { background: linear-gradient(180deg, rgba(14, 10, 6, 0.35) 0%, rgba(14, 10, 6, 0) 22%, rgba(14, 10, 6, 0) 45%, rgba(14, 10, 6, 0.86)); }
  .work-bars { opacity: 1; top: 12px; left: 14px; right: 14px; gap: 5px; }
  .work-bars i { position: relative; height: 3px; border-radius: 3px; overflow: hidden; background: rgba(255, 255, 255, 0.35); }
  .work-bars i.is-done { background: #fff; }
  .work-bars i.is-on { background: rgba(255, 255, 255, 0.35); }
  .work-bars i.is-on::after { content: ""; position: absolute; inset: 0; background: #fff; transform-origin: left; animation: bar 2.8s linear forwards; }
  .work:not(.is-live) .work-bars i.is-on::after { animation: none; transform: scaleX(1); }
  @keyframes bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  .work-badge { top: 28px; right: 14px; }
  .work-meta { bottom: 74px; padding: 0 18px; gap: 6px; }
  .work-meta strong, .work-wide .work-meta strong { font-size: clamp(32px, 9.4vw, 42px); line-height: 1.02; }
  .work-meta small { font-size: 14px; }
  .work-desc { display: block; font-size: 14px; line-height: 1.45; color: rgba(255, 255, 255, 0.82); max-width: 34ch; }
  .work.is-live .work-meta > * { animation: rise 0.8s var(--ease) both; }
  .work.is-live .work-meta > :nth-child(2) { animation-delay: 0.08s; }
  .work.is-live .work-meta > :nth-child(3) { animation-delay: 0.16s; }
  .work.is-live .work-meta > :nth-child(4) { animation-delay: 0.24s; }
  @keyframes rise { from { opacity: 0; transform: translateY(16px); } }
  .work-actions { position: absolute; z-index: 3; left: 18px; right: 18px; bottom: 18px; display: flex; gap: 8px; }
  .work-open, .work-chat { flex: 1; display: grid; place-items: center; min-height: 46px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 700; text-decoration: none; }
  .work-open { border: 0; background: #fff; color: var(--ink); }
  .work-chat { background: rgba(255, 255, 255, 0.16); color: #fff; border: 1px solid rgba(255, 255, 255, 0.5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
  .work-card:hover .work-meta { transform: none; }

  .works-fab { position: fixed; z-index: 55; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px;
    border-radius: 999px; background: var(--ink); color: var(--limestone); font-size: 15px; font-weight: 700; text-decoration: none;
    box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.7); transform: translateY(140%); transition: transform 0.5s var(--ease); }
  .works-fab.is-on { transform: none; }
  .fab-dot { width: 9px; height: 9px; border-radius: 50%; background: #3ad06e; box-shadow: 0 0 0 4px rgba(58, 208, 110, 0.25); }
  body:has(.sheet[open]) .works-fab, body:has(.map-card:not([hidden])) .works-fab { transform: translateY(140%); }
  .works-end { padding-bottom: 100px; }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  html:has(.works-page) { scroll-snap-type: none; }
  .work.is-live .work-media img.is-on, .work-bars i.is-on::after, .work.is-live .work-meta > * { animation: none; }
}
