/* ==========================================================================
   SAMPLE — fuel station forecourt console
   ==========================================================================
   The third temperament. This one lives on a wall-mounted screen behind a
   counter, glanced at from three metres away while somebody is being served,
   at two in the morning under strip lighting. So: dark, very large numerals,
   almost no chrome, and state carried by colour and motion rather than text
   that has to be read.

   Scoped under .stn.
   ========================================================================== */

.stn {
  --bg:     #0b0f14;
  --bg-2:   #121820;
  --panel:  #161d26;
  --line:   #232c38;
  --line-2: #33404f;
  --ink:    #e8edf3;
  --ink-2:  #93a1b3;
  --ink-3:  #7d8b9d;   /* 4.98:1 on the panel; #5f6d7e was 3.21 and failed */

  --idle:   #4b5a6b;
  --live:   #22c55e;
  --hold:   #f59e0b;
  --owed:   #ef4444;
  --cyan:   #22d3ee;

  --sans: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.stn *, .stn *::before, .stn *::after { box-sizing: border-box; }
.stn svg { display: block; }
.stn a { color: var(--cyan); }

.stn-wrap { width: 100%; max-width: 90rem; margin-inline: auto; padding: 1rem clamp(.75rem, 2.5vw, 1.75rem) 4rem; }

/* ------------------------------------------------------------------ bar --- */

.stn-top {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem clamp(.75rem, 2.5vw, 1.75rem);
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 2.2rem; z-index: 40;
}
.stn-brand {
  display: flex; align-items: center; gap: .6rem;
  margin: 0;
  font-size: 1rem;          /* an h1 by markup, a brand line by design */
  font-weight: 700;
  letter-spacing: -0.01em;
}
.stn-brand i {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--cyan); color: #06212a;
  display: grid; place-items: center;
  font-style: normal; font-weight: 900; font-size: .78rem;
}
.stn-top .sp { margin-left: auto; }
.stn-meta { display: flex; gap: 1.2rem; font-size: .78rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.stn-meta b { color: var(--ink); font-weight: 600; }

/* ----------------------------------------------------------------- pumps --- */

.stn-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15.5rem), 1fr)); margin-top: 1rem; }

.pump {
  /* The tile is a <button>, so every child would be inline by default and a
     3px bar quietly becomes nothing sitting on the text baseline. Laying the
     whole thing out as a column is the fix, not styling each child in turn. */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .85rem .9rem .9rem;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .2s, transform .12s, background .2s;
}
.pump:hover { border-color: var(--line-2); }
.pump:active { transform: scale(.985); }
.pump:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* The status strip down the left edge is the thing you read from three metres. */
.pump::before {
  content: "";
  position: absolute; inset: 0 auto 0 0;
  width: 4px;
  background: var(--c, var(--idle));
}
.pump[data-s="idle"]    { --c: var(--idle); }
.pump[data-s="filling"] { --c: var(--live); }
.pump[data-s="hold"]    { --c: var(--hold); }
.pump[data-s="owed"]    { --c: var(--owed); border-color: var(--owed); }

.pump__head { display: flex; align-items: baseline; gap: .5rem; }
.pump__n { font-family: var(--mono); font-size: .72rem; color: var(--ink-3); letter-spacing: .1em; }
.pump__grade { font-size: .74rem; font-weight: 600; color: var(--c, var(--ink-2)); margin-left: auto; text-transform: uppercase; letter-spacing: .04em; }
/* An idle pump's strip is deliberately the dimmest thing on the screen, but
   the grade beside it is text and has to be read - 2.4:1 was not readable. */
.pump[data-s="idle"] .pump__grade,
.pump[data-s="idle"] .pump__state { color: var(--ink-3); }

.pump__money {
  display: block;
  font-family: var(--mono);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin: .35rem 0 .1rem;
  line-height: 1;
}
.pump[data-s="idle"] .pump__money { color: var(--ink-3); }
.pump__litres { display: block; font-family: var(--mono); font-size: .78rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.pump__state {
  display: flex; align-items: center; gap: .38rem;
  margin-top: .6rem;
  font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--c, var(--idle));
}
.pump__dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pump[data-s="filling"] .pump__dot { animation: stn-pulse 1.1s ease-in-out infinite; }
@keyframes stn-pulse { 50% { opacity: .25; transform: scale(.7); } }

/* Nozzle-lifted-but-not-flowing is the state that costs money, so it gets the
   only genuinely attention-grabbing treatment on the screen. */
.pump[data-s="owed"]::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--owed);
  animation: stn-alarm 1.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes stn-alarm { 50% { box-shadow: inset 0 0 24px -6px var(--owed), inset 0 0 0 1px var(--owed); } }

