/* The site chrome and theme — palette, faces, header, nav and the profile
 * block — in ONE place, loaded by every app page.
 *
 * WHY THIS EXISTS. These rules were copy-pasted into all twelve pages, each with
 * its own `flex-wrap: wrap` override. That's why the bar sat on one line on most
 * pages and spilled onto two on the dashboard. The `header`, `header h1/h2`,
 * `.header-right` and `.signout-link` rules were folded in here too (2026-09-14)
 * so the app matches the landing page instead of drifting from it page by page.
 * Pages must NOT redeclare them.
 *
 * 2026-11-16: the app takes on the landing page's "D · Dark editorial" look
 * (#208) — near-black ground, Sora headings, the roofed Unbounded wordmark,
 * plates instead of grey boxes, glowing green pills. The tokens live here.
 *
 * ALWAYS ONE LINE. `nowrap` plus `white-space: nowrap` on the items; if a future
 * destination or a narrow phone pushes past the edge, the bar scrolls sideways
 * rather than wrapping or clipping. Items are LEFT-aligned, which keeps the
 * first one reachable when it does overflow.
 */

/* The app's column width, in ONE place. Header, nav and every page's .content
 * read it, so the whole surface stays aligned and widening it later is a
 * one-line change rather than fifteen. 820 because the nav's pills need ~762px
 * for the admin's eleven destinations. */
:root { --app-width: 820px; }

/* The landing page's palette and faces (landing.html declares the same values
   inline). Unbounded for the wordmark only, Sora for headings and big numbers,
   Inter for reading. */
:root {
  --logo: "Unbounded", sans-serif; --display: "Sora", sans-serif; --body: "Inter", sans-serif;
  --bg: #0b0c0b; --plate: #161916; --plate-2: #1c201c; --line: #232823;
  --green: #4cc46a; --green-deep: #2f9a4b; --mint: #7fe39a;
  --muted: #9aa39a; --soft: #b7c0b7; --text: #f3f5f2; --light: #f2f5f1; --ink: #0b130d;
  --radius: 22px;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
/* Pages still declare their own body rule (background, colour); this sets the
   face and the headline type. */
html { background: var(--bg); }
body { font-family: var(--body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -0.02em; }
button, input, select, textarea { font-family: inherit; }
::selection { background: rgba(76,196,106,0.35); color: #fff; }

/* The landing's glowing green pill, for any app page's primary action. */
.btn-cta {
  display: inline-block; padding: 12px 24px; border: 0; border-radius: 999px;
  background: linear-gradient(180deg, var(--green), var(--green-deep));
  color: #fff; font-size: 0.95rem; font-weight: 700; text-decoration: none; cursor: pointer;
  box-shadow: 0 6px 22px rgba(76,196,106,0.3);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.btn-cta:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 10px 30px rgba(76,196,106,0.42); }
.btn-cta:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }

/* ── Header ──────────────────────────────────────────────────────────────── */

header {
  width: 100%; max-width: var(--app-width);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

/* The wordmark is the landing page's roofed "flip·hus" in Unbounded. Every page
   ships `<a href="/"><h1>FlipHus</h1></a>`; nav.js swaps the text for the
   wordmark spans on load, so the markup (and the heading-links-home rule) stays
   the same everywhere. Before it runs, the plain text shows in the same face. */
header h1 {
  font-family: var(--logo); font-size: 1.6rem; font-weight: 800; color: #fff;
  letter-spacing: -0.02em; line-height: 1; padding-top: 0.32em;
  display: inline-flex; align-items: center;
}
header h1 b { color: var(--green); font-weight: inherit; }
header h1 .roof { position: relative; display: inline-block; }
header h1 .roof::before {
  content: ""; position: absolute; left: 50%; top: -0.32em; width: 0.62em; height: 0.62em;
  border-left: 0.11em solid var(--green); border-top: 0.11em solid var(--green);
  border-radius: 2px; transform: translateX(-50%) rotate(45deg);
}
header a:hover h1 { filter: brightness(1.12); }
/* The page's own title under the wordmark, in Sora like the landing's heads. */
header h2 {
  font-family: var(--display); font-size: clamp(1.1rem, 2.6vw, 1.45rem); font-weight: 700;
  color: var(--soft); letter-spacing: -0.025em; line-height: 1.25; margin-top: 12px;
}

/* ── Profile block ───────────────────────────────────────────────────────── */

.header-right {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end;
}
.header-right img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--line); }
.header-right > a { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.header-right span { font-size: 0.85rem; color: var(--soft); font-weight: 500; }
.header-right > a:hover span { color: #fff; }

.signout-link {
  font-size: 0.82rem; color: var(--muted); text-decoration: none;
  padding: 7px 13px; border-radius: 999px;
  transition: color .15s, background .15s;
}
.signout-link:hover { color: #fff; background: rgba(255,255,255,0.06); }

/* Sign-in, shown to a visitor the app lets through (share pages, the friends
   view before auth): the landing page's green pill. */
.google-btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 20px; border-radius: 999px; border: 0;
  background: linear-gradient(180deg, var(--green), var(--green-deep));
  color: #fff; font-size: 0.88rem; font-weight: 700;
  text-decoration: none; font-family: var(--body);
  box-shadow: 0 6px 20px rgba(76,196,106,0.28);
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}
.google-btn:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 10px 28px rgba(76,196,106,0.4); }
.google-btn img { width: 16px; height: 16px; border-radius: 50%; background: #fff; padding: 1px; }

/* ── Nav ─────────────────────────────────────────────────────────────────── */

.nav-menu {
  width: 100%;
  /* The nav sets the column width for the whole app: its pills need ~762px for
     the admin's eleven destinations. --app-width carries that to the header and
     to every page's .content, so the three edges line up. */
  max-width: var(--app-width);
  display: flex;
  flex-wrap: nowrap;
  /* Left-aligned so the first pill sits under the wordmark, and so the first
     item is always at the scroll origin when the bar overflows (plain centring
     pushed "Listings" out of reach). */
  justify-content: flex-start;
  gap: 1px;
  padding: 5px;
  margin-bottom: 22px;
  border-radius: 999px;
  /* The landing page's header: translucent, blurred, a hairline. Sticky, so the
     destinations stay a thumb away on a long feed. */
  position: sticky; top: 8px; z-index: 30;
  background: rgba(17,19,17,0.82);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;
}
.nav-menu::-webkit-scrollbar { display: none; }
/* Set by nav.js when pills are hidden off an edge: fade that edge. */
.nav-menu.more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); }
.nav-menu.more-left { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 48px), transparent); }
.nav-menu.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent); }

