/* ─────────────────────────────────────────────────────────────────────────
   THE GATHERING THEME — the `apps` and `components` cascade layers.

   Lives with its app rather than in the platform's crm/css/tokens/apps.css
   because it draws on Gathering-owned brand primitives (tokens/brand.css);
   platform CSS referencing an app's tokens would point the dependency arrow
   upward, against CLAUDE.md's layer rules. Same reasoning as Coherence.

   Loaded only on Gathering routes (registered on AppBrand.theme, rendered by
   shell/_tokens_css.html), keyed off the same app_slug that sets
   <body data-app>.

   Source: specs/the-gathering-style.zip.

   ── What this theme deliberately does NOT do ──────────────────────────

   The kit is a marketing homepage: 80px serif titles, 160px section rhythm,
   pill buttons in caps, Red Hat Text as the body face. Gathering's screens in
   METIS are dense operational CRM — camp lists, create forms, holon sections
   that share every component with the rest of the product. Applying the
   homepage wholesale would either wreck those screens or fork every shared
   component to survive it.

   So this theme takes the same restraint Coherence's did. It changes:
     · the display face (Newsreader, with the one olive accent phrase);
     · the ground (warm canvas, and the deep-green second ground as an opt-in
       section treatment);
     · the decorative system (hexagons, ink, the olive rule, the eyebrow).

   It does not touch the shape or density of anything shared: buttons keep
   their platform treatments and radii, chips keep theirs, tables keep their
   row height. The kit's pill/caps button and its .tg-tag are NOT reproduced
   here — a per-app button shape is a conversation about the component set
   (docs/dev/web/design-system.md §4.4), not something a theme file decides. Where a
   Gathering screen wants a tag, it uses `.chip--mono`, which already renders
   as tracked mono caps.

   ── The accent ────────────────────────────────────────────────────────

   Gathering sets no --color-accent, on purpose, and that is not an omission.

   Olive #989B4B is The Gathering's brand hue AND the platform's default
   accent — the platform ramps were promoted out of this very brand. So
   Gathering inherits exactly the right colour by doing nothing, and any
   restatement here would be a second copy of one value waiting to drift.

   This replaces an earlier [data-app="gathering"] block that set the accent
   to --orange-500. Orange is not a second brand hue: style.md's own checklist
   reads "at most one orange element on the page" and names it the ticket
   accent — the single most important action, once. An app-wide orange accent
   spent that budget on every chip, link and focus ring at once. It is
   available as .tg-tickets for the one action that deserves it.
   ───────────────────────────────────────────────────────────────────────── */

@layer apps {
  /* ── Gathering's own content area ──────────────────────────────────
     The brand serif for display text. Newsreader already ships in the
     platform's font set (crm/css/tokens/primitives.css --font-serif, loaded
     for every route from shell/_fonts_css.html), so unlike Coherence this
     costs no extra font request and has no fallback flash.

     --color-decor is left at the platform default (--olive-300): it is
     already this brand's decorative olive. */
  [data-app="gathering"] main,
  [data-app="gathering"][data-app-content] {
    --font-display: var(--font-serif);
  }
}

