/* ducklocal.app — the product page.
 *
 * One bold thing: the duck-yellow hero band holding the app itself, drawn in
 * HTML. Everything below it is quiet. System fonts only — the product's
 * promise is that nothing leaves your machine, so the page fetches nothing
 * from anyone else either. */

:root {
  --duck: #f2b705;
  --duck-deep: #d9a300;
  --ink: #1d1a12;
  --paper: #ffffff;
  --muted: #6b6556;
  --rule: #e8e3d3;
  --link: #806000;
  --code-bg: #f6f4ee;
  --keyword: #7a4d00;
  --string: #2f6b3a;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "PingFang SC", monospace;

  --measure: 34rem;
  --page: 72rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece6d6;
    --paper: #16140e;
    --muted: #a39c8a;
    --rule: #2e2a1f;
    --link: #f2c94c;
    --code-bg: #221f17;
    --keyword: #f2c94c;
    --string: #8fcf95;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
}

a:focus-visible,
.button:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 3px;
  border-radius: 6px;
}

code,
pre {
  font-family: var(--mono);
}

.wrap {
  width: min(var(--page), 100% - 2.5rem);
  margin-inline: auto;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-block: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: inherit;
  text-decoration: none;
  font-weight: 650;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

.brand img {
  width: 2rem;
  height: 2rem;
}

.topbar nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.95rem;
}

.topbar nav a:not(.button) {
  color: inherit;
  text-decoration: none;
}

.topbar nav a:not(.button):hover {
  text-decoration: underline;
}

/* ---------- buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border-radius: 0.6rem;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  line-height: 1.2;
}

.button-primary {
  background: #1d1a12;
  color: #fff8e1;
}

.button-primary:hover {
  background: #000;
}

.button-quiet {
  color: #1d1a12;
  box-shadow: inset 0 0 0 1.5px rgba(29, 26, 18, 0.45);
}

.button-quiet:hover {
  box-shadow: inset 0 0 0 1.5px #1d1a12;
}

.topbar .button {
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
}

/* ---------- hero: the yellow band ---------- */

.hero {
  background: var(--duck);
  color: #1d1a12;
  padding-block: clamp(2.5rem, 6vw, 5rem) clamp(3rem, 7vw, 6rem);
}

.hero a:focus-visible {
  outline-color: #1d1a12;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.hero h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(2.4rem, 5.2vw, 4.1rem);
  line-height: 1.02;
  font-weight: 750;
  letter-spacing: -0.035em;
  max-width: 12ch;
}

