/* ---------------------------------------------------------------------------
 * hub.css — the marketing site only.
 *
 * Everything reusable lives in the design system: /ds/styles.css supplies the
 * tokens, the base layer and the .us-* component classes. This file is only the
 * page compositions those classes do not cover — the header, the tool grid, the
 * prose pages and the footer — plus the specimen sheet's layout.
 *
 * It is per-theme for exactly the reason this port demonstrates: a brutalist
 * hero and a colour-block one are different compositions, not the same one
 * restyled. RawBlock's landing page was six bordered cards in a plain grid
 * because that system had no other move. CreateSpace's spec asks for
 * asymmetric, grid-heavy layouts with colour blocks, so the grid here is
 * deliberately uneven and the header carries a colour field behind it.
 *
 * The rules this file obeys: no gradients — colour arrives as flat blocks;
 * yellow is a fill and never type; the tool accents stay out of the furniture.
 * ------------------------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-default);
  background: var(--accent-primary);
  color: var(--ink-on-accent);
  text-decoration: none;
  box-shadow: var(--shadow-lg);
}

.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
}

/* --- wordmark -------------------------------------------------------------
 * A rose square with the name stacked over three lines and a six-arm asterisk
 * in the corner. RawBlock's mark was a horizontal black rectangle that
 * inverted on the plate; this one keeps its rose everywhere, because here the
 * colour is the brand and a wordmark that changes hue by context is two
 * wordmarks.
 *
 * Every value below is a fraction of --wm-size, so the whole lockup scales
 * from one number and the two placements differ by that number alone. The
 * fractions are the mark's proportions and are not tokens: they describe this
 * drawing, not the system.
 *
 * Only the mono variant ships. The accent version — blue u, yellow l, green
 * dot — is 1.10:1 and 1.07:1 for the blue and the green against the rose
 * ground, so two of its three letters disappear. It is a nice idea on a
 * lighter ground and it is not one this mark can carry.
 * ------------------------------------------------------------------------- */

.us-wordmark {
  /* The header size, and the default everywhere else. The header grows to
     match it rather than the mark being squeezed to fit the header — this
     system leads with the brand, so the mark sets the height and the nav
     centres against it. */
  --wm-size: 144px;

  --wm-corner: 0.176;   /* radius, as a fraction of --wm-size */
  --wm-type: 0.235;     /* font-size */
  --wm-inset-x: 0.075;  /* left margin */
  --wm-inset-b: 0.1;    /* how far up the baseline sits */
  --wm-lead: 0.88;      /* rows one and two */
  --wm-lead-space: 0.67; /* ".space" tucks in tighter */

  --wm-star: 0.235;     /* diameter */
  --wm-star-t: 0.082;   /* from the top */
  --wm-star-r: 0.06;    /* from the right */
  --wm-star-arm: 0.34;  /* arm width at the tip, as a fraction of --wm-star */
  --wm-star-waist: 0.12; /* arm width at the centre */

  position: relative;
  box-sizing: border-box;
  width: var(--wm-size);
  height: var(--wm-size);
  border-radius: calc(var(--wm-size) * var(--wm-corner));
  /* --brand-mark, not --accent-primary: the accent lifts to #fb7185 on a dark
     page and would take white type down to 2.1:1. See tokens/colors.css. */
  background: var(--brand-mark);
  padding: 0 0 calc(var(--wm-size) * var(--wm-inset-b))
    calc(var(--wm-size) * var(--wm-inset-x));

  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  overflow: hidden;

  font-family: var(--font-display);
  font-weight: var(--weight-extrabold);
  font-size: calc(var(--wm-size) * var(--wm-type));
  line-height: var(--wm-lead);
  letter-spacing: -0.05em;
  color: var(--ink-on-brand-mark);
  -webkit-font-smoothing: antialiased;
  user-select: none;

  transition: transform var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

.us-wordmark-row {
  display: block;
  white-space: nowrap;
}

.us-wordmark-row--full { line-height: var(--wm-lead); }
.us-wordmark-row--space { line-height: var(--wm-lead-space); }

/* Three bars at 0 / 60 / 120 make six arms. Each is clipped to a hexagon —
   wide at both tips, pinched at the waist — so the arms taper into the centre
   the way a drawn asterisk does rather than crossing as flat slabs. */
.us-wordmark-star {
  position: absolute;
  top: calc(var(--wm-size) * var(--wm-star-t));
  right: calc(var(--wm-size) * var(--wm-star-r));
  width: calc(var(--wm-size) * var(--wm-star));
  aspect-ratio: 1;
}

.us-wordmark-star i {
  position: absolute;
  inset: 0;
  background: var(--ink-on-brand-mark);
  clip-path: polygon(
    calc(50% - var(--wm-star-arm) * 50%) 0%,
    calc(50% + var(--wm-star-arm) * 50%) 0%,
    calc(50% + var(--wm-star-waist) * 50%) 50%,
    calc(50% + var(--wm-star-arm) * 50%) 100%,
    calc(50% - var(--wm-star-arm) * 50%) 100%,
    calc(50% - var(--wm-star-waist) * 50%) 50%
  );
}

.us-wordmark-star i:nth-child(2) { transform: rotate(60deg); }
.us-wordmark-star i:nth-child(3) { transform: rotate(120deg); }

.site-brand {
  text-decoration: none;
  display: inline-flex;
}

/* The ground is fixed, so hover is the lift the rest of the system uses
   rather than a colour change. */
.site-brand:hover .us-wordmark {
  transform: translateY(var(--lift));
  box-shadow: var(--shadow-color);
}

/* There is no .site-footer-mark rule any more: the footer does not carry the
   mark. The class is still accepted by wordmark() if anything wants a second
   placement later — it just has no size override of its own to inherit.

   144px is most of a phone header. The mark stays legible down to about 48px —
   below that the three rows start closing up — so there is room to come down. */
@media (max-width: 767px) {
  .us-wordmark { --wm-size: 88px; }
}

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

.site-header {
  border-bottom: var(--border-thin) solid var(--line-1);
  background: var(--surface-page);
}

/* The mark sets the height: the square plus a band of air top and bottom.
   Stated in terms of the mark rather than as a magic number, so resizing one
   resizes the other and the nav never sits against the edge. At this size the
   air is --space-2 rather than --space-3: a 144px block does not need 12px of
   padding to feel unconstrained, and every pixel here pushes the grid down. */
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  min-height: calc(144px + var(--space-2) * 2);
}

