/* avhort.com — shared styles. Pure CSS, no build step. */

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Dark is the default. The theme lives on <html data-theme>, set by the inline
   script in each page's <head> before first paint. Without an explicit choice
   we follow the OS setting. */
:root {
  --bg: #0f1114;
  --surface: #171a1f;
  --surface-hover: #1d2128;
  --border: #262b33;
  --text: #e8ebef;
  --text-secondary: #a4acb8;
  --text-tertiary: #737b87;
  --overlay: rgba(8, 9, 11, 0.7);

  --accent: #7ea6ff;
  --topic-analytics: #6cc6a0;
  --topic-books: #e0a355;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --radius: 12px;
  --transition: 180ms cubic-bezier(0.2, 0, 0.2, 1);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fcfcfb;
    --surface: #f3f4f2;
    --surface-hover: #eaebe8;
    --border: #e0e2dd;
    --text: #16181c;
    --text-secondary: #4e5560;
    --text-tertiary: #79808b;
    --overlay: rgba(20, 22, 26, 0.35);

    --accent: #2f62d6;
    --topic-analytics: #1d7f5a;
    --topic-books: #a96a17;
  }
}

:root[data-theme="light"] {
  --bg: #fcfcfb;
  --surface: #f3f4f2;
  --surface-hover: #eaebe8;
  --border: #e0e2dd;
  --text: #16181c;
  --text-secondary: #4e5560;
  --text-tertiary: #79808b;
  --overlay: rgba(20, 22, 26, 0.35);

  --accent: #2f62d6;
  --topic-analytics: #1d7f5a;
  --topic-books: #a96a17;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 4.5rem) clamp(1.25rem, 5vw, 2rem) 3rem;
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.site-name {
  margin: 0;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

a.site-name { text-decoration: none; color: var(--text); }

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 0.35rem;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
}

.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn svg { width: 18px; height: 18px; }

/* Only one of the two theme glyphs is ever shown. */
.icon-btn .icon-moon { display: none; }
:root[data-theme="light"] .icon-btn .icon-moon { display: block; }
:root[data-theme="light"] .icon-btn .icon-sun { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .icon-btn .icon-moon { display: block; }
  :root:not([data-theme="dark"]) .icon-btn .icon-sun { display: none; }
}

/* ---------- Menu panel ---------- */

.menu[hidden] { display: none; }

.menu {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--overlay);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1rem;
  overflow-y: auto;
}

.menu-inner {
  position: relative;
  width: 100%;
  max-width: 38rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 1.5rem 1.75rem;
}

.menu-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.menu-close:hover { background: var(--surface); color: var(--text); }
.menu-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.menu .label:first-of-type { margin-top: 1.75rem; }

body.menu-open { overflow: hidden; }

/* ---------- Intro ---------- */

.intro p {
  margin: 0 0 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.intro p:last-child { margin-bottom: 0; }

/* Keyword highlights inside running text. Some of them are links to the
   topic pages; they should read as coloured words, not as browser links. */
.kw { font-weight: 600; }

a.kw {
  text-decoration: none;
  text-underline-offset: 3px;
}
a.kw:hover,
a.kw:focus-visible { text-decoration: underline; }
.kw-data { color: var(--topic-analytics); }
.kw-risk { color: var(--accent); }
.kw-books { color: var(--topic-books); }

/* ---------- Section headings ---------- */

h2 {
  margin: 2.75rem 0 1rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.label {
  margin: 2.5rem 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

/* ---------- Link pills ---------- */

.pills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.pills a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.95rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color var(--transition), border-color var(--transition);
}

.pills a:hover,
.pills a:focus-visible {
  background: var(--surface-hover);
  border-color: #333a45;
}

.pills svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-secondary); }

/* ---------- Topic tiles ---------- */

.tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.tile {
  display: block;
  padding: 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: background-color var(--transition), border-color var(--transition);
}

.tile:hover,
.tile:focus-visible {
  background: var(--surface-hover);
  border-color: #333a45;
}

.tile-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
}

.tile-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.tile-icon svg { width: 18px; height: 18px; }

.tile-title { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }

.tile p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.55;
}

.tile-soon {
  display: inline-block;
  margin-top: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.site-footer a { color: var(--text-tertiary); }

/* ---------- Stub topic pages ---------- */

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 2rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
}
.back:hover { color: var(--text); }

.stub-word {
  margin: 0;
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.stub-note {
  margin: 1rem 0 0;
  color: var(--text-tertiary);
  font-size: 0.95rem;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 34rem) {
  .tiles { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
