/* projectmerlin.app — the dustinmooney.com design system, ported 2026-09-16.
   Newsreader for reading, Geist Mono for labels, one accent (the Graeber
   yellow), hard corners everywhere except the toolbar. Light or dark follows
   the visitor's device unless the toggle says otherwise. */

:root {
  --bg: #fcfcfa;
  --text: #1c2128;
  --text-dim: #5c6470;
  --accent: #fcb900;
  --on-accent: #1c2128;
  --accent-soft: rgba(252, 185, 0, 0.16);
  --rule: #e3e4df;
  --card: #f4f4f0;
  --bar: #1c2128;
  --bar-fg: #f4f4f0;
  --mark-on-bar: none;
  --mark-on-page: invert(1);
  --max: 44rem;
  --wide: 65rem;
  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --err: #b42318;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #15171b; --text: #e8e6df; --text-dim: #9aa0aa;
    --accent: #fcb900; --on-accent: #0c0d10; --accent-soft: rgba(252, 185, 0, 0.14);
    --rule: #2a2e35; --card: #1d2026; --bar: #fcfcfa; --bar-fg: #1c2128; --mark-on-bar: invert(1); --mark-on-page: none;
    --err: #ff8a80;
  }
}
:root[data-theme='dark'] {
  --bg: #15171b; --text: #e8e6df; --text-dim: #9aa0aa;
  --accent: #fcb900; --on-accent: #0c0d10; --accent-soft: rgba(252, 185, 0, 0.14);
  --rule: #2a2e35; --card: #1d2026; --bar: #fcfcfa; --bar-fg: #1c2128; --mark-on-bar: invert(1); --mark-on-page: none;
  --err: #ff8a80;
}
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
html.dark-active .theme-toggle .sun { display: block; }
html.dark-active .theme-toggle .moon { display: none; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 112.5%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); font-weight: 400; letter-spacing: -0.015em; }
h2 { font-size: 1.85rem; font-weight: 400; }
h3 { font-size: 1.25rem; }

