/* ==========================================================================
   API Espresso — shared stylesheet
   Design language adapted from a Replit-generated visual reference
   (palette, Playfair Display / DM Sans / DM Mono type pairing, spacing and
   layout patterns, illustration style). Content and structure are our own —
   see PROGRESS.md for what was and wasn't ported from that reference.
   ========================================================================== */

:root {
  --paper: #f3eee5;
  --paper2: #e8e0d3;
  --ink: #211e1a;
  --muted: #777064;
  --line: #cec4b4;
  --red: #a94a31;
  --dark: #1d1a17;
  --dark2: #24211e;
  --dark-line: #37332e;
  --white: #f8f4eb;

  --sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Playfair Display", Georgia, serif;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--ink); color: var(--paper); }

h1, h2, h3, p { margin-top: 0; }

em {
  font-family: var(--serif);
  font-style: normal;
  font-weight: 400;
  letter-spacing: -0.06em;
}

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

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

/* Faint paper-grain texture over the whole page — subtle, not a pattern
   anyone consciously notices, just keeps flat color fields from feeling too
   digital-flat. */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  width: calc(100% - 64px);
  max-width: 1360px;
  margin: auto;
}

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

.header {
  height: 84px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 40px;
}
.logo { display: flex; align-items: center; line-height: 1; flex: 0 0 auto; }
.logo-art { display: block; height: 62px; width: auto; max-width: 220px; object-fit: contain; }
.nav {
  display: flex;
  gap: 30px;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}
