/* ARK Scrapper — a terminal-flavoured catalogue.
   Monochrome by default; the one accent is reserved for things you can act on. */

:root {
  --bg: #0a0a0a;
  --panel: #111111;
  --panel-2: #161616;
  --line: #242424;
  --line-bright: #333333;
  --text: #ededed;
  --dim: #8b8b8b;
  --dimmer: #5f5f5f;
  --accent: #7ee787;
  --accent-dim: #2ea043;
  --warn: #e3b341;
  --danger: #f85149;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  --radius: 6px;
}

* { box-sizing: border-box; }

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

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

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

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

header.top {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(10, 10, 10, 0.86);
  backdrop-filter: blur(8px);
  z-index: 50;
}
header.top .wrap { display: flex; align-items: center; gap: 28px; height: 56px; }
.brand { font-family: var(--mono); font-weight: 600; letter-spacing: -0.02em; }
.brand span { color: var(--accent); }
nav.links { display: flex; gap: 20px; margin-left: auto; font-size: 13.5px; color: var(--dim); }
nav.links a.active { color: var(--text); }

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

.hero { padding: 56px 0 32px; text-align: center; }
.hero pre {
  font-family: var(--mono);
  color: var(--accent-dim);
  font-size: 11px;
  line-height: 1.15;
  margin: 0 0 22px;
  overflow-x: auto;
}
.hero h1 { font-size: 28px; font-weight: 600; margin: 0 0 10px; letter-spacing: -0.02em; }
.hero p { color: var(--dim); margin: 0 auto; max-width: 620px; }
/* Two commands, one per job: making a plan, and using one someone already made.
   Labels are aligned in their own column so the commands line up under each other. */
.hero .cmds { display: inline-flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.hero .cmd {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 14px;
  text-align: left;
}
.hero .cmd .lbl {
  flex: none;
  width: 62px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dimmer);
}
.hero .cmd code { font-family: inherit; white-space: nowrap; }
.hero .cmd .copy { margin-left: auto; }
.hero .cmd b { color: var(--accent); font-weight: 500; }

/* --- panels & forms ---------------------------------------------------------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.panel + .panel { margin-top: 16px; }
.panel h2, .panel h3 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 14px;
}

textarea, input[type="text"], input[type="search"], select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  padding: 11px 13px;
  outline: none;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
textarea:focus, input:focus, select:focus { border-color: var(--accent-dim); }
input::placeholder, textarea::placeholder { color: var(--dimmer); }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 260px; }

button {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--line-bright);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 16px;
  cursor: pointer;
}
button:hover { border-color: var(--dimmer); }
button.primary { background: var(--accent); border-color: var(--accent); color: #07240f; font-weight: 600; }
button.primary:hover { background: #96f0a0; }
button.ghost { background: transparent; color: var(--dim); }
button.small { padding: 5px 10px; font-size: 12.5px; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.opts { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; font-size: 13.5px; color: var(--dim); }
.opts label { display: flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.opts input[type="checkbox"] { accent-color: var(--accent-dim); }
.opts select { width: auto; padding: 4px 8px; font-size: 13px; }

/* --- live run ---------------------------------------------------------------- */

