/* ==========================================================================
   Shenachie — layout
   Sections, containers, grids, and the responsive layer.

   Ported from the design's own responsive.css. The prototypes were authored
   desktop-first with inline styles, and all breakpoint behaviour hangs off
   data-* attributes. Those hooks are kept so the markup matches the design
   1:1 and stays diffable against future handoffs.

   Breakpoints: 1024 (tablet) / 768 (phone + small tablet) / 520 (phone)
   ========================================================================== */

/* --- Sections and containers --------------------------------------------- */

.section {
  position: relative;
  padding: 80px var(--gutter);
}
.section--tight { padding: 64px var(--gutter); }
.section--flush-bottom { padding-bottom: 0; }   /* image bleeds to the edge */

.section--dark   { background: var(--c-ink); }
.section--black  { background: var(--c-black); }
/*
  Yellow band text colour is set by INHERITANCE, not by a descendant selector.

  `.section--yellow p` was (0,1,1) and so outranked every component's own
  (0,1,0) rule, reaching inside cards and stat bands that merely happened to
  sit in a yellow section -- which is how the blog cards ended up with
  near-black body text on a black hover state, and the stat figures came out
  muted grey. An inherited colour loses to any explicit rule, so components
  always win on their own text.
*/
.section--yellow { background: var(--c-yellow); color: var(--c-body-light); }
:where(.section--yellow) :where(h1, h2, h3, h4, h5, h6) { color: var(--c-ink); }
/*
  :where() gives this zero specificity so it acts as a true default. As a
  plain descendant selector it was (0,1,1) and reached inside components --
  forcing ink onto a dark card heading, which is invisible.
*/

/*
  Every container centres itself. The modifiers previously set only max-width,
  so used on their own -- which is how the templates use them -- they inherited
  no auto margin and sat hard against the left gutter while .container was
  centred. That put blocks on the same page at three different left edges.
*/
.container,
.container--wide,
.container--list,
.container--narrow,
.container--prose,
.container--measure { width: 100%; margin-inline: auto; }

.container         { max-width: var(--w-content); }
.container--wide   { max-width: var(--w-wide); }
.container--list   { max-width: var(--w-list); }
.container--narrow { max-width: var(--w-narrow); }
.container--prose  { max-width: var(--w-prose); }
.container--measure{ max-width: var(--w-measure); }

/*
  Heroes sit inside 7vw padding with no width cap, so on a wide screen the
  headline started ~260px left of the body content beneath it. Cap and centre
  the hero's content so the two share a left edge at every width.
*/
.hero__inner > * { width: 100%; max-width: var(--w-content); margin-inline: auto; }

/* Scrim over a background image or video */
.scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.section > .container { position: relative; z-index: 2; }

/* --- Grids ---------------------------------------------------------------
   Column counts are set inline via data-grid to mirror the design markup;
   the media queries below step them down. Gaps stay CSS-side.
   ------------------------------------------------------------------------ */

[data-grid] { display: grid; }
[data-grid="six"]      { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; }
[data-grid="five"]     { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; }
[data-grid="four"]     { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
[data-grid="three"]    { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
[data-grid="two"]      { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; }
[data-grid="split"]    { grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); gap: 64px; }
[data-grid="listcard"] { grid-template-columns: 220px 1fr; gap: 0; }

/* --- Full-height sections ------------------------------------------------
   svh rather than vh: on mobile, vh includes the browser chrome that
   disappears on scroll, so a 100vh hero is taller than the actual viewport.
   ------------------------------------------------------------------------ */

[data-fullheight="hero"]    { height: 100vh; min-height: 560px; }
[data-fullheight="content"] { min-height: 100vh; }

@supports (height: 100svh) {
  [data-fullheight="hero"]    { height: 100svh; min-height: 560px; }
  [data-fullheight="content"] { min-height: 100svh; }
}

/* --- Hero pattern --------------------------------------------------------
   Consistent across every page: fixed-height box, full-bleed cover media,
   top-fading dark gradient, headline bottom-left.
   ------------------------------------------------------------------------ */

.hero {
  position: relative;
  height: min(58vh, 460px);
  min-height: 360px;
  background: var(--c-hero-base);
  overflow: hidden;
}
.hero__media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero__scrim {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(10,10,10,0.7), transparent 60%);
}
.hero__inner {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: flex-end;
  padding: 0 var(--gutter) 40px;
}
.hero--tall  { height: min(62vh, 520px); min-height: 400px; }
.hero--short { height: min(52vh, 420px); min-height: 340px; }

/* ==========================================================================
   Responsive layer
   ========================================================================== */

@media (max-width: 1024px) {
  [data-grid="six"]   { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  [data-grid="five"]  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  [data-grid="four"]  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  [data-grid="split"] { grid-template-columns: 1fr; gap: 48px; }
  [data-nowrap]       { white-space: normal; }
}

@media (max-width: 768px) {
  [data-grid="six"],
  [data-grid="five"],
  [data-grid="four"],
  [data-grid="three"],
  [data-grid="two"]      { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  [data-grid="two"]      { gap: 36px; }
  [data-grid="listcard"] { grid-template-columns: 1fr; }

  [data-fullheight="content"] { min-height: 0; height: auto; }
  [data-fullheight="hero"]    { height: 72svh; min-height: 420px; }

  [data-measure] { max-width: 100%; }
  [data-fig="fox"] { width: 190px; }

  .section { padding: 56px var(--gutter); }
  .hero__inner { padding-bottom: 32px; }
}

@media (max-width: 520px) {
  [data-grid="six"],
  [data-grid="five"],
  [data-grid="four"],
  [data-grid="three"],
  [data-grid="two"],
  [data-grid="split"],
  [data-grid="listcard"] { grid-template-columns: 1fr; }

  [data-tile] { height: 240px; }
  [data-fig="fox"] { width: 150px; }

  .section { padding: 48px var(--gutter); }
}

/* --- Print --------------------------------------------------------------- */

@media print {
  .site-header, .site-footer, .midnav, .storyband, .contact-form { display: none; }
  body { background: #fff; color: #000; }
}
