/* ==========================================================================
   uitech.ro - "technical specification document"
   A single static page. Rail + numbered sections, engineering-tool UI.
   Everything below is driven by the tokens in :root.
   ========================================================================== */

:root {
  /* --- Base ---------------------------------------------------------------
     Black/white/gray only. No decorative hue.
     Contrast, measured (WCAG 2.1):
       --ink    19.80:1 on --bg      AAA
       --text   17.72:1 on --bg      AAA
       --muted   5.29:1 on --bg      AA
                 4.81:1 on --sunken  AA   (worst case: rail + table hover)
     There is one gray for de-emphasised text, not two. An earlier lighter
     tone measured 4.26:1 and failed AA at label sizes, so label hierarchy
     comes from letter-spacing and weight instead. */
  --bg:      #FFFFFF;
  --panel:   #FAFAFA;
  --sunken:  #F4F4F5;
  --ink:     #0A0A0A;
  --text:    #18181B;
  --muted:   #6B6B72;
  --rule:    #E4E4E7;
  --rule-2:  #D4D4D8;

  /* --- Status scale -------------------------------------------------------
     The only colour in the system, and only ever used to signal state.
       green = shipped / stable / resolved
       amber = medium / in progress
       red   = critical / unresolved / dispute
     Each foreground is checked against its own tinted background, not --bg. */
  --ok-fg:     #14663C;
  --ok-bg:     #E8F4EC;
  --ok-line:   #B4D8C2;

  --warn-fg:   #7A4A05;
  --warn-bg:   #FCF2E2;
  --warn-line: #E6CC9C;

  --crit-fg:   #9B1C1C;
  --crit-bg:   #FCEBEB;
  --crit-line: #E7BCBC;

  /* --- Lifecycle scale ----------------------------------------------------
     A second, separate axis. Severity above describes the state of an issue;
     lifecycle describes whether a thing is currently running. Deliberately a
     true neutral gray with no hue in it, so RETIRED cannot be misread as a
     washed-out amber or a soft failure state. */
  --idle-fg:   #3F3F46;
  --idle-bg:   #EFEFF1;
  --idle-line: #D4D4D8;

  /* --- Type ---------------------------------------------------------------
     One family. Hierarchy comes from numbering, weight, and rules. */
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo,
          Consolas, "Liberation Mono", monospace;

  --fs-xs:   0.6875rem; /* 11px - chips, rail numbers, footer */
  --fs-sm:   0.75rem;   /* 12px - rail, table cells, labels */
  --fs-base: 0.875rem;  /* 14px - body copy */
  --fs-md:   0.9375rem; /* 15px - stat values, CTA */
  --fs-h3:   0.875rem;  /* 14px */
  --fs-h2:   1.0625rem; /* 17px */
  --fs-h1:   1.375rem;  /* 22px */

  /* --- Space --------------------------------------------------------------- */
  --rail-w:  15rem;
  --gutter:  1.25rem;
  --measure: 74ch;
  --sec-gap: 3.25rem;
  --topbar-h: 3rem;
  --railbar-h: 2.75rem; /* mobile only: height of the horizontal rail strip */
}

@media (min-width: 60em) {
  :root { --gutter: 2.5rem; }
}


/* ==========================================================================
   Base
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  /* Anchors must clear the sticky topbar and, on mobile, the rail strip too. */
  scroll-padding-top: calc(var(--topbar-h) + var(--railbar-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

@media (min-width: 60em) {
  html { scroll-padding-top: calc(var(--topbar-h) + 1.5rem); }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.3; }
h1 { font-size: var(--fs-h1); letter-spacing: -0.01em; color: var(--ink); }
h2 { font-size: var(--fs-h2); letter-spacing: 0.02em; color: var(--ink); }
h3 { font-size: var(--fs-h3); font-weight: 500; color: var(--ink); }

p, ul, ol, dl { margin: 0; }
a { color: inherit; }

/* One focus treatment, everywhere. */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px; top: 0;
  z-index: 20;
  background: var(--ink);
  color: var(--bg);
  padding: 0.6rem 1rem;
  font-size: var(--fs-sm);
}
.skip-link:focus { left: 0; }

.body { max-width: var(--measure); color: var(--text); }
.body p + p { margin-top: 0.85rem; }
.note { color: var(--muted); }


/* ==========================================================================
   Status chips and tags
   .chip  = filled, for a state in a transition or a headline status
   .tag   = outlined, quieter, for an attribute
   Both take a -ok / -warn / -crit modifier. Nothing else may use these colours.
   ========================================================================== */

.chip, .tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 0.35em 0.6em;
  border: 1px solid;
  border-radius: 2px;
  white-space: nowrap;
}

