/* ==========================================================================
   imago creative — front page layout
   Desktop: [5 terracotta buttons] [logo / open panel] [5 sage buttons]
   Phone:   logo on top, the two button columns side by side underneath,
            and panels open as a sheet over a dimmed page.
   ========================================================================== */

:root {
  --ink: #042433;
  --terra: #be6640;
  --terra-dk: #a8542f;
  --sage: #85917b;
  --sage-dk: #6d7a63;
  --cream: #faf8f5;

  /* Desktop proportions, taken from the design mock-up. */
  --col-w: 172px;
  --pill-h: 61px;
  --pill-font: 22px;
  --pill-gap: 26px;
  --group-gap: 139px;
  --center-w: 548px;
  --panel-w: 460px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Quicksand', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #e9d3c6; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.stage {
  flex: 1 0 auto;
  display: grid;
  place-items: center;
  padding: 48px 24px 24px;
}
.layout {
  display: grid;
  grid-template-columns: var(--col-w) minmax(0, var(--center-w)) var(--col-w);
  grid-template-areas: "left center right";
  align-items: center;
  width: 100%;
  max-width: calc(var(--col-w) * 2 + var(--center-w));
}
.col { display: flex; flex-direction: column; gap: var(--group-gap); }
.col--left  { grid-area: left; }
.col--right { grid-area: right; }
.group { display: flex; flex-direction: column; gap: var(--pill-gap); }

.center {
  grid-area: center;
  position: relative;
  align-self: stretch;
  display: grid;
  place-items: center;
}
.center > picture { display: block; width: 100%; }
.logo {
  display: block;
  width: 100%;
  height: auto;
  /* The mock-up sits the vase a little low, so its side sprigs line up with
     the gap between the button groups. */
  transform: translateY(6%);
  animation: icFade .8s ease both;
  user-select: none;
  transition: opacity .5s ease, transform .6s cubic-bezier(.22, 1, .36, 1), filter .5s ease;
}
/* With a window open, the logo steps back; its sprigs still peek out. */
.layout.has-open .logo {
  opacity: .4;
  filter: saturate(.7) blur(1px);
  transform: translateY(6%) scale(.96);
}

/* ── Menu buttons ───────────────────────────────────────────────────────── */
.pill {
  --bg: var(--terra);
  --bg-dk: var(--terra-dk);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--pill-h);
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--bg);
  color: #fff;
  font: 500 var(--pill-font)/1.1 'Quicksand', system-ui, sans-serif;
  letter-spacing: .2px;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: icFade .5s ease both;
  animation-delay: calc(var(--i, 0) * 50ms + 50ms);
  transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), background .22s ease, box-shadow .22s ease;
}
.col--right .pill { --bg: var(--sage); --bg-dk: var(--sage-dk); }
.pill:hover {
  background: var(--bg-dk);
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 20px -10px rgba(4, 36, 51, .45);
}
.pill:active { transform: translateY(-1px) scale(.99); }
.pill:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
/* The button whose panel is open. */
.pill[aria-expanded="true"] {
  background: var(--bg-dk);
  box-shadow: 0 0 0 3px var(--cream), 0 0 0 5px var(--bg-dk);
}

/* ── Panels ─────────────────────────────────────────────────────────────── */
/* On desktop the panel sits over the logo, between the button columns, so
   visitors can hop straight to another section. */
