/*
 * polytropic.pt: the page's own layout, on the product's tokens (tokens.css, the --wf-* properties). The kit's parts
 * it reuses (the button, the badge, the dashed empty box, the line icons, the canvas's grid) follow spaces v0.14.0,
 * core/src/app/ui/styles.css and Icon.tsx, scaled up for a page that is read rather than worked in. The product has
 * no spacing or type-scale tokens (its sizes are written into its rules, small for a dense app), so the --site-*
 * scale below is the page's own, on the same 4px steps the kit's paddings use.
 */

:root {
  --site-space-1: 4px;
  --site-space-2: 8px;
  --site-space-3: 12px;
  --site-space-4: 16px;
  --site-space-5: 24px;
  --site-space-6: 32px;
  --site-space-7: 48px;
  --site-space-8: 64px;
  --site-space-9: 96px;
  --site-wrap: 1080px;
  --site-gutter: 16px;
  --site-text: 1rem;
  --site-text-small: 0.875rem;
  --site-text-lead: 1.1875rem;
  --site-h1: clamp(2rem, 1.25rem + 3.4vw, 3.25rem);
  --site-h2: clamp(1.5rem, 1.2rem + 1.3vw, 2rem);
  --site-h3: 1.125rem;
}

* {
  box-sizing: border-box;
}

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--wf-bg);
  color: var(--wf-text);
  font: var(--site-text) / 1.6 var(--wf-font);
}

a {
  color: var(--wf-accent);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--wf-accent-hover);
}

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

code {
  font-family: var(--wf-font-mono);
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--wf-surface-muted);
  white-space: nowrap;
}

/* An address too long for a phone's line may break anywhere; an expression never does. */
code.code-wrap {
  white-space: normal;
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: var(--site-h1);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.08;
}

h2 {
  font-size: var(--site-h2);
  font-weight: 650;
  letter-spacing: -0.01em;
}

h3 {
  font-size: var(--site-h3);
  font-weight: 600;
}

p {
  margin: 0;
}

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

@media (min-width: 720px) {
  :root {
    --site-gutter: 24px;
  }
}

/* The skip link: out of sight until the keyboard reaches it. */
.skip {
  position: absolute;
  left: var(--site-space-2);
  top: -100px;
  padding: var(--site-space-2) var(--site-space-3);
  background: var(--wf-surface);
  border: 1px solid var(--wf-border-strong);
  border-radius: var(--wf-radius);
  z-index: 10;
}

.skip:focus {
  top: var(--site-space-2);
}

/* The top bar, as the product's (.wf-topbar): the surface with one line beneath. */
.topbar {
  background: var(--wf-surface);
  border-bottom: 1px solid var(--wf-border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--site-space-4);
  min-height: 56px;
}

.brand {
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--wf-text);
  text-decoration: none;
}

.brand:hover {
  color: var(--wf-text);
}

.nav ul {
  display: flex;
  gap: var(--site-space-5);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--site-text-small);
}

.nav a {
  color: var(--wf-text-muted);
  text-decoration: none;
}

.nav a:hover {
  color: var(--wf-text);
}

/* On a phone the page is one scroll, so the top bar keeps only Contact. */
@media (max-width: 560px) {
  .nav-optional {
    display: none;
  }
}

/* The line icons of the product's kit: a 24 x 24 grid in the current colour, decorative beside their label. The
   page defines each once in a sprite (no inline style: the page's policy refuses it) and draws it with <use>. */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  flex: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Sections */

.section {
  padding: var(--site-space-8) 0;
  border-bottom: 1px solid var(--wf-border);
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: var(--site-space-3);
  margin-bottom: var(--site-space-6);
  max-width: 68ch;
}

.section-lead {
  color: var(--wf-text-muted);
  font-size: 1.0625rem;
}

@media (max-width: 720px) {
  .section {
    padding: var(--site-space-7) 0;
  }
}

/* The hero, on the canvas's paper: its grid lines, 40px minor and 200px major, in the grid tokens, fading out. */
.hero {
  position: relative;
  padding: var(--site-space-9) 0 var(--site-space-8);
  border-bottom: 1px solid var(--wf-border);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--wf-grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--wf-grid-major) 1px, transparent 1px),
    linear-gradient(var(--wf-grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--wf-grid-minor) 1px, transparent 1px);
  background-size:
    200px 200px,
    200px 200px,
    40px 40px,
    40px 40px;
  background-position: center top;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 95%);
  mask-image: linear-gradient(to bottom, #000 30%, transparent 95%);
  pointer-events: none;
}

