/* Layout and typography. Colors and sizes come from theme.css. */

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

html {
  font-size: var(--font-size);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image: var(--frost-pattern), var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.4;
  /* room for the fixed bottom nav */
  padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}

body.no-nav { padding-bottom: env(safe-area-inset-bottom, 0px); }

h1, h2, h3 { line-height: 1.15; margin: 0 0 .5rem; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); font-weight: 700; }
[hidden] { display: none !important; }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 4px solid var(--orange); outline-offset: 2px; }

/* ---------- App frame ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: calc(.5rem + env(safe-area-inset-top, 0px)) 1rem .5rem;
  background: var(--surface-ice);
  border-bottom: var(--outline) solid var(--line);
  box-shadow: var(--frost-edge);
}

/* icicles dripping from the header */
.app-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 100%;
  height: 30px;
  margin-top: calc(var(--outline) * -1 - 1.5px);
  background: var(--icicles) repeat-x left top / 160px 30px;
  pointer-events: none;
}

.app-header .spacer { flex: 1; }

main#view {
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1rem 1rem;
}

.app-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  background: linear-gradient(180deg, #2c3b8c 0%, var(--navy) 40%, #161f55 100%);
  border-top: 2px solid #8fc4ef;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.app-nav a {
  position: relative;
  flex: 1;
  max-width: 180px;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #c9d6f5;
  text-decoration: none;
  font-size: .8rem;
  font-weight: 700;
}

.app-nav a svg { width: 28px; height: 28px; }
.app-nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .12); }
.app-nav a[aria-current="page"]::before {
  content: "";
  position: absolute; top: 0; left: 20%; right: 20%;
  height: 4px; border-radius: 0 0 4px 4px;
  background: var(--orange);
}
.app-nav .nav-badge { position: absolute; top: 8px; right: calc(50% - 26px); }

#banners { max-width: 760px; margin: 0 auto; padding: 0 1rem; }
#banners:not(:empty) { padding-top: 2rem; }
#banners:not(:empty) + main#view { padding-top: .75rem; }
