/* EK Pixora Studio — Glassmorphism 2.0, "light through glass" (DESIGN.md decision 44 and section 13).
   Loaded after glass.css (and home.css) on the pages built from base.html (.tc). The plates and sheets are classes
   in the page templates, so nothing moves while a page loads; glass.js draws the light, gives each frame its
   photograph's light and makes the lens on the opening photograph.

   The idea comes from the studio's own tools: light passing through glass. The page is lit like a frame taken at
   golden hour: saffron light from the top right, the lagoon's teal from the left and a lamp-warm glow low on the
   right drift slowly behind everything. On that light, everything is optical glass, stacked in depth:

     far     the night page, the wash of the photograph in view and the light
     plates  every section stands on its own large plate of frosted glass (.g2-stage; on the Portfolio, one plate
             for each category)
     sheets  smaller panes on the plates carry the studio's words (.g2-sheet: each page's opening, the studio's
             sentence, the steps, the contact details and form, the About words, the Commercial offers, a story's
             words, and on Services each service as a card laid over the edge of its photograph)
     near    the photographs in thick glass that glows with their own light, the floating capsule navigation, the
             lens on the opening photograph, and the pill-shaped buttons

   Every pane has the same anatomy: a tint, a frosted grain, a bevelled edge (light along the top, shade along the
   bottom), a rim that splits the light into warm and cool like the edge of a lens, and coloured light cast beneath
   it. Every colour comes from the colour theme's tokens, so the dashboard's themes still work. Blur is only used
   where glass is over something with detail (a photograph): over the light a pane needs no blur to look frosted
   (the light is already soft), so the page stays smooth to scroll on a phone. Nothing animates blur; motion is
   transform, opacity and the position of light.

   Words on the plates and sheets over the night page are measured from pixels (data-legibility="pixels" in the
   templates, tests/site_test.py): a pane there only adds tint, so the words are at least as readable as on the
   page itself. */

.tc {
  --g2-warm: var(--color-saffron);
  --g2-ember: var(--color-ember);
  --g2-cool: #2E7C84;   /* the lagoon teal, lit (the same hue as Lagoon, brighter); see the @supports rule below */
  --frost: url("/assets/img/frost.png");
  --edge: clamp(8px, 1.4vw, 22px);              /* how far the plates stand in from the sides of the screen */
  --r-stage: clamp(24px, 2.8vw, 42px);          /* plates */
  --r-5: clamp(20px, 2.2vw, 30px);              /* sheets */
  --sheet-pad: clamp(24px, 3vw, 46px);
}
/* Where the browser can derive colours, the lit teal follows the colour theme's own Lagoon. */
@supports (color: oklch(from red l c h)) {
  .tc { --g2-cool: oklch(from var(--color-lagoon) calc(l + 0.27) calc(c * 2.1) h); }
}

/* ---------- Far: the night page, lit from behind ---------- */
/* The wash of the photograph in view stays, but quieter, so the page reads as the studio's teal and gold. */
.tc .ambient__layer.is-on { opacity: 0.45; }
.tc .leaks {
  /* The light behind the page. glass.js draws it into a tiny canvas (48 by 64) that is stretched across the screen,
     like the wash of the photograph: the browser's smoothing makes it a soft field of light, and a tiny picture
     costs a phone almost nothing to move. It drifts slowly on its own and a little with the page, by transform
     only. */
  position: fixed;
  left: -8vw;
  top: -8vh;
  width: 116vw;
  height: 116vh;
  z-index: -1;
  pointer-events: none;
  transform: translate3d(0, var(--leak-y, 0px), 0);
}
.tc .leaks canvas { display: block; width: 100%; height: 100%; animation: g2-drift 52s ease-in-out infinite alternate; }
@keyframes g2-drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-4vw, 3vh, 0) scale(1.05); } }

/* ---------- The material, version 2: a rim that splits the light ----------
   Every glass surface keeps its tint, thickness, reflections and fitted legibility (glass.css); its 1px rim now
   carries a warm fringe on one side and a cool one on the other, like the edge of a lens. */
