/* One stylesheet for every page. The accent is neutral on the home page;
   each product's pages set a theme class on <body> (and the home page's
   product cards use the same classes). White text passes AA on every accent. */
:root {
  --accent: #1f2937;          /* buttons, price tag */
  --accent-ink: #ffffff;
  --accent-soft: #f1f1ec;
  --ink: #000000;
  --muted: #474747;
  --line: #000000;
  --line-soft: #d6d6d0;
  --bg: #f4f4f0;
  --card: #ffffff;
  --radius: 6px;
  --gutter: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

.theme-tenders { --accent: #c2410c; --accent-soft: #fff4ec; }
.theme-land { --accent: #166534; --accent-soft: #effaf2; }
.theme-retrofit { --accent: #1d4ed8; --accent-soft: #eef4ff; }
.theme-planning { --accent: #0f766e; --accent-soft: #ecfdf8; }

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
}

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

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

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 8px 12px;
  z-index: 10;
}
.skip-link:focus { top: 8px; }

/* ---------- top bar & footer ---------- */
.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.topbar-inner,
.footer-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
}
.topbar-title { color: var(--muted); font-size: 15px; }
a.topbar-title { text-decoration: none; }
a.topbar-title:hover { text-decoration: underline; }
.topbar-nav { margin-left: auto; display: flex; gap: 18px; align-items: center; font-size: 15px; }
.topbar-nav a { font-weight: 600; }
.topbar-nav a[aria-current="page"] { color: var(--muted); text-decoration: none; }
.topbar-account { font-weight: 700; }

.site-footer { padding: 24px 0 40px; color: var(--muted); font-size: 14px; }
.site-footer nav { display: flex; gap: 6px 16px; flex-wrap: wrap; }
.site-footer nav strong { color: var(--ink); font-weight: 600; width: 100%; }
.site-footer a { color: var(--muted); }

/* ---------- page ---------- */
.page {
  max-width: 1040px;
  margin: 32px auto 0;
  padding: 0 var(--gutter);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* Product card: head + body on the left, purchase column on the right. */
.product {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas:
    "head side"
    "body side";
  grid-template-rows: auto 1fr;
}
.product-head { grid-area: head; }
.product-body { grid-area: body; padding: 24px; }
.product-side {
  grid-area: side;
  border-left: 1px solid var(--line);
}

.product-title {
  margin: 0;
  padding: 24px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--line);
}

.meta-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}
.meta-row > * { padding: 14px 24px; display: flex; align-items: center; gap: 10px; }
.meta-row > * + * { border-left: 1px solid var(--line); }

.price-tag {
  display: inline-flex;
  align-items: center;
  min-width: 64px;
  min-height: 34px;
  padding: 4px 22px 4px 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 18px;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%);
  white-space: nowrap;
}
.price-tag:empty::before { content: "\00a0"; }
.price-from { color: var(--muted); font-size: 14px; }

.seller {
  font-weight: 600;
  text-decoration: none;
}
.seller-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  background: var(--accent-soft);
}

/* ---------- description ---------- */
.lead {
  font-size: 20px;
  line-height: 1.4;
  font-weight: 600;
  margin: 0 0 12px;
}
.product-body h2 {
  font-size: 18px;
  margin: 28px 0 8px;
  letter-spacing: -0.01em;
}
.product-body h3 {
  font-size: 16px;
  margin: 18px 0 6px;
}
.product-body p { margin: 0 0 12px; }
.product-body ul, .product-body ol { margin: 0 0 12px; padding-left: 22px; }
.product-body li { margin: 4px 0; }
.product-body section + section { border-top: 1px solid var(--line-soft); margin-top: 24px; padding-top: 4px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.note {
  border: 1px solid var(--line);
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 12px 0;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0 !important; }
.tags li {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 14px;
  margin: 0 !important;
}

/* ---------- purchase column ---------- */
.buy { padding: 24px; display: grid; gap: 12px; }
.buy + .buy { border-top: 1px solid var(--line); }
.buy p { margin: 0; }
.buy-name { font-weight: 700; line-height: 1.3; }
.buy-price { font-size: 22px; font-weight: 800; margin: 0; }

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover:not([disabled]) { transform: translate(-3px, -3px); box-shadow: 3px 3px 0 var(--line); }
.btn:active:not([disabled]) { transform: none; box-shadow: none; }
.btn[disabled] { cursor: progress; opacity: 0.7; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--card); color: var(--ink); }
.btn-inline { width: auto; }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:hover:not([disabled]) { transform: none; } }

