/* ============================================================
   Balance Farm — global styles
   Type scale, reset, and component styles.
   ============================================================ */

/* Self-hosted Instrument Sans variable font — the Google Fonts build
   strips the stylistic sets (ss01 straight-leg y etc.), so the brand
   alternates only render from the full upstream file. */
@font-face {
  font-family: 'Instrument Sans';
  src: url('../assets/fonts/InstrumentSans-var.woff2') format('woff2-variations');
  font-weight: var(--w-regular) 700;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

/* ---- Design tokens ---- */
:root {
  --font-sans:  'Instrument Sans', system-ui, -apple-system, sans-serif;
  --font-serif: 'Crimson Text', Georgia, 'Times New Roman', serif;

  --color-ink:   var(--ink);            /* alias: the older name, still widely used */
  --color-paper: var(--paper);          /* alias: the older name for white */
  --color-bg:    var(--page);           /* alias: the older name for the page */
  --nav-surface: var(--chrome);
  --nav-blur:    var(--chrome-blur);
  --booking-line: var(--hairline);      /* was 3%; merged with the 4% hairline */

  --edge: clamp(28px, 3.4vw, 48px);     /* hero copy inset          */
}

/* ---- Reset ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  /* Instrument Sans stylistic sets (global, per brand spec):
     on:  ss01 y, ss03 R, ss05 G, ss06 J, ss07 Q, ss08 2, ss09 &, ss10 currency
     off: ss02 K, ss04 M */
  font-feature-settings: "ss01" 1, "ss03" 1, "ss05" 1, "ss06" 1, "ss07" 1, "ss08" 1, "ss09" 1, "ss10" 1;
  background: var(--color-bg);
  color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { display: block; }
button { font-family: inherit; }
button, input, textarea, select { font-feature-settings: inherit; }

/* ============================================================
   TYPE STYLES  (reusable)
   ============================================================ */
.text-tagline {           /* 52 / 100% / -4% / bold */
  font-size: var(--t-2xl);
  line-height: 100%;
  font-weight: 700;
  letter-spacing: var(--t-2xl-track);
}
.text-body {              /* 18 / 100% */
  font-size: var(--t-base);
  line-height: 100%;
  font-weight: var(--w-semi);
}
.text-cta {               /* 16 / 100% / -1% */
  font-size: var(--t-sm);
  line-height: 100%;
  font-weight: var(--w-medium);
  letter-spacing: var(--t-sm-track);
}

/* backdrop behind the expanded menu — fades softly in and out */
.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 29;                /* just below the nav (30) */
  background: var(--tint-1);
  -webkit-backdrop-filter: blur(28px);
  backdrop-filter: blur(28px);
}
.menu-backdrop {
  opacity: 0;
  pointer-events: none;
  transition: opacity 460ms ease;
}
.menu-backdrop.is-visible { opacity: 1; }

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed;
  top: var(--chrome-inset);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  /* the side margin matches the top inset, so the nav sits evenly framed */
  width: min(407px, calc(100% - var(--chrome-inset) * 2));
  border-radius: var(--r-md);
  background: var(--nav-surface);
  -webkit-backdrop-filter: blur(var(--nav-blur));
  backdrop-filter: blur(var(--nav-blur));
  overflow: hidden;
}

/* top row */
.nav__bar {
  padding: 10px 10px 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav__logo { display: flex; align-items: center; flex-shrink: 0; min-width: 0; }
.nav__logo img { width: 178px; max-width: 100%; height: auto; }

.nav__actions { display: flex; align-items: center; gap: var(--s-1); flex-shrink: 0; }

.nav__menu {
  position: relative;
  width: 38px; height: 38px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); border: none; border-radius: var(--r-pill);
  cursor: pointer;
  transition: background 200ms ease;
}
@media (hover: hover) {
  .nav__menu:hover { background: var(--fill-2); }
}

/* icon crossfade: hamburger <-> single close bar */
.nav__icon {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 220ms ease;
}
.nav__icon--open  { width: 16px; height: auto; opacity: 1; }
.nav__icon--close { width: 16px; height: auto; opacity: 0; }
.nav.is-open .nav__icon--open  { opacity: 0; }
.nav.is-open .nav__icon--close { opacity: 1; }

/* expanding menu panel */
.nav__panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 720ms var(--e-move), opacity 420ms ease;
}
.nav.is-open .nav__panel {
  max-height: calc(100dvh - 100px);
  opacity: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;      /* scrolls itself without dragging the page */
}

.nav__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 72px 20px;               /* same gutter as .nav__meta */
}
.nav__link {
  display: block;
  padding: 1px 0;
  font-family: var(--font-serif);
  font-size: var(--t-2xl);
  line-height: 1;
  font-weight: var(--w-regular);
  color: var(--color-ink);
  /* enter animation */
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 420ms ease, transform 420ms var(--e-move), color 180ms ease;
}
@media (hover: hover) {
  .nav__link:hover { color: var(--ink-45); }
}
.nav.is-open .nav__link { opacity: 1; transform: translateY(0); }
.nav.is-open .nav__list li:nth-child(1) .nav__link { transition-delay: 170ms; }
.nav.is-open .nav__list li:nth-child(2) .nav__link { transition-delay: 265ms; }
.nav.is-open .nav__list li:nth-child(3) .nav__link { transition-delay: 360ms; }

/* secondary links */
.nav__meta { padding: 0 20px; }
.nav__meta-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 12px 0;
  border-top: 1px solid var(--hairline);
}
.nav__meta-label,
.nav__meta-link { font-size: var(--t-sm); font-weight: var(--w-medium); letter-spacing: var(--t-sm-track); line-height: 150%; text-align: left; }
.nav__meta-label { color: var(--ink-45); }
.nav__meta-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-1);
}
.nav__meta-link {
  color: var(--color-ink);
  transition: opacity var(--d-fast) ease;
}
@media (hover: hover) {
  .nav__meta-link:hover { opacity: 0.55; }
  /* the placeholder link has no page yet, so it does not invite a click */
  .nav__meta-link.is-inactive:hover { opacity: 1; }
}
.nav__meta-link.is-inactive { cursor: default; }

/* brand mark */
.nav__mark { display: block; width: 85px; height: auto; margin: 72px 20px 20px; }

/* the search panel under the nav carries Book while the hero is in view;
   the pill takes over once that panel collapses (see js/ui/calendar.js) */
.nav:not(.is-compact) .nav__book { display: none; }
.nav__book {
  padding: 12px 20px; flex-shrink: 0;
  font-size: var(--t-xs);
  color: var(--paper);
  background: var(--accent);
  border: none; border-radius: var(--r-pill);
  cursor: pointer;
  transition: background 200ms ease;
}
@media (hover: hover) {
  .nav__book:hover { background: var(--accent-hover); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 900px) {
  .text-tagline { font-size: var(--t-2xl); }
}

/* Mobile */
@media (max-width: 600px) {
  /* the chrome sits on a wider margin here, where a phone edge is closer */
  :root { --chrome-inset: 16px; }
  /* menu panel: tighter list, smaller links, meta matched to the list gutter */
  .nav__list { padding: 40px 20px; }
  .nav__meta { padding: 40px 20px 0; }

  .text-tagline { font-size: min(30px, 6.2vw); }
  .text-body { font-size: var(--t-sm); }
}

/* Fine-tune very small screens so the nav never crowds */
@media (max-width: 380px) {
  .nav { padding-left: 12px; }
  .nav__logo img { width: 128px; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .nav__panel,
  .nav__link,
  .nav__icon { transition-duration: 1ms !important; transition-delay: 0ms !important; }
}