.nav-item {
  font-family: var(--body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  /* 9px sides: the admin's eleven pills fit the 820px column (measured 805px
     with Inter loaded; 13px sides overflowed to 903px and cut off "Ops"). */
  padding: 8px 9px;
  border-radius: 999px;
  transition: color .15s, background .15s;
  /* "How it works" and "Market sales" must never break mid-label, and items
     keep their natural width — truncating labels is worse than scrolling. */
  white-space: nowrap;
  flex: 0 0 auto;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-item.active {
  color: var(--ink);
  font-weight: 700;
  background: linear-gradient(180deg, var(--mint), var(--green));
  box-shadow: 0 4px 14px rgba(76,196,106,0.3);
}

/* ── Content pages ───────────────────────────────────────────────────────── */
/* Areas, Market, Market sales, Sold, Glossary, How it works and Account all
   build on the same `.section` panel and `.stat-box` tiles, each page with its
   own copy of the old grey-box look. Rather than restyle seven copies, the
   editorial look is set once here, scoped under #app so it outranks the page
   rules (which still own layout and per-page colours). */
#app .section {
  background: var(--plate); border-radius: 28px;
  border: 1px solid rgba(255,255,255,0.05); box-shadow: none;
  padding: 30px 32px; margin-bottom: 18px;
}
#app .section h3 {
  font-family: var(--display); font-weight: 800; color: #fff;
  font-size: clamp(1.45rem, 3.4vw, 1.9rem); line-height: 1.08; letter-spacing: -0.04em;
  border-bottom: 0; padding-bottom: 0; margin-bottom: 16px;
}
#app .section p { line-height: 1.65; }
#app .stat-box { background: var(--plate-2); border-radius: 18px; padding: 18px 14px; }
#app .stat-box .stat-value {
  font-family: var(--display); font-weight: 800; letter-spacing: -0.04em;
  font-size: clamp(1.45rem, 3.6vw, 2rem); line-height: 1.05; font-variant-numeric: tabular-nums;
}
#app :is(.area-card, .term-card, .competitor, .indicator-card, .sold-card, .moat-card, .step) { border-radius: 16px; }
#app :is(.area-table, .cost-table, .matrix) th { font-weight: 600; letter-spacing: 0.08em; }

/* Wide comparison tables scroll inside their panel on a phone rather than
   pushing the whole page sideways (Market's matrix was 469px at 375). */
@media (max-width: 640px) {
  #app .matrix { display: block; max-width: 100%; overflow-x: auto; }
}

@media (max-width: 640px) {
  #app .section { padding: 22px 20px; border-radius: 22px; }
  #app .instructions { padding: 16px 18px; font-size: 0.8rem; }
  header h1 { font-size: 1.35rem; }
  header h2 { font-size: 1.05rem; margin-top: 10px; }
  .nav-menu { top: 6px; }
}