@media (max-width: 767px) {
  .site-header-inner {
    min-height: calc(88px + var(--space-2) * 2);
  }
}

/* The nav sits on the header's own rule rather than floating in the middle of
   the band. align-self drops it to the bottom of the flex line; the negative
   margin pulls it down over the 1px border so each item's underline lands
   exactly on it, the way a tab strip does. The brand stays centred. */
.site-nav {
  display: flex;
  gap: var(--space-1);
  align-self: flex-end;
  margin-bottom: calc(var(--border-thin) * -1);
}

/* Chrome, not running text, so it is not the link blue and carries no
   underline of its own — the bottom border is the underline, and it is only
   ever coloured for the page you are on. */
.site-nav a {
  padding: 10px 14px;
  border-bottom: var(--border-thick) solid transparent;
  border-radius: 0;
  font: var(--weight-medium) var(--text-body-sm) / 1.2 var(--font-sans);
  letter-spacing: 0;
  color: var(--ink-2);
  text-decoration: none;
  transition: var(--transition-default);
}

.site-nav a:hover {
  color: var(--ink-1);
  border-bottom-color: var(--line-2);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

/* The coffee link is the one nav item that is an offer rather than a
   destination, so it gets the accent and a little space away from the two
   that are. It stays a link, not a button: it goes to a page.

   Written as `.site-nav a.site-nav-coffee` rather than `.site-nav-coffee`,
   because the plain class is (0,1,0) and loses to `.site-nav a` at (0,1,1) —
   which silently rendered it the same grey as the other two. */
.site-nav a.site-nav-coffee {
  margin-left: var(--space-4);
  color: var(--accent-primary);
}

.site-nav a.site-nav-coffee:hover {
  color: var(--accent-primary-hover);
  border-bottom-color: var(--accent-primary);
}

/* --- the donation popover -------------------------------------------------
 * Only what is genuinely about hanging a panel under a nav item. Everything
 * inside it — the buttons, the input, the select, the error line — is a design
 * system component, so this block has no colours of its own to keep in step.
 *
 * The markup does not exist until donate.js builds it: with JavaScript off the
 * coffee link stays the link it is server-rendered as, and none of this applies
 * to anything.
 */
.site-donate-root {
  position: relative;
  display: inline-flex;
}

.site-donate-pop {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 300; /* above the header, which sits at 200 */
  display: grid;
  gap: var(--space-3);
  width: 300px;
  padding: var(--space-5);
  border: var(--border-thin) solid var(--line-1);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  box-shadow: var(--shadow-lg);
  text-align: left;
}

/* `hidden` is an attribute, and display:grid above would otherwise beat it —
   the panel would sit open on every page load. */
.site-donate-pop[hidden] {
  display: none;
}

/* The nav is right-aligned against the container edge, so on a narrow screen a
   fixed-width panel anchored to it would hang off the side of the page. */
@media (max-width: 400px) {
  .site-donate-pop {
    width: calc(100vw - var(--space-5) * 2);
  }
}

.site-donate-title {
  margin: 0;
  font: var(--weight-medium) var(--text-body-sm) / 1.2 var(--font-sans);
  color: var(--ink-1);
}

.site-donate-amounts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.site-donate-row {
  display: flex;
  gap: var(--space-2);
}

.site-donate-custom {
  flex: 1;
  min-width: 0; /* an input's intrinsic width would push the select out */
}

.site-donate-currency {
  width: 92px;
  flex: none;
}

/* The popover closes the moment checkout opens, so the only thing left to say
   is said back on the page Stripe returns to. Bottom centre, out of the way of
   the header the donation was started from. */
.site-donate-toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-5);
  transform: translateX(-50%);
  z-index: 400;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  background: var(--surface-inverse);
  color: var(--surface-page);
  font: var(--weight-medium) var(--text-body-sm) / 1.2 var(--font-sans);
  box-shadow: var(--shadow-lg);
  transition: var(--transition-default);
}