.tc .glass::after {
  background:
    radial-gradient(circle var(--glint-r, 170px) at var(--px, -600px) var(--py, -600px), rgb(var(--g-white) / var(--glint)) 0%, rgb(var(--g-white) / calc(var(--glint) * 0.35)) 45%, rgb(var(--g-white) / 0) 100%),
    linear-gradient(115deg, rgb(var(--g-white) / 0) calc(var(--sweep) - 12%), rgb(var(--g-white) / var(--g-rim-sweep, 1)) var(--sweep), rgb(var(--g-white) / 0) calc(var(--sweep) + 12%)),
    conic-gradient(from 200deg at 38% 42%,
      rgb(var(--g-white) / var(--g-rim-a, 1)) 0deg,
      color-mix(in srgb, var(--g2-warm) calc(var(--g-rim-b, 0.5) * 120%), transparent) 50deg,
      rgb(var(--g-white) / var(--g-rim-c, 0.12)) 120deg,
      color-mix(in srgb, var(--g2-cool) calc(var(--g-rim-d, 0.6) * 140%), transparent) 200deg,
      rgb(var(--g-white) / var(--g-rim-c, 0.12)) 280deg,
      rgb(var(--g-white) / var(--g-rim-a, 1)) 360deg);
}
/* frost: the larger panes carry a fine grain, so they read as frosted glass rather than tinted plastic */
.tc .glass--1:not(.frame), .tc .glass--2:not(.frame) {
  background-image: var(--frost), linear-gradient(180deg, rgb(var(--g-white) / var(--g-thick-top, 0.22)) 0%, rgb(var(--g-white) / 0) 40%, rgb(0 0 0 / var(--g-thick-bottom, 0.03)) 100%);
}

/* ---------- Near: the navigation as a floating capsule ---------- */
.tc .site-header__glass {
  --g-blur: 26px;
  --g-sat: 185%;
  --g-radius: 999px;
  left: max(10px, env(safe-area-inset-left, 0px), (100% - 1240px) / 2);
  right: max(10px, env(safe-area-inset-right, 0px), (100% - 1240px) / 2);
}
.tc .site-header .wrap { max-width: 1240px; }
@media (max-width: 639px) { .tc .site-header__glass { --g-blur: 18px; } }
/* the menu sheet, to match */
.tc .menu-sheet { --g-radius: 30px; }

/* ---------- Near: pill-shaped buttons, chips and controls ---------- */
.tc .btn, .tc .menu-toggle, .tc .lightbox__btn, .tc .motion-switch { border-radius: 999px; --g-radius: 999px; }
.tc .btn--primary { padding-inline: 1.6em; }
@media (min-width: 640px) {
  .tc .filters { --g-radius: 999px; padding: 6px; }
  .tc .filter, .tc .filters .filters__lens { border-radius: 999px; --g-radius: 999px; }
}

/* ---------- Plates: every section stands on its own plate of frosted glass ---------- */
.tc .section.g2-stage-host { padding-block: clamp(10px, 1.6vw, 24px); }
.tc .g2-stage {
  position: relative;
  isolation: isolate;
  border-radius: var(--r-stage);
  background-color: color-mix(in srgb, var(--color-ink) 24%, transparent);
  background-image:
    var(--frost),
    radial-gradient(110% 38% at 22% -22%, rgb(255 255 255 / 0.06), rgb(255 255 255 / 0) 60%),
    linear-gradient(172deg, rgb(255 255 255 / 0.045), rgb(255 255 255 / 0.01) 38%, rgb(0 0 0 / 0.1));
  /* A plate is the quietest pane: a soft field of frost with a faint top light, so the sheets and the framed
     photographs on it carry the edges (decision 47). */
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.1),
    inset 0 -1px 0 rgb(0 0 0 / 0.22),
    0 44px 80px -56px rgb(0 0 0 / 0.7);
}
.tc .wrap.g2-stage {
  --plate-px: var(--gutter);
  width: calc(100% - 2 * var(--edge));
  max-width: 1520px;
  margin-block: clamp(10px, 1.6vw, 24px);
  padding: clamp(32px, 4.6vw, 80px) var(--plate-px);
}
/* the portfolio: each category is its own plate */
.tc .portfolio-group.g2-stage { --plate-px: clamp(14px, 2.4vw, 40px); padding: clamp(22px, 3vw, 48px) var(--plate-px); }
.tc .portfolio-group.g2-stage + .portfolio-group.g2-stage { margin-top: clamp(18px, 2.2vw, 32px); }
.tc .portfolio-group.g2-stage .portfolio-group__head { margin-bottom: clamp(20px, 2.4vw, 36px); }