.nav a { color: var(--muted); }
.nav a.active, .nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ink);
  color: var(--paper);
  padding: 13px 18px;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  border: 1px solid transparent;
  cursor: pointer;
}
.button:hover { background: var(--dark); }
.button b { color: #d4775a; margin-left: 2px; }
.button.outline { background: transparent; color: var(--ink); border-color: var(--line); }
.button.outline:hover { border-color: var(--ink); }
.button.disabled { background: var(--paper2); color: var(--muted); cursor: not-allowed; }
.button.disabled:hover { background: var(--paper2); }
.header > .button { margin-left: 4px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.dot { width: 7px; height: 10px; background: var(--red); border-radius: 50%; transform: rotate(35deg); flex: 0 0 auto; }

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

.hero-reference {
  min-height: 430px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}
.hero-reference .copy { padding: 58px 32px 54px; align-self: center; }
.hero-reference h1 {
  font-size: clamp(56px, 6vw, 82px);
  line-height: 0.9;
  letter-spacing: -0.03em;
  font-weight: 500;
  margin: 20px 0;
}
.hero-reference .copy p { font-size: 16px; line-height: 1.5; color: var(--muted); max-width: 40ch; margin: 22px 0 24px; }
.hero-reference-art {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 430px;
  overflow: hidden;
  background: var(--paper2);
}
.hero-art-image { width: min(420px, 82%); height: auto; max-height: 325px; object-fit: contain; display: block; }

/* ------------------------------------------------------------ feature strip */

.feature-strip {
  padding: 0 32px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}
.feature { padding: 28px 28px 30px 20px; min-height: 132px; border-right: 1px solid var(--line); }
.feature:first-child { border-left: 0; padding-left: 0; }
.feature:last-child { border-right: 0; }
.feature-art { display: block; width: 42px; height: 42px; object-fit: contain; margin-bottom: 14px; }
.feature strong { display: block; font-family: var(--serif); font-size: 17px; line-height: 1.15; margin-bottom: 8px; }
.feature p { font-size: 12.5px; line-height: 1.5; color: var(--muted); margin: 0; max-width: 240px; }

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

.section { max-width: 1360px; padding: 0 32px; margin: 0 auto; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  padding: 60px 0 22px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 26px;
}
.section-head h2 {
  font-family: var(--serif);
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1;
  letter-spacing: -0.02em;
  font-weight: 500;
  margin: 10px 0 0;
}
.small-link { font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: var(--ink); white-space: nowrap; padding-bottom: 4px; border-bottom: 1px solid var(--ink); }
.small-link:hover { color: var(--red); border-color: var(--red); }

/* Homepage "available APIs" — a list row per product, not a grid, since
   there's only ever a small number and each deserves room for real copy. */
.api-card {
  display: grid;
  grid-template-columns: 185px 1fr 130px;
  min-height: 137px;
  border-top: 1px solid var(--line);
  align-items: center;
}
.api-card:last-of-type { border-bottom: 1px solid var(--line); }
.api-card-art { display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--line); height: 100%; }
.api-art-image { width: 150px; height: 108px; object-fit: contain; }
.api-card-main { padding: 18px 28px; }
.api-card .tag { font-family: var(--mono); font-size: 9px; text-transform: uppercase; color: var(--red); }
.api-card h3 { font-family: var(--serif); font-size: 24px; line-height: 1.1; letter-spacing: -0.01em; margin: 8px 0 8px; font-weight: 500; }
.api-card p { font-size: 13px; color: var(--muted); margin: 0; max-width: 46ch; }
.api-card-side { display: flex; justify-content: center; padding: 0 20px; }
.api-card-side a, .api-card-side span { font-family: var(--mono); font-size: 10px; text-transform: uppercase; }
.api-card-side span.soon { color: var(--muted); }

.suggest {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: center;
  gap: 28px;
  min-height: 105px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 24px 0;
}
.suggest-art { display: flex; align-items: center; justify-content: center; }
.suggestion-art-image { width: 170px; height: 112px; object-fit: contain; }
.suggest h3 { font-family: var(--serif); font-size: 22px; font-weight: 500; margin-bottom: 6px; }
.suggest p { font-size: 13px; color: var(--muted); margin: 0 0 14px; }

/* ------------------------------------------------------------------ steps */

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.step { border-top: 1px solid var(--line); padding: 24px 25px 0 0; min-height: 175px; }
.step:not(:first-child) { border-left: 1px solid var(--line); padding-left: 25px; }
.step span { font-family: var(--mono); font-size: 9px; color: var(--red); }
.step strong { display: block; font-family: var(--serif); font-size: 20px; font-weight: 500; margin: 18px 0 8px; }
.step p { font-size: 13.5px; color: var(--muted); line-height: 1.55; max-width: 26ch; }

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

.footer { border-top: 1px solid var(--ink); padding: 58px 0 30px; margin-top: 90px; }
.footer-top { display: flex; justify-content: space-between; align-items: center; }
.footer-top > span { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; }
.footer-links { display: grid; grid-template-columns: repeat(3, 150px); gap: 40px; margin: 55px 0; }
.footer-links div { display: flex; flex-direction: column; gap: 11px; font-family: var(--mono); font-size: 11px; }
.footer-links b { color: var(--muted); font-size: 10px; margin-bottom: 4px; font-weight: 600; }
.footer-links a:hover { color: var(--red); }
.footer-bottom {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
}

/* -------------------------------------------------------------- page head */

.page-head { padding: 90px 0 50px; border-bottom: 1px solid var(--ink); }
.page-head .eyebrow { margin-bottom: 22px; }
.page-head h1 {
  font-family: var(--serif);
  font-size: clamp(44px, 6vw, 72px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  font-weight: 500;
  margin: 0;
}
.page-head p { max-width: 62ch; color: var(--muted); font-size: 16px; line-height: 1.55; margin: 24px 0 0; }

/* -------------------------------------------------------------- catalog */

.catalog-tools { display: flex; gap: 24px; align-items: center; margin: 34px 0 26px; }
.search { flex: 1; height: 44px; border: 1px solid var(--line); border-radius: 7px; padding: 0 13px; display: flex; align-items: center; background: rgba(255, 255, 255, 0.35); }
.search:focus-within { border-color: var(--ink); }
.search-icon { width: 14px; height: 14px; border: 1.6px solid var(--ink); border-radius: 50%; position: relative; flex: 0 0 14px; margin-right: 10px; opacity: 0.75; }
.search-icon::after { content: ""; position: absolute; width: 6px; height: 1.6px; background: var(--ink); right: -4px; bottom: -2px; transform: rotate(45deg); transform-origin: left center; }
.search input { border: 0; background: transparent; outline: 0; width: 100%; font-family: var(--mono); font-size: 12px; color: var(--ink); }
.search input::placeholder { color: var(--muted); }
.filters { display: flex; gap: 18px; flex-wrap: wrap; }
.filters button { border: 0; background: none; font-family: var(--mono); font-size: 10px; text-transform: uppercase; color: var(--muted); cursor: pointer; padding: 0; }
.filters button.active, .filters button:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding-bottom: 80px; }
.card { border: 1px solid var(--line); border-radius: 8px; min-height: 420px; display: flex; flex-direction: column; background: rgba(255, 255, 255, 0.15); transition: 0.15s; }
.card:hover { transform: translateY(-3px); border-color: var(--ink); }
.card-art { height: 190px; background: var(--paper2); margin: 12px; border-radius: 5px; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.card-art img { width: 78%; height: 78%; object-fit: contain; }
.art-label { position: absolute; top: 12px; left: 12px; color: var(--muted); font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.card-body { padding: 6px 20px 20px; flex-grow: 1; }
.card-meta { display: flex; justify-content: space-between; color: var(--muted); font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.card h3 { font-family: var(--serif); font-size: 24px; line-height: 1.05; font-weight: 500; letter-spacing: -0.01em; margin: 14px 0 10px; }
.card p { font-size: 12.5px; line-height: 1.5; color: var(--muted); margin: 0; }
.card-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; }
.card-foot .price { font-family: var(--mono); font-size: 15px; }
.card-foot .price small { font-size: 9px; color: var(--muted); }
.card-foot a, .card-foot .soon { font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.card-foot .soon { color: var(--muted); }
.card-foot a b { color: var(--red); }

/* ----------------------------------------------------------- API doc page */

body.api-doc-page { background: var(--dark); color: var(--white); }
.api-doc-page .header { border-color: var(--dark-line); }
.api-doc-page .nav a { color: #ded5c7; }
.api-doc-page .nav a.active, .api-doc-page .nav a:hover { color: #fff; }
.api-doc-page .button.outline { color: #f5ead8; border-color: #bca77f; }
.api-doc-page .button.outline:hover { border-color: #fff; }
.api-doc-page .header > .button b { color: #d9b776; }

.api-top { padding: 20px 6px; font-family: var(--mono); font-size: 11px; color: #bca77f; }
.api-top span { margin: 0 8px; color: #6b6459; }
.api-top strong { color: #f5ead8; font-weight: 400; }

.api-reference-layout { display: grid; grid-template-columns: 165px minmax(0, 1fr) 195px; border-top: 1px solid var(--dark-line); }

.api-side-left { border-right: 1px solid var(--dark-line); padding: 24px 14px 0 0; display: flex; flex-direction: column; height: max-content; position: sticky; top: 0; min-width: 0; }
.api-side-left a { padding: 11px 14px; border-radius: 5px; font-family: var(--mono); font-size: 11px; color: #bfb6a7; }
.api-side-left a.active { background: var(--dark2); color: #f5ead8; }
.api-side-left a:hover { color: #f5ead8; }
.api-help { margin-top: auto; margin-bottom: 24px; background: #1b1916; border: 1px solid #302c26; border-radius: 6px; padding: 15px; }
.api-help strong { font-family: var(--serif); font-size: 16px; display: block; margin-bottom: 6px; }
.api-help p { font-size: 10.5px; color: #968e83; line-height: 1.5; margin: 0 0 12px; }

.api-center { padding: 34px 28px 60px; min-width: 0; }
.api-center .tag { font-family: var(--mono); font-size: 10px; text-transform: uppercase; color: #d9a06a; }
.api-center h1 { font-family: var(--serif); font-size: clamp(32px, 4vw, 44px); line-height: 1; letter-spacing: -0.02em; font-weight: 500; margin: 15px 0 19px; }
.api-center .intro { color: #aaa196; line-height: 1.55; font-size: 14px; max-width: 62ch; }
.api-chips { display: flex; gap: 8px; margin: 20px 0 26px; flex-wrap: wrap; }
.api-chip { background: var(--dark2); border-radius: 15px; padding: 6px 12px; font-family: var(--mono); font-size: 9.5px; color: #bcb2a3; }

.doc-section { border-top: 1px solid var(--dark-line); padding: 26px 0; }
.doc-section h2 { font-family: var(--serif); font-size: 21px; font-weight: 500; margin: 0 0 14px; }
.doc-section h3 { font-family: var(--serif); font-size: 15px; font-weight: 500; margin: 22px 0 12px; }
.doc-section p { font-size: 12.5px; color: #aaa196; line-height: 1.6; margin: 0 0 12px; max-width: 68ch; }

.endpoint { background: #201d19; border: 1px solid var(--dark-line); border-radius: 5px; padding: 11px 13px; font-family: var(--mono); font-size: 11px; overflow-wrap: anywhere; }
.endpoint b { color: #7eb46e; margin-right: 10px; }

.param-table { border: 1px solid var(--dark-line); border-radius: 5px; overflow: hidden; font-size: 11px; min-width: 0; }
.param-row { display: grid; grid-template-columns: 1fr 0.6fr 0.6fr 2.2fr; border-bottom: 1px solid var(--dark-line); }
.param-row:last-child { border-bottom: 0; }
.param-row span { padding: 10px 12px; color: #c8bfb1; overflow-wrap: anywhere; min-width: 0; }
.param-row.param-head span { color: #79726a; font-size: 9.5px; text-transform: uppercase; font-family: var(--mono); }
.param-row code { color: #f5ead8; }

.codebox { background: #0e0d0c; border: 1px solid var(--dark-line); border-radius: 5px; overflow: hidden; margin-top: 16px; min-width: 0; }
.codebar { padding: 9px 12px; border-bottom: 1px solid #292622; display: flex; gap: 18px; font-family: var(--mono); font-size: 9.5px; color: #766f65; }
.codebar .selected { color: #eee0ce; }
.codebox pre { padding: 15px; margin: 0; overflow-x: auto; overflow-wrap: anywhere; color: #91bd83; font-family: var(--mono); font-size: 11px; line-height: 1.65; white-space: pre-wrap; }
.codebox .string { color: #d9a06a; }
.codebox .comment { color: #6b6459; }

.api-side-right { border-left: 1px solid var(--dark-line); padding: 30px 0 0 22px; }
.side-card { background: #1b1916; border: 1px solid #302c26; border-radius: 6px; padding: 17px; margin-bottom: 16px; }
.side-card strong { font-family: var(--serif); font-size: 16px; display: block; margin-bottom: 4px; }
.side-card p { font-size: 10.5px; line-height: 1.5; color: #9b9387; margin: 6px 0 0; }
.side-card .price-big { font-family: var(--mono); font-size: 17px; margin: 14px 0 4px; }
.side-card .price-big small { font-size: 10px; color: #8e877c; font-weight: 400; }
.side-card .tiers { font-size: 10.5px; color: #b8afa2; line-height: 1.9; margin: 10px 0; }
.side-card .tiers span { color: #d4b26e; margin-right: 6px; font-family: var(--mono); }
.side-card .button { width: 100%; justify-content: center; margin-top: 8px; box-sizing: border-box; }
.related { border-top: 1px solid var(--dark-line); margin-top: 10px; padding-top: 6px; }
.related .related-item { display: block; padding: 9px 0; border-bottom: 1px solid #302c26; font-size: 11px; color: #d8cfc2; }
.related small { display: block; color: #8e877c; margin-top: 3px; line-height: 1.4; font-size: 10px; }

/* ----------------------------------------------------------------- about */

.about-section { padding: 80px 0; border-top: 1px solid var(--line); }
.about-section-head { margin-bottom: 40px; }
.about-section-head .eyebrow { margin-bottom: 16px; }
.about-section-head h2 { font-family: var(--serif); font-size: clamp(30px, 4vw, 44px); line-height: 1.05; letter-spacing: -0.02em; font-weight: 500; margin: 0; }
.about-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 70px; }
.about-grid .lead { font-family: var(--serif); font-size: 30px; line-height: 1.1; letter-spacing: -0.02em; font-weight: 500; }
.about-grid > div:last-child p { font-size: 15px; line-height: 1.65; color: var(--muted); max-width: 58ch; margin-bottom: 18px; }

/* ------------------------------------------------------------ suggestions */

.suggestion-page { display: grid; grid-template-columns: 1fr 1fr; min-height: 560px; align-items: center; gap: 90px; padding: 40px 0; }
.receipt {
  width: 250px;
  min-height: 300px;
  background: var(--paper2);
  padding: 24px;
  box-shadow: 12px 15px 0 rgba(20, 15, 12, 0.12);
  transform: rotate(-4deg);
  justify-self: center;
  display: flex;
  flex-direction: column;
}
.receipt span, .receipt small { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.receipt strong { font-family: var(--serif); font-size: 34px; font-weight: 400; line-height: 0.95; margin-top: 70px; }
.receipt i { border-top: 1px dashed var(--line); margin: 22px 0; font-style: normal; }
.receipt b { font-family: var(--serif); font-size: 48px; font-weight: 400; color: var(--red); align-self: center; }
.suggestion-page h1 {
  font-family: var(--serif);
  font-size: clamp(40px, 5vw, 60px);
  line-height: 1;
  letter-spacing: -0.02em;
  font-weight: 500;
}
.suggestion-page p { max-width: 48ch; color: var(--muted); line-height: 1.6; margin: 26px 0 0; }

/* --------------------------------------------------------------- legal */

.legal { max-width: 780px; padding: 90px 0 100px; }
.legal h1 { font-family: var(--serif); font-size: clamp(40px, 5vw, 58px); line-height: 1; letter-spacing: -0.02em; font-weight: 500; margin: 20px 0 12px; }
.legal .updated { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 45px; }
.legal h2 { font-size: 21px; letter-spacing: -0.01em; margin-top: 42px; }
.legal h2:first-of-type { margin-top: 0; }
.legal p, .legal li { color: var(--muted); font-size: 14px; line-height: 1.7; }
.legal strong { color: var(--ink); }
.legal ul { padding-left: 20px; }

/* -------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .wrap { width: calc(100% - 36px); }
  .nav { display: none; }
  .hero-reference, .about-grid, .suggestion-page { grid-template-columns: 1fr; }
  .hero-reference-art { min-height: 300px; order: -1; }
  .feature-strip { grid-template-columns: 1fr; padding: 0; }
  .feature { border-right: 0; border-bottom: 1px solid var(--line); padding-left: 12px; padding-right: 12px; }
  .feature:last-child { border-bottom: 0; }
  .cards { grid-template-columns: 1fr 1fr; }
  .catalog-tools { flex-direction: column; align-items: stretch; }
  .api-card { grid-template-columns: 150px minmax(0, 1fr); }
  .api-card-side { display: none; }
  .api-reference-layout { grid-template-columns: 130px minmax(0, 1fr); }
  .api-side-right { display: none; }
  .steps { grid-template-columns: 1fr; }
  .step:not(:first-child) { border-left: 0; padding-left: 0; }
  .footer-links { grid-template-columns: 1fr 1fr; }
  .about-section .about-grid { gap: 40px; }
}
@media (max-width: 600px) {
  .wrap { width: calc(100% - 28px); }
  .header { height: 68px; gap: 18px; }
  .header .nav { display: none; }
  .header > .button { display: none; }
  .logo-art { height: 44px; }
  .hero-reference h1 { font-size: 44px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .cards { grid-template-columns: 1fr; }
  .card-art { display: none; }
  .api-card { grid-template-columns: 1fr; }
  .api-card-art { display: none; }
  .suggest { grid-template-columns: 1fr; text-align: center; }
  .suggest-art { display: none; }
  .api-reference-layout { grid-template-columns: 1fr; }
  .api-side-left { position: static; flex-direction: row; overflow-x: auto; padding: 10px 0; }
  .api-help { display: none; }
  .param-row { grid-template-columns: 1fr 1fr; }
  .param-row span:nth-child(3), .param-row span:nth-child(4) { display: none; }
  .footer-links { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; gap: 8px; }
}