.site-donate-toast.is-going {
  opacity: 0;
}

/* --- tool grid -----------------------------------------------------------
 * Six equal cards, three to a row.
 *
 * The spec's own word is "asymmetric", and this deliberately is not — see the
 * note in DESIGN.md. Six tools are six peers: none is a lead piece, and a
 * layout that gives one of them four columns and another two is making an
 * editorial claim about the catalogue that is not true. Equal cards also mean
 * every screenshot is reproduced at the same scale, which is the thing a
 * visitor is actually comparing.
 *
 * No span rules, so the grid does not care how many tools there are — a
 * seventh fills the next cell and nothing needs editing.
 * ------------------------------------------------------------------------- */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-5);
  /* Stretch, so cards in a row end level. The plate is a fixed ratio and the
     body takes the slack, which puts a little air under a one-line
     description — that is the cost of a level bottom edge and it is the right
     trade on an even grid. */
  align-items: stretch;
}

/* Three up, once there is room for three at a sensible width. Below this the
   auto-fill rule above drops to two and then one on its own. */
@media (min-width: 1000px) {
  .tool-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* The landing page opens straight on the grid — there is no hero above it, so
   a full --space-9 of section padding reads as a rendering fault rather than
   as air. Every other .us-section on the site sits under a coloured plate that
   gives the gap something to be. */
#tools.us-section {
  padding-block-start: var(--space-7);
}

/* --- prose pages (about, privacy, legal) ---------------------------------- */

.prose {
  max-width: var(--measure);
}

/* Every prose page opens on its first heading now that the page-head plates
   have come off all three. The section already contributes 96px of padding,
   and the first heading's own 64px on top of that opens the page on a void. */
.prose--opens-page > :first-child {
  margin-top: 0;
}

/* A rose rule above each h2 rather than RawBlock's heavy black one. Short,
   because it is marking a section rather than dividing the page. */
.prose h2 {
  margin: var(--space-8) 0 var(--space-4);
  padding-top: var(--space-4);
  border-top: var(--border-heavy) solid var(--accent-primary);
  font-family: var(--font-display);
  font-size: var(--text-display-3);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
}

.prose h3 {
  margin: var(--space-6) 0 var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-title-1);
  font-weight: var(--weight-semibold);
}

.prose p,
.prose dd {
  color: var(--ink-2);
  margin-bottom: var(--space-4);
}

/* Rows with a hairline between them, and a rose marker where RawBlock had
   nothing — this system is allowed decorative marks, and a list of privacy
   guarantees is a place a reader benefits from one. */
.prose ul {
  margin: 0 0 var(--space-4);
  padding-left: 0;
  list-style: none;
}

.prose li {
  position: relative;
  padding: var(--space-3) 0 var(--space-3) var(--space-5);
  border-bottom: var(--border-thin) solid var(--line-1);
  color: var(--ink-2);
}

.prose li::before {
  content: "";
  position: absolute;
  left: 0;
  top: calc(var(--space-3) + 0.6em);
  width: 8px;
  height: 8px;
  border-radius: var(--radius-sm);
  background: var(--accent-primary);
}

.prose dt {
  font-weight: var(--weight-semibold);
  color: var(--ink-1);
  margin-top: var(--space-4);
}

.prose dd {
  margin: var(--space-1) 0 var(--space-4);
}

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

.site-footer {
  padding-block: var(--space-8) var(--space-6);
}

/* flex-start, not space-between. The footer held a brand block on the left and
   the link columns on the right, and space-between is what kept them apart.
   With the brand gone there is one child, and space-between would leave it
   pinned wherever the flex algorithm put it rather than at the margin. */