.pump__bar { display: block; height: 3px; border-radius: 99px; background: #0d131a; margin-top: .7rem; overflow: hidden; }
.pump__bar i { display: block; transition: width .25s linear; height: 100%; background: var(--c, var(--idle)); width: 0; }

/* ---------------------------------------------------------------- lower --- */

.stn-cols { display: grid; gap: .9rem; grid-template-columns: minmax(0, 1fr); margin-top: .9rem; }
@media (min-width: 68rem) { .stn-cols { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.card__head {
  display: flex; align-items: center; gap: .6rem;
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.card__head h2 { margin: 0; font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.card__head .sp { margin-left: auto; }
.card__body { padding: .9rem; }
.card__body--flush { padding: 0; }

table.tx { width: 100%; border-collapse: collapse; font-size: .82rem; }
.tx th, .tx td { text-align: left; padding: .5rem .9rem; border-bottom: 1px solid var(--line); }
.tx thead th { font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.tx td.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tx tbody tr:last-child td { border-bottom: 0; }
.tx tbody tr.is-new { animation: stn-row .4s cubic-bezier(.16,1,.3,1); }
@keyframes stn-row { from { background: rgba(34,211,238,.14); } }
.tx .who { color: var(--ink-2); font-size: .76rem; }

.tank { display: grid; gap: .8rem; }
.tank__row { display: grid; grid-template-columns: 1fr auto; gap: .25rem .8rem; font-size: .82rem; align-items: baseline; }
.tank__row b { font-weight: 600; }
.tank__row em { font-style: normal; font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: .78rem; }
.tank__bar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: #0d131a; overflow: hidden; position: relative; }
.tank__bar i { display: block; height: 100%; transition: width .6s cubic-bezier(.16,1,.3,1); }
/* The reorder threshold is drawn on the bar rather than described in a note,
   because "below 25%" is a rule you have to remember and a line is one you do not. */
.tank__bar u {
  position: absolute; top: 0; bottom: 0; left: 25%;
  width: 2px; margin-left: -1px;
  background: rgba(232, 237, 243, .65);
  box-shadow: 0 0 0 1px rgba(11, 15, 20, .55);
}

.stn-btns { display: flex; gap: .5rem; flex-wrap: wrap; }
.sbtn {
  font: inherit; font-size: .78rem; font-weight: 600;
  padding: .45rem .85rem;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  color: var(--ink);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.sbtn:hover { background: #1b2531; border-color: var(--ink-3); }
.sbtn:active { transform: scale(.97); }
.sbtn--go { background: var(--cyan); border-color: var(--cyan); color: #06212a; }
.sbtn--go:hover { background: #4ee0f5; border-color: #4ee0f5; }
/* A shade darker than --owed. White on #ef4444 is 3.76:1, which is fine for a
   border and not fine for 12px button text. The alarm keeps the brighter red. */
.sbtn--stop { background: #dc2626; border-color: #dc2626; color: #fff; }
.sbtn[disabled] { opacity: .4; cursor: not-allowed; }

.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: .8rem; }
.kpi div { background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: .7rem .8rem; }
.kpi dt { font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.kpi dd { margin: .25rem 0 0; font-family: var(--mono); font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.stn-toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; display: grid; gap: .5rem; justify-items: end; }
.stn-toast {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--cyan);
  color: var(--ink);
  border-radius: 8px;
  padding: .55rem .85rem;
  font-size: .8rem;
  max-width: 24rem;
  box-shadow: 0 16px 34px -18px #000;
  animation: stn-in .25s cubic-bezier(.16,1,.3,1);
}
.stn-toast[data-k="warn"] { border-left-color: var(--hold); }
.stn-toast[data-k="stop"] { border-left-color: var(--owed); }
@keyframes stn-in { from { opacity: 0; transform: translateY(8px); } }

/* ----------------------------------------------------------- design note --- */

.stn-note {
  margin-top: 1.5rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(1.2rem, 3vw, 2rem);
}
.stn-note h2 { margin: 0 0 .8rem; font-size: 1.25rem; letter-spacing: -0.02em; }
.stn-note h3 { margin: 1.6rem 0 .4rem; font-size: .95rem; }
.stn-note p  { margin: 0 0 .7rem; color: var(--ink-2); line-height: 1.7; max-width: 46rem; }
.stn-note code { font-family: var(--mono); font-size: .86em; background: #0d131a; border-radius: 4px; padding: .1em .35em; color: var(--cyan); }

.stn .diagram {
  --dg-fill: #121820;
  --dg-group: #0e141b;
  --dg-line: #33404f;
  --dg-line-2: #93a1b3;
  --dg-text: #e8edf3;
  --dg-muted: #93a1b3;
  --dg-warn: #f59e0b;
  --dg-accent-fill: #0d2b33;
  margin: 1.5rem 0 0;
}
.stn .diagram__scroll { background: var(--bg); border-color: var(--line); }
.stn .diagram figcaption { color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  .stn *, .stn *::before, .stn *::after {
    transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important;
  }
}

/* The site-wide focus ring is the portfolio's teal. Inside a sample that
   reads as a leak from the host page, so each one states its own. */
.stn :focus-visible { outline-color: var(--cyan); }