.chip-ok   { color: var(--ok-fg);   background: var(--ok-bg);   border-color: var(--ok-line); }
.chip-warn { color: var(--warn-fg); background: var(--warn-bg); border-color: var(--warn-line); }
.chip-crit { color: var(--crit-fg); background: var(--crit-bg); border-color: var(--crit-line); }
.chip-idle { color: var(--idle-fg); background: var(--idle-bg); border-color: var(--idle-line); }

.tag       { background: none; color: var(--muted); border-color: var(--rule-2); }
.tag-ok    { color: var(--ok-fg); border-color: var(--ok-line); }

.dot {
  width: 0.4em; height: 0.4em;
  background: currentColor;
  flex: none;
}


/* ==========================================================================
   Header strip
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--topbar-h);
  padding-inline: var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.topbar-label {
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink);
}

.topbar-tags {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}


/* ==========================================================================
   Document shell
   ========================================================================== */

.doc { display: block; }

@media (min-width: 60em) {
  .doc {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    align-items: start;
  }
}


/* ==========================================================================
   Left rail
   Desktop: a sticky vertical index down the left edge.
   Mobile:  a horizontal scrolling strip pinned under the header. Always
            visible, always textual, never behind a toggle.
   ========================================================================== */

.rail {
  position: sticky;
  top: var(--topbar-h);
  z-index: 9;
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
}

.rail-label {
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.rail-list { list-style: none; padding: 0; }

.rail-list a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: var(--fs-sm);
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.rail-num { font-weight: 500; color: var(--muted); }

.rail-list a:hover { color: var(--ink); }
.rail-list a:hover .rail-num { color: var(--ink); }
.rail-list a.is-current { color: var(--ink); font-weight: 500; }
.rail-list a.is-current .rail-num { color: var(--ink); }

/* Thin-stroke glyphs, drawn in currentColor so they track link state. */
.ico {
  width: 14px; height: 14px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

/* --- Mobile rail: horizontal strip ---------------------------------------- */
@media (max-width: 59.999em) {
  .rail-inner {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: var(--railbar-h);
    padding-inline: var(--gutter);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .rail-inner::-webkit-scrollbar { display: none; }

  .rail-label { flex: none; padding-right: 0.4rem; border-right: 1px solid var(--rule-2); }

  .rail-list { display: flex; gap: 0.25rem; margin: 0; }
  .rail-list a { padding: 0.35rem 0.5rem; border-radius: 2px; }
  .rail-list a.is-current { background: var(--sunken); }

  /* The label alone carries the section on narrow screens. */
  .rail-name { display: none; }
  .rail-num  { font-size: var(--fs-sm); }
}

/* --- Desktop rail: vertical index ----------------------------------------- */
@media (min-width: 60em) {
  .rail {
    height: calc(100vh - var(--topbar-h));
    border-bottom: 0;
    border-right: 1px solid var(--rule);
  }
  .rail-inner { padding: 1.75rem var(--gutter); }
  .rail-label { margin-bottom: 1rem; }
  .rail-list { display: block; }
  .rail-list li + li { margin-top: 0.15rem; }
  .rail-list a {
    align-items: flex-start;
    padding: 0.45rem 0.5rem;
    margin-inline: -0.5rem;
    white-space: normal;
  }
  .rail-list a.is-current { background: var(--sunken); }
  .ico { margin-top: 0.28rem; }
  .rail-name { color: inherit; }
}


/* ==========================================================================
   Main column
   ========================================================================== */

.main {
  padding: 2rem var(--gutter) 0;
  max-width: 62rem;
}

@media (min-width: 60em) {
  .main { padding-top: 2.75rem; }
}

/* --- Document head + metadata --------------------------------------------- */

.dochead { padding-bottom: 2rem; border-bottom: 1px solid var(--rule); }

.meta {
  margin-top: 1.25rem;
  border: 1px solid var(--rule);
  max-width: var(--measure);
}

.meta-row {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0 1rem;
  padding: 0.6rem 0.85rem;
  font-size: var(--fs-sm);
}
.meta-row + .meta-row { border-top: 1px solid var(--rule); }

.meta dt { color: var(--muted); letter-spacing: 0.06em; }
.meta dd {
  margin: 0;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (max-width: 30em) {
  .meta-row { grid-template-columns: 1fr; gap: 0.2rem; }
}


/* --- Sections -------------------------------------------------------------- */

.sec { padding-block: var(--sec-gap); }
.sec + .sec { border-top: 1px solid var(--rule); }

.sec > h2 {
  display: flex;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 1.5rem;
}

.sec-num { color: var(--muted); font-weight: 500; flex: none; }
.sec > h2 .sec-num { color: var(--ink); }

.sub + .sub,
.body + .sub,
.tbl + .sub,
.transitions + .sub { margin-top: 2.25rem; }
.sub > h3 { margin-bottom: 0.9rem; display: flex; gap: 0.75rem; }


/* --- 2.1 Scope list -------------------------------------------------------- */

.scope {
  list-style: none;
  padding: 0;
  border-top: 1px solid var(--rule);
  max-width: var(--measure);
}

.scope li {
  padding: 0.55rem 0 0.55rem 1.5rem;
  border-bottom: 1px solid var(--rule);
  color: var(--text);
  position: relative;
  font-size: var(--fs-sm);
}

.scope li::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 1.15em;
  width: 0.5rem;
  height: 1px;
  background: var(--rule-2);
}


/* --- Tables ---------------------------------------------------------------- */

.tbl {
  width: 100%;
  max-width: var(--measure);
  border-collapse: collapse;
  font-size: var(--fs-sm);
  text-align: left;
}

.tbl th {
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--rule-2);
  padding: 0.5rem 0.85rem;
}

.tbl td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--rule);
  color: var(--text);
}

