/* Matcha landing page: a light green page with one slim top bar.
   The bar, the drop-down panel and the dialog follow the proportions and motion of apple.com's
   navigation: a slim white bar, a full-width panel that unrolls beneath it with large staggered links
   while the page behind dims, and a soft rounded sheet. */
:root {
  color-scheme: light;
  --bg: #e3efd6;
  --panel: #ffffff;
  --surface: #ffffff;
  --text: #1d1f1b;
  --muted: #62695d;
  --hairline: rgba(29, 31, 27, 0.1);
  --fill: #eef3e8;
  --fill-hover: #e3eadb;
  --accent: #3b7a2c;
  --ink: #1d1f1b;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --bar-h: 64px;
  --gutter: clamp(20px, 4vw, 44px);
  --ease-nav: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
}

*, *::before, *::after { box-sizing: border-box; }
/* The page never scrolls or zooms: pinch and double-tap are disabled here (and in main.js for
   browsers that ignore touch-action); panning stays allowed so the dialog can scroll on small screens. */
html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  position: fixed;
  inset: 0;
  margin: 0;
  overflow: hidden;
  /* White frame at the top; the green page is a flat sheet tucked under the bar (body::before). */
  background: var(--panel);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
/* The page itself: one flat green sheet beginning under the white bar, its top corners rounded so
   the two colours meet as two surfaces. No gradient, no dividing line. */
body::before {
  content: "";
  position: fixed;
  inset: calc(var(--bar-h) + env(safe-area-inset-top)) 0 0 0;
  background: var(--bg);
  border-radius: 28px 28px 0 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
[hidden]:not(.menu-list) { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Top bar ---------- */
.bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top);
  /* Always white, so nothing at the top changes colour when the panel unrolls beneath it. */
  background: var(--panel);
}
.nav { position: relative; }
.bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--bar-h);
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}
.brand { margin: 0; line-height: 0; }
.brand img {
  display: block;
  width: 40px;
  height: 40px;
  user-select: none;
  -webkit-user-drag: none;
}

/* ---------- Menu button: two lines that fold into a cross ---------- */
.menu-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -13px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: opacity 200ms ease;
}
.menu-button:hover { opacity: 0.6; }
.menu-icon { position: relative; display: block; width: 18px; height: 18px; }
.menu-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 8.25px;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  transition: transform 360ms var(--ease-nav);
}
.menu-line:first-child { transform: translateY(-3.5px); }
.menu-line:last-child { transform: translateY(3.5px); }
.menu-button[aria-expanded="true"] .menu-line:first-child { transform: rotate(45deg); }
.menu-button[aria-expanded="true"] .menu-line:last-child { transform: rotate(-45deg); }

/* ---------- Drop-down panel ---------- */
.menu-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: block;
  margin: 0;
  padding: 20px max(var(--gutter), env(safe-area-inset-right)) 44px max(var(--gutter), env(safe-area-inset-left));
  list-style: none;
  background: var(--panel);
  box-shadow: 0 1px 0 var(--hairline);
  clip-path: inset(0 0 -2px 0);
  transition:
    clip-path 420ms var(--ease-nav),
    display 420ms allow-discrete;
}
.menu-list > li {
  max-width: calc(1440px - 2 * var(--gutter));
  margin: 0 auto;
}
.menu-list[hidden] {
  display: none;
  clip-path: inset(0 0 100% 0);
  transition-duration: 260ms;
}
@starting-style {
  .menu-list:not([hidden]) { clip-path: inset(0 0 100% 0); }
}

.menu-item {
  display: inline-block;
  padding: 7px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: clamp(22px, 6.4vw, 28px);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.015em;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  opacity: 1;
  transform: none;
  transition:
    opacity 360ms ease,
    transform 520ms var(--ease-out),
    color 200ms ease;
}
/* Links rise into place one after another as the panel unrolls. */
.menu-list > li:nth-child(1) .menu-item { transition-delay: 90ms, 90ms, 0s; }
.menu-list > li:nth-child(2) .menu-item { transition-delay: 150ms, 150ms, 0s; }
.menu-list[hidden] .menu-item {
  opacity: 0;
  transform: translateY(-10px);
  transition-duration: 140ms;
  transition-delay: 0s;
}
@starting-style {
  .menu-list:not([hidden]) .menu-item { opacity: 0; transform: translateY(-10px); }
}
/* Contact swaps its label for the address: the old text drops out, the new text rises in. */
.menu-list .menu-item.is-swapping {
  opacity: 0;
  transform: translateY(6px);
  transition-duration: 140ms;
  transition-delay: 0s;
}
/* Pointing at one link quietens the other. */
@media (hover: hover) {
  .menu-list:hover .menu-item:not(:hover) { color: color-mix(in srgb, var(--text) 45%, transparent); }
}
.menu-item:focus { outline: none; }
.menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }

/* The page behind the open panel dims and softens. */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: rgba(29, 41, 24, 0.22);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 320ms var(--ease-nav), visibility 0s linear 320ms;
}
body:has(.menu-button[aria-expanded="true"]) .scrim {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

/* ---------- Dialog ---------- */
.sheet {
  position: fixed;
  width: min(780px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 44px 44px 40px;
  border: 0;
  border-radius: 28px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px -20px rgba(29, 41, 24, 0.35), 0 0 0 1px rgba(29, 31, 27, 0.04);
  overflow: auto;
  overscroll-behavior: contain;
  opacity: 0;
  transform: translateY(14px) scale(0.975);
  transition:
    opacity 200ms ease,
    transform 200ms ease,
    overlay 200ms allow-discrete,
    display 200ms allow-discrete;
}
.sheet[open] {
  opacity: 1;
  transform: none;
  transition:
    opacity 320ms ease,
    transform 480ms var(--ease-sheet),
    overlay 480ms allow-discrete,
    display 480ms allow-discrete;
}
@starting-style {
  .sheet[open] { opacity: 0; transform: translateY(14px) scale(0.975); }
}
.sheet::backdrop {
  background: rgba(29, 41, 24, 0);
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
  transition:
    background-color 240ms ease,
    backdrop-filter 240ms ease,
    -webkit-backdrop-filter 240ms ease,
    overlay 240ms allow-discrete,
    display 240ms allow-discrete;
}
.sheet[open]::backdrop {
  background: rgba(29, 41, 24, 0.32);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
@starting-style {
  .sheet[open]::backdrop { background: rgba(29, 41, 24, 0); -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); }
}

.sheet-head { margin-bottom: 4px; padding-right: 44px; }
.sheet-title {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.125;
  letter-spacing: -0.02em;
}

.icon-button {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--fill);
  color: var(--muted);
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}
.icon-button:hover { background: var(--fill-hover); color: var(--text); }
.icon-button svg { width: 16px; height: 16px; }

.step-label { margin: 28px 0 10px; color: var(--muted); font-size: 14px; line-height: 1.43; letter-spacing: -0.016em; }

.code-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}
.code-box {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
}
.code {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  border-radius: 14px;
  background: var(--fill);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.5;
  letter-spacing: 0;
  white-space: pre;
  scrollbar-width: none;
}
.code::-webkit-scrollbar { display: none; }
.code code { font: inherit; }
/* Set by main.js while more of the line is hidden to the right: fade the text into the box so it
   is obvious the box scrolls. */
.code-box::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 44px;
  border-radius: 0 14px 14px 0;
  background: linear-gradient(to right, transparent, var(--fill) 78%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}
.code-box.has-more::after { opacity: 1; }

.copy-button {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #ffffff;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.016em;
  cursor: pointer;
  transition: background-color 220ms ease, transform 160ms var(--ease-out);
}
.copy-button:hover { background: #33372f; }
.copy-button:active { transform: scale(0.96); }
/* Both labels share one grid cell so the button never changes size. */
.copy-button > span {
  grid-area: 1 / 1;
  display: grid;
  place-items: center;
  transition: opacity 180ms ease, transform 260ms var(--ease-out), visibility 0s linear 0s;
}
/* The label that is not showing fades out, then leaves the accessibility tree (visibility). */
.copy-done,
.copy-button.is-copied .copy-idle {
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, transform 260ms var(--ease-out), visibility 0s linear 180ms;
}
.copy-done { transform: scale(0.6); }
.copy-button.is-copied { background: var(--accent); }
.copy-button.is-copied .copy-idle { transform: scale(0.6); }
.copy-button.is-copied .copy-done {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 180ms ease, transform 260ms var(--ease-out), visibility 0s linear 0s;
}

@media (max-width: 520px) {
  body::before { border-radius: 22px 22px 0 0; }
  .menu-list { padding-top: 16px; padding-bottom: 36px; }
  .sheet { padding: 36px 22px 24px; border-radius: 24px; }
  .sheet-title { font-size: 28px; }
  .code { padding: 12px 14px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    animation-duration: 0s !important;
    scroll-behavior: auto !important;
  }
}