.hero .lede {
  margin: 0 0 2rem;
  max-width: var(--measure);
  font-size: 1.2rem;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.hero .fineprint {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(29, 26, 18, 0.72);
}

/* The app, drawn: its own chrome, sidebar, query tab, toolbar, editor, results
 * and status bar, as they are — not a stylised idea of them. Neutral greys,
 * because inside the window it is the app's palette, not the page's. */

.window {
  --w-bg: #ffffff;
  --w-side: #f7f7f7;
  --w-chrome: #f3f3f3;
  --w-line: #e4e4e4;
  --w-text: #1f1f1f;
  --w-muted: #737373;
  --w-kw: #1f5fd1;
  --w-num: #b35c00;
  --w-hover: #ececec;
  background: var(--w-bg);
  color: var(--w-text);
  border-radius: 0.7rem;
  box-shadow:
    0 0 0 1px rgba(29, 26, 18, 0.14),
    0 24px 48px -16px rgba(80, 55, 0, 0.45);
  overflow: hidden;
  font-size: 0.78rem;
  line-height: 1.35;
  margin: 0;
}

@media (prefers-color-scheme: dark) {
  .window {
    --w-bg: #1c1c1c;
    --w-side: #202020;
    --w-chrome: #242424;
    --w-line: #333333;
    --w-text: #ececec;
    --w-muted: #9a9a9a;
    --w-kw: #6ea8ff;
    --w-num: #f0a35e;
    --w-hover: #2c2c2c;
  }
}

.window .i {
  width: 0.85em;
  height: 0.85em;
  flex: none;
}

.window .grow {
  flex: 1;
}

.win-title,
.tabs,
.toolbar,
.res-head,
.win-status,
.side-top,
.chip,
.btn,
.tab,
.tree li {
  display: flex;
  align-items: center;
}

.win-title {
  gap: 0.35rem;
  padding: 0.5rem 0.7rem;
  background: var(--w-chrome);
  border-bottom: 1px solid var(--w-line);
  position: relative;
}

.dots {
  display: flex;
  gap: 0.35rem;
  margin-right: 0.4rem;
}

.dots i {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
}

.dots i:nth-child(1) { background: #ff5f57; }
.dots i:nth-child(2) { background: #febc2e; }
.dots i:nth-child(3) { background: #28c840; }

.chip {
  gap: 0.3rem;
  padding: 0.15rem 0.35rem;
  font-size: 0.72rem;
}

.chip.quiet {
  color: var(--w-muted);
}

.win-name {
  flex: 1;
  text-align: center;
  font-weight: 650;
  font-size: 0.74rem;
}

.win-body {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
}

.win-side {
  background: var(--w-side);
  border-right: 1px solid var(--w-line);
  padding: 0.5rem 0.45rem;
  min-width: 0;
}

.side-top {
  gap: 0.35rem;
  color: var(--w-muted);
  margin-bottom: 0.55rem;
}

.seg {
  display: inline-flex;
  padding: 0.12rem;
  border-radius: 0.35rem;
  background: var(--w-hover);
  font-size: 0.68rem;
}

.seg > * {
  padding: 0.12rem 0.4rem;
  border-radius: 0.25rem;
  font-weight: 500;
}

.seg b {
  background: var(--w-bg);
  color: var(--w-text);
  box-shadow: 0 0 0 1px var(--w-line);
}

.tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree li {
  gap: 0.35rem;
  padding: 0.2rem 0.3rem;
  border-radius: 0.25rem;
  white-space: nowrap;
}

.tree li span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree small {
  color: var(--w-muted);
  font-size: 0.66rem;
}

.tree .sec {
  color: var(--w-muted);
  font-weight: 650;
  font-size: 0.68rem;
}

.tree .file {
  padding-left: 1rem;
}

.tree .file .i {
  color: var(--w-muted);
}

.tree .col {
  padding-left: 2.15rem;
  font-size: 0.72rem;
}

.win-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tabs {
  gap: 0.3rem;
  padding: 0 0.5rem 0 0;
  background: var(--w-chrome);
  border-bottom: 1px solid var(--w-line);
  color: var(--w-muted);
}

.tab {
  gap: 0.35rem;
  padding: 0.4rem 0.6rem;
  background: var(--w-bg);
  color: var(--w-text);
  border-right: 1px solid var(--w-line);
  margin-bottom: -1px;
}

.tab .i:last-child {
  color: var(--w-muted);
  margin-left: 0.2rem;
}

.toolbar {
  gap: 0.35rem;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--w-line);
}

.btn {
  gap: 0.3rem;
  padding: 0.2rem 0.45rem;
  border-radius: 0.35rem;
  box-shadow: inset 0 0 0 1px var(--w-line);
  font-size: 0.72rem;
  white-space: nowrap;
}

.btn.run {
  background: #171717;
  color: #fafafa;
  box-shadow: none;
}

@media (prefers-color-scheme: dark) {
  .btn.run {
    background: #fafafa;
    color: #171717;
  }
}

.btn.run kbd {
  font: inherit;
  font-size: 0.66rem;
  padding: 0 0.25rem;
  border-radius: 0.2rem;
  background: rgba(255, 255, 255, 0.18);
}

.btn.sm {
  font-size: 0.66rem;
  padding: 0.15rem 0.4rem;
}

.editor {
  list-style: none;
  counter-reset: line;
  margin: 0;
  padding: 0.55rem 0;
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.6;
  white-space: pre;
  overflow: hidden;
  border-bottom: 1px solid var(--w-line);
}

.editor li {
  counter-increment: line;
  padding-right: 0.75rem;
}

.editor li::before {
  content: counter(line);
  display: inline-block;
  width: 2.2rem;
  padding-right: 0.75rem;
  text-align: right;
  color: var(--w-muted);
}

.editor .k { color: var(--w-kw); }
.editor .n { color: var(--w-num); }

.res-head {
  gap: 0.6rem;
  padding: 0 0.55rem;
  border-bottom: 1px solid var(--w-line);
}

.res-head small {
  color: var(--w-muted);
  font-size: 0.66rem;
  white-space: nowrap;
}

.rtab {
  padding: 0.4rem 0.1rem;
  color: var(--w-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.rtab.on {
  color: var(--w-text);
  border-bottom-color: var(--w-text);
}

.grid {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.grid th,
.grid td {
  padding: 0.3rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--w-line);
  white-space: nowrap;
}

.grid th {
  font-weight: 600;
  font-size: 0.7rem;
}

.grid .rn {
  width: 2rem;
  color: var(--w-muted);
  border-right: 1px solid var(--w-line);
}

.grid .num {
  text-align: right;
}

.win-status {
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-top: 1px solid var(--w-line);
  background: var(--w-chrome);
  color: var(--w-muted);
  font-size: 0.68rem;
}

.win-status .i {
  color: #16a34a;
}

.win-status code {
  font-size: 0.66rem;
}

/* The one orchestrated moment: the result arrives as if the query just ran. */
@media (prefers-reduced-motion: no-preference) {
  .grid tbody tr {
    animation: arrive 0.45s ease-out both;
  }
  .grid tbody tr:nth-child(1) { animation-delay: 0.55s; }
  .grid tbody tr:nth-child(2) { animation-delay: 0.62s; }
  .grid tbody tr:nth-child(3) { animation-delay: 0.69s; }
  .grid tbody tr:nth-child(4) { animation-delay: 0.76s; }
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(0.3rem); }
}

/* ---------- sections ---------- */

section {
  padding-block: clamp(3.5rem, 8vw, 6rem);
}

section + section {
  border-top: 1px solid var(--rule);
}

h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
  max-width: 22ch;
}

h3 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  line-height: 1.3;
  font-weight: 650;
}

p {
  margin: 0 0 1rem;
  max-width: var(--measure);
}

.intro {
  color: var(--muted);
  font-size: 1.1rem;
  margin-bottom: 2.5rem;
}

/* How it works — a real sequence, so it is numbered. */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  padding-top: 1.1rem;
  border-top: 3px solid var(--ink);
}

.steps li::before {
  content: counter(step);
  display: block;
  font-size: 2.4rem;
  font-weight: 750;
  line-height: 1;
  margin-bottom: 0.9rem;
  color: var(--duck-deep);
}

.steps p {
  color: var(--muted);
  margin: 0;
}

/* What it opens: a plain list, set large. */

.formats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2rem;
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.formats li small {
  font-size: 0.55em;
  font-weight: 500;
  color: var(--muted);
  margin-left: 0.35rem;
}

/* Capability rows: prose beside the thing itself. */

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
}