/* ---------- Sheets: smaller panes on the plates (and the opening of every page) ---------- */
.tc .g2-sheet:not(.glass) {
  position: relative;
  isolation: isolate;
  border-radius: var(--r-5);
  padding: var(--sheet-pad);
  background-color: color-mix(in srgb, var(--color-ink) 30%, transparent);
  background-image:
    var(--frost),
    radial-gradient(120% 55% at 24% -28%, rgb(255 255 255 / 0.1), rgb(255 255 255 / 0) 58%),
    radial-gradient(70% 60% at 100% 112%, color-mix(in srgb, var(--g2-warm) 8%, transparent), transparent 70%),
    linear-gradient(162deg, rgb(255 255 255 / 0.085), rgb(255 255 255 / 0.03) 48%, rgb(0 0 0 / 0.1));
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.26),
    inset 0 -1px 0 rgb(0 0 0 / 0.3),
    inset 0 0 42px rgb(255 255 255 / 0.035),
    0 1px 2px rgb(0 0 0 / 0.22),
    0 30px 56px -34px rgb(0 0 0 / 0.7),
    -30px 40px 80px -56px color-mix(in srgb, var(--g2-warm) 24%, transparent),
    34px 46px 84px -56px color-mix(in srgb, var(--g2-cool) 40%, transparent);
}
/* the rim that splits the light, on plates and sheets */
.tc .g2-sheet:not(.glass)::after, .tc .g2-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background: conic-gradient(from 205deg at 36% 40%,
    rgb(255 255 255 / 0.5) 0deg,
    color-mix(in srgb, var(--g2-warm) 46%, transparent) 46deg,
    rgb(255 255 255 / 0.07) 115deg,
    color-mix(in srgb, var(--g2-cool) 62%, transparent) 205deg,
    rgb(255 255 255 / 0.05) 285deg,
    rgb(255 255 255 / 0.5) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.tc .g2-stage::after { opacity: 0.3; }
/* labels on glass are pale gold (decision 36), on the plates as on the slabs */
.tc :is(.g2-stage, .g2-sheet) .label, .tc .contact-grid > div.g2-sheet > .label:first-child { color: var(--pale-gold); }

/* each page's opening: a pane that fits its words, on the page's left edge (in the middle with layout C) */
.tc .page-head { padding-block: clamp(96px, 5rem + 5vw, 152px) clamp(10px, 1.6vw, 24px); }
.tc .page-head > .wrap.g2-sheet {
  width: min(1120px, 100% - 2 * var(--edge));
  margin-inline: max(var(--edge), (100% - 1520px) / 2) auto;
  gap: var(--space-4);
}
.tc .page-head > .wrap.g2-sheet.lay--c { margin-inline: auto; }

/* Home: the studio's sentence on its pane, beside the two photographs */
.home .opening__text.g2-sheet { align-self: center; }

/* how it works: four panes in a row, the number lit like a reading on a lens */
.tc .steps > li.g2-sheet { border-top: 0; padding: clamp(22px, 2.4vw, 32px); align-content: start; }
.tc .steps > li.g2-sheet::before { color: var(--g2-warm); font-size: 0.8125rem; letter-spacing: 0.2em; }
@media (min-width: 640px) { .tc .steps { gap: clamp(14px, 1.6vw, 24px); } }
@media (max-width: 639px) { .tc .steps[data-carousel] > li.g2-sheet { border: 0; padding: 22px 20px 24px; } }

/* the invitation at the foot of a page: the golden light gathers under its plate */
.tc .wrap.invite.g2-stage {
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.2), inset 0 -1px 0 rgb(0 0 0 / 0.3), 0 2px 4px rgb(0 0 0 / 0.18),
    0 40px 70px -50px rgb(0 0 0 / 0.75),
    0 50px 100px -60px color-mix(in srgb, var(--g2-warm) 55%, transparent);
}

