/* openroutine.dev
 *
 * The palette and type stack are lifted verbatim from the daemon's own web UI
 * (ui/styles.css) so the site and the product are visibly the same object.
 * No webfonts, no framework, no build step — same rule the product follows.
 */

:root {
  --bg: #fbfaf8;
  --panel: #ffffff;
  --ink: #1c1a17;
  --muted: #6b6560;
  --line: #e5e0d8;
  --accent: #7a5c3e;
  --ok: #2f6b45;
  --bad: #9c3328;
  --warn: #8a6d1f;

  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  /* A wash of the accent, used to mark the OpenRoutine column and callouts. */
  --accent-wash: #f4efe8;

  color-scheme: light dark;
  font-family: var(--sans);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16151a;
    --panel: #1e1d24;
    --ink: #ece9e4;
    --muted: #9a948c;
    --line: #322f39;
    --accent: #c8a179;
    --ok: #7fc59b;
    --bad: #e0857a;
    --warn: #d8bb66;

    --accent-wash: #24222b;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 1rem;
  overflow-wrap: break-word;
}

/* ---------- shell ---------- */

.wrap {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

section { padding: 3.5rem 0; }
section + section { border-top: 1px solid var(--line); }

/* ---------- type ---------- */

h1, h2, h3 { letter-spacing: -0.015em; line-height: 1.25; }

h1 {
  font-size: 2.6rem;
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.35rem;
  margin: 0 0 0.35rem;
}

h3 {
  font-size: 1rem;
  margin: 2.25rem 0 0.6rem;
}

.lede {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 1.75rem;
  max-width: 46rem;
}

.section-note {
  color: var(--muted);
  margin: 0 0 1.75rem;
  max-width: 46rem;
}

p { margin: 0 0 1rem; max-width: 46rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--accent-wash);
  padding: 0.1em 0.35em;
  border-radius: 5px;
}

pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.65;
  margin: 0 0 1.25rem;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

/* Comment lines inside shell samples, dimmed the way a terminal would. */
pre .c { color: var(--muted); }
/* Frontmatter fences and keys in the task sample. */
pre .k { color: var(--accent); }

/* ---------- masthead ---------- */

.masthead {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.masthead .wrap {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: 3.5rem;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  /* Sans, not mono: the wordmark is mixed-case, and it matches the product
   * UI's own <h1>OpenRoutine</h1>. Lowercase things — the domain, paths, the
   * CLI — stay in var(--mono) wherever they appear. */
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
  letter-spacing: -0.02em;
}

.wordmark svg { display: block; width: 1.15rem; height: 1.15rem; }

.masthead nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.9rem;
}

.masthead nav a { color: var(--muted); text-decoration: none; }
.masthead nav a:hover,
.masthead nav a[aria-current="page"] { color: var(--ink); }

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

.hero { padding: 4.5rem 0 3.5rem; }

.hero .lede { font-size: 1.2rem; max-width: 44rem; }
.hero .lede strong { color: var(--ink); font-weight: 600; }

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.75rem;
}

.btn {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 1.1rem;
  border-radius: 7px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
  display: inline-block;
}

.btn:hover { opacity: 0.88; }

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn.ghost:hover { border-color: var(--muted); opacity: 1; }

/* ---------- two-column feature blocks ---------- */

.split {
  display: grid;
  gap: 2rem;
  align-items: start;
}

/* Grid items default to min-width:auto, which lets a `pre` full of long lines
 * widen its track rather than scroll inside it. The current samples stay under
 * the limit either way; this keeps a longer one from ever pushing the page. */
.split > *, .cards > * { min-width: 0; }

/* The code column is sized to the widest sample it holds, not to a fraction of
 * the page — a ratio looks fine until a line is one character too long and the
 * block starts scrolling sideways for no visible reason. */
@media (min-width: 62rem) {
  .split { grid-template-columns: minmax(0, 34rem) minmax(0, 1fr); gap: 2.5rem; }
  .split pre { margin-bottom: 0; }
}

.cards {
  display: grid;
  gap: 1rem;
  /* 20rem lands the four cards as 2x2 on a desktop column rather than 3+1.
   * min() keeps the track from exceeding the viewport on a narrow phone. */
  grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
  margin-top: 1.5rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
}

.card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  color: var(--ink);
}

.card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- tables ---------- */

.scroller {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 44rem;
}

.scroller table { min-width: 46rem; }

th, td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
  vertical-align: top;
}

th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

tbody th {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.86rem;
  color: var(--ink);
  font-weight: 600;
  white-space: normal;
}

tr:last-child td, tr:last-child th { border-bottom: none; }

td code, th code { background: none; padding: 0; }

/* The column that is the point of the comparison. */
.compare th.mine, .compare td.mine {
  background: var(--accent-wash);
}

.compare th.mine { color: var(--accent); }

/* Reference tables in the docs: first column is a key name. */
.keys td:first-child, .keys th:first-child { white-space: nowrap; }
.keys td:first-child code { color: var(--accent); }

/* ---------- callouts ---------- */

.note {
  border-left: 3px solid var(--line);
  padding: 0.15rem 0 0.15rem 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  margin: 1.25rem 0;
  max-width: 46rem;
}

.note strong { color: var(--ink); }

.note.warn { border-left-color: var(--warn); }

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

.docs-toc {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 2rem;
  font-size: 0.92rem;
  max-width: 40rem;
}

.docs-toc li { margin-bottom: 0.3rem; break-inside: avoid; }

.docs h2 { margin-top: 0; }

/* The anchor ids sit on the sections, so the offset has to live there too —
 * on the h2 it does nothing, and every #link lands under the sticky masthead. */
section[id] { scroll-margin-top: 4.25rem; }

.docs section { padding: 2.75rem 0; }

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--line);
  padding: 2.5rem 0 3.5rem;
  color: var(--muted);
  font-size: 0.86rem;
}

footer p { max-width: 44rem; }

footer .closer {
  color: var(--ink);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

footer .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin: 0;
}

/* ---------- 404 ---------- */

.centered {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ---------- small screens ---------- */

@media (max-width: 40rem) {
  h1 { font-size: 2rem; }
  .hero { padding: 3rem 0 2.5rem; }
  .hero .lede { font-size: 1.05rem; }
  section { padding: 2.75rem 0; }
  .docs-toc { columns: 1; }
}