.row + .row {
  margin-top: clamp(3rem, 7vw, 5rem);
}

.row.flip > :first-child {
  order: 2;
}

.row p {
  color: var(--muted);
}

.snippet {
  margin: 0;
  padding: 1.1rem 1.25rem;
  border-radius: 0.6rem;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  font-size: 0.85rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}

.snippet .k { color: var(--keyword); font-weight: 600; }
.snippet .s { color: var(--string); }
.snippet .c { color: var(--muted); }

.promise {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.9rem;
  font-size: 1.05rem;
}

.promise li {
  padding-left: 1.6rem;
  position: relative;
}

.promise li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--duck);
}

/* Closing call to action. */

.closing {
  text-align: left;
}

.closing .hero-actions {
  margin-top: 1.5rem;
}

.closing .button-quiet {
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--rule);
}

.closing .button-quiet:hover {
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

@media (prefers-color-scheme: dark) {
  .closing .button-primary {
    background: var(--duck);
    color: #1d1a12;
  }
  .closing .button-primary:hover {
    background: #ffc928;
  }
}

footer {
  border-top: 1px solid var(--rule);
  padding-block: 2rem 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
}

footer a {
  color: inherit;
}

footer .spacer {
  flex: 1;
}

/* ---------- narrow screens ---------- */

@media (max-width: 860px) {
  .hero-grid,
  .row {
    grid-template-columns: minmax(0, 1fr);
  }
  .row.flip > :first-child {
    order: 0;
  }
  .steps {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  /* The hero's own Download for Mac sits just below; the top bar keeps
     only the links. */
  .topbar nav .optional,
  .topbar nav .button {
    display: none;
  }
  .win-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .win-side,
  .window .wide-only,
  .win-title .chip {
    display: none;
  }
}
