/* defreest.us: the public front page and the private home base share this sheet.
   No inline styles anywhere (the Content-Security-Policy allows this file only).
   Palette follows the TMOS design-lab tokens; dark is the default, light follows the device. */

:root {
  color-scheme: dark light;
  --bg: #0e1213;
  --bg-raised: #171c1d;
  --surface: #141919;
  --line: #273031;
  --line-strong: #3a4647;
  --fg: #edf0e9;
  --muted: #a9b5b1;
  --accent: #79c9b5;
  --accent-ink: #0d221c;
  --accent-soft: rgba(121, 201, 181, 0.12);
  --glow: rgba(121, 201, 181, 0.16);
  --grid: rgba(237, 240, 233, 0.035);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --wrap: 1120px;
  --gutter: 24px;
  --radius: 14px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f1;
    --bg-raised: #ffffff;
    --surface: #fbfcf9;
    --line: #d7ded8;
    --line-strong: #b9c5bc;
    --fg: #18231f;
    --muted: #51635b;
    --accent: #1f6b58;
    --accent-ink: #ffffff;
    --accent-soft: rgba(31, 107, 88, 0.09);
    --glow: rgba(31, 107, 88, 0.12);
    --grid: rgba(24, 35, 31, 0.045);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 480px at 78% -80px, var(--glow), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, 44px 44px, 44px 44px;
  background-repeat: no-repeat, repeat, repeat;
  color: var(--fg);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
svg { display: block; }

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

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 20;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 12px; }

/* Header */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.top-in {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 15px;
  text-decoration: none;
}
.brand .mk { width: 26px; height: 26px; }

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
  text-decoration: none;
}
.nav a:hover { color: var(--fg); background: var(--accent-soft); }

.who {
  margin-left: auto;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
  text-align: right;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-raised);
  color: var(--fg);
  font-size: 15.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--fg)); }
.btn-small { min-height: 38px; padding: 0 14px; font-size: 14.5px; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 44px;
  padding-top: 36px;
  padding-bottom: 24px;
}

.hero-copy { min-width: 0; }