.hero > .wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--site-space-5);
}

.hero h1 {
  max-width: 18ch;
}

.lead {
  font-size: var(--site-text-lead);
  color: var(--wf-text-muted);
  max-width: 62ch;
}

.tenets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--site-space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  max-width: 920px;
}

.tenets li {
  display: flex;
  flex-direction: column;
  gap: var(--site-space-1);
  padding-left: var(--site-space-3);
  border-left: 2px solid var(--wf-accent);
}

.tenets strong {
  font-weight: 600;
}

.tenets span {
  color: var(--wf-text-muted);
  font-size: 0.9375rem;
}

@media (max-width: 720px) {
  .hero {
    padding: var(--site-space-8) 0 var(--site-space-7);
  }
}

/* Buttons, as the kit's .wf-button and .wf-button-primary, at a page's size. */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--site-space-3);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: var(--site-space-2);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--wf-radius);
  border: 1px solid var(--wf-border-strong);
  background: var(--wf-surface);
  color: var(--wf-text);
  text-decoration: none;
  white-space: nowrap;
}

.button:hover {
  border-color: var(--wf-accent);
  color: var(--wf-text);
}

.button-primary {
  background: var(--wf-accent);
  border-color: var(--wf-accent);
  color: var(--wf-on-accent);
}

.button-primary:hover {
  background: var(--wf-accent-hover);
  border-color: var(--wf-accent-hover);
  color: var(--wf-on-accent);
}

/* Grids and cards: the surface, one border, the kit's large radius. */
.grid {
  display: grid;
  gap: var(--site-space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  gap: var(--site-space-3);
  padding: var(--site-space-5);
  background: var(--wf-surface);
  border: 1px solid var(--wf-border);
  border-radius: var(--wf-radius-large);
}

.card p {
  color: var(--wf-text-muted);
}

.card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--site-space-2) var(--site-space-3);
}

.card-head .icon {
  color: var(--wf-accent);
}

.card-head .badge {
  margin-left: auto;
}

.card .coming {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--site-space-2);
  padding-top: var(--site-space-3);
  border-top: 1px solid var(--wf-border);
}

.kicker {
  font-family: var(--wf-font-mono);
  font-size: 0.8125rem;
  color: var(--wf-text-muted);
}

/*
 * Badges, as the kit's .wf-badge. Built is the success colour on the surface rather than on --wf-success-soft: that
 * light pairing is 4.44:1, under WCAG AA's 4.5:1 for text this small, while on the surface it is 5.05:1.
 */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  padding: 1px 9px;
  border-radius: 999px;
  border: 1px solid var(--wf-border);
  background: var(--wf-surface-muted);
  color: var(--wf-text-muted);
  white-space: nowrap;
}

.badge-built {
  background: var(--wf-surface);
  border-color: var(--wf-success);
  color: var(--wf-success);
}

.badge-progress {
  background: var(--wf-accent-soft);
  border-color: transparent;
  color: var(--wf-accent);
}

.badge-coming {
  background: var(--wf-warning-soft);
  border-color: transparent;
  color: var(--wf-warning);
}

/*
 * Placeholders, as the kit's empty state (.wf-empty): a dashed box saying what goes there. A screenshot's box keeps
 * the picture's proportions so the page does not move when the picture arrives.
 */
.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--site-space-2);
  margin: 0;
  padding: var(--site-space-6) var(--site-space-4);
  aspect-ratio: 16 / 9;
  text-align: center;
  color: var(--wf-text-muted);
  background: color-mix(in srgb, var(--wf-surface) 75%, transparent);
  border: 1px dashed var(--wf-border-strong);
  border-radius: var(--wf-radius-large);
}

.placeholder .icon {
  width: 28px;
  height: 28px;
}

.placeholder figcaption {
  font-size: var(--site-text-small);
  max-width: 40ch;
}

.placeholder-wide {
  aspect-ratio: 21 / 9;
  margin-top: var(--site-space-5);
}

@media (max-width: 560px) {
  .placeholder,
  .placeholder-wide {
    aspect-ratio: 4 / 3;
  }
}

