/* The phone app look (on every page after site13.css): the tab bar at the bottom on phones and in the installed app,
   a navy header on phones, the Tools, Saved, More and offline pages, the add-to-home-screen box and Save to read later. */

/* ---- Tab bar ---- */
.app-tabs { display: none; }
@media (max-width: 720px), (display-mode: standalone) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .app-tabs { position: fixed; z-index: 1100; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
              padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
              background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(15, 42, 67, .06); }
  .app-tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 60px;
                color: var(--soft); font-size: .7rem; font-weight: 600; text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .app-tabs .icon { font-size: 1.3rem; }
  .app-tabs a[aria-current="page"] { color: #b0202d; font-weight: 750; }
  .app-tabs a:focus-visible { outline: 3px solid var(--link); outline-offset: -3px; border-radius: 10px; }
  .go-top-btn { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media print { .app-tabs, .app-nudge { display: none !important; } }

/* ---- Navy header on phones, like the app's ---- */
@media (max-width: 720px) {
  .site-header { background: var(--night); border-bottom-color: var(--night); }
  .site-header .brand, .site-header .brand:hover { color: #fff; }
  .site-header .brand span { color: #ff6b75; }
  .site-header .brand small { color: #c9d4de; }
  .site-header .header-button { color: #fff; }
  .site-header .header-button:hover { color: #fff; background: rgba(255, 255, 255, .12); }
  .site-header .header-button:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
}

/* ---- Tools, More, offline pages ---- */
.app-page { max-width: 720px; margin: 0 auto; padding: 4px 0 24px; }
.app-title { margin: 8px 0 4px; font-size: clamp(1.5rem, 5vw, 2rem); }
.app-sub { margin: 0 0 16px; color: var(--soft); }
.app-label { margin: 24px 0 8px; font-size: .78rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--soft); }
.app-tools { display: grid; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.app-tools .tool-link { padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
@media (min-width: 600px) { .app-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.app-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 64px; margin: 0 0 8px; padding: 10px 14px;
           background: #fff; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); text-decoration: none; }
.app-row:hover { color: var(--ink); background: var(--wash); }
.app-row > .icon:first-child { font-size: 1.25rem; color: var(--accent); }
.app-row b { display: block; }
.app-row small { display: block; color: var(--soft); font-size: .85rem; }
.app-list { margin: 0; padding: 0; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.app-list li + li { border-top: 1px solid var(--line); }
.app-list a { display: flex; align-items: center; min-height: 52px; padding: 0 16px; color: var(--ink); font-weight: 650; text-decoration: none; }
.app-list a:hover { background: var(--wash); color: var(--ink); }

/* ---- Saved ---- */
.app-saved { margin: 0; padding: 0; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.app-saved li { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 14px; }
.app-saved li + li { border-top: 1px solid var(--line); }
.app-saved a { flex: 1; min-width: 0; padding: 10px 0; color: var(--ink); font-weight: 650; line-height: 1.35; text-decoration: none; }
.app-saved a:hover { color: var(--link); }
.app-empty { margin: 20px 0; padding: 16px; background: var(--wash); border-radius: 14px; }
.app-empty p { margin: 0; }
.app-empty[hidden], .app-install[hidden], .app-nudge[hidden], .read-later[hidden] { display: none; }

/* ---- Close and remove buttons ---- */
.app-x { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--soft); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.app-x:hover { background: var(--wash); color: var(--ink); }

/* ---- Add to home screen ---- */
.app-install { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.app-install p { flex: 1; min-width: 0; margin: 0; }
.app-install b { display: block; line-height: 1.3; }
.app-install small { display: block; color: var(--soft); font-size: .85rem; line-height: 1.4; }
.app-install-icon { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--night); color: #fff; font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.app-install-icon span { color: #ff6b75; }
.app-btn { flex: none; min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.app-btn:hover { background: #b5212d; }
.app-btn[hidden] { display: none; }
.app-nudge { position: fixed; z-index: 1050; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
.app-nudge .app-install { margin: 0; box-shadow: 0 10px 30px rgba(15, 42, 67, .25); }

/* ---- Story page: save to read later ---- */
.read-later { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: -8px 0 16px; padding: 0 16px; font: inherit; font-size: .95rem; font-weight: 700;
              color: var(--night); background: #fff; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.read-later:hover { background: var(--wash); }
.read-later[aria-pressed="true"] { color: #fff; background: var(--night); border-color: var(--night); }