.panels {
  position: absolute;
  inset: -13px 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.panels .ic-panel {
  grid-area: 1 / 1;
  width: min(var(--panel-w), 100%);
  max-height: 100%;
  pointer-events: auto;
}
.ic-panel.is-opening  { animation: icPop .4s cubic-bezier(.34, 1.56, .64, 1) both; }
.ic-panel.is-closing  { animation: icOut .12s ease both; pointer-events: none; }

/* The window's contents arrive one after another once it has taken shape. */
.ic-panel.is-revealing { animation: icSettle .45s cubic-bezier(.22, 1, .36, 1) both; }
.ic-panel.is-revealing .ic-panel__title { animation: icRise .55s cubic-bezier(.22, 1, .36, 1) both .02s; }
.ic-panel.is-revealing .ic-panel__close { animation: icSpin .6s cubic-bezier(.34, 1.56, .64, 1) both .12s; }
.ic-panel.is-revealing .ic-panel__body > * { animation: icRise .55s cubic-bezier(.22, 1, .36, 1) both .32s; }
.ic-panel.is-revealing .ic-panel__body > :nth-child(1) { animation-delay: .08s; }
.ic-panel.is-revealing .ic-panel__body > :nth-child(2) { animation-delay: .13s; }
.ic-panel.is-revealing .ic-panel__body > :nth-child(3) { animation-delay: .18s; }
.ic-panel.is-revealing .ic-panel__body > :nth-child(4) { animation-delay: .23s; }
.ic-panel.is-revealing .ic-panel__body > :nth-child(5) { animation-delay: .28s; }
.ic-panel.is-revealing .ic-form { animation: icRise .55s cubic-bezier(.22, 1, .36, 1) both .2s; }
.ic-panel.is-revealing .ic-panel__media { animation: icRise .6s cubic-bezier(.22, 1, .36, 1) both .12s; }
.ic-panel.is-revealing .ic-slide.is-active img { animation: icWipeL 1s cubic-bezier(.65, 0, .35, 1) both .2s; }
.ic-panel--right.is-revealing .ic-slide.is-active img { animation-name: icWipeR; }
.ic-panel.is-revealing .ic-slider__dots { animation: icRise .5s ease both .7s; }

@keyframes icFade   { from { opacity: 0; } to { opacity: 1; } }
@keyframes icPop {
  0%   { opacity: 0; transform: scale(.84) translateY(14px); }
  60%  { opacity: 1; transform: scale(1.02) translateY(0); }
  100% { opacity: 1; transform: none; }
}
@keyframes icOut    { to { opacity: 0; } }
@keyframes icSettle { from { opacity: 0; transform: scale(.985); border-color: transparent; } }
@keyframes icRise   { from { opacity: 0; transform: translateY(14px); } }
@keyframes icSpin   { from { opacity: 0; transform: rotate(-135deg) scale(.4); } }
@keyframes icWipeL  { from { clip-path: inset(0 100% 0 0); transform: scale(1.18); } to { clip-path: inset(0 0 0 0); transform: none; } }
@keyframes icWipeR  { from { clip-path: inset(0 0 0 100%); transform: scale(1.18); } to { clip-path: inset(0 0 0 0); transform: none; } }

/* The coloured shape that grows out of a button (see site.js). */
.morph {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  will-change: clip-path;
}
.leaf {
  position: fixed;
  z-index: 61;
  display: block;
  pointer-events: none;
  will-change: transform, opacity;
}
.leaf svg { display: block; width: 100%; height: 100%; fill: currentColor; overflow: visible; }
.leaf .vein { fill: none; stroke: rgba(255, 255, 255, .45); stroke-width: .8; }
.leaf--olive { border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: currentColor; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.credit {
  flex: none;
  padding: 10px 16px 18px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .2px;
  color: rgba(4, 36, 51, .55);
  animation: icFade 1s ease both .6s;
}
.credit a {
  color: var(--terra);
  font-weight: 600;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .3s ease, color .2s ease;
}
.credit a:hover { color: var(--terra-dk); background-size: 100% 1px; }
.credit a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px; }

/* ── Mid-size screens ───────────────────────────────────────────────────── */
@media (max-width: 1040px) {
  :root {
    --col-w: 150px;
    --pill-h: 54px;
    --pill-font: 19px;
    --pill-gap: 20px;
    --group-gap: 110px;
    --center-w: 470px;
    --panel-w: 430px;
  }
}

/* ── Phones and small tablets ───────────────────────────────────────────── */
@media (max-width: 820px), (max-height: 560px) and (max-width: 1040px) {
  :root {
    --pill-h: 50px;
    --pill-font: 17px;
    --pill-gap: 12px;
    --group-gap: 12px;
  }
  .stage { padding: 28px 16px 24px; }
  .layout {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "center center"
      "left   right";
    column-gap: 12px;
    row-gap: 22px;
    max-width: 440px;
  }
  .center { align-self: auto; }
  .logo { width: min(320px, 82%); margin: 0 auto; transform: none; }

  .panels {
    position: fixed;
    inset: 0;
    z-index: 50;
    padding: 16px;
    background: rgba(4, 36, 51, .3);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility 0s linear .2s;
  }
  .panels.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .2s ease;
  }
  .panels .ic-panel {
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
  }
  body.panel-open { overflow: hidden; }
}

@media (max-width: 360px) {
  :root { --pill-font: 16px; --pill-h: 46px; }
  .layout { column-gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }
}
