:root {
  --bg:           #0c0b09;
  --surface:      #141210;
  --surface-2:    #0a0908;
  --border:       rgba(255,255,255,0.07);
  --accent:       #e07b20;
  --accent-hover: #f08c2a;
  --accent-dim:   rgba(224,123,32,0.15);
  --text:         #f0ece4;
  --text-dim:     #7a7570;
  --success:      #5a9e6a;
  --error:        #c25b4a;
  --working:      #4a7ab8;

  --font-display: 'Barlow Condensed', 'Bebas Neue', system-ui, sans-serif;
  --font-body:    'IBM Plex Sans', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', 'Menlo', monospace;
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

/* ---- layout ----------------------------------------------------------- */

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 2rem;
}

body.job .container { max-width: 920px; }

header.site {
  padding: 2.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: 0.22em;
  color: var(--accent);
  text-transform: uppercase;
}

.tagline {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.header-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
}

.header-row a {
  font-size: 0.85rem;
  color: var(--text-dim);
}
.header-row a:hover { color: var(--accent); }

footer.site {
  margin-top: 5rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
}

main { padding-bottom: 4rem; }

section { margin-bottom: 4rem; }

/* ---- hero ------------------------------------------------------------- */

.hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 6vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: -0.005em;
  margin: 0;
  text-transform: uppercase;
}

.hero h1 + h1 { color: var(--accent); }

.hero p {
  font-size: 1.05rem;
  color: var(--text-dim);
  margin-top: 1.5rem;
  max-width: 560px;
}

/* ---- form ------------------------------------------------------------- */

textarea, .tier, button, .input {
  font-family: var(--font-body);
  border-radius: 0;
}

textarea {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 1rem;
  font-size: 1rem;
  resize: vertical;
  min-height: 8rem;
}
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.char-count {
  text-align: right;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 0.4rem;
  font-family: var(--font-mono);
  transition: color 0.15s;
}
/* Visual warning as the user approaches the 1000-char cap. */
.char-count.warn { color: var(--accent); }

.tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2rem;
}

@media (max-width: 800px) {
  .tiers { grid-template-columns: 1fr; }
}

.tier.internal {
  border-left: 3px solid transparent;
  border-style: dashed;
  border-color: var(--border);
  opacity: 0.85;
}
.tier.internal.selected {
  border-left: 3px solid var(--text-dim);
  border-style: solid;
  opacity: 1;
}
.tier.internal .tier-price {
  color: var(--text-dim);
  font-style: italic;
  font-size: 1.2rem;
}
.tier.internal .tier-badge {
  background: var(--text-dim);
  color: var(--bg);
}

.key-input {
  display: none;
  width: 100%;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-dim);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.key-input:focus { outline: none; border-color: var(--text-dim); }
.key-input.visible { display: block; }

.tier {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  padding: 1.75rem 1.5rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.tier:hover { background: #181614; }

.tier.selected {
  border-left: 3px solid var(--accent);
  background: #181614;
}

.tier-name {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 1.1rem;
}

.tier-price {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--accent);
  margin: 0.4rem 0 0.6rem;
}

.tier-desc {
  font-size: 0.9rem;
  color: var(--text-dim);
}

.tier-badge {
  position: absolute;
  top: 0.75rem; right: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--accent);
  color: var(--bg);
  padding: 0.15rem 0.5rem;
  letter-spacing: 0.1em;
}

button.primary {
  width: 100%;
  margin-top: 2rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 1rem 2rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 0 30px -8px var(--accent);
}

button.primary:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: inset 0 3px 8px rgba(0,0,0,0.45), 0 0 18px -10px var(--accent);
}

button.primary:disabled {
  opacity: 0.5; cursor: not-allowed;
}

.disclaimer {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 1rem;
  text-align: center;
}

/* ---- "how it works" --------------------------------------------------- */

h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 1.5rem;
}

.how ol {
  padding: 0;
  margin: 0;
  list-style: none;
  counter-reset: step;
}

.how li {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  counter-increment: step;
  position: relative;
  padding-left: 3rem;
}

.how li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0; top: 1.5rem;
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.9rem;
}

.how strong {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 0.4rem;
}

.trust {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-dim);
  padding: 2rem;
  border: 1px solid var(--border);
  background: var(--surface);
}

/* Cancelled-payment notice shown on /?cancelled=1. Visual treatment matches
   the sovereign stamp pattern but in error-tone so it reads as a warning. */
.cancelled-notice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--error);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
}
.cancelled-notice .glyph {
  color: var(--error);
  font-weight: bold;
  letter-spacing: 0.08em;
}

/* Compact sovereignty stamp shown above the tier cards on the landing page.
   Visual cue: a dashed left border in accent — "stamp of origin". */
.sovereign-stamp {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 0.5rem;
  padding: 0.6rem 0.9rem;
  border: 1px dashed var(--border);
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}
.sovereign-stamp .glyph {
  color: var(--accent);
  font-weight: bold;
  letter-spacing: 0.05em;
}

