/* ==========================================================================
   02 — Reset, type, base layout, header/footer, tab bar
        MOBILE FIRST: baseline = phone, tiers added via min-width.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--c-ink);
  background: var(--c-bg-flat);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* Stops rubber-band overscrolling behind the fixed bars. */
  overscroll-behavior-y: none;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4 {
  margin: 0;
  color: var(--c-navy-2);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: -.011em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-snug); }
p  { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--c-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color var(--t-fast) var(--e-out);
}
a:hover { color: var(--c-blue-700); }

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

/* iOS zooms into fields under 16px — this avoids that. */
input, select, textarea { font-size: max(16px, 1rem); }

ul, ol { margin: 0; padding: 0; list-style: none; }

/* Keyboard focus: visible, but not on a mouse click ------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid rgba(0, 102, 179, .55);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* No sticky hover states on touch devices. */
@media (hover: none) {
  a:hover { color: var(--c-blue); }
}

.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;
}

.skip-link {
  position: fixed; top: calc(8px + var(--safe-t)); left: 8px; z-index: 200;
  transform: translateY(-260%);
  background: var(--c-navy); color: #fff; padding: 12px 18px;
  border-radius: var(--r-sm); text-decoration: none; font-weight: 600;
  transition: transform var(--t-base) var(--e-out);
}
.skip-link:focus-visible { transform: translateY(0); color: #fff; }

/* --- Layout primitives ---------------------------------------------------- */
.shell   { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.shell--narrow { max-width: var(--maxw-narrow); }

.app-body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
#app { flex: 1 0 auto; display: flex; flex-direction: column; }
#app > main { flex: 1 0 auto; }

/* Room for the bottom nav and the sticky action bar. */
body.has-tabbar #app  { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }

/* ==========================================================================
   Header
   ====================================================================== */
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  padding-top: var(--safe-t);
  transition: box-shadow var(--t-base) var(--e-out),
              border-color var(--t-base) var(--e-out);
}
.site-header.is-stuck {
  border-bottom-color: var(--c-line-soft);
  box-shadow: 0 4px 16px rgba(0, 32, 71, .07);
}
.site-header__inner {
  max-width: var(--maxw); margin-inline: auto;
  padding: 10px var(--gutter);
  display: flex; align-items: center; gap: 12px;
  min-height: 56px;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; border: 0; background: none; padding: 0;
  cursor: pointer; margin-right: auto; min-height: var(--tap);
}
.brand__mark { width: 42px; height: auto; flex: none; transition: transform var(--t-base) var(--e-spring); }
.brand:active .brand__mark { transform: scale(.94); }
.brand__word {
  font-weight: 700; font-size: .875rem; line-height: 1.15;
  color: var(--c-blue-600); letter-spacing: -.01em; text-align: left;
  white-space: nowrap;
}
/* On very narrow screens the mark carries the brand on its own. */
@media (max-width: 359px) { .brand__word { display: none; } }

/* Public header: "Sign up" is redundant on the phone — the main action is
   already large in the hero. The space belongs to sign-in. */
.header__actions .mainnav__link { display: none; }

.header__actions { display: flex; align-items: center; gap: 6px; }
/* On the phone the account menu lives in the tab bar ("Profile"). */
.header__actions--desktop { display: none; }

/* Header nav — hidden on the phone, where the tab bar carries navigation. */
.mainnav { display: none; }
.mainnav__link {
  position: relative;
  display: inline-flex; align-items: center;
  padding: 10px 14px; min-height: var(--tap); border-radius: var(--r-sm);
  font-weight: 600; font-size: var(--fs-sm); color: var(--c-navy-2);
  text-decoration: none; background: none; border: 0; cursor: pointer;
  white-space: nowrap;
  transition: color var(--t-fast) var(--e-out), background var(--t-fast) var(--e-out);
}
.mainnav__link:hover { background: var(--c-tint); color: var(--c-blue); }
.mainnav__link::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px;
  height: 3px; border-radius: 3px; background: var(--c-navy-2);
  transform: scaleX(0); transform-origin: center;
  transition: transform var(--t-base) var(--e-spring);
}
.mainnav__link.is-active::after { transform: scaleX(1); }