.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--space-7);
}

.site-footer-cols {
  display: flex;
  gap: var(--space-7);
  flex-wrap: wrap;
}

.site-footer-head {
  color: var(--ink-on-brand);
  margin-bottom: var(--space-3);
}

.site-footer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.site-footer-list a {
  font-size: var(--text-body-sm);
}

/* The unique-visitor count: its own row under the link columns, a bare
   zero-padded number in mono, only just lighter than the plate it sits on. */
.site-footer-count {
  flex-basis: 100%;
  margin: 0;
}

/* A button, but dressed as nothing: it should read as a faint number until
   someone goes looking. Hover only brings it up a step. */
.site-footer-count-num {
  padding: 0;
  border: 0;
  background: none;
  color: var(--grey-700);
  font-family: var(--font-mono);
  font-size: var(--text-body-sm);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-standard);
}

.site-footer-count-num:hover,
.site-footer-count-num[aria-expanded="true"] {
  color: var(--grey-500);
}

.site-footer-count-num:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-focus);
}

/* The footer's "suggestions" opener: a button dressed as the links beside it.
   The panel it opens is styled in the design system (float.css), because tool
   pages open it too. */
.site-footer-suggest {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--text-body-sm);
  color: var(--ink-on-brand);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.site-footer-suggest:hover {
  color: var(--yellow); /* same hover as every other link on the plate */
}

.site-footer-suggest:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

@media (max-width: 767px) {
  .site-footer-inner {
    gap: var(--space-6);
  }
}

/* --- the specimen sheet ---------------------------------------------------
 * /_design and /_design-dark. Scaffolding for looking at the system, not part
 * of it: nothing below styles a component, it only arranges them on a page and
 * labels them.
 *
 * Laid out with air rather than with rules, which is the whole difference from
 * RawBlock's specimen: a system with cards and shadows needs room around each
 * sample for the shadow to fall into, where that one needed hard divisions.
 * ------------------------------------------------------------------------- */

.spec-head {
  padding-block: var(--space-8);
}

.spec-head h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 72px);
  font-weight: var(--weight-extrabold);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  color: var(--ink-on-brand);
}

.spec-head p {
  max-width: 60ch;
  margin-top: var(--space-4);
  color: var(--ink-on-brand-2);
}

.spec-section {
  padding-block: var(--space-7);
  border-top: var(--border-thin) solid var(--line-1);
}

.spec-section:first-of-type {
  border-top: none;
}

.spec-note {
  max-width: var(--measure);
  margin-top: var(--space-2);
  color: var(--ink-3);
  font-size: var(--text-body-sm);
}

/* A row of labelled samples. Wraps rather than scrolls: a specimen that needs
   scrolling to be read cannot be compared in a screenshot. */
.spec-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-top: var(--space-5);
  align-items: flex-start;
}

.spec-cell {
  min-width: 150px;
}

.spec-cell-demo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 60px;
}

.spec-cell-label {
  margin-top: var(--space-2);
  font-size: var(--text-micro);
  color: var(--ink-2);
}

.spec-cell-mono {
  font: var(--weight-regular) var(--text-nano) / 1.5 var(--font-mono);
  color: var(--ink-3);
}

.spec-wide {
  margin-top: var(--space-5);
  max-width: 560px;
}

.spec-on-plate {
  display: inline-block;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
}

/* --- token displays -------------------------------------------------------- */

.spec-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.spec-swatch {
  width: 128px;
}

.spec-swatch-chip {
  height: 64px;
  border: var(--border-thin) solid var(--line-1);
  border-radius: var(--radius-default);
  margin-bottom: var(--space-2);
}

.spec-type {
  margin-top: var(--space-5);
}

.spec-type-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-5);
  padding: var(--space-3) 0;
  border-top: var(--border-thin) solid var(--line-1);
}

.spec-type-row .spec-cell-mono {
  flex: 0 0 120px;
}

.spec-type-sample {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-1);
}

.spec-space {
  margin-top: var(--space-5);
}

.spec-space-row,
.spec-border-row {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-2) 0;
}

.spec-space-row .spec-cell-mono,
.spec-border-row .spec-cell-mono {
  flex: 0 0 140px;
}

.spec-space-bar {
  height: 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-primary);
}

.spec-border-bar {
  width: 240px;
}

.spec-toolcard {
  max-width: 340px;
  margin-top: var(--space-5);
}

/* The tooltip is held open so it appears in a screenshot; hovering is how you
   see it on a real page. */
.spec-tooltip-open .us-tooltip-label {
  opacity: 1;
}

/* The dialog renders in place rather than over the page, for the same reason. */
.spec-dialog-inline .us-dialog {
  max-width: 520px;
}
