/* The hero — canvas board "1 · Hero".
 *
 * A rounded panel inset from the tan page by the page gutter, the bridge
 * artwork across it, the can standing at a tilt in the middle and floating on
 * the spot, with the tagline above and the style note and button pinned to the
 * panel's bottom corners.
 *
 * The tilt and the float are deliberately separate properties: `rotate` holds
 * the -6deg on its own, and `transform` carries the float. Putting both in
 * transform means the keyframes have to restate the rotation and the centring
 * translate on every frame, and the first one that forgets drops the can into
 * the corner.
 */

.sgh {
  background: var(--sg-page);
  padding: var(--page-gutter) 0;
}

.sgh__in {
  position: relative;
  margin-inline: var(--page-gutter);
  border-radius: var(--panel-r);
  overflow: hidden;
  /* 1248 x 668 on the board — a hair under 2:1, held as an aspect ratio so it
     keeps its proportion at every width, with a floor for phones. */
  aspect-ratio: 1248 / 800;
  min-height: 420px;
  color: var(--navy);
  isolation: isolate;
}

/* The Section background setting is written inline onto the section, where no
   stylesheet rule can outrank it. On this design it belongs to the panel, so
   the section is held at the tan and the panel reads --sec-bg instead. */
.sgh.has-sec-bg { background-color: var(--sg-page) !important; }
.sgh__in { background: var(--sec-bg, var(--yel)); }

/* the bridge artwork ------------------------------------------------------ */

/* The bridge fills the panel from the left edge and bleeds off the right:
   the rocks meet the left side, the deck runs out past the right one, and
   the rounded corners do the cropping. */
.sgh__art {
  position: absolute;
  left: var(--sgh-art-x, -10%);
  bottom: 2%;
  width: 118%;
  z-index: 0;
  pointer-events: none;
}

.sgh__art img { display: block; width: 100%; height: auto; opacity: .95; }

/* The drawing's own left edge is an unfinished cliff, and its right edge cuts
   the deck off square. Every layout below keeps at least the first 8% of the
   drawing past the panel's left edge and runs it past the right one, sized so
   the top of the main tower stays inside the panel. As a safety net, the
   drawing's outer edges also fade out, so an unusual screen shape can only
   ever show a soft edge, never a broken one. */
.sgh__art img {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 95%, transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 95%, transparent 100%);
}

/* the tagline ------------------------------------------------------------- */

.sgh__tag {
  position: absolute;
  left: 50%;
  top: clamp(22px, 7.3%, 56px);
  transform: translateX(-50%);
  margin: 0;
  z-index: 3;
  font-family: var(--f-body);
  font-weight: 700;
  font-style: italic;
  font-size: clamp(14px, 1.33vw, 17px);
  line-height: 1.2;
  white-space: nowrap;
  color: var(--navy);
}

/* the can ----------------------------------------------------------------- */

.sgh__stage { position: absolute; inset: 0; }

.sgh__prod {
  position: absolute;
  left: var(--sgh-x, 50%);
  /* Fixed to the board (204 of 1248 wide, 149 up from the bottom of 668).
     The old Size and Drop sliders meant different things in the old layout
     and pushed the can off the top of the panel, so they are not read here;
     Across and Tilt mean the same as they always did and still work. */
  bottom: 22.3%;
  transform: translateX(-50%);
  width: 16.3%;
  z-index: 2;
}

/* The tilt is the can's alone, so the glass behind it stands upright. */
.sgh__can {
  position: relative;
  z-index: 2;
  display: block;
  rotate: var(--sgh-tilt, -6deg);
  transform-origin: 50% 80%;
  transition: translate .45s cubic-bezier(.34, 1.15, .5, 1);
}

.sgh__can img { display: block; width: 100%; height: auto; object-fit: contain; }

/* ---- the glass peeking out -----------------------------------------------
 * As the Squarespace hero had it: the pint waits hidden behind the can, and
 * on hover (or a tap, on a phone) it slides out to the right while the can
 * eases left, with the same springy curve. Only transform and opacity move,
 * which keeps it smooth in Safari, and the whole pair still floats together
 * because the float is on .sgh__prod around them both.
 */
.sgh__glass {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 0;
  /* True to life once it is out: a US pint stands about 22% taller than a
     12 oz can (14.9 cm to 12.2 cm) and is wider at the rim. Hidden, it is
     shrunk to sit wholly behind the can, and it grows to its real size as
     it slides out. */
  height: 122%;
  width: auto;
  max-width: none;
  opacity: 0;
  translate: -50% 0;
  scale: .8;
  transform-origin: bottom center;
  filter: drop-shadow(-10px 12px 14px rgba(60, 43, 82, .22));
  transition: translate .45s cubic-bezier(.34, 1.15, .5, 1), scale .45s cubic-bezier(.34, 1.15, .5, 1), opacity .3s ease;
  pointer-events: none;
  will-change: translate;
}

