/* rustycompanion.com homepage. Oxidized steel + rust data plates.
   (styles.css still serves rust-srv-setup.php and is left as is.) */

:root {
  color-scheme: dark;

  --steel-950: oklch(0.17 0.010 50);
  --steel-900: oklch(0.215 0.012 50);
  --steel-800: oklch(0.29 0.014 50);
  --steel-700: oklch(0.38 0.014 50);
  --bone: oklch(0.94 0.012 75);
  --ash: oklch(0.76 0.018 65);
  --rust-700: oklch(0.36 0.11 33);
  --rust-650: oklch(0.45 0.145 34);
  --rust-500: oklch(0.58 0.17 34);
  --rust-300: oklch(0.74 0.12 45);
  --rust-100: oklch(0.90 0.035 50);
  --amber: oklch(0.84 0.13 78);

  --font-body: 'Barlow', system-ui, sans-serif;
  --font-head: 'Big Shoulders', 'Barlow', sans-serif;
  --font-stencil: 'Big Shoulders Stencil', 'Big Shoulders', 'Barlow', sans-serif;
  --font-code: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --max: 1320px;
  --gutter: clamp(1rem, 4vw, 3rem);

  /* Light specks for brushed steel, dark pitting for rust. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 0.95 0 0 0 0 0.9 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --pitting: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.04 0 0 0 0 0.02 0 0 0 0.32 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --rivet: radial-gradient(circle, oklch(0.94 0.012 75 / 0.22) 0 1.4px, oklch(0 0 0 / 0.55) 1.9px 3px, transparent 3.4px);
}

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

body {
  margin: 0;
  background: var(--grain), var(--steel-950);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--rust-300); text-underline-offset: 3px; }
a:hover { color: var(--bone); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ash); }

code {
  font-family: var(--font-code);
  font-size: 0.9em;
  background: var(--steel-800);
  color: var(--bone);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  background: var(--amber);
  color: var(--steel-950);
  padding: 0.5rem 1rem;
  font-weight: 600;
  z-index: 10;
}
.skip-link:focus { top: 1rem; }

/* ---- Masthead ------------------------------------------------------------ */

.masthead {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) var(--gutter) clamp(1.25rem, 2.5vw, 2rem);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 3rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 1.2vw, 1rem);
  color: var(--bone);
  text-decoration: none;
}
.brand img { width: clamp(44px, 5vw, 64px); height: auto; }
.brand-name {
  font-family: var(--font-stencil);
  font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  line-height: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.tagline {
  margin: 0;
  max-width: 36ch;
  color: var(--ash);
  font-size: clamp(1rem, 1.3vw, 1.15rem);
  line-height: 1.45;
}

/* ---- Two doors: build board + bot ----------------------------------------- */

.doors {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1rem, 2vw, 1.5rem);
}
@media (min-width: 1000px) {
  .doors { grid-template-columns: minmax(0, 1.6fr) minmax(330px, 1fr); }
}

.plate {
  position: relative;
  min-width: 0;
  border-radius: 6px;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat, no-repeat;
  background-size: 9px 9px, 9px 9px, 9px 9px, 9px 9px, auto, auto;
  background-position: top 11px left 11px, top 11px right 11px, bottom 11px left 11px, bottom 11px right 11px, 0 0, 0 0;
}

.plate--steel {
  background-image: var(--rivet), var(--rivet), var(--rivet), var(--rivet), var(--grain),
    linear-gradient(var(--steel-900), var(--steel-900));
  border: 1px solid var(--steel-800);
  box-shadow: inset 0 1px 0 oklch(0.94 0.012 75 / 0.05), 0 24px 48px -28px oklch(0 0 0 / 0.9);
}

.plate--rust {
  background-image: var(--rivet), var(--rivet), var(--rivet), var(--rivet), var(--pitting),
    linear-gradient(165deg, var(--rust-650), oklch(0.39 0.13 32));
  border: 1px solid var(--rust-700);
  box-shadow: inset 0 1px 0 oklch(0.94 0.012 75 / 0.08), 0 24px 48px -28px oklch(0 0 0 / 0.9);
}

.plate h2 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ---- Build board --------------------------------------------------------- */

.board { display: flex; flex-direction: column; }
.board-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}
.board-head h2 { font-size: clamp(1.3rem, 2vw, 1.6rem); color: var(--rust-300); }

.freshness { margin: 0; color: var(--ash); font-size: 0.95rem; }
.freshness.is-stale { color: var(--amber); }

.live-dot {
  position: relative;
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--amber);
  vertical-align: 0.05em;
}
.live-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--amber);
  animation: pulse 2.4s var(--ease-out) infinite;
}
.is-stale .live-dot { background: var(--ash); }
.is-stale .live-dot::after { display: none; }

@keyframes pulse {
  from { transform: scale(1); opacity: 0.55; }
  to { transform: scale(2.8); opacity: 0; }
}

.readout {
  display: grid;
  gap: 0.35rem 3rem;
  align-items: end;
  margin: clamp(1.25rem, 3vw, 2rem) 0 clamp(1.25rem, 3vw, 2rem);
  padding-bottom: clamp(1.25rem, 3vw, 2rem);
  border-bottom: 1px solid var(--steel-800);
}

.readout-label { margin: 0; color: var(--ash); font-weight: 500; }
.readout-value {
  margin: 0;
  font-family: var(--font-stencil);
  font-weight: 800;
  font-size: clamp(3.75rem, 9vw, 7.25rem);
  line-height: 0.82;
  letter-spacing: 0.005em;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
}

