/* termd.dev — design system per the Idiomd micro-site pattern.
   Paper/ink base, one dialect accent (termd petrol). Dark mode via
   prefers-color-scheme. Status colors are semantic and family-wide. */

:root {
  --paper: #FAFAF7;
  --surface: #FFFFFF;
  --ink: #1A1A1A;
  --muted: #5C5C56;
  --border: #E4E4DC;
  --accent: #0E7C7B;
  --accent-ink: #0B5F5E;
  --accent-soft: #E4F0EF;
  --status-draft: #6B7280;
  --status-approved: #1A7F37;
  --status-deprecated: #9A6700;
  --status-rejected: #8B1E1E;
  --c-adrmd: #3D5AB9;
  --c-specmd: #7A4FC0;
  --c-termd: #0E7C7B;
  --c-uxmd: #C0447E;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151714;
    --surface: #1D201C;
    --ink: #EAEAE4;
    --muted: #A0A098;
    --border: #30332D;
    --accent: #35A8A5;
    --accent-ink: #7FD1CE;
    --accent-soft: #143231;
    --status-draft: #9CA3AF;
    --status-approved: #4CB868;
    --status-deprecated: #D4A72C;
    --status-rejected: #E5716B;
    --c-adrmd: #7B93E8;
    --c-specmd: #AC8BE0;
    --c-termd: #35A8A5;
    --c-uxmd: #E087B1;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- layout ---------- */

.wrap { max-width: 760px; margin: 0 auto; padding: 0 1.25rem; }
.wide { max-width: 1000px; margin: 0 auto; padding: 0 1.25rem; }

section { padding: 3.5rem 0; }
section + section { border-top: 1px solid var(--border); }

h1, h2, h3 { line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 2.6rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.7rem; margin: 0 0 1rem; }
h3 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
p { margin: 0.75rem 0; }
.lead { font-size: 1.2rem; color: var(--muted); }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-ink); }

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.6;
}
pre code { background: none; border: none; padding: 0; font-size: inherit; }

.comment { color: var(--muted); }
.accent { color: var(--accent); }

/* ---------- family bar ---------- */

.family-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}
.family-bar .wide {
  display: flex; align-items: center; gap: 1rem;
  padding-top: 0.4rem; padding-bottom: 0.4rem;
  flex-wrap: wrap;
}
.family-bar a { color: var(--muted); text-decoration: none; }
.family-bar a:hover { color: var(--ink); }
.family-bar .dialects { display: flex; gap: 0.9rem; margin-left: auto; }
.family-bar .dialects a { display: inline-flex; align-items: center; gap: 0.35rem; }
.family-bar .dialects .active { color: var(--ink); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-adrmd { background: var(--c-adrmd); }
.dot-specmd { background: var(--c-specmd); }
.dot-termd { background: var(--c-termd); }
.dot-uxmd { background: var(--c-uxmd); }

/* ---------- header / nav ---------- */

header.site {
  border-bottom: 1px solid var(--border);
  background: var(--paper);
}
header.site .wide {
  display: flex; align-items: baseline; gap: 2rem;
  padding-top: 1rem; padding-bottom: 1rem;
}
.wordmark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration: none;
}
.wordmark .tld { color: var(--accent); }
nav.main { display: flex; gap: 1.4rem; margin-left: auto; }
nav.main a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
nav.main a:hover, nav.main a[aria-current="page"] { color: var(--ink); }
nav.main a[aria-current="page"] { font-weight: 600; }

/* ---------- hero ---------- */

.hero { display: grid; grid-template-columns: 1fr 1.25fr; gap: 3rem; align-items: center; max-width: 1140px; }
@media (max-width: 860px) {
  /* drop the container padding so the animation spans the full width;
     the text column keeps its own */
  .hero { grid-template-columns: 1fr; gap: 2.25rem; padding: 0; }
  .hero > div { padding: 0 1.25rem; }
  .hero .hero-anim { max-width: 560px; margin: 0 auto; }
}
.hero .actions { display: flex; gap: 0.9rem; margin-top: 1.5rem; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--accent);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn-ghost { color: var(--accent); background: transparent; }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- cards ---------- */

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-top: 2rem; }
@media (max-width: 860px) { .cards { grid-template-columns: 1fr; } }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.4rem;
}
.card h3 { margin-top: 0; }
.card p { font-size: 0.95rem; color: var(--muted); }
.card figure { margin: 0 0 1rem; }

/* ---------- annotated code ---------- */