@layer components {
  /* ── Ground ────────────────────────────────────────────────────────
     "No pure-white page background" is on the kit's pre-flight checklist.
     The platform's page ground is --stone-50, a warm near-white; the brand's
     is --cream (#F6F7EE), the same idea one step further into olive. Surfaces
     stay white so cards and tables still lift off the field. */
  [data-app="gathering"] {
    --color-bg: var(--cream);

    /* The kit's hairline: rgba(25,47,43,.12), a green-tinted line rather than
       the platform's warm grey. Set once here, so every shared surface that
       draws a border — tables, cards, inputs, the panel — picks it up without
       any of them being touched. */
    --color-border:       var(--tg-hairline);
    --color-border-light: color-mix(in oklab, var(--green-900) 7%, transparent);

    /* The kit's link hue ("connect"), taken a step towards the ink so small
       caps links hold contrast on the canvas. .tg-dark swaps it for olive. */
    --tg-link: color-mix(in oklab, var(--tg-turquoise) 85%, var(--green-900));
  }

  /* ── Display type ──────────────────────────────────────────────────
     Newsreader, regular, tight, sentence case — never uppercase, and never
     bold. The scale clamps down fluidly; --tg-t-title is the desktop maximum.

     Matched by CLASS, never by element. `h1, h2` used to be in here, and that
     was wrong twice over. It reached into user-authored HTML — a description is
     Quill output rendered verbatim, so headings people typed into their prose
     came out in the serif at up to 56px. And it put the serif on every section
     heading ("People", "Journeys"), which reads as a mistake rather than a
     treatment: this brand's serif is for the big title at the top of a page,
     not for the labels down it.

     So the page title gets it — via .detail-header h1 and .header-name-field
     in crm/css/detail.css, which consume --font-display directly — a page that
     wants a block title asks for one with .tg-title, and nothing else is
     touched.

     Not scoped to <main>, and it does not need to be: the serif arrives via
     --font-display, which the apps layer above declares only on the app's own
     content area. Outside it — the place strip, the place switcher, the
     hijack bar — var(--font-display) still resolves to the platform default, so the
     shell keeps platform type without this selector having to say so.

     Saying it here instead would break the styleguide, whose preview canvas
     sits INSIDE the shell's own <main> and so can never match a `main`
     descendant selector. That is the same reason [data-app-content] exists
     (crm/css/tokens/apps.css). */
  [data-app="gathering"] .tg-title {
    font-family: var(--font-display);
    font-weight: var(--tg-w-regular);
    font-size: var(--tg-fs-title);
    line-height: var(--tg-lh-title);
    letter-spacing: var(--tg-ls-title);
    text-wrap: balance;
  }

  /* The full 80px title is opt-in, for a page opener with room for it. A CRM
     page header is not that; the hub and the styleguide are. */
  [data-app="gathering"] .tg-title--hero {
    font-size: var(--tg-fs-title-hero);
  }

  [data-app="gathering"] .tg-display {
    font-family: var(--font-display);
    font-weight: var(--tg-w-regular);
    letter-spacing: var(--tg-ls-title);
    line-height: var(--tg-lh-intro);
  }

  /* THE ONE FLOURISH. Every block title carries a single olive accent phrase,
     with at most one italic word inside it. Nowhere else in the system — not
     in body copy, not in labels, not twice in one title.

       <h1 class="tg-title">The Gathering is a living experiment
         <span class="tg-accent">in <em>regenerative</em> culture</span></h1>

     Both resolve to the accent, which lifts to olive-400 on the dark ground
     via .tg-dark below — so neither is ever hard-coded. */
  [data-app="gathering"] :where(.tg-title, .tg-display) .tg-accent,
  [data-app="gathering"] :where(.tg-title, .tg-display) em {
    color: var(--color-accent);
  }

  [data-app="gathering"] :where(.tg-title, .tg-display) em {
    font-style: italic;
    font-weight: var(--tg-w-regular);
  }

  /* Intro paragraph — Red Hat Display at the brand's generous size, sitting
     under a title. Measure is capped: the kit runs the intro at 538px and the
     running body at 650px, and long serif titles need a short line under them
     to read as a pair. */
  [data-app="gathering"] .tg-intro {
    font-family: var(--font-ui);
    font-weight: var(--tg-w-regular);
    font-size: var(--tg-fs-intro);
    line-height: var(--tg-lh-intro);
    max-width: 33.6rem;
    margin: 0;
  }

  [data-app="gathering"] .tg-body {
    font-family: var(--font-body);
    font-size: var(--tg-t-body);
    line-height: var(--tg-lh-body);
    max-width: 40.6rem;
  }

  /* ── Page opener ───────────────────────────────────────────────────
     Eyebrow, serif title, optional intro — the brand's way of starting a
     page, and the only layout rule in this file. It is here rather than in a
     per-page stylesheet because every Gathering-owned page starts the same
     way; the partial that renders it is gathering/partials/_page_opener.html.

     The measure is capped so a title never runs the full width of a wide
     screen: a serif at this size needs a short line to read as a title
     rather than as a paragraph. */
  [data-app="gathering"] .tg-opener {
    padding: var(--space-8) 0 var(--space-6);
    max-width: 44rem;
  }

  [data-app="gathering"] .tg-opener .tg-title {
    margin: var(--space-3) 0 0;
  }

  [data-app="gathering"] .tg-opener .tg-intro {
    margin-top: var(--space-4);
  }

  /* ── Eyebrow ───────────────────────────────────────────────────────
     Mono caps, tracked +8%, prefixed by the signature olive tick. A label,
     never a sentence — if it needs a verb it is an intro, not an eyebrow. */
  [data-app="gathering"] .tg-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: var(--tg-w-regular);
    letter-spacing: var(--tg-ls-eyebrow);
    text-transform: uppercase;
    color: var(--color-accent);
  }

  [data-app="gathering"] .tg-eyebrow::before {
    content: "";
    width: var(--space-6);
    height: 1px;
    background: currentColor;
    flex: none;
  }

  /* ── The olive rule ────────────────────────────────────────────────
     A 1px olive vertical line with two lines of Red Hat Display beside it.
     The brand's universal lockup: the logo, the slogan, the dates and the
     location tags are all this same construction at different sizes. */
  [data-app="gathering"] .tg-rule-item {
    position: relative;
    padding-left: var(--space-4);
    font-family: var(--font-ui);
    font-weight: var(--tg-w-regular);
    font-size: var(--text-lg);
    line-height: 1.25;
  }

  [data-app="gathering"] .tg-rule-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.15em;
    bottom: 0.15em;
    width: 1px;
    background: var(--tg-rule);
  }

  [data-app="gathering"] .tg-rule-item__meta {
    display: block;
    font-weight: var(--tg-w-light);
    color: var(--color-accent);
  }

  /* Caps list — the "Upcoming Gatherings" treatment. Name in regular, meta
     line in light olive, each item prefixed by the same olive rule. Kept at a
     CRM-sensible size rather than the homepage's 48px. */
  [data-app="gathering"] .tg-caps-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  [data-app="gathering"] .tg-caps-list > li {
    position: relative;
    padding-left: var(--space-4);
  }

  [data-app="gathering"] .tg-caps-list > li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.2em;
    bottom: 0.2em;
    width: 1px;
    background: var(--tg-rule);
  }

  [data-app="gathering"] .tg-caps-list .tg-caps-name {
    display: block;
    font-family: var(--font-ui);
    font-weight: var(--tg-w-regular);
    font-size: var(--text-xl);
    line-height: 1.1;
    text-transform: uppercase;
  }

  [data-app="gathering"] .tg-caps-list .tg-caps-meta {
    display: block;
    font-family: var(--font-ui);
    font-weight: var(--tg-w-light);
    font-size: var(--text-lg);
    line-height: 1.2;
    text-transform: uppercase;
    color: var(--color-accent);
  }

  /* ── Hexagons ──────────────────────────────────────────────────────
     The brand's primary shape, and the answer to "what shape is media in
     this app". The ratio is a brand constant (tokens/brand.css).

     .tg-hex alone is a plain polygon clip and is safe anywhere.
     .tg-hex--soft is the exact Figma silhouette with softened corners. It
     needs the <defs> block from crm/partials/_tg_hex_defs.html included once
     per document — Chrome cannot reference an SVG clipPath across files, and
     without the defs the element clips to NOTHING rather than falling back.
     That failure is silent and total, which is why the defs partial exists
     instead of a documented copy-paste. */
  [data-app="gathering"] .tg-hex {
    position: relative;
    aspect-ratio: 1 / var(--tg-hex-ratio);
    clip-path: var(--tg-hex-clip);
    overflow: hidden;
  }

  [data-app="gathering"] .tg-hex--soft {
    clip-path: url("#tg-hex-clip");
  }

  [data-app="gathering"] .tg-hex > :where(img, video) {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Icon + label hexagon. White on the canvas ground, one step lighter than
     the ground on green — a clip-path cannot carry a border, so the tile's
     silhouette has to read from its fill alone. */
  [data-app="gathering"] .tg-hex-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: 0 14%;
    text-align: center;
    background: var(--color-surface);
    color: var(--color-text);
    text-decoration: none;
    transition: background var(--transition-base), color var(--transition-base);
  }

  [data-app="gathering"] a.tg-hex-tile:hover {
    background: var(--color-accent-soft);
  }

  [data-app="gathering"] .tg-hex-tile .tg-hex-label {
    font-family: var(--font-ui);
    font-weight: var(--tg-w-medium);
    font-size: var(--text-lg);
    line-height: 1.3;
  }

  [data-app="gathering"] .tg-hex-tile .tg-hex-text {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--tg-lh-body);
    color: var(--color-text-muted);
  }

  [data-app="gathering"] .tg-hex-tile .tg-icon {
    color: var(--color-accent);
  }

  /* Honeycomb — rows of hexes, alternate rows nudged half a cell across,
     rows overlapping vertically so the cells interlock rather than stack. */
  [data-app="gathering"] .tg-honeycomb {
    --tg-hex-w: 13.5rem;
    --tg-hex-gap: var(--space-2);
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  [data-app="gathering"] .tg-honeycomb-row {
    display: flex;
    gap: var(--tg-hex-gap);
  }

  [data-app="gathering"] .tg-honeycomb-row + .tg-honeycomb-row {
    margin-top: calc(var(--tg-hex-w) * var(--tg-hex-ratio) * -1 * var(--tg-hex-overlap));
  }

  [data-app="gathering"] .tg-honeycomb-row--offset {
    margin-left: calc((var(--tg-hex-w) + var(--tg-hex-gap)) / 2);
  }

  [data-app="gathering"] .tg-honeycomb .tg-hex {
    width: var(--tg-hex-w);
    flex: none;
  }

  @media (max-width: 720px) {
    [data-app="gathering"] .tg-honeycomb { --tg-hex-w: 44vw; }
  }

  /* ── Icons ─────────────────────────────────────────────────────────
     The brand icons are single-colour SVGs. They are tinted by masking a
     coloured box, so `color` drives the hue and they inherit correctly on
     both grounds. Never a filter: a filter cannot reach a token, so an icon
     tinted that way silently stops following the accent.

     Each icon sets its own mask-image, from img/icons/. Use a plain <img>
     instead when the icon should keep its native colour. */
  [data-app="gathering"] .tg-icon {
    display: inline-block;
    width: var(--space-16);
    height: var(--space-16);
    flex: none;
    background: currentColor;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
  }

  [data-app="gathering"] .tg-icon--sm { width: var(--space-6); height: var(--space-6); }
  [data-app="gathering"] .tg-icon--md { width: var(--space-12); height: var(--space-12); }

  /* The amenity and programme marks, as classes rather than inline styles, so
     a template names an icon instead of repeating a url() twice (the -webkit-
     prefix is still required in Safari). Relative url() so
     ManifestStaticFilesStorage rewrites them to hashed filenames. */
  [data-app="gathering"] .tg-icon--forest    { mask-image: url("../img/icons/forest.svg");    -webkit-mask-image: url("../img/icons/forest.svg"); }
  [data-app="gathering"] .tg-icon--camping   { mask-image: url("../img/icons/camping.svg");   -webkit-mask-image: url("../img/icons/camping.svg"); }
  [data-app="gathering"] .tg-icon--spaces    { mask-image: url("../img/icons/gathering-spaces.svg"); -webkit-mask-image: url("../img/icons/gathering-spaces.svg"); }
  [data-app="gathering"] .tg-icon--kitchens  { mask-image: url("../img/icons/community-kitchens.svg"); -webkit-mask-image: url("../img/icons/community-kitchens.svg"); }
  [data-app="gathering"] .tg-icon--ticket    { mask-image: url("../img/icons/ticket.svg");    -webkit-mask-image: url("../img/icons/ticket.svg"); }
  [data-app="gathering"] .tg-icon--circles   { mask-image: url("../img/icons/program/circles.svg");   -webkit-mask-image: url("../img/icons/program/circles.svg"); }
  [data-app="gathering"] .tg-icon--workshops { mask-image: url("../img/icons/program/workshops.svg"); -webkit-mask-image: url("../img/icons/program/workshops.svg"); }
  [data-app="gathering"] .tg-icon--dialogue  { mask-image: url("../img/icons/program/dialogue.svg");  -webkit-mask-image: url("../img/icons/program/dialogue.svg"); }
  [data-app="gathering"] .tg-icon--weaving   { mask-image: url("../img/icons/dna/weaving.svg");       -webkit-mask-image: url("../img/icons/dna/weaving.svg"); }
  [data-app="gathering"] .tg-icon--nature    { mask-image: url("../img/icons/dna/nature.svg");        -webkit-mask-image: url("../img/icons/dna/nature.svg"); }

  /* ── The second ground ─────────────────────────────────────────────
     The brand has exactly two grounds: warm canvas and deep forest green.
     .tg-dark puts a section on the green one and remaps the semantic tokens
     inside it, so every pattern in the subtree — titles, accents, rules,
     cards, muted text — flips automatically.

     Recolouring children by hand instead of using this is how a dark section
     ends up with one component that never got the memo. */
  [data-app="gathering"] .tg-dark {
    background: var(--green-900);
    color: var(--color-text);

    --color-text:        var(--white);
    --color-text-strong: var(--white);
    --color-text-muted:  color-mix(in oklab, var(--white) 72%, transparent);
    --color-text-faint:  color-mix(in oklab, var(--white) 45%, transparent);

    /* Olive lifts on dark — 600 is too heavy against forest green. */
    --color-accent:      var(--olive-400);
    --color-accent-text: var(--green-900);
    --color-decor:       var(--olive-400);

    --color-bg:           var(--green-900);
    --color-surface:      color-mix(in oklab, var(--white) 6%, transparent);
    --color-surface-2:    color-mix(in oklab, var(--white) 10%, transparent);
    --color-border:       var(--tg-hairline-dark);
    --color-border-light: color-mix(in oklab, var(--white) 10%, transparent);

    --tg-rule: var(--olive-400);
    --tg-link: var(--olive-400);
  }

  /* On the green ground a hex tile lifts one step out of the ground rather
     than dropping to white, which would punch a hole in the section. */
  [data-app="gathering"] .tg-dark .tg-hex-tile {
    background: var(--green-800);
    color: var(--white);
  }

  [data-app="gathering"] .tg-dark a.tg-hex-tile:hover {
    background: var(--green-700);
  }

  /* ── Ink ───────────────────────────────────────────────────────────
     The brand's decorative system: photographs of hand-painted ink,
     multiplied into the ground. Opt-in per page via .tg-flavour on a
     positioned container — never app-wide, and never behind body copy: the
     motif sits under the content's own surface layer
     (docs/dev/web/design-system.md §4.6).

     The motif file comes from --app-backdrop, which theme_context picks at
     random per request from the app's registered backdrops. A page that wants
     a specific motif sets --app-backdrop itself with one of the --ink-N
     modifiers below. Placement variants exist so motifs vary down a page
     instead of being stamped in the same corner. */
  [data-app="gathering"] .tg-flavour {
    position: relative;
    overflow: hidden;
  }

  [data-app="gathering"] .tg-flavour > * {
    position: relative;
    z-index: 1;
  }

  [data-app="gathering"] .tg-flavour::before {
    content: "";
    position: absolute;
    z-index: 0;
    /* FULL-BLEED, not a corner blob. The kit is explicit that ink is "always
       full-bleed (or wider), always behind content" — its own .tg-ink runs at
       132% of its container. A motif boxed into a corner reads as a stamp
       someone placed; a band reads as the paper the page is printed on, which
       is the whole point of the material.

       It fills its container, including behind the copy. That is a deliberate
       departure from docs/dev/web/design-system.md §4.6 ("never place decorative art
       directly behind body text"), made by the product owner and recorded here
       so it is not read as an oversight and quietly "fixed" later. The ink is
       held at 4.5–7% and multiplied, so it darkens text rather than veiling it.

       Inset rather than sized, so it is the full width of whatever it is put
       on at every window size, with no width to keep in sync. */
    inset: 0;
    background-image: var(--app-backdrop);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    /* Multiply so the ink reads through the paper as a stain rather than a
       grey rectangle sitting on top of it. */
    mix-blend-mode: multiply;
    opacity: var(--tg-ink-opacity);
    pointer-events: none;
    user-select: none;
    /* The ink files carry their own pale wash to the edge of the frame, so the
       band is faded top and bottom — otherwise it shows a hard seam against the
       canvas where the image stops. Straight from the kit's .tg-ink. */
    mask-image: linear-gradient(to bottom, transparent 0, var(--black) 18%, var(--black) 82%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, var(--black) 18%, var(--black) 82%, transparent 100%);
  }

  [data-app="gathering"] .tg-flavour--subtle::before { opacity: var(--tg-ink-opacity-subtle); }

  /* The placement modifiers now anchor the band's crop rather than moving a
     box around — same class names, same templates, but "edge-right" means the
     right of the artwork is what you see, not that the artwork sits on the
     right. Vary them down a page so adjacent sections do not show the same
     crop of the same motif. */
  [data-app="gathering"] .tg-flavour--edge-right::before { background-position: right center; }
  [data-app="gathering"] .tg-flavour--edge-left::before  { background-position: left center; }
  [data-app="gathering"] .tg-flavour--corner-bl::before  { background-position: left bottom; }

  /* On the green ground, multiply would bury black ink in dark green. Screen
     is its mirror: the ink lifts out of the ground instead of sinking into
     it. Same asset, opposite blend — this is why the ground is a token remap
     and not a hand-recolour. */
  [data-app="gathering"] .tg-dark.tg-flavour::before,
  [data-app="gathering"] .tg-dark .tg-flavour::before {
    mix-blend-mode: screen;
    opacity: var(--tg-ink-opacity-subtle);
  }

  /* Motif files. A page picks one; the class is the opt-in. */
  [data-app="gathering"] .tg-flavour--ink-1 { --app-backdrop: url("../img/ink/ink-1.jpg"); }
  [data-app="gathering"] .tg-flavour--ink-2 { --app-backdrop: url("../img/ink/ink-2.jpg"); }
  [data-app="gathering"] .tg-flavour--ink-3 { --app-backdrop: url("../img/ink/ink-3.jpg"); }
  [data-app="gathering"] .tg-flavour--ink-4 { --app-backdrop: url("../img/ink/ink-4.jpg"); }
  [data-app="gathering"] .tg-flavour--ink-5 { --app-backdrop: url("../img/ink/ink-5.jpg"); }
  [data-app="gathering"] .tg-flavour--ink-6 { --app-backdrop: url("../img/ink/ink-6.jpg"); }
  [data-app="gathering"] .tg-flavour--wash  { --app-backdrop: url("../img/ink/green-wash.jpg"); }

  /* ── The page motif, as a band ─────────────────────────────────────
     The platform pins an app's registered motif to the bottom-left corner of
     the content area at min(39vw, 494px) (crm/css/base.css). That is right for
     Coherence, whose calligraphy marks are single gestures that read as a seal.
     It is wrong for this brand, whose ink is a wash: cropped into a corner it
     reads as a smudge.

     So Gathering takes the same registered asset and runs it the full width of
     the page instead, anchored to the bottom edge. Overriding rather than
     changing the platform rule, because the corner placement is still correct
     for the app it was built for.

     One of six ink flourishes, picked at random per REQUEST by theme_context —
     so a reload gives a different one and the decoration stays incidental
     rather than becoming a landmark people navigate by. */
  [data-app="gathering"][data-app-motif] .main::after {
    --app-motif-size: min(38vh, 26rem);
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: var(--app-motif-size);
    background-position: center bottom;
    background-size: cover;
    /* Fade the top edge only — the bottom is the viewport edge, so there is no
       seam to hide there. */
    mask-image: linear-gradient(to bottom, transparent 0, var(--black) 60%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, var(--black) 60%);
    opacity: 0.12;
    /* base.css hides the corner motif under 900px because a corner blob has
       nowhere to go on a narrow window. A full-width band does — it is the one
       shape that still works there — so Gathering keeps it. The components
       layer beats base regardless of the media query that hid it. */
    display: block;
  }

  /* The band spans the CONTENT column only. `right: 0` above is the window's
     right edge, and a detail page puts a 320px notes/chat aside there — so the
     band ran under the notes, which is not what it decorates. Inset by the
     aside plus the grid gap, from the same --detail-aside-w the grid itself
     uses, so the two cannot drift apart.

     :has() rather than a blanket inset, because pages with no aside (the hub,
     lists, create forms) should still run edge to edge. */
  [data-app="gathering"][data-app-motif] .main:has(.detail-grid--chat-right)::after {
    right: calc(var(--detail-aside-w) + var(--space-lg));
  }

  /* The mirrored layout puts the aside on the left instead. No template ships
     it today, but the rule costs one line and the alternative is the band
     silently reappearing under the aside if one ever does. */
  [data-app="gathering"][data-app-motif] .main:has(.detail-grid--chat-left)::after {
    left: calc(var(--detail-aside-w) + var(--space-lg));
  }

  /* ── Photo bands ───────────────────────────────────────────────────
     A full-bleed image with the brand's cut-shape edge, and a left-to-right
     deep-green protection gradient when text sits on it. Copy stays inside
     the left 40%, which is where the gradient is still opaque enough to hold
     a serif title. The masks carry preserveAspectRatio="none", so they
     stretch to any box. */
  [data-app="gathering"] .tg-photo-band {
    position: relative;
    display: grid;
    align-items: center;
    isolation: isolate;
  }

  [data-app="gathering"] .tg-photo-band > .tg-photo-media {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    mask-size: 100% 100%;
    mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
  }

  [data-app="gathering"] .tg-photo-band > .tg-photo-media > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  [data-app="gathering"] .tg-photo-cut-top > .tg-photo-media {
    mask-image: url("../img/masks/cut-mask-top.svg");
    -webkit-mask-image: url("../img/masks/cut-mask-top.svg");
  }

  [data-app="gathering"] .tg-photo-cut-bottom > .tg-photo-media {
    mask-image: url("../img/masks/cut-mask-bottom.svg");
    -webkit-mask-image: url("../img/masks/cut-mask-bottom.svg");
  }

  [data-app="gathering"] .tg-photo-gradient::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--tg-photo-gradient);
    pointer-events: none;
  }

  [data-app="gathering"] .tg-photo-copy {
    position: relative;
    z-index: 1;
    max-width: 34rem;
    color: var(--white);
  }

  /* ── The ticket action ─────────────────────────────────────────────
     DELIBERATE EXCEPTION to "never write a colour that is not the accent".
     Orange is the one element on a page that must NOT follow the accent: the
     kit's checklist reads "at most one orange element on the page", and its
     whole job is to be the single thing louder than everything else. It is a
     modifier on the platform .btn — same shape, same size, same padding —
     because the treatment is a colour decision, not a new component.

     If two of these appear on one screen, both are wrong. */
  [data-app="gathering"] .btn.tg-tickets {
    background: var(--orange-500);
    border-color: var(--orange-500);
    color: var(--white);
  }

  [data-app="gathering"] .btn.tg-tickets:hover {
    background: color-mix(in oklab, var(--orange-500) 85%, var(--black));
    border-color: color-mix(in oklab, var(--orange-500) 85%, var(--black));
  }

  /* ── Public buttons and links ──────────────────────────────────────
     The kit's button: a pill, caps, +5% tracking. Only for the public site,
     which does not load crm/css/base.css and so has no `.btn` shape at all —
     inside the CRM, Gathering keeps the platform's six treatments (brand.css,
     tracking). The ticket action is this shape in orange:
     `class="btn tg-button tg-tickets"`. `--line` is the quiet outlined one,
     and it follows the ground: ink on canvas, cream on forest green. */
  [data-app="gathering"] .tg-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--space-12);
    padding: 0 var(--space-6);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    font-family: var(--font-ui);
    font-weight: var(--tg-w-semibold);
    font-size: var(--text-md);
    letter-spacing: var(--tg-ls-button);
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    --button-transition: background-color var(--dur-base) var(--ease-out),
                         color var(--dur-base) var(--ease-out),
                         transform var(--dur-fast) var(--ease-out);
    transition: var(--button-transition);
  }

  [data-app="gathering"] .tg-button:active { transform: scale(0.97); }

  /* A lifted button keeps its fill and press transitions and adds the lift's
     (shared.css .lift): this layer's `transition` would otherwise replace it,
     and the button would jump up instead of rising. */
  [data-app="gathering"] .tg-button.lift {
    transition: var(--button-transition), var(--lift-transition);
  }

  [data-app="gathering"] .tg-button > svg {
    width: 1.2em;
    height: 1.2em;
    flex: none;
  }

  [data-app="gathering"] .tg-button--line {
    background: transparent;
    border-color: color-mix(in oklab, var(--color-text) 50%, transparent);
    color: var(--color-text);
  }

  [data-app="gathering"] .tg-button--line:hover {
    background: var(--color-text);
    border-color: var(--color-text);
    color: var(--color-bg);
  }

  /* The caps "action" link: See México, Explore the camps, Follow. Quieter
     than a button, louder than running text. */
  [data-app="gathering"] .tg-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-ui);
    font-weight: var(--tg-w-semibold);
    font-size: var(--text-md);
    letter-spacing: var(--tg-ls-button);
    text-transform: uppercase;
    text-decoration: none;
    color: var(--tg-link);
    transition: color var(--dur-base) var(--ease-out);
  }

  [data-app="gathering"] .tg-link:hover { color: var(--color-text); }

  [data-app="gathering"] .tg-link > svg {
    width: 1.15em;
    height: 1.15em;
    flex: none;
  }

  /* ── Logo mark, tinted ─────────────────────────────────────────────
     The hexagon mark as a mask over a coloured box, so `color` tints it — the
     same mechanism as .tg-icon. The front page draws each gathering as the
     mark in that gathering's country colour (METIS-pub#390); an <img> of the
     SVG cannot take a colour. Give it a width at the call site; the height
     follows the mark. */
  [data-app="gathering"] .tg-logomark {
    display: inline-block;
    flex: none;
    aspect-ratio: 1 / var(--tg-hex-ratio);
    background: currentColor;
    mask: url("../img/marks/logo-mark.svg") center / contain no-repeat;
    -webkit-mask: url("../img/marks/logo-mark.svg") center / contain no-repeat;
  }

  /* ── Brand mark ────────────────────────────────────────────────────
     The hexagon logo mark. Uses currentColor, so it takes the ink of
     whatever it sits in; never recoloured by hand, never stretched — the
     hexagon's ratio is the brand's. */
  [data-app="gathering"] .tg-mark {
    width: var(--space-8);
    height: calc(var(--space-8) * var(--tg-hex-ratio));
    flex-shrink: 0;
  }

  /* The public site's one hover is .lift in web/view/static/view/css/shared.css
     (METIS-pub#469); the dead .tg-lift that was here is gone — do not add a second. */
}