.steps { font-family: var(--mono); font-size: 13px; margin: 0; padding: 0; list-style: none; }
.steps li { display: flex; gap: 10px; padding: 4px 0; color: var(--dim); }
.steps li .mark { color: var(--accent); width: 14px; }
.steps li.active { color: var(--text); }
.steps li.active .mark { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

.question { border-left: 2px solid var(--accent-dim); padding-left: 16px; margin-top: 16px; }
.question .q-title { font-weight: 600; margin-bottom: 4px; }
.question .q-help { color: var(--dim); font-size: 13.5px; margin-bottom: 14px; }

.choice-group { margin-bottom: 18px; }
.choice-group .slot { font-family: var(--mono); font-size: 13px; color: var(--accent); margin-bottom: 8px; }
.choice-opts { display: flex; flex-direction: column; gap: 6px; }
.choice-opts label {
  display: flex; gap: 10px; align-items: baseline;
  padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.choice-opts label:hover { border-color: var(--line-bright); }
.choice-opts label.sel { border-color: var(--accent-dim); background: var(--panel-2); }
.choice-opts .nm { font-family: var(--mono); font-size: 13.5px; }
.choice-opts .note { color: var(--dim); font-size: 13px; }
.tag-rec {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em;
  color: var(--accent); border: 1px solid var(--accent-dim);
  border-radius: 3px; padding: 1px 5px; margin-left: auto; text-transform: uppercase;
}

.pin-row { display: grid; grid-template-columns: 160px 1fr; gap: 10px; align-items: center; margin-bottom: 8px; }
.pin-row .lib { font-family: var(--mono); font-size: 13.5px; }
.pin-row .why { color: var(--dimmer); font-size: 12px; display: block; }

.url-row {
  display: grid; grid-template-columns: 18px 120px 1fr auto; gap: 10px;
  align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line);
}
.url-row:last-of-type { border-bottom: none; }
.url-row .n { font-family: var(--mono); color: var(--dimmer); font-size: 12px; }
.url-row .lib { font-family: var(--mono); font-size: 12.5px; color: var(--dim); }
.url-row input { font-family: var(--mono); font-size: 12.5px; padding: 6px 9px; }
.url-row.dropped input { text-decoration: line-through; opacity: 0.4; }

/* --- catalogue --------------------------------------------------------------- */

.tabs { display: flex; gap: 4px; font-family: var(--mono); font-size: 12.5px; }
.tabs button {
  background: transparent; border: 1px solid transparent; color: var(--dim);
  padding: 6px 12px; border-radius: var(--radius);
}
.tabs button.on { color: var(--text); border-color: var(--line); background: var(--panel); }

.plan-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.plan-row {
  display: grid;
  grid-template-columns: 34px 1fr 92px 74px;
  gap: 14px;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.plan-row:last-child { border-bottom: none; }
/* Grid children default to min-width:auto, so a long requirement pushes the row
   wider than its container and shunts the install count off-screen. */
.plan-row > * { min-width: 0; }
.plan-row:hover { background: var(--panel-2); }
.plan-row .rank { font-family: var(--mono); color: var(--dimmer); font-size: 13px; text-align: right; }
.plan-row .name { font-weight: 600; letter-spacing: -0.01em; }
.plan-row .rank { align-self: start; padding-top: 2px; }
.plan-row .req { color: var(--dim); font-size: 13px; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-row .installs { font-family: var(--mono); font-size: 13.5px; text-align: right; }
.plan-row .installs small { display: block; color: var(--dimmer); font-size: 10.5px; letter-spacing: 0.05em; }

.labels { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.label {
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  border: 1px solid var(--line-bright); border-radius: 3px; padding: 1px 6px;
}
.label:hover { color: var(--accent); border-color: var(--accent-dim); }
.label.more { border-style: dashed; }

.spark { display: block; }
.spark path { fill: none; stroke: var(--accent-dim); stroke-width: 1.5; }
.spark .flat { stroke: var(--line-bright); }

.empty { padding: 44px 20px; text-align: center; color: var(--dim); }
.empty code { font-family: var(--mono); color: var(--accent); }

/* --- plan detail ------------------------------------------------------------- */

.detail-head { display: flex; gap: 24px; align-items: flex-start; padding: 34px 0 22px; }
.detail-head h1 { font-size: 30px; margin: 0 0 6px; letter-spacing: -0.025em; }
.detail-head .req { color: var(--dim); max-width: 640px; }
.stat-strip { display: flex; gap: 28px; margin: 18px 0 0; font-family: var(--mono); font-size: 13px; }
.stat-strip div span { display: block; color: var(--dimmer); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; }

.chart { width: 100%; height: 110px; }
.chart rect { fill: var(--accent-dim); }
.chart rect.zero { fill: var(--line); }
.chart text { fill: var(--dimmer); font-family: var(--mono); font-size: 9px; }

.md {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 30px; overflow-x: auto;
}
.md h1, .md h2, .md h3 { letter-spacing: -0.02em; line-height: 1.3; }
.md h1 { font-size: 25px; margin: 0 0 14px; }
.md h2 { font-size: 19px; margin: 30px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.md h3 { font-size: 16px; margin: 20px 0 8px; color: var(--dim); }
.md p, .md li { color: #d6d6d6; }
.md code { font-family: var(--mono); font-size: 12.5px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; }
.md pre { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; overflow-x: auto; }
.md pre code { background: none; border: none; padding: 0; font-size: 12.5px; line-height: 1.55; }
.md table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.md th, .md td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.md th { background: var(--panel-2); font-family: var(--mono); font-size: 12px; }
.md a { color: var(--accent); }
.md blockquote { border-left: 2px solid var(--line-bright); margin: 0; padding-left: 16px; color: var(--dim); }

footer.bottom { border-top: 1px solid var(--line); margin-top: 64px; padding: 28px 0 48px;
  color: var(--dimmer); font-size: 13px; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line-bright); border-radius: var(--radius);
  padding: 10px 18px; font-size: 13.5px; z-index: 100;
}

@media (max-width: 720px) {
  .plan-row { grid-template-columns: 26px 1fr 64px; }
  .plan-row .spark-cell { display: none; }
  .detail-head { flex-direction: column; }
  .pin-row, .url-row { grid-template-columns: 1fr; }
}

.md sup a { color: var(--accent); font-size: 10px; text-decoration: none; padding: 0 1px; }
.md .footnote { font-size: 12.5px; color: var(--dim); font-family: var(--mono); line-height: 1.7; }
.md .footnote a { color: var(--accent); }
.md .footnote:target, .md sup a:target { background: var(--panel-2); }

/* --- refine bar --------------------------------------------------------------- */

/* Docked to the viewport, not to the end of the document: the plan is long, and a
   bar you have to scroll to the bottom to find is a bar most people never see. */
.refine-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 22px 24px 16px;
  /* Fades the plan out underneath rather than cutting it with a hard edge. */
  background: linear-gradient(to top, var(--bg) 58%, rgba(10, 10, 10, 0));
  pointer-events: none;
}
.refine-dock > * { max-width: 1100px; margin: 0 auto; pointer-events: auto; }

.refine {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line-bright);
  border-radius: 10px;
  padding: 10px 12px 10px 16px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55);
}
.refine .caret { font-family: var(--mono); color: var(--accent); font-weight: 600; }
.refine input {
  border: none;
  background: transparent;
  padding: 6px 0;
  font-size: 14.5px;
}
.refine input:focus { border: none; outline: none; }
.refine button { white-space: nowrap; }
.refine.busy input { color: var(--dim); }
.refine .spin { font-family: var(--mono); color: var(--accent); }

.revision-note {
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
  margin-top: 10px;
}
.revision-note b { color: var(--accent); font-weight: 500; }

.running-req {
  color: var(--dim);
  font-size: 13.5px;
  border-left: 2px solid var(--line-bright);
  padding-left: 12px;
  margin-bottom: 14px;
}

/* --- rewriting overlay -------------------------------------------------------- */

.md-wrap { position: relative; }

.rewriting {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 70px 20px 20px;
  border-radius: var(--radius);
  /* The old plan stays faintly visible underneath: it is still the current plan
     until the new one is stored, and hiding it entirely reads as data loss. */
  background: rgba(10, 10, 10, 0.82);
  backdrop-filter: blur(2px);
  z-index: 20;
}
.rewriting-card {
  /* Follows the viewport instead of yanking the page to the top of the plan: the
     card stays visible wherever the reader happens to be. */
  position: sticky;
  top: 96px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  max-width: 560px;
  padding: 18px 22px;
  border: 1px solid var(--line-bright);
  border-radius: 10px;
  background: var(--panel);
}
.rewriting-title { font-weight: 600; margin-bottom: 3px; }
.rewriting-sub { color: var(--text); font-size: 13.5px; margin-bottom: 8px; }
.rewriting-meta { font-family: var(--mono); font-size: 11.5px; color: var(--dimmer); }
.rewriting-meta .elapsed { color: var(--accent); }

.spinner {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: none;
  border: 2px solid var(--line-bright);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* --- post-revision banner ------------------------------------------------------ */

.banner {
  margin-top: 26px;
  padding: 12px 16px;
  border: 1px solid var(--accent-dim);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--panel);
  font-size: 13.5px;
}
.banner-sub { color: var(--dim); }
.banner-warn { margin-top: 6px; color: var(--warn); font-size: 13px; }
.revision-note .bad { color: var(--danger); }

/* --- install command on a plan page ------------------------------------------- */

.install-cmd {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 12.5px;
  cursor: pointer;
}
.install-cmd:hover { border-color: var(--line-bright); }
.install-cmd code { color: var(--accent); }
/* Shared by the hero rows and a plan's install line, so both read the same. */
.cmd .copy,
.install-cmd .copy {
  margin-left: auto;
  flex: none;
  padding: 3px 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dimmer);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  user-select: none;
  cursor: pointer;
}
.cmd .copy:hover,
.install-cmd .copy:hover { color: var(--accent); border-color: var(--accent-dim); }

.err-detail {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--dim);
  font-size: 12.5px;
  line-height: 1.6;
}
.err-detail li { margin-bottom: 3px; overflow-wrap: anywhere; }
