/* Mereology site. Fonts are self-hosted subsets of DejaVu (see assets/fonts/DEJAVU-LICENSE.txt).
   Theme: follows the device by default; html[data-theme="light" | "dark"] overrides it. */

@font-face {
  font-family: "DejaVu Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/dejavu-serif-400.woff2") format("woff2");
}
@font-face {
  font-family: "DejaVu Serif";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/dejavu-serif-700.woff2") format("woff2");
}
@font-face {
  font-family: "DejaVu Sans Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/dejavu-sans-mono-400.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --bg: #1b1a17;
  --fg: #f4f1ea;
  --soft: rgba(244, 241, 234, 0.74);    /* body copy, about 8.9:1 */
  --faint: rgba(244, 241, 234, 0.58);   /* labels, about 5.9:1 */
  --line: rgba(244, 241, 234, 0.16);
  --line-strong: rgba(244, 241, 234, 0.3);
  --tint: rgba(244, 241, 234, 0.035);
  --bg-a: rgba(27, 26, 23, 0.94);
  --serif: "DejaVu Serif", Georgia, "Times New Roman", serif;
  --mono: "DejaVu Sans Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f4f1ea;
    --fg: #1b1a17;
    --soft: rgba(27, 26, 23, 0.78);     /* about 7.9:1 */
    --faint: rgba(27, 26, 23, 0.64);    /* about 5.0:1 */
    --line: rgba(27, 26, 23, 0.16);
    --line-strong: rgba(27, 26, 23, 0.3);
    --tint: rgba(27, 26, 23, 0.04);
    --bg-a: rgba(244, 241, 234, 0.94);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f1ea;
  --fg: #1b1a17;
  --soft: rgba(27, 26, 23, 0.78);
  --faint: rgba(27, 26, 23, 0.64);
  --line: rgba(27, 26, 23, 0.16);
  --line-strong: rgba(27, 26, 23, 0.3);
  --tint: rgba(27, 26, 23, 0.04);
  --bg-a: rgba(244, 241, 234, 0.94);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--fg); }
a:focus-visible, .btn:focus-visible, .theme-toggle:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 4px;
  border-radius: 2px;
}

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 28px; }

/* marks are inline SVG and take the text color */
svg.mk { display: block; color: var(--fg); }

.skip {
  position: absolute; left: 16px; top: -64px;
  background: var(--fg); color: var(--bg);
  font-family: var(--mono); font-size: 13px;
  padding: 10px 16px; z-index: 30; text-decoration: none;
}
.skip:focus { top: 12px; }

/* header */
header.site {
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
  background: var(--bg-a);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 10;
}
header.site .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding-top: 12px; padding-bottom: 12px;
}
header.site a.home { display: block; line-height: 0; }
header.site svg.lockup { height: 34px; width: auto; display: block; color: var(--fg); }
nav.main { display: flex; align-items: center; white-space: nowrap; }
nav.main a {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; text-decoration: none; color: var(--soft);
  margin-left: 26px; padding: 6px 0;
}
nav.main a:hover, nav.main a[aria-current="page"] { color: var(--fg); }

.theme-toggle {
  background: none; border: 1px solid transparent; color: var(--soft);
  width: 38px; height: 38px; border-radius: 50%; margin-left: 18px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.theme-toggle:hover { color: var(--fg); border-color: var(--line-strong); }
.theme-toggle svg { width: 20px; height: 20px; display: block; }

@media (max-width: 720px) {
  header.site svg.lockup { height: 28px; }
  nav.main a { margin-left: 16px; letter-spacing: 0.1em; }
  nav.main a.hide-s { display: none; }
  .theme-toggle { margin-left: 10px; }
}
@media (max-width: 480px) { nav.main a.hide-xs { display: none; } }

/* sections that need a full-width rule */
.band { border-bottom: 1px solid var(--line); }

/* hero */
.hero { text-align: center; padding: 88px 0 56px; }
.hero svg.parent-mark { width: 224px; height: 224px; margin: 0 auto; }
.hero h1 {
  font-size: clamp(44px, 9vw, 68px);
  line-height: 1.05;
  font-weight: 700;
  margin: 28px 0 0;
}
.hero .tagline {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--soft); margin: 22px 0 28px;
}
.hero p.lede { max-width: 640px; margin: 0 auto; font-size: 20px; color: var(--fg); }
.hero p.sub { max-width: 600px; margin: 18px auto 0; color: var(--soft); font-size: 17px; }

.parts {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  max-width: 760px; margin: 52px auto 0;
}
.parts a {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 20px 8px 16px; text-decoration: none; color: var(--soft);
  border: 1px solid transparent; border-radius: 4px;
  transition: border-color 0.15s, color 0.15s;
}
.parts a:hover, .parts a:focus-visible { border-color: var(--line); color: var(--fg); }
.parts svg.mk { width: 64px; height: 64px; color: inherit; }
.parts span {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em;
  text-transform: uppercase; text-align: center; line-height: 1.4;
}
@media (max-width: 560px) {
  .hero { padding: 64px 0 44px; }
  .hero svg.parent-mark { width: 176px; height: 176px; }
  .parts { grid-template-columns: repeat(2, 1fr); margin-top: 40px; }
}

