/* ============================================================
   data_subdomain.css
   Stylesheet for data.<tenant> HTML view.
   Visual structure 1:1 with docs/reference/AKINOS Structured
   Data Layer (standalone).html — see :root vars + .machine-*
   block below. Server-rendered, zero JS.
   ============================================================ */

:root {
  --font-system: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif:  Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-mono:   "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg:           #faf9f6;
  --panel:        #ffffff;
  --ink:          #1c1b18;
  --ink-soft:     #56544d;
  --ink-faint:    #8a877d;
  --rule:         #e6e3db;
  --rule-strong:  #d2cec3;
  --tag-bg:       #efece4;
  --accent:       #005B65;

  --maxw:    860px;
  --row-pad: 9px 0;
  --stack:   24px;
  --lh:      1.62;
}

[data-typeface="system"] { --font: var(--font-system); }
[data-typeface="serif"]  { --font: var(--font-serif); }
[data-typeface="mono"]   { --font: var(--font-mono); }
[data-density="compact"]     { --row-pad: 4px 0; --stack: 14px; --lh: 1.45; }
[data-density="comfortable"] { --row-pad: 9px 0; --stack: 24px; --lh: 1.62; }

/* ── Background palettes ─────────────────────────────────────
   warm   — cream page, white cards (default in the reference).
   petrol — cool blue-grey page, slightly lifted cards. Chosen
            as the brand default for the data subdomain.        */
[data-bg="petrol"] {
  --bg:           #F0F6F8;
  --panel:        oklch(0.985 0.006 216);
  --rule:         oklch(0.93  0.009 216);
  --rule-strong:  oklch(0.86  0.014 216);
  --tag-bg:       oklch(0.955 0.010 216);
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body.data-subdomain {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font, var(--font-system));
  font-size: 16px;
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 0 20px 80px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--font-mono); }

/* ── Machine banner (per-tenant notice header) ───────────── */
.machine-banner {
  max-width: var(--maxw);
  margin: 0 auto;
  border: 1px solid var(--rule-strong);
  border-top: 3px solid var(--accent);
  background: var(--panel);
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 28px;
}
.machine-banner .eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 9px;
}
.machine-banner .eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.machine-banner p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  max-width: 64ch;
}
.machine-banner b { color: var(--ink); font-weight: 600; }
.machine-banner .return { margin-top: 3px; font-size: 13.5px; }

/* ── Machine navigation (back-to-registry + crumbs) ──────── */
.machine-nav {
  max-width: var(--maxw);
  margin: 14px auto 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.machine-nav .registry-link { font-weight: 600; }
.machine-nav .crumbs {
  color: var(--ink-faint);
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.machine-nav .crumbs span::after {
  content: "\203A";
  margin-left: 7px;
  color: var(--rule-strong);
}
.machine-nav .crumbs span:last-child::after { content: ""; }

/* ── Entity card (article body) ──────────────────────────── */
.entity {
  max-width: var(--maxw);
  margin: var(--stack) auto 0;
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 26px 28px;
}

.entity-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
  margin-bottom: 4px;
}
.entity-head h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.type-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: var(--tag-bg);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.type-tag::before { content: "@type "; color: var(--ink-faint); }
.entity-id {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-faint);
  word-break: break-all;
  margin-top: 2px;
}
.entity-id::before { content: "@id  "; }
.entity-id a { color: inherit; border-bottom: 1px dotted var(--rule-strong); }
.entity-id a:hover { color: var(--accent); border-bottom-color: var(--accent); text-decoration: none; }

.entity-desc {
  margin: 15px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  max-width: 66ch;
}
.entity-desc p { margin: 0 0 10px; }
.entity-desc p:last-child { margin-bottom: 0; }

/* Unlisted chip (small "Unlisted" badge in the entity head) */
.data-hero-unlisted {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 8px;
  background: #FEF3C7;
  color: #92400E;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 4px;
  vertical-align: middle;
}

/* ── Group label (section heading inside .entity) ────────── */
.group-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 26px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}
.group-label a { color: inherit; }
.group-label a:hover { color: var(--accent); text-decoration: none; }

