/* ============================================================
   1q2w.uk — styles.css
   Static portal, no build step.

   Palette (all text pairs hold >= 4.5:1)
     --paper  #dde2e9   ground
     --ink    #1e242b   primary text
     --line   #b9c0c9   hairlines
     --dim    #59626b   secondary text
   Row fill colors are set per service as --row-ink.
   ============================================================ */

:root {
  --paper: #dde2e9;
  --ink: #1e242b;
  --line: #b9c0c9;
  --dim: #59626b;

  --sans: "Archivo", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;

  /* central measure; gutters absorb the rest so rows can fill full width */
  --col: 58rem;
  --gutter: max(1.25rem, calc((100% - var(--col)) / 2));
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.5;
  overflow-x: clip;
}

::selection { background: var(--ink); color: var(--paper); }

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

header {
  padding: clamp(1.6rem, 6vh, 3.6rem) var(--gutter) clamp(1.2rem, 4vh, 2.4rem);
}

.wordmark {
  margin: 0;
  font-size: clamp(2.2rem, 7vw, 3.5rem);
  font-weight: 780;
  font-stretch: 125%;
  letter-spacing: -0.015em;
  line-height: 1;
}

/* ---------- table ---------- */

nav { border-bottom: 1px solid var(--line); }

.cols,
.row {
  display: grid;
  grid-template-columns: 2.75rem 13rem minmax(0, 1fr) 12.5rem;
  column-gap: 1rem;
  align-items: baseline;
  padding-inline: var(--gutter);
}

.cols {
  margin: 0;
  padding-block: 0.55rem;
  border-top: 1px solid var(--line);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.cols span:nth-child(4) { text-align: right; }

.group-head {
  margin: 0;
  padding: 1.4rem var(--gutter) 0.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* per-service row fill colors (uniform depth: relative luminance 0.09-0.12) */
.svc-truenas  { --row-ink: #35608d; }
.svc-dockge   { --row-ink: #7d5a2e; }
.svc-ddns     { --row-ink: #8c4141; }
.svc-jellyfin { --row-ink: #5f4b8c; }
.svc-file     { --row-ink: #66622a; }
.svc-qbit     { --row-ink: #3d6b4a; }

/* ---------- row ---------- */

.row {
  position: relative;
  isolation: isolate;
  padding-block: 0.95rem;
  border-top: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  transition: color 0s linear 0.12s;
}

/* on hover/focus the row fills with its service color
   in four hard frames, left to right, edge to edge */
.row::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--row-ink);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.24s steps(4, jump-end);
}

.idx,
.host {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--rowdim, var(--dim));
}

.name,
.role { color: var(--rowtext, var(--ink)); }

/* text flips column by column, timed to the fill front.
   idle delays = retract order (right to left) */
.idx  { transition: color 0s linear 0.19s; }
.name { transition: color 0s linear 0.15s; }
.host { transition: color 0s linear 0.10s; }
.role { transition: color 0s linear 0.04s; }

@media (hover: hover) {
  .row:hover { color: var(--paper); --rowdim: var(--paper); --rowtext: var(--paper); }
  .row:hover::before { transform: scaleX(1); }
}

.row:focus-visible,
.row:active { color: var(--paper); --rowdim: var(--paper); --rowtext: var(--paper); }

.row:focus-visible::before,
.row:active::before { transform: scaleX(1); }

.row:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -6px;
}

/* fill delays = advance order (left to right) */
.row:hover .idx,  .row:focus-visible .idx,  .row:active .idx  { transition-delay: 0.06s; }
.row:hover .name, .row:focus-visible .name, .row:active .name { transition-delay: 0.12s; }
.row:hover .host, .row:focus-visible .host, .row:active .host { transition-delay: 0.15s; }
.row:hover .role, .row:focus-visible .role, .row:active .role { transition-delay: 0.21s; }

/* ---------- row internals ---------- */

.name {
  font-size: 1.125rem;
  font-weight: 650;
  font-stretch: 118%;
  line-height: 1.2;
}

.role {
  font-size: 0.8125rem;
  text-align: right;
}

/* ---------- mobile: two-line rows, no vertical scroll ---------- */

@media (max-width: 760px) {
  .cols,
  .host { display: none; }

  .row {
    grid-template-columns: 2.2rem minmax(0, 1fr);
    row-gap: 0.2rem;
    padding-block: 0.75rem;
  }

  .idx { grid-row: 1 / span 2; }
  .name { grid-column: 2; }
  .role { grid-column: 2; grid-row: 2; text-align: left; }
}

/* short viewports: compress rhythm, keep all six rows on screen */
@media (max-width: 760px) and (max-height: 700px) {
  header { padding-block: 1.1rem 0.8rem; }
  .group-head { padding-top: 1rem; }
  .row { padding-block: 0.55rem; }
}

/* ---------- reduced motion: fill becomes an instant state ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    animation: none !important;
  }
}