.buy-note { margin: 0; font-size: 14px; color: var(--muted); text-align: center; }
.form-status { margin: 0; font-size: 14px; }
.form-status:empty { margin-top: -12px; }
.form-status:not(:empty) { color: #9f1d1d; font-weight: 600; }

.facts {
  width: 100%;
  border-collapse: collapse;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.facts caption {
  text-align: left;
  font-weight: 700;
  padding: 14px 24px 6px;
}
.facts th, .facts td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.facts th { padding-left: 24px; width: 34%; font-weight: 600; }
.facts td { padding-right: 24px; }
.facts tr:last-child th, .facts tr:last-child td { border-bottom: 0; }
.facts + .facts { border-top: 1px solid var(--line); }

/* ---------- home page ---------- */
.intro h1 {
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}
.intro .lead { margin: 0 0 28px; max-width: 60ch; }

.products {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.product-card { display: flex; flex-direction: column; }
.product-card h2 {
  margin: 0;
  padding: 20px 24px;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--line);
}
.product-card h2 a { text-decoration: none; }
.product-card h2 a:hover { text-decoration: underline; }
.product-card p { margin: 0; padding: 20px 24px; flex: 1; }
.product-card .card-action { padding: 0 24px 24px; }

/* ---------- simple document pages (legal, success, 404) ---------- */
.doc { padding: 32px; max-width: 760px; margin: 0 auto; }
.doc h1 { font-size: clamp(26px, 4vw, 34px); line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.02em; }
.doc h2 { font-size: 19px; margin: 28px 0 8px; }
.doc p, .doc li { max-width: 68ch; }
.doc ul { padding-left: 22px; }
.placeholder { background: #fff1a8; padding: 0 3px; font-weight: 600; }

.downloads { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 10px; max-width: 420px; }
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-soft);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -3px;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ---------- home page plan box ---------- */
.plan-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0 0 32px;
}
.plan-price { margin: 0; display: flex; align-items: center; gap: 10px; flex-basis: 100%; }
.plan-box .form-status { flex-basis: 100%; }
.plan-box .buy-note { flex-basis: 100%; text-align: left; }

/* ---------- account page ---------- */
.sign-in-form { display: grid; gap: 10px; max-width: 420px; margin: 16px 0; }
.sign-in-form label { font-weight: 700; }
.sign-in-form input {
  font: inherit;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  width: 100%;
}
.sign-in-form .form-status:empty { margin-top: 0; }
.datasets { list-style: none; padding: 0 !important; margin: 20px 0; display: grid; gap: 8px; }
.dataset { border-top: 1px solid var(--line-soft); padding-top: 8px; }
.dataset h2 { margin-top: 8px; }
.dataset .downloads { margin: 12px 0; }
.account-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.account-actions p { flex-basis: 100%; margin: 0; }

[hidden] { display: none !important; }

/* ---------- small screens: stack, buy box straight after the title ---------- */
@media (max-width: 820px) {
  .page { margin-top: 16px; }
  .product {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "side" "body";
    grid-template-rows: auto;
  }
  .product-side { border-left: 0; border-bottom: 1px solid var(--line); }
  .product-title, .product-body, .buy { padding: 18px var(--gutter); }
  .meta-row > * { padding: 12px var(--gutter); }
  .facts caption, .facts th { padding-left: var(--gutter); }
  .facts td { padding-right: var(--gutter); }
  .doc { padding: 22px var(--gutter); }
  .products { grid-template-columns: minmax(0, 1fr); }
  .product-card h2, .product-card p { padding-left: var(--gutter); padding-right: var(--gutter); }
  .product-card .card-action { padding: 0 var(--gutter) var(--gutter); }
}