/* ── Data list (raw schema-org key/value rows) ───────────── */
dl.data {
  display: grid;
  grid-template-columns: minmax(150px, max-content) 1fr;
  margin: 12px 0 0;
  align-items: baseline;
}
dl.data > dt {
  padding: var(--row-pad);
  padding-right: 22px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
dl.data > dd {
  padding: var(--row-pad);
  margin: 0;
  color: var(--ink);
  font-size: 14.5px;
  min-width: 0;
  word-break: break-word;
}
dl.data.prop > dt { align-self: start; }
dl.data > dd p { margin: 0 0 9px; }
dl.data > dd p:last-child { margin-bottom: 0; }

[data-render="rows"] dl.data > dt,
[data-render="rows"] dl.data > dd { border-top: 1px solid var(--rule); }
[data-render="rows"] dl.data > dt:first-of-type,
[data-render="rows"] dl.data > dd:nth-of-type(1) { border-top: 0; }

/* ── Inline reference text helpers ───────────────────────── */
.data-ref-hidden { color: var(--ink-faint); font-style: italic; }
.data-link-external { color: var(--accent); border-bottom: 1px solid rgba(0,91,101,0.25); }
.data-link-external:hover { border-bottom-color: var(--accent); text-decoration: none; }

/* ── Stub list (registry sections) ───────────────────────── */
.reg-group { margin-top: 10px; }

/* Compact entity cards used by the registry landing page. The HTML
   shows just the entity name linked to its @id (and the page-mirror
   URL when present); the full compact reference — including @type
   and description — lives in the in-page JSON-LD payload. */
ul.entity-cards {
  list-style: none;
  margin: 0;
  padding: 0;
}
ul.entity-cards > li.entity-card {
  padding: var(--row-pad);
  border-top: 1px solid var(--rule);
  font-size: 14.5px;
}
ul.entity-cards > li.entity-card:first-child { border-top: 0; }

.entity-card .entity-name {
  font-weight: 600;
}
.entity-card .entity-mirror {
  display: inline-block;
  margin-left: 10px;
  font-size: 13px;
  color: var(--accent);
}

/* ── Raw JSON-LD disclosure ──────────────────────────────── */
/* Class is `data-source` to keep existing test selectors; visually
   matches the reference template's `.source` block exactly. */
.data-source {
  max-width: var(--maxw);
  margin: var(--stack) auto 0;
  border: 1px solid var(--rule);
  background: var(--panel);
}
.data-source > summary {
  cursor: pointer;
  padding: 13px 18px;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 9px;
  user-select: none;
}
.data-source > summary::-webkit-details-marker { display: none; }
.data-source > summary::before { content: "\25B8"; color: var(--accent); }
.data-source[open] > summary::before { content: "\25BE"; }
.data-source > summary b { color: var(--ink); font-weight: 600; }
.data-source pre {
  margin: 0;
  padding: 16px 18px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-soft);
  border-top: 1px solid var(--rule);
  white-space: pre-wrap;
  word-break: break-word;
}
.data-source pre code {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  padding: 0;
}

[data-show-source="false"] .data-source { display: none; }

/* ── Machine footer (back link + meta) ───────────────────── */
.machine-footer {
  max-width: var(--maxw);
  margin: var(--stack) auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.machine-footer a { font-weight: 600; }
.machine-footer .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
}

/* ── Empty-state for registry / type-index ───────────────── */
.data-registry-empty {
  max-width: var(--maxw);
  margin: var(--stack) auto 0;
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 22px 28px;
  color: var(--ink-soft);
  font-size: 14.5px;
}

/* ── Type-index count chip (after the h1) ────────────────── */
.data-hero-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: var(--tag-bg);
  padding: 3px 8px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 720px) {
  body.data-subdomain { padding: 0 12px 60px; }
  .machine-banner { padding: 16px 18px; }
  .entity { padding: 22px 20px; }
  .entity-head h1 { font-size: 22px; }
  dl.data {
    grid-template-columns: 1fr;
    gap: 0;
  }
  dl.data > dt { padding-bottom: 0; padding-right: 0; }
  dl.data > dd { padding-top: 2px; }
  [data-render="rows"] dl.data > dd { border-top: 0; }
}