/* A word still to be given: marked plainly where it will stand. */
.placeholder-inline {
  font-family: var(--wf-font-mono);
  font-size: 0.875em;
  padding: 1px 6px;
  border: 1px dashed var(--wf-warning);
  border-radius: 4px;
  background: var(--wf-warning-soft);
  color: var(--wf-text);
  white-space: nowrap;
}

/* The layers: our products on the engine's public API, nothing beside it. */
.layers {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--site-space-2);
  margin: 0 0 var(--site-space-6);
  padding: var(--site-space-5);
  background: var(--wf-surface);
  border: 1px solid var(--wf-border);
  border-radius: var(--wf-radius-large);
}

.layer-products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));
  gap: var(--site-space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.layer-products li {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--site-space-2);
  padding: var(--site-space-3);
  font-weight: 500;
  font-size: 0.9375rem;
  background: var(--wf-bg);
  border: 1px solid var(--wf-border-strong);
  border-radius: var(--wf-radius);
}

.layer-products .icon {
  width: 18px;
  height: 18px;
  color: var(--wf-accent);
}

.layer-api {
  display: flex;
  align-items: center;
  gap: var(--site-space-3);
  font-family: var(--wf-font-mono);
  font-size: 0.8125rem;
  color: var(--wf-text-muted);
}

.layer-api::before,
.layer-api::after {
  content: "";
  flex: 1;
  border-top: 1px dashed var(--wf-border-strong);
}

.layer-engine {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: var(--site-space-1) var(--site-space-3);
  padding: var(--site-space-4);
  text-align: center;
  background: var(--wf-accent-soft);
  border: 1px solid var(--wf-accent);
  border-radius: var(--wf-radius);
}

.layer-engine strong {
  font-size: 1.0625rem;
}

.layer-engine span {
  color: var(--wf-text-muted);
  font-size: 0.9375rem;
}

.layers figcaption {
  margin-top: var(--site-space-2);
  font-size: var(--site-text-small);
  color: var(--wf-text-muted);
  text-align: center;
}

/* The engine's properties: a quiet list with an icon each, not cards. */
.features {
  display: grid;
  gap: var(--site-space-6) var(--site-space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.features li {
  display: flex;
  gap: var(--site-space-3);
}

.features .icon {
  color: var(--wf-accent);
  margin-top: 2px;
}

.features h3 {
  margin-bottom: var(--site-space-1);
}

.features p {
  color: var(--wf-text-muted);
}

.note {
  margin-top: var(--site-space-6);
  color: var(--wf-text-muted);
  font-size: 0.9375rem;
}

/* Examples: a story each. A product's own word for an action (Try, Publish) is set off by weight, not slant. */
.example h3 {
  font-size: 1.1875rem;
}

.card em {
  font-style: normal;
  font-weight: 600;
  color: var(--wf-text);
}

/* What makes it different: two columns of short claims under a rule. */
.claims {
  display: grid;
  gap: var(--site-space-6) var(--site-space-7);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
}

.claims article {
  display: flex;
  flex-direction: column;
  gap: var(--site-space-2);
  padding-top: var(--site-space-4);
  border-top: 2px solid var(--wf-accent);
}

.claims p {
  color: var(--wf-text-muted);
}

/* Contact */
.contact {
  border-bottom: none;
}

.contact-box {
  display: flex;
  flex-direction: column;
  gap: var(--site-space-4);
  max-width: 720px;
  padding: var(--site-space-6);
  background: var(--wf-surface);
  border: 1px solid var(--wf-border);
  border-radius: var(--wf-radius-large);
}

.contact-box p {
  color: var(--wf-text-muted);
}

.contact-box p strong {
  color: var(--wf-text);
  font-weight: 600;
}

@media (max-width: 560px) {
  .contact-box {
    padding: var(--site-space-5);
  }
}

/* The footer */
.footer {
  padding: var(--site-space-6) 0 var(--site-space-7);
  background: var(--wf-surface);
  border-top: 1px solid var(--wf-border);
  font-size: var(--site-text-small);
}

.footer .wrap {
  display: flex;
  flex-direction: column;
  gap: var(--site-space-2);
}

.footer p {
  color: var(--wf-text-muted);
  max-width: 72ch;
}

.footer strong {
  color: var(--wf-text);
}

/* The not-found page */
.missing {
  min-height: 60vh;
  display: flex;
  align-items: center;
}

.missing .wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--site-space-4);
}