/* principles */
.principles { display: grid; grid-template-columns: repeat(3, 1fr); }
.principles > div { padding: 32px 26px; text-align: center; }
.principles > div + div { border-left: 1px solid var(--line); }
.principles .k {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--faint); display: block; margin-bottom: 8px;
}
.principles p { margin: 0; font-size: 16.5px; }
@media (max-width: 720px) {
  .principles { grid-template-columns: 1fr; }
  .principles > div + div { border-left: none; border-top: 1px solid var(--line); }
}

/* entity sections: mark, name, and role centered; description justified */
section.entity { padding: 80px 0; scroll-margin-top: 64px; text-align: center; }
section.entity svg.mk { width: 132px; height: 132px; margin: 0 auto 28px; }
section.entity h2 { font-size: 38px; font-weight: 700; margin: 0 0 8px; line-height: 1.15; }
section.entity .role {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--soft); margin: 0 0 32px;
}
section.entity .copy { max-width: 640px; margin: 0 auto; }
section.entity .copy p {
  color: var(--soft); margin: 0 0 16px;
  text-align: justify; text-justify: inter-word;
  hyphens: auto; -webkit-hyphens: auto;
}
section.entity .copy p strong { color: var(--fg); font-weight: 400; }
section.entity .cta { margin-top: 12px; }
section.entity .status {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--faint); margin: 26px auto 0; line-height: 1.6;
  max-width: 640px;
}
.btn {
  display: inline-block; padding: 12px 24px;
  border: 1px solid var(--fg); border-radius: 999px;
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase;
  text-decoration: none; color: var(--fg);
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--fg); color: var(--bg); }
@media (max-width: 720px) {
  section.entity { padding: 60px 0; }
  section.entity svg.mk { width: 112px; height: 112px; margin-bottom: 22px; }
  section.entity h2 { font-size: 32px; }
  section.entity .copy p { font-size: 17px; }
}

/* how it fits: nested containment */
.fit { padding: 80px 0; text-align: center; scroll-margin-top: 64px; }
.fit h2 { font-size: 30px; font-weight: 700; margin: 0 0 8px; line-height: 1.2; }
.fit .role {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--soft); margin: 0 0 36px;
}
.nest {
  max-width: 860px; margin: 0 auto;
  border: 1px solid var(--line-strong); border-radius: 24px;
  padding: 22px 22px 22px; background: var(--tint);
}
.nest .nest { margin: 20px 0 0; max-width: none; }
.nest.internal { border-style: dashed; }
.nest-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; align-items: start; }
.nest-row > .nest { margin: 0; }
.nest > .head { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.nest > .head svg.mk { width: 40px; height: 40px; }
.nest > .head .n { font-size: 20px; line-height: 1.3; }
.nest > .head .r {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--faint); line-height: 1.5;
}
.fit p.note { color: var(--soft); max-width: 600px; margin: 30px auto 0; font-size: 16.5px; }
@media (max-width: 560px) {
  .nest { padding: 16px 12px 14px; border-radius: 20px; }
  .nest .nest { margin: 14px 0 0; }
  .nest-row { grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
  .nest > .head .n { font-size: 18px; }
  .nest > .head .r { letter-spacing: 0.1em; }
}

/* footer */
footer.site { border-top: 1px solid var(--line); padding: 44px 0 54px; }
footer.site .wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px 24px; }
footer.site .small, footer.site a {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
}
footer.site .small { color: var(--faint); }
footer.site a { color: var(--soft); text-decoration: none; }
footer.site a:hover { color: var(--fg); }
footer.site .flinks { display: flex; gap: 8px 24px; flex-wrap: wrap; justify-content: center; }
@media (max-width: 560px) {
  footer.site .wrap { flex-direction: column; text-align: center; }
}

/* policy pages (left-aligned; this is a legal document, not a showcase) */
.policy { padding: 64px 0 40px; }
.policy h1 { font-size: 40px; font-weight: 700; margin: 0 0 8px; line-height: 1.2; }
.policy .eff {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 34px;
}
.policy h2 { font-size: 23px; font-weight: 700; margin: 40px 0 10px; line-height: 1.3; }
.policy p, .policy li { color: var(--soft); max-width: 720px; }
.policy p strong, .policy li strong { color: var(--fg); font-weight: 400; }
.policy ul { padding-left: 22px; }
.policy li { margin-bottom: 8px; }
.policy a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 720px) { .policy h1 { font-size: 32px; } }

/* 404 */
.lost { text-align: center; padding: 96px 0 120px; }
.lost svg.mk { width: 120px; height: 120px; margin: 0 auto; }
.lost h1 { font-size: 34px; font-weight: 700; margin: 24px 0 8px; }
.lost p { color: var(--soft); margin: 0 0 24px; }