.tbl tbody tr:hover td { background: var(--panel); }

.col-num {
  width: 4.5rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tbl td.col-num { color: var(--muted); }

.tbl + .body { margin-top: 1rem; }


/* --- 2.3 Throughput stats -------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  max-width: var(--measure);
}

@media (min-width: 40em) {
  .stats { grid-template-columns: repeat(3, 1fr); }
}

.stat { background: var(--bg); padding: 0.9rem 0.85rem; }

.stat-v {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.stat-k {
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 0.25rem;
}


/* --- 2.4 Compliance transitions -------------------------------------------- */

.transitions {
  list-style: none;
  padding: 0;
  margin-top: 1.25rem;
  border-top: 1px solid var(--rule);
  max-width: var(--measure);
}

.transitions li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}

.to { color: var(--muted); flex: none; }

.transition-note {
  flex: 1 1 16rem;
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.5;
}


/* --- Definitions -----------------------------------------------------------
   The one place the page defines a term of its own. Set apart so it reads,
   and extracts, as a standalone definition. */

.define {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  background: var(--panel);
  border-left: 2px solid var(--ink);
  color: var(--text);
  font-size: var(--fs-sm);
}

.define dfn {
  font-style: normal;
  font-weight: 700;
  color: var(--ink);
}


/* --- Plain and back links --------------------------------------------------
   .plain  = a link that must not look like one (the wordmark).
   .rail-back = the return path out of an annex, set above the numbered index. */

.plain { text-decoration: none; color: inherit; }

.rail-back { color: var(--muted); }
.rail-back .rail-name { display: inline; }

@media (min-width: 60em) {
  .rail-list li:has(.rail-back) {
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--rule);
  }
}


/* --- External links --------------------------------------------------------
   One thin glyph, no icon set. The arrow is decorative; the link text is the
   full domain, so it already names its own destination. */

.ext {
  text-decoration: none;
  border-bottom: 1px solid var(--rule-2);
}
.ext:hover { border-bottom-color: var(--ink); }

.ext::after {
  content: "\2197";
  margin-left: 0.25em;
  font-size: 0.8em;
  color: var(--muted);
}


/* --- 4.0 Prior work --------------------------------------------------------
   Each project is a sub-clause with a heading row and a status on the right,
   so the three read as a scannable column of statuses without forcing
   multi-sentence descriptions into table cells. */

.project-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  max-width: var(--measure);
  padding-bottom: 0.6rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--rule);
}

.project-head h3 { margin-bottom: 0; }

@media (min-width: 40em) {
  /* Statuses line up on the right edge of the measure, like a table column. */
  .project-head .chip { margin-left: auto; }
}

.project .transitions { margin-top: 1rem; }


/* --- 5.0 Contact ----------------------------------------------------------- */

.cta-wrap { margin-top: 1.25rem; }

.cta {
  display: inline-block;
  font-size: var(--fs-md);
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  color: var(--bg);
  background: var(--ink);
  padding: 0.85rem 1.25rem;
  border: 1px solid var(--ink);
  border-radius: 2px;
  transition: background-color 0.15s, color 0.15s;
}
.cta:hover { background: var(--bg); color: var(--ink); }


/* ==========================================================================
   Footer
   ========================================================================== */

.docfoot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1.5rem 2.5rem;
  border-top: 1px solid var(--rule);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  color: var(--muted);
}

.eod { color: var(--muted); }