/* Avatar & icon buttons ---------------------------------------------------- */
.avatar {
  width: var(--tap); height: var(--tap); flex: none; border-radius: 50%;
  background: var(--c-tint-2); color: var(--c-navy-2);
  border: 0; cursor: pointer;
  display: grid; place-items: center;
  font-weight: 700; font-size: .8125rem; letter-spacing: .02em;
  transition: transform var(--t-fast) var(--e-spring), box-shadow var(--t-fast) var(--e-out);
}
.avatar:active { transform: scale(.93); }
.avatar[aria-expanded="true"] { box-shadow: var(--sh-focus); }

.iconbtn {
  width: var(--tap); height: var(--tap); flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: none; border: 0; cursor: pointer; color: var(--c-navy-2);
  transition: background var(--t-fast) var(--e-out), transform var(--t-fast) var(--e-spring);
}
.iconbtn:hover { background: var(--c-tint); }
.iconbtn:active { transform: scale(.92); }
.iconbtn svg { width: 22px; height: 22px; }

/* ==========================================================================
   Bottom navigation — the primary navigation on the phone
   ========================================================================== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-tabbar);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--c-line-soft);
  box-shadow: var(--sh-up);
  padding-bottom: var(--safe-b);
}
.tabbar__item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-height: var(--tabbar-h);
  border: 0; background: none; cursor: pointer; text-decoration: none;
  color: var(--c-muted); font-size: .6875rem; font-weight: 600; letter-spacing: .01em;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--t-fast) var(--e-out);
}
.tabbar__item svg { width: 23px; height: 23px; transition: transform var(--t-base) var(--e-spring); }
.tabbar__item::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 26px; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--c-blue);
  transform: translateX(-50%) scaleX(0); transform-origin: center;
  transition: transform var(--t-base) var(--e-spring);
}
.tabbar__item.is-active { color: var(--c-blue); }
.tabbar__item.is-active::before { transform: translateX(-50%) scaleX(1); }
.tabbar__item.is-active svg { transform: translateY(-1px); }
.tabbar__item:active svg { transform: scale(.9); }

/* ==========================================================================
   Footer
   ======================================================================== */
.site-footer { margin-top: auto; }
.footer-service {
  background: var(--c-grey-100);
  padding: 22px 0 24px;
}
.footer-service__inner {
  max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter);
}
.footer-service__label {
  font-size: var(--fs-xs); color: var(--c-ink-2); margin-bottom: 10px;
}
.footer-legal { background: var(--c-navy); color: #fff; }
.footer-legal__inner {
  max-width: var(--maxw); margin-inline: auto; padding: 20px var(--gutter);
  display: flex; flex-direction: column; gap: 16px;
}
.footer-legal__copy { font-size: var(--fs-xs); line-height: 1.45; opacity: .88; order: 2; }
.footer-legal__links {
  display: flex; flex-wrap: wrap; gap: 4px 18px; order: 1;
}
.footer-legal__links a {
  color: #fff; text-decoration: none; font-size: var(--fs-sm);
  position: relative; padding: 6px 0;
}
.footer-legal__links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 3px; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform var(--t-base) var(--e-out);
}
.footer-legal__links a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ==========================================================================
   Tier md — from here the header nav takes over
   ========================================================================== */
@media (min-width: 768px) {
  .site-header__inner { padding: 12px var(--gutter); gap: 20px; min-height: 64px; }
  .site-header { transition: box-shadow var(--t-base) var(--e-out),
                             border-color var(--t-base) var(--e-out); }
  .brand { gap: 12px; }
  .brand__mark { width: 50px; }
  .brand__word { font-size: 1rem; }

  .mainnav { display: flex; align-items: center; gap: 4px; }
  .header__actions { gap: 10px; }
  .header__actions--desktop { display: flex; }
  .header__actions .mainnav__link { display: inline-flex; }

  .tabbar { display: none; }

  .footer-service { padding: 26px 0 30px; }
  .footer-service__label { font-size: var(--fs-sm); margin-bottom: 12px; }
  .footer-legal__inner {
    flex-direction: row; align-items: center; gap: 10px 28px; padding: 18px var(--gutter);
  }
  .footer-legal__copy { order: 0; }
  .footer-legal__links { order: 0; margin-left: auto; gap: 8px 26px; }
  .footer-legal__links a { padding: 2px 0; }
}

@media (min-width: 1024px) {
  .brand__mark { width: 52px; }
  .brand__word { font-size: 1.0625rem; }
  .site-header__inner { padding: 14px var(--gutter); }
  .site-header.is-stuck .site-header__inner { padding-block: 9px; }
  .site-header__inner { transition: padding var(--t-base) var(--e-out); }
}