.readout-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 0.9rem 1.5rem;
  margin: clamp(0.9rem, 2vw, 1.4rem) 0 0;
}
.readout-meta dt { color: var(--ash); font-size: 0.9rem; font-weight: 500; }
.readout-meta dd { margin: 0.1rem 0 0; font-size: 1.2rem; font-weight: 600; overflow-wrap: anywhere; }

.unavailable { margin: 1.5rem 0; color: var(--ash); max-width: 52ch; }

.table-wrap { overflow-x: auto; margin-bottom: clamp(1.25rem, 3vw, 1.75rem); }
.branches {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.branches caption {
  text-align: left;
  color: var(--ash);
  font-weight: 500;
  padding-bottom: 0.5rem;
}
.branches th,
.branches td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--steel-800);
  vertical-align: baseline;
}
.branches thead th {
  color: var(--ash);
  font-weight: 500;
  font-size: 0.9rem;
  border-bottom-color: var(--steel-700);
}
.branches tbody th {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.branches tbody tr:last-child > * { border-bottom: 0; }
.branches td { white-space: nowrap; }
.branches td[colspan] { white-space: normal; }
.branches tr.is-public { background: oklch(0.29 0.014 50 / 0.6); }

.tag {
  display: block;
  width: fit-content;
  margin-top: 0.3rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.tag--ahead { color: var(--amber); border-color: oklch(0.84 0.13 78 / 0.5); }
.tag--behind { color: var(--ash); border-color: var(--steel-700); }

@media (max-width: 640px) {
  .branches thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .branches tbody, .branches tr, .branches th, .branches td { display: block; }
  .branches tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1rem;
    padding: 0.9rem 0.75rem;
    border-bottom: 1px solid var(--steel-800);
  }
  .branches tbody tr:last-child { border-bottom: 0; }
  .branches tbody th { grid-column: 1 / -1; padding: 0; border: 0; }
  .branches td { padding: 0; border: 0; }
  .branches td[colspan] { grid-column: 1 / -1; }
  .branches td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--ash);
    font-size: 0.82rem;
  }
}

.board-foot {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 2rem;
  padding-top: clamp(1.1rem, 2.5vw, 1.5rem);
  border-top: 1px dashed var(--steel-700);
}
.foot-label { margin: 0 0 0.15rem; color: var(--ash); font-weight: 500; }
.foot-value { margin: 0; font-size: 1.25rem; font-weight: 600; }
.foot-sub { display: block; font-size: 0.95rem; font-weight: 500; color: var(--ash); }
.countdown { color: var(--amber); }

/* ---- Bot plate ----------------------------------------------------------- */

.bot { display: flex; flex-direction: column; gap: 1.25rem; }

.kicker {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rust-100);
}

.bot h2 {
  font-size: clamp(2rem, 3.1vw, 2.65rem);
  line-height: 0.95;
  color: var(--bone);
  max-width: 17ch;
}

.feeds { list-style: none; margin: 0; padding: 0; }
.feeds li {
  padding: 0.65rem 0;
  border-top: 1px solid oklch(0.94 0.012 75 / 0.2);
  color: var(--rust-100);
  line-height: 1.45;
}
.feeds li:last-child { border-bottom: 1px solid oklch(0.94 0.012 75 / 0.2); }
.feeds strong { display: block; color: var(--bone); font-size: 1.1rem; font-weight: 600; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.4rem;
  border: 1px solid transparent;
  border-radius: 4px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.2s var(--ease-out), border-color 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.btn--primary { background: var(--bone); color: var(--steel-950); }
.btn--primary:hover { background: var(--amber); color: var(--steel-950); }
.btn--ghost { color: var(--bone); border-color: oklch(0.94 0.012 75 / 0.55); }
.btn--ghost:hover { color: var(--bone); background: oklch(0.94 0.012 75 / 0.1); border-color: var(--bone); }
.plate--rust :focus-visible { outline-color: var(--bone); }

.proof { margin: 0; color: var(--rust-100); font-size: 0.95rem; }

/* ---- Setup steps (inside the bot plate) -------------------------------- */

.setup {
  margin-top: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px dashed oklch(0.94 0.012 75 / 0.3);
}
.setup-title {
  margin: 0 0 0.9rem;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bone);
}
.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.1rem minmax(0, 1fr);
  align-items: baseline;
}
.steps li::before {
  content: counter(step);
  grid-row: span 2;
  font-family: var(--font-stencil);
  font-weight: 800;
  font-size: 2rem;
  line-height: 0.9;
  color: oklch(0.94 0.012 75 / 0.8);
}
.steps p { margin: 0; color: var(--rust-100); line-height: 1.45; }
.steps .step-name { color: var(--bone); font-weight: 600; font-size: 1.05rem; }
.plate--rust code { background: oklch(0 0 0 / 0.28); color: var(--bone); }

/* ---- Footer -------------------------------------------------------------- */

.site-foot {
  max-width: var(--max);
  margin: clamp(3rem, 7vw, 5rem) auto 0;
  padding: 1.5rem var(--gutter) 2.5rem;
  border-top: 1px solid var(--steel-800);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
  color: var(--ash);
  font-size: 0.95rem;
}
.site-foot p { margin: 0; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; }
.site-foot a { color: var(--ash); }
.site-foot a:hover { color: var(--bone); }

/* ---- Entrance ------------------------------------------------------------ */

@media (prefers-reduced-motion: no-preference) {
  .doors > * { animation: rise 0.7s var(--ease-out) both; }
  .doors > * + * { animation-delay: 0.08s; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot::after { animation: none; opacity: 0; }
}
