/* Page frame: container, header, sections, footer. */

/* ---------- Container ---------- */
.container {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

/* ---------- Header ----------
   Desktop: a bar that gains a frosted surface and a hairline once the page scrolls (js/site.js sets data-scrolled).
   Phones (under 720px): a floating pill like bysourav.com's (owner, 2026-11-16: the pill is for phones only), stuck
   just under the Dynamic Island; once the page scrolls, a frosted strip fills the space behind the island. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: max(0.6rem, env(safe-area-inset-top, 0px));
  padding-bottom: 0.6rem;
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}

.site-header[data-scrolled] {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
}

@media (max-width: 719px) {
  .site-header,
  .site-header[data-scrolled] {
    padding-bottom: 0.5rem;
    border-bottom-color: transparent;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .site-header::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: env(safe-area-inset-top, 0px);
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    opacity: 0;
    transition: opacity var(--dur) var(--ease-out);
    pointer-events: none;
  }

  .site-header[data-scrolled]::before {
    opacity: 1;
  }

  .site-header .container {
    position: relative;
    width: calc(100% - 2 * max(0.75rem, env(safe-area-inset-left, 0px)));
    padding: 4px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-raised) 84%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    box-shadow:
      inset 0 0 0 1px var(--line),
      0 10px 30px -14px rgb(0 0 0 / 0.35);
  }

  /* Inside the pill everything is one height (a 48px tap target) and 4px from the edge all round, so the round icon
     and the round help button are concentric with the pill's ends. The controls share the pill's surface (no borders
     of their own); Help keeps a quiet tint so it always stands out. */
  .site-header .site-nav {
    gap: 0.25rem;
  }

  .site-header .brand img {
    width: var(--control);
    height: var(--control);
    border-radius: 50%;
  }

  .site-header .drops-pill,
  .site-header .icon-btn {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
  }

  .site-header .drops-pill {
    padding-inline: 0.55rem 0.7rem;
  }

  .site-header .btn-help {
    padding-inline: 0.95rem;
    border-color: transparent;
    background: var(--brand-soft);
  }
}

.site-header .btn-help {
  white-space: nowrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 48px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  background-image: none;
  padding-bottom: 0;
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 11px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Text links in the header hide on small screens; the footer carries them too. */
.site-nav .nav-link {
  display: none;
}

.site-nav .btn {
  height: var(--control);
  min-height: 0;
}

/* The narrowest phones: the header holds four controls, so the brand keeps its icon and drops its word. */
@media (max-width: 374px) {
  .site-header .brand span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (min-width: 720px) {
  .site-nav {
    gap: var(--space-xs);
  }

  /* Nav items are soft pills: the current one (aria-current, set in the page and, on the home page, by js/site.js as
     you scroll) is tinted violet; the others tint lightly on hover. */
  .site-nav .nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 0.95rem;
    border-radius: 999px;
    color: var(--ink-soft);
    font-weight: 500;
    text-decoration: none;
    background-image: none;
    transition:
      color var(--dur) var(--ease-out),
      background-color var(--dur) var(--ease-out),
      box-shadow var(--dur) var(--ease-out);
  }

  .site-nav .nav-link[aria-current] {
    color: var(--ink);
    background-color: var(--brand-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 22%, transparent);
  }

  .site-nav .btn-help[aria-current] {
    border-color: color-mix(in srgb, var(--brand) 40%, transparent);
    background: var(--brand-soft);
  }

  .site-nav .nav-link + .drops-pill,
  .site-nav .nav-link + .icon-btn,
  .site-nav .nav-link + .btn {
    margin-left: var(--space-s);
  }
}

@media (hover: hover) and (pointer: fine) {
  .site-nav .nav-link:not([aria-current]):hover {
    color: var(--ink);
    background-color: color-mix(in srgb, var(--brand) 7%, transparent);
  }
}

/* ---------- Sections ---------- */
.section {
  padding-block: var(--space-xl);
}

.section + .section {
  padding-top: 0;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  max-width: 40rem;
  margin-bottom: var(--space-l);
}

.section-head .lede {
  max-width: 44ch;
}

.section-head-center {
  align-items: center;
  margin-inline: auto;
  text-align: center;
}

/* ---------- Page head (inner pages) ---------- */
.page-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  padding-top: var(--space-l);
  padding-bottom: var(--space-l);
}

.page-head h1 {
  font-size: var(--step-3);
  max-width: 18ch;
}

.page-head .lede {
  max-width: 46ch;
}

/* ---------- Footer: brand and columns, then the disclaimer ---------- */
.site-footer {
  padding-top: var(--space-l);
  padding-bottom: max(var(--space-l), env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
}

.footer-top {
  display: grid;
  gap: var(--space-l);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  max-width: 32ch;
}

.footer-brand p {
  color: var(--muted);
  font-size: var(--step--1);
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-m);
}

.footer-h {
  margin-bottom: 0.25rem;
  color: var(--brand-ink);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.footer-cols ul {
  padding: 0;
  list-style: none;
}

.footer-cols a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-soft);
  font-weight: 500;
  text-decoration: none;
  background-image: none;
  padding-bottom: 0;
}

.footer-cols a.footer-help {
  color: var(--ink);
  /* Words that can wrap: a block (not a flex box, which would make them one block), padded to a 44px tap target,
     with the squiggle on the words (.squiggle) so every line gets one. */
  display: block;
  min-height: 0;
  padding: 0.55rem 0;
}

@media (hover: hover) and (pointer: fine) {
  .footer-cols a:hover {
    color: var(--ink);
  }
}

.footer-bottom {
  display: grid;
  gap: 0.35rem;
  margin-top: var(--space-l);
  padding-top: var(--space-m);
  border-top: 1px solid var(--line);
}

/* The maker credit: quiet, but where people look for who made something. */
.footer-maker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.maker-link {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  min-height: 44px;
  color: var(--ink);
  font-weight: 600;
  /* The pen line sits just under the centred words of this 44px-tall box, not at its foot. */
  padding-bottom: 0;
  background-position: 0 calc(50% + 0.95em);
}

.maker-link .icon {
  width: 0.95em;
  height: 0.95em;
  color: var(--brand-ink);
  transition: translate var(--dur) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .maker-link:hover .icon {
    translate: 2px -2px;
  }
}

@media (min-width: 860px) {
  .footer-top {
    grid-template-columns: 1fr minmax(0, 32rem);
    align-items: start;
  }

  .footer-bottom {
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: var(--space-l);
  }
}

/* The App Store badge under the footer blurb: only as wide as Apple's artwork. */
.footer-brand .store-badge {
  align-self: flex-start;
}
