/* Ajilex — site styles. No build step; edit and deploy.
   Idea: the site is a terminal session. One monospace face at nearly one
   size; hierarchy comes from brightness and weight. Red "-" lines are the
   old way of working, green "+" lines the new one. Prompt lines are
   decoration, added from data-cmd and hidden from screen readers. */

@font-face {
  font-family: "Martian Mono";
  src: url("../fonts/martian-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-stretch: 75% 112.5%;
  font-display: swap;
}

:root {
  --bg: #12142a;
  --raised: #1a1d38;
  --sunken: #0a0c1c;
  --fg: #dfe1ef;
  --bright: #ffffff;
  --dim: #8b90b5;
  --rule: #2a2e52;
  --prompt: #9fa3ff;
  --red: #ff6b7f;
  --green: #7fe0b0;
  --focus: #7fe0b0;

  --font: "Martian Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --measure: 68ch;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1080px;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 0.9375rem;
  font-stretch: 87.5%;
  line-height: 1.75;
}

::selection { background: var(--green); color: var(--bg); }

img, svg { display: block; max-width: 100%; }

a { color: var(--prompt); text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
a:hover { color: var(--bright); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

h1, h2, h3 { margin: 0; color: var(--bright); line-height: 1.4; font-stretch: 100%; text-wrap: balance; }
h1 { font-size: clamp(1.3rem, 1.05rem + 1vw, 1.75rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
h2 { font-size: 1rem; font-weight: 700; }
h2::before { content: "## " / ""; color: var(--dim); font-weight: 400; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 1em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }
strong { color: var(--bright); }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 10; background: var(--raised); color: var(--bright); padding: 8px 12px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Prompt lines: "ajilex:~$ <command>" above a block */
[data-cmd]::before {
  content: "ajilex:~$ " attr(data-cmd) / "";
  display: block;
  margin-bottom: 0.9em;
  color: var(--dim);
  font-weight: 400;
  white-space: pre-wrap;
}
.prompt::before { content: "ajilex:~$ " / ""; color: var(--dim); }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--bright); text-decoration: none; font-weight: 700; font-stretch: 100%; }
.brand:hover { color: var(--bright); }
.brand svg { width: 24px; height: 24px; }
.site-nav { display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); }
.site-nav a { color: var(--fg); text-decoration: none; }
.site-nav a::after { content: "/" / ""; color: var(--dim); }
.site-nav a:hover { color: var(--bright); }
.site-nav a[aria-current="page"] { color: var(--green); }
.site-nav .nav-cta::after { content: none; }
.site-nav .nav-cta { color: var(--bg); background: var(--fg); padding: 2px 10px; }
.site-nav .nav-cta:hover, .site-nav .nav-cta[aria-current="page"] { color: var(--bg); background: var(--green); }

/* Logo mark: fixed colours, same as the favicon */
.mark-bg { fill: #1b1e3a; }
.mark-del { fill: #ff5c72; }
.mark-add { fill: #7fe0b0; }

/* Buttons: inverse video, like a selected line in a terminal */
.button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  color: var(--bg);
  background: var(--fg);
  border: 0;
  border-radius: 0;
  padding: 8px 18px;
  text-decoration: none;
  cursor: pointer;
}
.button::before { content: "> " / ""; }
.button:hover { color: var(--bg); background: var(--green); }
.button:disabled { opacity: 0.6; cursor: wait; }

/* Hero */
.hero { padding: clamp(40px, 6vw, 72px) 0 clamp(40px, 5vw, 64px); }
.hero h1 { max-width: 30ch; margin-bottom: 0.8em; }
.hero .lede { color: var(--dim); margin-bottom: 1.6em; max-width: 60ch; }

/* "ajilex fix <example>": the old way is printed in red and struck out,
   the new way in green underneath */
.edit { margin-top: clamp(48px, 6vw, 72px); padding-top: clamp(24px, 3vw, 36px); padding-bottom: clamp(24px, 3vw, 36px); background: var(--sunken); border: 1px solid var(--rule); }
.edit-cmd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 1em; }
.edit-tabs { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.edit-tab {
  font: inherit;
  color: var(--fg);
  background: var(--raised);
  border: 1px solid var(--dim);
  padding: 0 10px;
  cursor: pointer;
  text-transform: lowercase;
}
.edit-tab:hover { color: var(--bright); border-color: var(--green); background: color-mix(in srgb, var(--green) 14%, var(--raised)); }
.edit-tab[aria-selected="true"] { color: var(--bg); background: var(--green); border-color: var(--green); }
.hint { margin-bottom: 0.4em; color: var(--dim); }
.edit-panel[hidden] { display: none; }
.edit-panel p { display: grid; grid-template-columns: 2ch 1fr; margin: 0; max-width: none; font-size: 0.9375rem; font-stretch: 100%; line-height: 1.6; }
.edit-panel .was { color: var(--red); }
.edit-panel .was::before { content: "-" / ""; }
.edit-panel .now { color: var(--green); font-weight: 600; margin-top: 0.3em; }
.edit-panel .now::before { content: "+" / ""; }
.strike { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.cursor-line { margin: 1em 0 0; }
.cursor-line::before { content: "ajilex:~$ "; color: var(--dim); }
.cursor { display: inline-block; width: 0.6em; height: 1.15em; vertical-align: text-bottom; background: var(--fg); }

/* One moment of motion: diff.js prints the output line by line, then the
   cursor blinks a few times and settles */
.is-pending { visibility: hidden; }
@media (prefers-reduced-motion: no-preference) {
  .edit.is-applying .cursor { animation: blink 1s steps(1) 4; }
  @keyframes blink { 50% { opacity: 0; } }
}

/* Sections */
.section { padding: clamp(48px, 6vw, 80px) 0; border-top: 1px solid var(--rule); }
.section-head { margin-bottom: 1.6em; }
.section-head h2 { margin-bottom: 0.4em; }
.section-head p { color: var(--dim); }

/* Services: like a man page, name then indented description */
.services { margin: 0; padding: 0; list-style: none; }
.services > li { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: 4px clamp(24px, 4vw, 48px); padding: 14px 0; }
.services h3 a { color: var(--bright); text-decoration: none; }
.services h3 a:hover { color: var(--green); text-decoration: underline; }
.services p { color: var(--dim); }

/* Process: a real sequence, so it is numbered */
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 6ch minmax(0, 12rem) minmax(0, 1fr); gap: 4px clamp(16px, 3vw, 32px); align-items: baseline; }
.steps li::before { content: "[" counter(step) "/4]"; color: var(--green); }
.steps p { color: var(--dim); }

/* Closing call to action */
.band { padding: clamp(48px, 6vw, 80px) 0; border-top: 1px solid var(--rule); }
.closing h2 { max-width: 48ch; margin-bottom: 1.2em; }

/* Inner pages */
.page-head { padding-top: clamp(40px, 6vw, 72px); padding-bottom: clamp(28px, 4vw, 48px); }
.page-head h1 { margin-bottom: 0.6em; }
.page-head p { color: var(--dim); }

.detail { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: 12px clamp(24px, 4vw, 48px); padding: clamp(32px, 5vw, 56px) 0; border-top: 1px solid var(--rule); scroll-margin-top: 16px; }
.detail h3 { margin: 1.6em 0 0.5em; color: var(--fg); }
.detail h3::before { content: "### " / ""; color: var(--dim); font-weight: 400; }
.detail ul, .prose ul { margin: 0 0 1em; padding-left: 0; list-style: none; max-width: var(--measure); }
.detail li, .prose li { position: relative; padding-left: 2ch; margin-bottom: 4px; }
.detail li::before, .prose li::before { content: "*" / ""; position: absolute; left: 0; color: var(--green); }

.prose { padding-bottom: clamp(56px, 8vw, 96px); }
.prose h2 { margin: 2.4em 0 0.6em; }
.prose dl { margin: 0 0 1em; display: grid; grid-template-columns: max-content 1fr; gap: 4px 20px; }
.prose dt { color: var(--dim); }
.prose dd { margin: 0; }

/* Contact form */
.contact-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: clamp(32px, 5vw, 64px); padding-bottom: clamp(56px, 8vw, 96px); }
.form { display: grid; gap: 20px; max-width: 36rem; }
.field label { display: block; margin-bottom: 6px; }
.optional { color: var(--dim); }
input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--bright);
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 10px 12px;
}
input:hover, select:hover, textarea:hover { border-color: var(--dim); }
textarea { min-height: 11rem; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--green); }
[aria-invalid="true"] { border-color: var(--red); }
.hp { position: absolute; left: -9999px; }
.form-status { color: var(--red); border-left: 2px solid var(--red); padding: 8px 14px; margin: 0; }
.form-status::before { content: "error: " / ""; font-weight: 700; }
.form-note { font-size: 0.875rem; color: var(--dim); }
.aside { border-left: 1px solid var(--rule); padding-left: clamp(16px, 3vw, 32px); align-self: start; }
.aside h2 { margin-bottom: 0.8em; }
.aside ol { margin: 0; padding-left: 0; list-style: none; counter-reset: next; color: var(--dim); }
.aside li { counter-increment: next; display: grid; grid-template-columns: 4ch 1fr; margin-bottom: 8px; }
.aside li::before { content: counter(next) "." / ""; color: var(--green); }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); padding: 24px 0 32px; font-size: 0.875rem; color: var(--dim); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.site-footer a { color: var(--dim); }
.site-footer a:hover { color: var(--bright); }

/* Narrow screens */
@media (max-width: 860px) {
  .services > li, .detail, .contact-grid { grid-template-columns: 1fr; }
  .steps li { grid-template-columns: 6ch minmax(0, 1fr); }
  .steps li p { grid-column: 2; }
  .edit-panel { min-height: 5.4rem; }
  .aside { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 24px; }
}
@media (max-width: 520px) {
  body { font-size: 0.875rem; }
  .site-nav { gap: 10px; }
  .brand { font-size: 0.875rem; }
}