/* Contact: the fields are wells cut into the glass */
.tc .g2-sheet .input, .tc .g2-sheet .select, .tc .g2-sheet .textarea {
  border-radius: 14px;
  border: 1px solid rgb(255 255 255 / 0.14);
  background-color: rgb(4 10 11 / 0.42);
  box-shadow: inset 0 2px 8px rgb(0 0 0 / 0.38), inset 0 -1px 0 rgb(255 255 255 / 0.06);
}
@media (min-width: 900px) { .tc .contact-grid { align-items: start; } }

/* About: the words on a pane; the portrait frame beside it */
.tc .about-grid > .prose.g2-sheet { max-width: none; }

/* Services: each service is a frosted card laid over the edge of its photograph, so the photograph shows
   through it, softened (real glass here: glass.js fits it for legibility like the plates on photographs) */
.tc .chapter { border-top: 0; }
.tc .chapter__body.g2-sheet--over {
  --g-blur: 22px;
  --g-radius: var(--r-5);
  --g-sat: 160%;
  position: relative;
  z-index: 2;
  max-width: none;
  padding: var(--sheet-pad);
}
@media (min-width: 820px) {
  .tc .chapter__body.g2-sheet--over { align-self: center; }
  /* photograph on the left: the card starts inside its right edge */
  .tc .chapter:not(.chapter--flip) > .chapter__media + .chapter__body.g2-sheet--over { grid-column: 6 / span 6; margin-inline-start: clamp(-150px, -9vw, -64px); }
  .tc .chapter:not(.chapter--flip) > .chapter__media--wide + .chapter__body.g2-sheet--over { grid-column: 8 / span 5; }
  /* photograph on the right: the card ends inside its left edge */
  .tc .chapter--flip > .chapter__media + .chapter__body.g2-sheet--over { grid-column: 1 / span 7; grid-row: 1; margin-inline-end: clamp(-150px, -9vw, -64px); }
  .tc .chapter--flip > .chapter__media--wide + .chapter__body.g2-sheet--over { grid-column: 1 / span 5; }
  .tc .chapter__media { position: relative; z-index: 1; }
}
@media (max-width: 819px) { .tc .chapter__body.g2-sheet--over { margin: -56px 12px 0; } }

/* Commercial: what we offer, as two panes (stacked with a little air between them on narrow screens and in
   layout G; in layout C the offers become three columns of items and the panes give way to the plate) */
.tc .cols-2 > .rule-list.g2-sheet { border-top: 0; padding-block: clamp(14px, 1.6vw, 22px); }
.tc .cols-2 > .rule-list.g2-sheet > li:last-child { border-bottom: 0; }
.tc .cols-2 { row-gap: clamp(14px, 1.6vw, 24px); }
@media (min-width: 820px) { .tc .lay--c > .cols-2 > .g2-sheet::after { content: none; } }

/* Section layouts on a plate (decision 28): layout E's wide band spans the plate rather than the screen */
.tc .g2-stage.lay--e > .rows > :first-child { width: calc(100% + 2 * var(--plate-px) - 2 * var(--edge)); max-width: none; margin-inline: calc(var(--edge) - var(--plate-px)); }

/* ---------- Near: photographs in thick glass that carries their light ----------
   The frame's glass shows the photograph itself, magnified and softened (glass.js makes a tiny softened copy,
   48 pixels wide, stretched across it), so each edge glows in the photograph's own colours; its light falls on
   the plate beneath, tinted the same way. */