/* GPU live indicator on the job page — sits under the status block. */
.gpu-strip {
  display: none;
  align-items: center;
  gap: 1.25rem;
  padding: 0.6rem 0.9rem;
  margin-bottom: 2rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}
.gpu-strip.visible { display: flex; flex-wrap: wrap; }
.gpu-strip .gpu-label {
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.gpu-strip .gpu-stat strong {
  color: var(--text);
  font-weight: 500;
  margin-left: 0.3rem;
}
/* Static accent square — the forge identity favours heat colour over
   decorative motion. Pulsing dot was replaced per the no-motion spec. */
.gpu-strip .gpu-pulse {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 0;
  box-shadow: 0 0 6px -1px var(--accent-dim);
}

/* ---- job page --------------------------------------------------------- */

.status-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-dim);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.status-block.running { border-left-color: var(--working); }
.status-block.queued  { border-left-color: var(--accent); }
.status-block.complete{ border-left-color: var(--success); }
.status-block.failed,
.status-block.cancelled { border-left-color: var(--error); }
.status-block.pending { border-left-color: var(--text-dim); border-left-style: dashed; }
.status-block.refunded { border-left-color: var(--text-dim); border-left-style: dashed; }
.status-block.disconnected { border-left-color: var(--error); border-left-style: dashed; }
.status-block.disconnected::after {
  content: 'live feed paused';
  display: inline-block;
  margin-left: 0.6rem;
  padding: 0.05rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--error);
  color: var(--bg);
  vertical-align: middle;
}

.status-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.status-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

.status-meta {
  margin-top: 0.5rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.phase-row {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 1rem;
}

.phase-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.elapsed {
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.progress {
  height: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin: 1rem 0 2rem;
  overflow: hidden;
  position: relative;
}
.progress-bar {
  height: 100%;
  width: 0%;
  /* Thermal heat-up: cool gray on the left, glowing accent on the right.
     The fixed-width gradient + transitioned width makes it look like the
     bar heats up as it advances. */
  background: linear-gradient(90deg, #2a2622 0%, #6b3a14 35%, var(--accent) 70%, var(--accent-hover) 100%);
  background-size: 100vw 100%;
  background-position: left center;
  transition: width 0.8s ease;
  box-shadow: 0 0 10px -2px var(--accent-dim);
}
.progress-bar.hot {
  box-shadow: 0 0 18px -2px var(--accent);
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 600px) {
  .agent-grid { grid-template-columns: repeat(2, 1fr); }
}

.agent {
  position: relative;
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  cursor: help;
}

.agent::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  color: var(--text);
  padding: 0.5rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 260px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 10;
}
.agent:hover::after { opacity: 1; }

.agent .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.agent.working .dot { background: var(--working); animation: pulse 1.2s ease-in-out infinite; }
.agent.done    .dot { background: var(--success); }
.agent.error   .dot { background: var(--error); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

.log {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  height: 320px;
  overflow-y: auto;
  margin-bottom: 2rem;
}

.log-entry {
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  animation: fade-in 0.3s ease;
}

.log-entry .log-time { color: var(--text-dim); margin-right: 0.6rem; }
.log-entry .log-tag  { color: var(--accent); margin-right: 0.6rem; }
/* Per-event-type tag colours so the operator can scan the log at a glance. */
.log-entry .log-tag.work { color: var(--working); }
.log-entry .log-tag.done { color: var(--success); }
.log-entry .log-tag.err  { color: var(--error); }
.log-entry .log-tag.warn { color: #d2a64a; }
.log-entry .log-tag.info { color: var(--text-dim); }
.log-entry .log-tag.hook { color: var(--accent); }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.actions {
  display: flex; gap: 1rem; flex-wrap: wrap;
}

.actions .secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--text-dim);
  padding: 1rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.actions .secondary:hover  { color: var(--text); border-color: var(--accent); background: var(--surface); }
.actions .secondary:active { background: var(--surface-2); }
.actions .secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--border);
  color: var(--text-dim);
}

/* ---- accessibility: focus rings -------------------------------------- */
/* Single rule for every keyboard-tabbable interactive element so the focus
   indicator never gets lost. Using outline (not box-shadow) keeps it crisp
   on the squared-edge design. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tier:focus-visible,
button:focus-visible,
.key-input:focus-visible,
.actions .secondary:focus-visible,
.agent:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Tooltips also open on keyboard focus, not just hover. */
.agent:focus-visible::after { opacity: 1; }

/* Right-column tooltips clip off-screen — flip anchor side for the
   right-edge cells of the 3-column grid. */
@media (min-width: 601px) {
  .agent-grid .agent:nth-child(3n)::after {
    left: auto;
    right: 0;
  }
}
@media (max-width: 600px) {
  .agent-grid .agent:nth-child(2n)::after {
    left: auto;
    right: 0;
  }
}

/* ---- prefers-reduced-motion ----------------------------------------- */
/* Honor user preference: kill all animations and transitions. The forge
   visual identity should still convey "heat" via colour, not motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