/* The first screen settles once. Styles only, so nothing waits for the script. */
.rise { animation: rise 0.75s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.rise.r1 { animation-delay: 0.04s; }
.rise.r2 { animation-delay: 0.1s; }
.rise.r3 { animation-delay: 0.18s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

/* Sections below the first screen rise as they scroll in (site.js adds .pre only to what is not yet visible). */
.pre { opacity: 0; transform: translateY(22px); }
.pre.in { opacity: 1; transform: none; transition: opacity 0.6s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }

.eyebrow {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.id { display: flex; align-items: center; gap: 22px; }
.id-text { min-width: 0; }
.portrait {
  flex: none;
  width: 116px;
  height: 145px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--bg-raised);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 20px 40px -24px rgba(0, 0, 0, 0.7);
  object-fit: cover;
}
h1 {
  margin-top: 6px;
  font-size: clamp(2.2rem, 1.5rem + 2.4vw, 3.1rem);
  font-weight: 680;
  line-height: 1.06;
  letter-spacing: -0.028em;
  text-wrap: balance;
}

.lede {
  max-width: 35em;
  color: var(--muted);
  font-size: 1.04rem;
  text-wrap: pretty;
}
.lede strong { color: var(--fg); font-weight: 600; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

/* Project marks. One sprite (marks.svg, written by brand/build_marks.py), coloured here:
   a mark's line takes `stroke` and its core takes `color`, both inherited through <use>.
   Six shared hues, each with a value for dark ground and one for light. */

.hue-mint { --hue-d: #79c9b5; --hue-l: #1f6b58; }
.hue-blue { --hue-d: #6ea8fe; --hue-l: #1f5fbf; }
.hue-violet { --hue-d: #b392f0; --hue-l: #6d3fc4; }
.hue-gold { --hue-d: #e2b659; --hue-l: #8a6412; }
.hue-coral { --hue-d: #f08c6c; --hue-l: #b8452a; }
.hue-green { --hue-d: #7fd08f; --hue-l: #23763a; }
[class*="hue-"] { --hue: var(--hue-d); }
@media (prefers-color-scheme: light) {
  [class*="hue-"] { --hue: var(--hue-l); }
}

.mk { flex: none; width: 24px; height: 24px; fill: none; stroke: var(--fg); color: var(--hue, var(--accent)); }
.mk-tile {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid color-mix(in srgb, var(--hue, var(--accent)) 46%, var(--line));
  border-radius: 11px;
  background: color-mix(in srgb, var(--hue, var(--accent)) 10%, var(--bg-raised));
}
.mk-tile .mk { width: 22px; height: 22px; }

/* Sections */

.section { padding-top: 56px; padding-bottom: 8px; }
.section-head { max-width: 44em; margin-bottom: 22px; }
h2 {
  margin-top: 8px;
  font-size: clamp(1.5rem, 1.2rem + 1vw, 1.95rem);
  font-weight: 660;
  line-height: 1.15;
  letter-spacing: -0.018em;
}
.section-head p:last-child { margin-top: 8px; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  scroll-margin-top: 84px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card h3 {
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.005em;
}
.card > p, .app-body > p, .feature-text > p { color: var(--muted); font-size: 0.95rem; line-height: 1.55; }
.card:target { border-color: var(--accent); }
.card-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-link h3 a { text-decoration: none; }
.card-link h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card-link h3 a:focus-visible { outline: none; }
.card-link:has(a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }

.icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 4px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.card-top { display: flex; align-items: center; gap: 11px; }
.card-top h3 { flex: 1; min-width: 0; }

.tag {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.6;
  white-space: nowrap;
}
.tag-live { border-color: var(--accent); color: var(--accent); }
.tag-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.tech { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; padding-top: 8px; }
.tech li {
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-raised);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.75;
  white-space: nowrap;
}
.out {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}
.out svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* The flagship rendering opens Projects, followed by every application card. */
#applications { padding-top: 20px; }
#applications > .window { width: 100%; max-width: 900px; margin: 0 auto 24px; }

/* Applications: one card per application, a rendering of it on top and a short story under it */

.apps { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.app { grid-column: 1 / -1; gap: 0; padding: 0; overflow: hidden; transition: border-color 0.2s ease, transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.25s ease; }
.app.span-7 { grid-column: span 7; }
.app.span-5 { grid-column: span 5; }
.app.span-4 { grid-column: span 4; }
.app:hover { border-color: var(--line-strong); transform: translateY(-3px); box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.55); }
.app.card-link:hover { border-color: var(--accent); }
.app:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.shot { border-bottom: 1px solid var(--line); }
.app-body { display: flex; flex: 1; flex-direction: column; gap: 8px; padding: 18px 20px 20px; }
.facts { display: grid; gap: 5px; margin: 2px 0 4px; }
.facts li { position: relative; padding-left: 20px; font-size: 0.92rem; line-height: 1.45; }
.facts li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.42em;
  width: 9px;
  height: 5px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

/* Featured card: the platform */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 0 32px;
  border-color: var(--line-strong);
}
.feature:hover { transform: none; box-shadow: none; }
.feature h3 { font-size: 1.45rem; letter-spacing: -0.015em; }
.feature-text { display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 26px 0 26px 26px; }
.feature .mk-tile { width: 42px; height: 42px; border-radius: 13px; }
.feature .mk-tile .mk { width: 26px; height: 26px; }
.feature-text > p { font-size: 1rem; }
.feature .card-top h3 { flex: none; }
.feature .tech { margin-top: 0; padding-top: 0; }
.demos { display: grid; align-content: center; gap: 14px; padding: 26px 26px 26px 0; }
.parts { display: grid; gap: 10px; align-content: center; }
.parts li {
  display: grid;
  grid-template-columns: 7.2em minmax(0, 1fr);
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-raised);
  font-size: 0.95rem;
}
.parts b { font-weight: 650; }
.parts span { color: var(--muted); }

/* Capabilities: where to see each one */

.seen { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: auto; padding-top: 8px; font-size: 0.85rem; }
.seen a {
  padding: 1px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--fg);
  font-weight: 600;
  line-height: 1.7;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.seen a:hover { border-color: var(--accent); color: var(--accent); }

/* Principles */

.flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0 0 22px; padding: 0; list-style: none; counter-reset: f; }
.flow li { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 36px 16px 0 0; counter-increment: f; }
.flow li::before {
  content: counter(f);
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bg);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}
.flow li::after { content: ""; position: absolute; left: 26px; right: 0; top: 13px; border-top: 1px dashed var(--line-strong); }
.flow li:last-child::after { right: auto; width: 0; border: 0; }
.flow b { font-size: 1rem; font-weight: 650; }
.flow b::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 5px var(--accent-soft);
  opacity: 0;
  animation: step 6s infinite;
}
.flow li:nth-child(2) b::before { animation-delay: 1.2s; }
.flow li:nth-child(3) b::before { animation-delay: 2.4s; }
.flow li:nth-child(4) b::before { animation-delay: 3.6s; }
.flow li:nth-child(5) b::before { animation-delay: 4.8s; }
.flow span { color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
@keyframes step { 0%, 100% { opacity: 0; } 4%, 16% { opacity: 1; } 24% { opacity: 0; } }
.js .flow:not(.on) b::before { animation-play-state: paused; }

.principles { counter-reset: p; }
.principles .card { counter-increment: p; background: transparent; }
.principles .card::before {
  content: "0" counter(p);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

/* Closing */

.closing {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 32px;
  padding: 26px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    radial-gradient(520px 240px at 100% 0%, var(--accent-soft), transparent 70%),
    var(--surface);
}
.closing > div:first-child { max-width: 34em; }
.closing h2 { margin-top: 0; }
.closing p { margin-top: 6px; color: var(--muted); }
.closing .actions { margin-top: 0; }

/* Footer */

.foot {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14.5px;
}
.foot-in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  min-height: 68px;
  padding-block: 16px;
}
.foot ul { display: flex; gap: 20px; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }

/* Home base (behind the login) */

.home-head { padding-top: 40px; padding-bottom: 4px; }
.home-head h1 { font-size: clamp(1.8rem, 1.3rem + 1.6vw, 2.4rem); margin-top: 8px; }
.home-head p:last-child { margin-top: 8px; color: var(--muted); max-width: 46em; font-size: 1rem; }

.group { padding-top: 30px; }
.group h2 {
  margin: 0 0 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 92px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.tile-top { display: flex; align-items: center; gap: 9px; }
.tile b { flex: 1; min-width: 0; font-size: 1rem; font-weight: 650; }
.tile .mk { width: 20px; height: 20px; }
.tile span.what { color: var(--muted); font-size: 0.88rem; line-height: 1.45; }
.note { margin-top: 28px; color: var(--muted); font-size: 0.9rem; }

/* Not found */

.lost { padding-top: 96px; padding-bottom: 40px; max-width: 40em; }
.lost p { margin-top: 14px; color: var(--muted); }
.lost .actions { margin-top: 24px; }

/* Narrower screens */

@media (max-width: 980px) {
  .hero { gap: 28px; }
  .hero .actions { gap: 8px; }
  .hero .btn { padding-inline: 12px; font-size: 14px; }
  .hero .eyebrow { font-size: 11px; letter-spacing: 0.08em; }
  .window { max-width: 680px; margin-inline: auto; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app.span-7, .app.span-5, .app.span-4 { grid-column: 1 / -1; }
  .app:not(.feature) { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); }
  .shot { display: grid; border-right: 1px solid var(--line); border-bottom: 0; }
  .shot .screen { place-self: stretch; }
  .app-body { justify-content: center; }
  .app-body .tech { margin-top: 0; }
  .feature { grid-template-columns: minmax(0, 1fr); }
  .feature-text { padding: 22px 22px 0; }
  .demos { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 20px 22px 22px; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  html { scroll-padding-top: 64px; }
  .nav { display: none; }
  .top-in { justify-content: space-between; min-height: 54px; }
  .who { margin-left: 0; flex: 1; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 24px; padding-bottom: 20px; }
  .hero .actions { margin-top: 18px; }
  .hero .actions .btn-primary { flex-basis: 100%; }
  .lede { font-size: 1.04rem; }
  .actions .btn { flex: 1 1 auto; }
  .section { padding-top: 40px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .card { padding: 16px; }
  .cap { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; row-gap: 4px; }
  .cap .icon { grid-row: 1 / span 2; margin: 2px 0 0; }
  .cap p { grid-column: 2; }
  .feature { padding: 0; }
  .feature-text { padding: 18px 16px 0; }
  .demos { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px; }
  .id { gap: 16px; }
  .portrait { width: 88px; height: 110px; border-radius: 15px; }
  .id .eyebrow { font-size: 11px; letter-spacing: 0.08em; }
  .id h1 { margin-top: 6px; }
  .parts li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .app:not(.feature) { display: flex; padding: 0; }
  .parts li { padding: 10px 12px; }
  .shot { display: block; border-right: 0; border-bottom: 1px solid var(--line); }
  .app-body { padding: 16px; }
  .flow { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .flow li { padding: 2px 0 0 40px; }
  .flow li::after { left: 13px; right: auto; top: 26px; bottom: -14px; border-top: 0; border-left: 1px dashed var(--line-strong); }
  .flow li:last-child::after { border: 0; }
  .closing { padding: 18px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { min-height: 84px; padding: 12px; }
  .foot { margin-top: 44px; }
}

@media (max-width: 380px) {
  .tiles { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rise, .flow b::before { animation: none; }
  .btn, .card, .tile, .seen a { transition: none; }
  .card-link:hover, .tile:hover, .app:hover { transform: none; }
  .pre { opacity: 1; transform: none; }
}

@media print {
  .top, .actions, .map, .foot ul { display: none; }
  .pre { opacity: 1; transform: none; }
  .rise { animation: none; }
  body { background: #fff; color: #000; }
}