a { color: var(--text); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
.mono { font-family: var(--mono); font-size: 0.8rem; color: var(--text-dim); letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }

p { margin: 0 0 1.1em; }
ul, ol { margin: 0 0 1.1em; padding-left: 1.3em; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
img, video { max-width: 100%; height: auto; }
blockquote { margin: 1.6rem 0; padding: 0.2rem 0 0.2rem 1.2rem; border-left: 3px solid var(--accent); color: var(--text-dim); }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.35rem; }
.wide { max-width: var(--wide); margin: 0 auto; padding: 0 1.5rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Toolbar: the M box + the bar (the only rounded things on the site) ── */
.barwrap { position: sticky; top: 0; z-index: 20; margin-top: 6px; padding: calc(0.75rem + 25px) 1.5rem 0; background: linear-gradient(var(--bg) 70%, transparent); }
@media (max-width: 860px) { .barwrap { margin-top: 0; } }
.barrow { max-width: var(--wide); margin: 0 auto; display: flex; gap: 8px; align-items: stretch; }
.markbox { width: 58px; height: 58px; border-radius: 14px; background: var(--bar); display: grid; place-items: center; flex: none; text-decoration: none; }
.markbox:hover, .markbox[aria-expanded='true'] { background: var(--accent); }
.markbox img { width: 30px; height: auto; display: block; filter: var(--mark-on-bar, none); }
.markbox:hover img, .markbox[aria-expanded='true'] img { filter: none; }
.bar { flex: 1; min-width: 0; border-radius: 14px; background: var(--bar); color: var(--bar-fg); height: 58px; display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 0 10px 0 20px; }
.bar .menu { display: flex; gap: 20px; }
.bar .menu a { color: inherit; text-decoration: none; font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.78; white-space: nowrap; }
.bar .menu a:hover, .bar .menu a[aria-current='page'] { opacity: 1; }
.bar .right { justify-self: end; display: flex; align-items: center; gap: 8px; }
.bar .tool { width: 38px; height: 38px; border-radius: 8px; border: 0; padding: 0; background: color-mix(in srgb, var(--bar-fg) 10%, transparent); color: var(--bar-fg); display: grid; place-items: center; cursor: pointer; }
.bar .tool:hover { background: var(--accent); color: var(--on-accent); }
.bar .tool svg { width: 18px; height: 18px; }
.bar .cta { text-decoration: none; color: var(--bar); background: var(--bar-fg); border-radius: 8px; padding: 10px 14px; font-family: var(--mono); font-weight: 500; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.bar .cta:hover { background: var(--accent); color: var(--on-accent); }
.drawer { max-width: var(--wide); margin: 8px auto 0; border-radius: 14px; background: var(--bar); color: var(--bar-fg); padding: 8px; display: grid; gap: 2px; }
.drawer[hidden] { display: none; }
.drawer a { color: inherit; text-decoration: none; font-family: var(--mono); font-size: 0.95rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 15px 14px; border-radius: 8px; }
.drawer a:hover { background: color-mix(in srgb, var(--bar-fg) 10%, transparent); }
@media (min-width: 861px) { .drawer { display: none; } }
@media (max-width: 860px) {
  .bar { display: flex; justify-content: flex-end; padding-left: 10px; }
  .bar .menu { display: none; }
}
main { display: block; }

/* ── Buttons, cards, section headings ── */
.btn { display: inline-block; text-decoration: none; font-weight: 500; font-size: 1rem; background: var(--accent); color: var(--on-accent) !important; padding: 0.6rem 1.1rem; border: 0; cursor: pointer; font-family: var(--serif); }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn:disabled { opacity: 0.55; cursor: default; filter: none; }
.quiet { text-decoration: none; color: var(--text-dim); font-size: 1rem; border-bottom: 1px solid var(--rule); background: none; border-top: 0; border-left: 0; border-right: 0; padding: 0; font-family: var(--serif); cursor: pointer; }
.quiet:hover { color: var(--text); border-color: var(--text); }
.actions { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }

.section { margin-top: 5rem; }
.section-h { display: flex; align-items: baseline; gap: 1rem; margin: 0 0 1.5rem; }
.section-h::after { content: ''; flex: 1; height: 1px; background: var(--rule); align-self: center; }
.section-h .mono { order: 3; }
.lede { font-size: 1.15rem; line-height: 1.55; max-width: var(--max); }
.lede b { font-weight: 500; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.card { background: var(--card); padding: 22px; display: flex; flex-direction: column; gap: 7px; text-decoration: none; color: var(--text); position: relative; }
a.card:hover { outline: 1.5px solid var(--accent); outline-offset: -1.5px; text-decoration: none; }
.card h3 { margin: 0; font-size: 1.3rem; font-weight: 500; line-height: 1.25; }
.card p { margin: 0; color: var(--text-dim); font-size: 1rem; line-height: 1.5; }
.card .ico { font-size: 1.4rem; line-height: 1; }
.card .when { margin-top: auto; padding-top: 12px; }
@media (max-width: 860px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } .grid4 { grid-template-columns: 1fr 1fr; } }

.tag-pill { display: inline-block; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.04em; background: var(--accent-soft); color: var(--text); padding: 0.1rem 0.5rem; vertical-align: middle; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 0.4rem; }
.chip { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.01em; background: var(--card); border: 1px solid var(--rule); padding: 0.45rem 0.8rem; color: var(--text); }
.chip small { color: var(--text-dim); font-size: inherit; }

/* ── Hero ── */
.hero { padding: 5.5rem 0 0.75rem; max-width: 44rem; }
.hero h1 { margin: 0 0 0.9rem; text-wrap: balance; }
.hero .roleline { display: block; margin: 0 0 1.6rem; }
.hero .intro { font-size: 1.3rem; line-height: 1.5; margin: 0 0 1.9rem; }
@media (max-width: 860px) { .hero { padding-top: 3.5rem; } .hero .intro { font-size: 1.15rem; } }
.head { margin-top: 3.5rem; }
.head h1 { margin-bottom: 0.9rem; }
.head .intro { font-size: 1.2rem; line-height: 1.55; max-width: 40rem; margin: 0; }

/* ── Stats / scoreboard ── */
.stats { margin-top: 2.2rem; }
.stat { background: var(--card); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.stat b { font-family: var(--serif); font-weight: 400; font-size: 2rem; line-height: 1.1; letter-spacing: -0.01em; }
.stat span { font-family: var(--mono); font-size: 0.78rem; color: var(--text-dim); letter-spacing: 0.01em; }
.notice { margin: 2rem 0 0; padding: 0.2rem 0 0.2rem 1.2rem; border-left: 3px solid var(--accent); color: var(--text-dim); max-width: 40rem; }
.notice b { color: var(--text); font-weight: 500; }

/* ── Gallery ── */
.gallery { margin-top: 0.5rem; }
.feature { margin: 0; background: var(--card); padding: 14px; }
.frame { position: relative; aspect-ratio: 1600 / 1059; overflow: hidden; background: #0c0d10; }
.frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .7s ease; }
.frame img.active { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .frame img { transition: none; } }
.feature figcaption { padding: 14px 4px 2px; color: var(--text-dim); min-height: 3.2em; font-size: 1rem; }
.feature figcaption b { color: var(--text); font-weight: 500; }
.thumbs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 14px; }
@media (max-width: 720px) { .thumbs { grid-template-columns: repeat(3, 1fr); } }
.thumb { padding: 0; border: 2px solid var(--rule); overflow: hidden; background: none; cursor: pointer; opacity: .55; transition: opacity .25s, border-color .25s; }
.thumb img { display: block; width: 100%; height: auto; aspect-ratio: 1600 / 1059; object-fit: cover; object-position: top; }
.thumb:hover { opacity: .85; }
.thumb.active { opacity: 1; border-color: var(--accent); }

/* ── Architecture ── */
.arch { background: var(--card); padding: 18px; overflow-x: auto; }
.arch svg { display: block; min-width: 640px; width: 100%; height: auto; }
.arch .box { fill: var(--bg); stroke: var(--rule); }
.arch .hot { fill: var(--accent-soft); stroke: var(--accent); }
.arch .t { fill: var(--text); font: 500 14px var(--serif); }
.arch .s { fill: var(--text-dim); font: 11px var(--mono); }
.arch .flow { stroke: var(--text-dim); stroke-width: 1.5; fill: none; marker-end: url(#arr); }
.arch .arrow { fill: var(--text-dim); }

/* ── Story ── */
.story { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 860px) { .story { grid-template-columns: 1fr; } }
.story p b, .story p strong { font-weight: 500; }
.method { background: var(--card); padding: 22px; }
.method h3 { margin-bottom: 0.8rem; }
.method ol { margin: 0; padding-left: 1.2em; color: var(--text-dim); font-size: 1rem; }
.method li { margin: 0.55rem 0; }
.method li b { color: var(--text); font-weight: 500; }

/* ── Forms (contact, demo access) ── */
.formcard { display: grid; gap: 1rem; background: var(--card); padding: 1.4rem; margin-top: 2rem; }
.formcard h3 { margin: 0; }
.formcard .sub { margin: -0.6rem 0 0.2rem; color: var(--text-dim); font-size: 1rem; }
.formcard .row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.formcard .phone-row { display: grid; grid-template-columns: 130px 1fr; gap: 0.6rem; }
.formcard label, .formcard .lbl { display: grid; gap: 0.35rem; font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-dim); }
.formcard label .opt { text-transform: none; letter-spacing: 0; }
.formcard input, .formcard textarea, .formcard select { font: inherit; font-family: var(--serif); font-size: 1.05rem; color: var(--text); background: var(--bg); border: 1px solid var(--rule); padding: 0.65rem 0.8rem; width: 100%; border-radius: 0; }
.formcard input:focus, .formcard textarea:focus, .formcard select:focus { outline: none; border-color: var(--accent); }
.formcard textarea { resize: vertical; min-height: 9rem; }
.formcard .actions { margin: 0.2rem 0 0; }
.formcard .btn { font-size: 1.05rem; padding: 0.7rem 1.6rem; }
.required { color: var(--accent); }
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.msg-box { display: none; padding: 0.9rem 1.1rem; font-size: 0.95rem; }
.msg-box.ok { display: block; background: var(--accent-soft); color: var(--text); }
.msg-box.err { display: block; background: var(--card); border-left: 3px solid var(--err); color: var(--text); }
.fine { font-size: 0.9rem; color: var(--text-dim); margin: 0; }
.fine a { color: inherit; }
.spinner { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(0,0,0,.25); border-top-color: var(--on-accent); animation: spin .7s linear infinite; margin-right: 8px; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.divider { display: flex; align-items: center; gap: 14px; margin: 2.2rem 0 0; color: var(--text-dim); font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
@media (max-width: 600px) { .formcard .row { grid-template-columns: 1fr; } }

/* ── Prose (legal pages) ── */
.prose { font-size: 1.15rem; line-height: 1.75; }
.prose h1 { margin: 3.5rem 0 0.9rem; }
.prose h2 { margin: 2.2rem 0 0.8rem; font-size: 1.5rem; }
.prose a { text-decoration-color: var(--accent); }
.prose .meta { margin: 0 0 1.4rem; }
.prose li { margin: 0.35rem 0; }
.prose b { font-weight: 500; }
.legal-nav { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.legal-nav a { text-decoration: none; color: var(--text-dim); font-family: var(--mono); font-size: 0.8rem; margin-right: 1.2rem; }
.legal-nav a:hover { color: var(--text); }
.meta { color: var(--text-dim); font-size: 1.05rem; line-height: 1.55; }

/* ── Footer ── */
.site-footer { margin-top: 7rem; border-top: 1px solid var(--rule); padding: 2.2rem 0 3.5rem; }
.site-footer .row { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.site-footer .id { display: flex; align-items: center; gap: 12px; font-size: 1.1rem; font-weight: 500; }
.site-footer .id img { width: 26px; height: auto; filter: var(--mark-on-page); }
.site-footer .tag { margin: 0.5rem 0 0; color: var(--text-dim); max-width: 28rem; }
.site-footer nav { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; }
.site-footer nav a { text-decoration: none; color: var(--text-dim); font-family: var(--mono); font-size: 0.8rem; }
.site-footer nav a:hover { color: var(--text); }
.site-footer .copyright { text-align: center; font-size: 0.72rem; margin-top: 2.2rem; }
.formcard .lbl label { display: block; }
[hidden] { display: none !important; }
.formcard #ts-contact:empty, .formcard #ts-signup:empty { display: none; }
@media (max-width: 860px) {
  .section-h { flex-wrap: wrap; row-gap: 0.2rem; }
  .section-h::after { flex-basis: 100%; order: 2; height: 0; }
  .section-h .mono { flex-basis: 100%; }
  .stat b { font-size: 1.6rem; }
  .story, .grid2, .grid3 { gap: 12px; }
}