.annotated { display: grid; grid-template-columns: minmax(0, 1.2fr) 1fr; gap: 2rem; align-items: start; margin-top: 1.5rem; }
@media (max-width: 860px) { .annotated { grid-template-columns: 1fr; } }
.annot-list { list-style: none; margin: 0; padding: 0; font-size: 0.95rem; }
.annot-list li { padding: 0.6rem 0 0.6rem 1rem; border-left: 2px solid var(--border); margin-bottom: 0.4rem; }
.annot-list li strong { font-family: var(--mono); font-weight: 600; color: var(--accent-ink); }

/* ---------- tables ---------- */

table { border-collapse: collapse; width: 100%; margin: 1.25rem 0; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
td code { white-space: nowrap; }

/* ---------- status badges ---------- */

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15em 0.6em;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.badge-draft { color: var(--status-draft); }
.badge-approved { color: var(--status-approved); }
.badge-deprecated { color: var(--status-deprecated); }
.badge-rejected { color: var(--status-rejected); }

/* ---------- tabs (examples page) ---------- */

.tabs { display: flex; gap: 0.4rem; margin: 1.5rem 0 0; flex-wrap: wrap; }
.tabs button {
  font: inherit; font-size: 0.9rem; font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  border-bottom: none;
  padding: 0.45rem 1.1rem;
  cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--accent-ink); background: var(--surface); }
.tabpanel {
  border: 1px solid var(--border);
  border-radius: 0 8px 8px 8px;
  background: var(--surface);
  padding: 1.25rem 1.5rem;
  transition: opacity 0.2s;
}
.tabpanel[hidden] { display: none; }
.tabpanel pre { border: none; padding: 0; background: none; }

/* ---------- rendered glossary (renderer markup) ---------- */

.rendered .term-register {
  columns: 3; column-gap: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.25rem; margin-bottom: 1.5rem;
  font-size: 0.92rem;
}
@media (max-width: 860px) { .rendered .term-register { columns: 2; } }
.rendered .register-group { break-inside: avoid; }
.rendered .register-group h3 { margin: 0 0 0.2rem; font-size: 0.8rem; color: var(--muted); }
.rendered .register-group ul { list-style: none; margin: 0 0 0.9rem; padding: 0; }
.rendered .register-group .retired a { text-decoration: line-through; color: var(--muted); }
.rendered article.term { padding: 1.25rem 0; border-top: 1px solid var(--border); }
.rendered article.term h1 { font-size: 1.3rem; display: inline-block; margin: 0 0.6rem 0.25rem 0; }
.rendered article.term h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 1rem 0 0.25rem; }
.rendered article.term p, .rendered article.term ul { margin: 0.25rem 0; font-size: 0.95rem; }
.rendered .term-status {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 600;
  padding: 0.15em 0.6em; border-radius: 999px; border: 1px solid currentColor;
  vertical-align: middle;
}
.rendered .term-status-draft { color: var(--status-draft); }
.rendered .term-status-approved { color: var(--status-approved); }
.rendered .term-status-deprecated { color: var(--status-deprecated); }
.rendered .term-status-rejected { color: var(--status-rejected); }
.rendered .term-examples { list-style: none; padding-left: 0; }
.rendered .term-examples .sign { font-weight: 700; margin-right: 0.3em; }
.rendered .example.do .sign { color: var(--status-approved); }
.rendered .example.dont .sign { color: var(--status-rejected); }
.rendered .term-refs { font-size: 0.9rem; margin-top: 0.75rem; }
.rendered .term-refs .label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-right: 0.3em; }

/* ---------- hero animation ---------- */

.hero-anim { width: 100%; height: auto; }
.hero-anim text { font-family: var(--mono); font-size: 13px; fill: var(--ink); }
.hero-anim .frame { fill: var(--surface); stroke: var(--border); }
.hero-anim .sep { stroke: var(--border); }
.hero-anim .mut { fill: var(--muted); }
.hero-anim .acc { fill: var(--accent); }
.hero-anim .bar { fill: var(--border); }
.hero-anim .stream { stroke: var(--accent); stroke-width: 1.5; fill: none; }
.hero-anim .bubble { fill: var(--accent-soft); stroke: var(--accent); }
.hero-anim .bubble-text { fill: var(--accent-ink); font-size: 12px; }