.sgh__prod.has-glass { cursor: pointer; outline: none; }
.sgh__prod.has-glass:is(:hover, :focus-visible, .is-peek) .sgh__glass { opacity: 1; translate: -32% 0; scale: 1; }
.sgh__prod.has-glass:is(:hover, :focus-visible, .is-peek) .sgh__can { translate: -12% 0; }
.sgh__prod.has-glass:focus-visible .sgh__can img { outline: 3px solid var(--plum); outline-offset: 4px; border-radius: 12px; }

.sgh--float .sgh__prod { animation: sghFloat 6s ease-in-out infinite; }

@keyframes sghFloat {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(-14px); }
}

/* the two bottom corners -------------------------------------------------- */

.sgh__foot {
  position: absolute;
  inset: auto 0 0;
  z-index: 3;
  padding: 0 clamp(18px, 2.9%, 36px) clamp(20px, 5.7%, 44px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.sgh__note {
  margin: 0;
  font-family: var(--f-mono);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  letter-spacing: 1.56px;
  text-transform: uppercase;
  color: var(--navy);
}

/* The note sits over the bridge drawing, so it is a pill like the map's
   tags: cream, with the plum outline, which also keeps it clear of the lines. */
.sgh__note {
  padding: 7px 14px 6px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--cream);
  font-size: 12px;
}
.sgh__note b { font-weight: 700; }
.sgh__note span { margin-left: .4em; }

/* The button is the global one from the Foundations board; it only needs to be
   told it is sitting on a light panel. */
.sgh__btn { --b-bg: var(--cream); --b-fg: var(--navy); --b-sh: var(--navy); }

/* ---- narrow screens ------------------------------------------------------
 * Below the fold of a phone the two-up footer stacks, the can shrinks, and the
 * panel gives up its aspect ratio so the content decides the height.
 */

@media (max-width: 760px) {
  .sgh__in { aspect-ratio: auto; min-height: 0; padding: 60px 0 0; }
  /* The stage is sized from the panel's width, not the screen's height, so
     the can, the bridge and the tagline keep the same spacing on every
     phone instead of opening a gap above the can on tall screens. */
  .sgh__stage { position: relative; inset: auto; height: auto; min-height: 0; aspect-ratio: 343 / 272; }
  .sgh__prod { width: 34%; bottom: 0; }
  /* On a phone the panel is tall, so the bridge is drawn larger, still
     filling from the left edge and running off the right. */
  .sgh__art { width: 136%; left: -12%; top: 52%; bottom: auto; transform: translateY(-50%); }
  .sgh__foot {
    position: static;
    flex-direction: column;
    align-items: center;   /* on a phone everything above is centred, so the button is too */
    gap: 14px;
    padding: 20px 20px 24px;
  }
  .sgh__tag { white-space: normal; width: min(90%, 34ch); text-align: center; }
}

/* ---- the split: brand on the left, film on the right ---------------------
 * Canvas board "1 · Hero, split". Two panels side by side, the pair one
 * desktop screen tall, the gutter between them the same as around them. The
 * bridge is reframed so the main tower stands on the right, the can and the
 * glass sit front and centre, and the pair floats more gently so it doesn't fight
 * the film beside it. Below 900px the two stack.
 */

.sgh__grid {
  margin-inline: var(--page-gutter);
  display: grid;
  /* the film is the wider of the two */
  grid-template-columns: 45fr 55fr;
  gap: var(--page-gutter);
  height: clamp(480px, 50vw, 680px);
}

.sgh--split .sgh__in { margin-inline: 0; aspect-ratio: auto; min-height: 0; height: 100%; }

/* capped by the panel's height, so on very wide screens the tower stays in */
.sgh--split .sgh__art { width: min(168%, calc(clamp(480px, 50vw, 680px) * 1.9)); left: -24%; bottom: 2%; }

.sgh--split .sgh__prod { left: 50%; bottom: 15%; width: 25%; }

.sgh--split.sgh--float .sgh__prod { animation-name: sghFloatSoft; }

@keyframes sghFloatSoft {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(-8px); }
}

.sgh--split .sgh__tag { top: clamp(22px, 6%, 40px); }

.sgh__film {
  position: relative;
  border-radius: var(--panel-r);
  overflow: hidden;
  background: var(--plum);
  min-width: 0;
}

/* the film fills its panel, whatever shape the panel is */
.sgh__film .sgf__frame { aspect-ratio: auto; height: 100%; }

@media (max-width: 900px) {
  .sgh__grid { grid-template-columns: minmax(0, 1fr); height: auto; }
  .sgh--split .sgh__in { height: auto; aspect-ratio: 1248 / 800; min-height: 420px; }
  .sgh--split .sgh__art { width: 120%; left: -10%; bottom: 2%; }
  .sgh--split .sgh__prod { left: var(--sgh-x, 50%); bottom: 22.3%; width: 16.3%; }
  .sgh__film .sgf__frame { aspect-ratio: 16 / 9; height: auto; }
}

@media (max-width: 760px) {
  .sgh--split .sgh__in { aspect-ratio: auto; min-height: 0; }
  .sgh--split .sgh__art { width: 136%; left: -12%; top: 52%; bottom: auto; }
  .sgh--split .sgh__prod { width: 34%; bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sgh--float .sgh__prod { animation: none; }
  .sgh__glass, .sgh__can { transition: opacity .2s ease; }
}