.tc .glass.frame { --g-radius: clamp(18px, 2vw, 28px); --halo: none; }
.tc .glass.frame.has-halo {
  background-color: transparent;
  background-image:
    linear-gradient(180deg, rgb(255 255 255 / 0.26) 0%, rgb(255 255 255 / 0) 32%, rgb(0 0 0 / 0.24) 100%),
    linear-gradient(color-mix(in srgb, var(--color-ink) 30%, transparent), color-mix(in srgb, var(--color-ink) 30%, transparent)),
    var(--halo);
  background-size: auto, auto, 124% 124%;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.42),
    inset 0 -1px 0 rgb(0 0 0 / 0.35),
    0 1px 2px rgb(0 0 0 / 0.25),
    0 26px 50px -30px rgb(0 0 0 / 0.75),
    0 0 48px -16px color-mix(in srgb, var(--glow, #000) 55%, transparent),
    0 34px 70px -34px color-mix(in srgb, var(--glow, #000) 80%, transparent);
}

/* ---------- Near: the plate on the opening photograph is a lens ----------
   Inside it, the photograph behind is magnified and softened, and more so in a band along its edge, as light
   bends most at the edge of thick glass. glass.js still fits its tint, so the words keep 4.5 : 1. */
.home .hero__plate { --g-radius: var(--r-5); padding: 26px 28px 28px; }
.home .hero__plate.has-lens { background-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.home .hero__plate .lens { position: absolute; inset: 0; z-index: -2; overflow: hidden; border-radius: inherit; pointer-events: none; }
.home .hero__plate .lens img { position: absolute; left: 0; top: 0; max-width: none; object-fit: cover; will-change: transform; transform: translate3d(var(--lx0, 0px), var(--ly0, 0px), 0) scale(var(--lz, 1.14)); }
.home .hero__plate .lens__core { filter: blur(9px) saturate(1.45) brightness(var(--g-bright, 0.9)); }
.home .hero__plate .lens__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 13px;
  overflow: hidden;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.home .hero__plate .lens__edge img { --lz: 1.42; filter: blur(5px) saturate(1.6) brightness(var(--g-bright, 0.9)); }
.home .hero__plate .lens::after { content: ""; position: absolute; inset: 0; background: rgb(var(--g-tint, 14 19 20) / var(--g-alpha, 0.5)); }
.home .hero__plate {
  box-shadow:
    inset 0 1px 0 0 rgb(255 255 255 / 0.4), inset 0 -1px 0 0 rgb(0 0 0 / 0.3),
    inset 0 0 0 13px rgb(255 255 255 / 0.035),
    0 30px 70px -30px rgb(0 0 0 / 0.7),
    -30px 40px 110px -60px color-mix(in srgb, var(--g2-warm) 45%, transparent);
}

/* ---------- Phones: the same look with less to draw while scrolling ----------
   One shadow under each pane instead of three, one glow around each photograph, and the lens without its more
   strongly bent edge band (the plate keeps its magnified, softened view of the photograph). */
@media (max-width: 639px) {
  .tc .g2-stage { box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.09), inset 0 -1px 0 rgb(0 0 0 / 0.2), 0 24px 40px -30px rgb(0 0 0 / 0.6); }
  .tc .g2-sheet:not(.glass) { box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.24), inset 0 -1px 0 rgb(0 0 0 / 0.3), 0 20px 36px -26px rgb(0 0 0 / 0.65); }
  .tc .glass.frame.has-halo { box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.42), inset 0 -1px 0 rgb(0 0 0 / 0.35), 0 22px 44px -26px color-mix(in srgb, var(--glow, #000) 70%, rgb(0 0 0 / 0.6)); }
  .home .hero__plate .lens__edge { display: none; }
}

/* ---------- Visitors who ask for less transparency or more contrast: solid panes ---------- */
@media (prefers-reduced-transparency: reduce) {
  .tc .g2-sheet:not(.glass), .tc .g2-stage { background-color: var(--color-ink); background-image: none; }
  .home .hero__plate .lens { display: none; }
}
@media (prefers-contrast: more) {
  .tc .g2-sheet:not(.glass), .tc .g2-stage { background-color: color-mix(in srgb, var(--color-ink) 92%, transparent); }
}
/* Reduce motion (the device setting or the footer switch): the light stands still. */
@media (prefers-reduced-motion: reduce) { .tc .leaks canvas { animation: none; } }
:root[data-motion="off"] .tc .leaks canvas { animation: none; }