.ha { opacity: 0; animation-duration: 7s; animation-iteration-count: infinite; }
.ha1 { animation-name: ha1; } .ha2 { animation-name: ha2; } .ha3 { animation-name: ha3; }
.ha4 { animation-name: ha4; } .ha5 { animation-name: ha5; } .ha6 { animation-name: ha6; }
.ha7 { animation-name: ha7; } .ha8 { animation-name: ha8; } .ha9 { animation-name: ha9; }
.ha10 { animation-name: ha10; }
.stream { stroke-dasharray: 200; stroke-dashoffset: 200; animation: hstream 7s infinite; }
.caret { animation: hblink 1s steps(2) infinite; }

@keyframes ha1 { 0%, 3% { opacity: 0; } 5%, 93% { opacity: 1; } 97%, 100% { opacity: 0; } }
@keyframes ha2 { 0%, 8% { opacity: 0; } 10%, 93% { opacity: 1; } 97%, 100% { opacity: 0; } }
@keyframes ha3 { 0%, 13% { opacity: 0; } 15%, 93% { opacity: 1; } 97%, 100% { opacity: 0; } }
@keyframes ha4 { 0%, 18% { opacity: 0; } 20%, 93% { opacity: 1; } 97%, 100% { opacity: 0; } }
@keyframes ha5 { 0%, 23% { opacity: 0; } 25%, 93% { opacity: 1; } 97%, 100% { opacity: 0; } }
@keyframes hstream { 0%, 28% { stroke-dashoffset: 200; opacity: 0; } 30% { opacity: 1; } 42%, 93% { stroke-dashoffset: 0; opacity: 1; } 97%, 100% { opacity: 0; } }
@keyframes ha6 { 0%, 42% { opacity: 0; } 46%, 93% { opacity: 1; } 97%, 100% { opacity: 0; } }
@keyframes ha7 { 0%, 48% { opacity: 0; } 50%, 93% { opacity: 1; } 97%, 100% { opacity: 0; } }
@keyframes ha8 { 0%, 53% { opacity: 0; } 55%, 93% { opacity: 1; } 97%, 100% { opacity: 0; } }
@keyframes ha9 { 0%, 58% { opacity: 0; } 60%, 93% { opacity: 1; } 97%, 100% { opacity: 0; } }
@keyframes ha10 { 0%, 66% { opacity: 0; } 70%, 93% { opacity: 1; } 97%, 100% { opacity: 0; } }
@keyframes hblink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .ha { animation: none; opacity: 1; }
  .stream { animation: none; stroke-dashoffset: 0; opacity: 1; }
  .caret { animation: none; }
}

/* ---------- static diagrams ---------- */

.diagram { width: 100%; height: auto; margin: 1.5rem 0; }
.diagram text { font-family: var(--sans); font-size: 13px; fill: var(--ink); }
.diagram .mono { font-family: var(--mono); font-size: 12px; }
.diagram .mut { fill: var(--muted); }
.diagram .frame { fill: var(--surface); stroke: var(--border); }
.diagram .edge { stroke: var(--muted); stroke-width: 1.2; fill: none; }
.diagram .edge-acc { stroke: var(--accent); stroke-width: 1.4; fill: none; }
.diagram .s-draft { stroke: var(--status-draft); }
.diagram .s-approved { stroke: var(--status-approved); }
.diagram .s-deprecated { stroke: var(--status-deprecated); }
.diagram .s-rejected { stroke: var(--status-rejected); }
.diagram .t-draft { fill: var(--status-draft); }
.diagram .t-approved { fill: var(--status-approved); }
.diagram .t-deprecated { fill: var(--status-deprecated); }
.diagram .t-rejected { fill: var(--status-rejected); }

/* ---------- family footer ---------- */

.family-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 1.5rem; }
@media (max-width: 860px) { .family-tiles { grid-template-columns: repeat(2, 1fr); } }
.tile {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  text-decoration: none;
  background: var(--surface);
}
.tile:hover { border-color: var(--muted); }
.tile .name { font-family: var(--mono); font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 0.5rem; }
.tile .job { font-size: 0.85rem; color: var(--muted); }
.tile.active { border-color: var(--accent); }

footer.site {
  border-top: 1px solid var(--border);
  padding: 2rem 0 3rem;
  font-size: 0.85rem;
  color: var(--muted);
}
footer.site a { color: var(--muted); }
footer.site .links { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 0.5rem; }

/* ---------- docs pages ---------- */

.docs-nav { font-size: 0.85rem; color: var(--muted); margin: 1.5rem 0 0; }
.docs-nav a { color: var(--muted); }
.docs-body h2 { margin-top: 2.5rem; }
.next-prev { display: flex; justify-content: space-between; margin-top: 3rem; font-size: 0.95rem; }
