/* ==========================================================================
   HappyDraft Design System — Components

   Requires tokens.css and base.css.

   Naming: .hd-block, .hd-block__element, .hd-block--modifier.
   Components read the SEMANTIC tokens only. If a component needs a raw
   --hd-c-* value, that is a sign a semantic token is missing — add it to
   tokens.css rather than reaching past the layer here.
   ========================================================================== */

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.hd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--hd-s-2);
  padding: var(--hd-s-3) var(--hd-s-5);
  min-height: 44px;              /* pointer target floor */
  border: var(--hd-rule) solid transparent;
  border-radius: var(--hd-radius-md);
  font-size: var(--hd-text-base);
  font-weight: var(--hd-weight-semibold);
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  background: none;
  transition: background-color var(--hd-dur-fast) var(--hd-ease),
              border-color var(--hd-dur-fast) var(--hd-ease),
              color var(--hd-dur-fast) var(--hd-ease),
              transform var(--hd-dur-fast) var(--hd-ease),
              box-shadow var(--hd-dur-fast) var(--hd-ease);
}
.hd-btn:active { transform: translateY(1px); }
.hd-btn:disabled,
.hd-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

/* Primary — one per view. This is "Open HappyDraft". */
.hd-btn--primary {
  background: var(--hd-accent);
  border-color: var(--hd-accent);
  color: var(--hd-text-on-accent);
  text-decoration: none;
  box-shadow: var(--hd-shadow-sm);
}
.hd-btn--primary:hover { background: var(--hd-accent-hover); border-color: var(--hd-accent-hover); color: var(--hd-text-on-accent); }
.hd-btn--primary:active { background: var(--hd-accent-active); border-color: var(--hd-accent-active); }

/* Secondary — the drawn outline. Reads like a line on the page. */
.hd-btn--secondary {
  background: var(--hd-surface-raised);
  border-color: var(--hd-border-strong);
  color: var(--hd-text);
  text-decoration: none;
}
.hd-btn--secondary:hover { border-color: var(--hd-accent); color: var(--hd-link-hover); background: var(--hd-surface-raised); }
.hd-btn--secondary:active { background: var(--hd-surface-tint); }

/* Ghost — tertiary, in-line with other text. */
.hd-btn--ghost {
  color: var(--hd-link);
  padding-inline: var(--hd-s-3);
  text-decoration: none;
}
.hd-btn--ghost:hover { background: var(--hd-surface-tint); color: var(--hd-link-on-tint); }

/* Warm — reserve for the single most encouraging action on the page
   ("Try it — no account"). Ink on pencil is 6.98, so text is ink here. */
.hd-btn--warm {
  background: var(--hd-c-pencil);
  border-color: var(--hd-c-pencil);
  color: var(--hd-c-ink);
  text-decoration: none;
  box-shadow: var(--hd-shadow-sm);
}
.hd-btn--warm:hover { background: #F2B65C; border-color: #F2B65C; color: var(--hd-c-ink); }
.hd-btn--warm:active { background: var(--hd-c-pencil-deep); border-color: var(--hd-c-pencil-deep); }

.hd-btn--sm { padding: var(--hd-s-2) var(--hd-s-4); min-height: 36px; font-size: var(--hd-text-sm); }
.hd-btn--lg { padding: var(--hd-s-4) var(--hd-s-7); min-height: 54px; font-size: var(--hd-text-lg); }
.hd-btn--block { display: flex; width: 100%; }

.hd-btn__icon { flex: none; width: 1.15em; height: 1.15em; }

/* ==========================================================================
   BADGE / PILL
   ========================================================================== */

.hd-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--hd-s-1);
  padding: 0.2em 0.7em;
  border-radius: var(--hd-radius-pill);
  font-family: var(--hd-font-mono);
  font-size: var(--hd-text-xs);
  font-weight: var(--hd-weight-medium);
  letter-spacing: var(--hd-tracking-wide);
  text-transform: uppercase;
  background: var(--hd-surface-tint);
  color: var(--hd-c-blueprint-800);
  border: var(--hd-hairline) solid transparent;
}
.hd-badge--neutral { background: transparent; border-color: var(--hd-border-strong); color: var(--hd-text-muted); }
.hd-badge--warm    { background: var(--hd-c-warn-bg); color: var(--hd-c-warn); }
.hd-badge--ok      { background: var(--hd-c-ok-bg);   color: var(--hd-c-ok); }
.hd-badge--danger  { background: var(--hd-c-danger-bg); color: var(--hd-c-danger); }

/* A keyboard key. The app is full of shortcuts; the help page will need this. */
.hd-kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: 0.15em 0.45em;
  border: var(--hd-hairline) solid var(--hd-border-strong);
  border-bottom-width: 2px;
  border-radius: var(--hd-radius-sm);
  background: var(--hd-surface-raised);
  box-shadow: var(--hd-shadow-xs);
  font-family: var(--hd-font-mono);
  font-size: 0.85em;
  line-height: 1.4;
  text-align: center;
  color: var(--hd-text);
  white-space: nowrap;
}

/* ==========================================================================
   HEADER / SITE NAV
   ========================================================================== */

.hd-header {
  position: sticky;
  top: 0;
  z-index: var(--hd-z-header);
  background: color-mix(in srgb, var(--hd-surface) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: var(--hd-hairline) solid var(--hd-border);
}

.hd-header__inner {
  display: flex;
  align-items: center;
  gap: var(--hd-s-5);
  min-height: 68px;
}

.hd-header__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--hd-s-3);
  text-decoration: none;
  color: var(--hd-text);
  margin-right: auto;
  /* Brand rule: one grid square of clear space around the mark. */
  padding: var(--hd-s-1);
}
.hd-header__brand img,
.hd-header__brand svg { height: 34px; width: auto; }

.hd-nav { display: flex; align-items: center; gap: var(--hd-s-1); }

.hd-nav__link {
  padding: var(--hd-s-2) var(--hd-s-3);
  border-radius: var(--hd-radius-md);
  font-size: var(--hd-text-sm);
  font-weight: var(--hd-weight-medium);
  color: var(--hd-text-soft);
  text-decoration: none;
  transition: background-color var(--hd-dur-fast) var(--hd-ease),
              color var(--hd-dur-fast) var(--hd-ease);
}
.hd-nav__link:hover { background: var(--hd-surface-tint); color: var(--hd-link-on-tint); }
.hd-nav__link[aria-current="page"] {
  color: var(--hd-text);
  font-weight: var(--hd-weight-semibold);
  box-shadow: inset 0 -2px 0 var(--hd-warm);   /* the warm underline = you are here */
}

/* Mobile: the nav collapses behind a <details> disclosure — no JS needed. */
.hd-nav__toggle { display: none; }

@media (max-width: 720px) {
  .hd-nav__toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--hd-s-2);
    padding: var(--hd-s-2) var(--hd-s-3);
    border: var(--hd-hairline) solid var(--hd-border-strong);
    border-radius: var(--hd-radius-md);
    background: var(--hd-surface-raised);
    font-size: var(--hd-text-sm);
    font-weight: var(--hd-weight-medium);
    cursor: pointer;
    list-style: none;
  }
  .hd-nav__toggle::-webkit-details-marker { display: none; }
  .hd-nav--collapsible > .hd-nav {
    position: absolute;
    left: var(--hd-gutter);
    right: var(--hd-gutter);
    margin-top: var(--hd-s-2);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--hd-s-2);
    border: var(--hd-hairline) solid var(--hd-border);
    border-radius: var(--hd-radius-lg);
    background: var(--hd-surface-raised);
    box-shadow: var(--hd-shadow-lg);
  }
  .hd-nav__link { padding: var(--hd-s-3); }
}

/* ==========================================================================
   HERO
   ========================================================================== */

.hd-hero {
  position: relative;
  padding-block: clamp(3rem, 1rem + 8vw, 7rem);
  overflow: hidden;
}

.hd-hero__inner {
  display: grid;
  gap: var(--hd-s-8);
  align-items: center;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .hd-hero__inner--split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
}

.hd-hero__title {
  font-size: var(--hd-text-display);
  font-weight: var(--hd-weight-bold);
  line-height: var(--hd-leading-tight);
  letter-spacing: var(--hd-tracking-tight);
  margin-bottom: var(--hd-s-4);
  text-wrap: balance;
}

/* The one place a warm word is allowed at display size — pencil-deep is
   AA-large only, and a display heading is comfortably past that floor. */
.hd-hero__title em {
  font-style: normal;
  color: var(--hd-text-warm-lg);
}

.hd-hero__sub {
  font-size: var(--hd-text-lg);
  line-height: var(--hd-leading-relaxed);
  color: var(--hd-text-soft);
  max-width: 46ch;
  margin-bottom: var(--hd-s-6);
}

.hd-hero__actions { display: flex; flex-wrap: wrap; gap: var(--hd-s-3); align-items: center; }

.hd-hero__note {
  margin-top: var(--hd-s-4);
  font-family: var(--hd-font-mono);
  font-size: var(--hd-text-sm);
  color: var(--hd-text-muted);
}

/* ==========================================================================
   SCREENSHOT FRAME

   A drawing sitting on the page. Paper-white mat, hairline border, soft
   ink shadow — it should read as a printed sheet, not a browser chrome mock.
   ========================================================================== */

.hd-shot {
  border: var(--hd-hairline) solid var(--hd-border-strong);
  border-radius: var(--hd-radius-lg);
  background: var(--hd-surface-raised);
  box-shadow: var(--hd-shadow-lg);
  overflow: hidden;
}
.hd-shot__bar {
  display: flex;
  align-items: center;
  gap: var(--hd-s-2);
  padding: var(--hd-s-2) var(--hd-s-4);
  border-bottom: var(--hd-hairline) solid var(--hd-border);
  background: var(--hd-surface);
  font-family: var(--hd-font-mono);
  font-size: var(--hd-text-xs);
  color: var(--hd-text-muted);
}
.hd-shot__body { display: block; }
.hd-shot__caption {
  padding: var(--hd-s-3) var(--hd-s-4);
  border-top: var(--hd-hairline) solid var(--hd-border);
  font-size: var(--hd-text-sm);
  color: var(--hd-text-muted);
}

/* ==========================================================================
   CARDS
   ========================================================================== */

.hd-card {
  display: flex;
  flex-direction: column;
  gap: var(--hd-s-3);
  padding: var(--hd-s-5);
  border: var(--hd-hairline) solid var(--hd-border);
  border-radius: var(--hd-radius-lg);
  background: var(--hd-surface-raised);
  transition: border-color var(--hd-dur-base) var(--hd-ease),
              box-shadow var(--hd-dur-base) var(--hd-ease),
              transform var(--hd-dur-base) var(--hd-ease);
}
.hd-card__title { font-size: var(--hd-text-xl); font-weight: var(--hd-weight-semibold); }
.hd-card__body  { color: var(--hd-text-soft); }
.hd-card__body :last-child { margin-bottom: 0; }
.hd-card__foot  { margin-top: auto; padding-top: var(--hd-s-2); font-size: var(--hd-text-sm); }

/* Only for cards that are entirely a link. */
.hd-card--link:hover {
  border-color: var(--hd-accent);
  box-shadow: var(--hd-shadow-md);
  transform: translateY(-2px);
}

.hd-card--flat { background: transparent; border-color: transparent; padding-inline: 0; }

/* Feature card with a mark at the top — the tick motif as an icon slot. */
.hd-card__icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--hd-radius-md);
  background: var(--hd-surface-tint);
  color: var(--hd-c-blueprint-800);
  flex: none;
}

/* ==========================================================================
   CALLOUTS

   Four intents. The `caution` variant exists specifically for the permit /
   legal language the venture brief requires — "verify with your jurisdiction"
   is never decoration, so it gets a real, deliberate treatment.
   ========================================================================== */

.hd-callout {
  display: flex;
  gap: var(--hd-s-3);
  padding: var(--hd-s-4) var(--hd-s-5);
  border-radius: var(--hd-radius-md);
  border-left: var(--hd-s-1) solid var(--hd-accent);
  background: var(--hd-surface-tint);
  color: var(--hd-text);
  font-size: var(--hd-text-base);
  line-height: var(--hd-leading-normal);
}
.hd-callout :last-child { margin-bottom: 0; }
.hd-callout__title {
  display: block;
  font-weight: var(--hd-weight-semibold);
  margin-bottom: var(--hd-s-1);
}

.hd-callout--note    { border-left-color: var(--hd-c-blueprint); background: var(--hd-c-sky); }
.hd-callout--tip     { border-left-color: var(--hd-c-ok);        background: var(--hd-c-ok-bg); }
.hd-callout--caution { border-left-color: var(--hd-c-warn);      background: var(--hd-c-warn-bg); }
.hd-callout--danger  { border-left-color: var(--hd-c-danger);    background: var(--hd-c-danger-bg); }

.hd-callout--caution .hd-callout__title { color: var(--hd-c-warn); }
.hd-callout--danger  .hd-callout__title { color: var(--hd-c-danger); }
.hd-callout--tip     .hd-callout__title { color: var(--hd-c-ok); }

/* ==========================================================================
   FORMS
   ========================================================================== */

.hd-field { display: flex; flex-direction: column; gap: var(--hd-s-2); }

.hd-label {
  font-size: var(--hd-text-sm);
  font-weight: var(--hd-weight-semibold);
  color: var(--hd-text-soft);
}
.hd-label__optional { font-weight: var(--hd-weight-regular); color: var(--hd-text-muted); }

.hd-input,
.hd-textarea,
.hd-select {
  width: 100%;
  padding: var(--hd-s-3) var(--hd-s-4);
  min-height: 44px;
  border: var(--hd-hairline) solid var(--hd-border-strong);
  border-radius: var(--hd-radius-md);
  background: var(--hd-surface-raised);
  color: var(--hd-text);
  font-size: var(--hd-text-base);
  transition: border-color var(--hd-dur-fast) var(--hd-ease),
              box-shadow var(--hd-dur-fast) var(--hd-ease);
}
.hd-input::placeholder, .hd-textarea::placeholder { color: var(--hd-c-dim); }
.hd-input:hover, .hd-textarea:hover, .hd-select:hover { border-color: var(--hd-accent); }
.hd-input:focus-visible, .hd-textarea:focus-visible, .hd-select:focus-visible {
  outline: none;
  border-color: var(--hd-accent);
  box-shadow: var(--hd-shadow-focus);
}
.hd-input[aria-invalid="true"], .hd-textarea[aria-invalid="true"] { border-color: var(--hd-c-danger); }

/* A numeric/dimension input — mono, tabular, right-aligned like the app's
   inspector. Used anywhere a measurement is typed. */
.hd-input--dimension {
  font-family: var(--hd-font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.hd-textarea { min-height: 120px; resize: vertical; }

.hd-help { font-size: var(--hd-text-sm); color: var(--hd-text-muted); }
.hd-error {
  font-size: var(--hd-text-sm);
  font-weight: var(--hd-weight-medium);
  color: var(--hd-c-danger);
}

/* Inline form — the email capture on the landing page. */
.hd-form-inline { display: flex; flex-wrap: wrap; gap: var(--hd-s-3); align-items: flex-start; }
.hd-form-inline .hd-field { flex: 1 1 260px; }

.hd-check { display: flex; align-items: flex-start; gap: var(--hd-s-3); font-size: var(--hd-text-sm); }
.hd-check input { margin-top: 0.22em; width: 18px; height: 18px; accent-color: var(--hd-accent); flex: none; }

/* ==========================================================================
   DOCS LAYOUT — sidebar + content + on-page contents
   ========================================================================== */

.hd-docs {
  display: grid;
  gap: var(--hd-s-8);
  grid-template-columns: 1fr;
  align-items: start;
  padding-block: var(--hd-s-7);
}
@media (min-width: 940px) {
  .hd-docs { grid-template-columns: 220px minmax(0, 1fr); }
  .hd-docs--with-toc { grid-template-columns: 220px minmax(0, 1fr) 200px; }
  .hd-docs__side, .hd-docs__toc { position: sticky; top: calc(68px + var(--hd-s-5)); }
}

.hd-sidenav__group + .hd-sidenav__group { margin-top: var(--hd-s-5); }
.hd-sidenav__heading {
  font-family: var(--hd-font-mono);
  font-size: var(--hd-text-xs);
  letter-spacing: var(--hd-tracking-wide);
  text-transform: uppercase;
  color: var(--hd-text-muted);
  margin-bottom: var(--hd-s-2);
}
.hd-sidenav__list { list-style: none; margin: 0; padding: 0; }
.hd-sidenav__link {
  display: block;
  padding: var(--hd-s-2) var(--hd-s-3);
  border-left: var(--hd-rule) solid var(--hd-border);
  font-size: var(--hd-text-sm);
  color: var(--hd-text-soft);
  text-decoration: none;
  transition: border-color var(--hd-dur-fast) var(--hd-ease),
              color var(--hd-dur-fast) var(--hd-ease),
              background-color var(--hd-dur-fast) var(--hd-ease);
}
.hd-sidenav__link:hover { color: var(--hd-link-hover); border-left-color: var(--hd-border-strong); background: var(--hd-surface-tint); }
.hd-sidenav__link[aria-current="page"] {
  color: var(--hd-text);
  font-weight: var(--hd-weight-semibold);
  border-left-color: var(--hd-accent);
  background: var(--hd-surface-tint);
}

.hd-toc__heading {
  font-family: var(--hd-font-mono);
  font-size: var(--hd-text-xs);
  letter-spacing: var(--hd-tracking-wide);
  text-transform: uppercase;
  color: var(--hd-text-muted);
  margin-bottom: var(--hd-s-2);
}
.hd-toc__list { list-style: none; margin: 0; padding: 0; font-size: var(--hd-text-sm); }
.hd-toc__list a { display: block; padding: var(--hd-s-1) 0; color: var(--hd-text-muted); text-decoration: none; }
.hd-toc__list a:hover { color: var(--hd-link-hover); }
.hd-toc__list--sub { padding-left: var(--hd-s-3); }

.hd-breadcrumb { display: flex; flex-wrap: wrap; gap: var(--hd-s-2); font-size: var(--hd-text-sm); color: var(--hd-text-muted); margin-bottom: var(--hd-s-4); }
.hd-breadcrumb a { color: var(--hd-text-muted); }
.hd-breadcrumb a:hover { color: var(--hd-link-hover); }
.hd-breadcrumb li + li::before { content: "/"; margin-right: var(--hd-s-2); color: var(--hd-border-strong); }
.hd-breadcrumb ol { display: contents; list-style: none; }

/* ==========================================================================
   CTA BAND + FOOTER
   ========================================================================== */

.hd-cta {
  padding-block: var(--hd-section-y);
  text-align: center;
}
.hd-cta__title { font-size: var(--hd-text-3xl); margin-bottom: var(--hd-s-3); }
.hd-cta__sub { color: var(--hd-text-soft); max-width: 52ch; margin-inline: auto; margin-bottom: var(--hd-s-6); }
.hd-cta__actions { display: flex; flex-wrap: wrap; gap: var(--hd-s-3); justify-content: center; }

/* On an inverted band the primary button's accent becomes pencil (see the
   .hd-invert theme), which is correct: warm does the welcome. */

.hd-footer {
  padding-block: var(--hd-s-8) var(--hd-s-6);
  font-size: var(--hd-text-sm);
}
.hd-footer__top {
  display: grid;
  gap: var(--hd-s-6);
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  padding-bottom: var(--hd-s-6);
  border-bottom: var(--hd-hairline) solid var(--hd-border);
}
.hd-footer__brand { grid-column: 1 / -1; }
@media (min-width: 760px) { .hd-footer__brand { grid-column: auto; max-width: 280px; } }
.hd-footer__brand img, .hd-footer__brand svg { height: 40px; width: auto; margin-bottom: var(--hd-s-3); }
.hd-footer__heading {
  font-family: var(--hd-font-mono);
  font-size: var(--hd-text-xs);
  letter-spacing: var(--hd-tracking-wide);
  text-transform: uppercase;
  color: var(--hd-text-muted);
  margin-bottom: var(--hd-s-3);
}
.hd-footer__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--hd-s-2); }
.hd-footer__list a { color: var(--hd-text-soft); text-decoration: none; }
.hd-footer__list a:hover { color: var(--hd-link-hover); text-decoration: underline; }
.hd-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--hd-s-3) var(--hd-s-5);
  justify-content: space-between;
  align-items: center;
  padding-top: var(--hd-s-5);
  color: var(--hd-text-muted);
}
.hd-footer__legal { font-family: var(--hd-font-mono); font-size: var(--hd-text-xs); }

/* ==========================================================================
   MISC
   ========================================================================== */

/* Stat / spec row — "1 file · 0 dependencies · 0 accounts" */
.hd-specs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--hd-s-5);
  list-style: none;
  margin: 0; padding: 0;
  font-family: var(--hd-font-mono);
  font-size: var(--hd-text-sm);
  color: var(--hd-text-muted);
}
.hd-specs li { display: flex; align-items: baseline; gap: var(--hd-s-2); }
.hd-specs strong { color: var(--hd-text); font-weight: var(--hd-weight-semibold); font-variant-numeric: tabular-nums; }

/* FAQ — native disclosure, no JS. */
.hd-faq { border-top: var(--hd-hairline) solid var(--hd-border); }
.hd-faq__item { border-bottom: var(--hd-hairline) solid var(--hd-border); }
.hd-faq__q {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--hd-s-4);
  padding: var(--hd-s-4) 0;
  font-weight: var(--hd-weight-semibold);
  cursor: pointer;
  list-style: none;
}
.hd-faq__q::-webkit-details-marker { display: none; }
.hd-faq__q::after {
  content: "+";
  font-family: var(--hd-font-mono);
  font-size: var(--hd-text-xl);
  color: var(--hd-text-muted);
  transition: transform var(--hd-dur-base) var(--hd-ease);
}
.hd-faq__item[open] > .hd-faq__q::after { content: "\2212"; }
.hd-faq__a { padding-bottom: var(--hd-s-4); color: var(--hd-text-soft); max-width: var(--hd-measure); }

/* Steps — numbered, for the help page. The number is a mono tick label. */
.hd-steps { list-style: none; margin: 0; padding: 0; counter-reset: hdstep; }
.hd-steps > li {
  position: relative;
  counter-increment: hdstep;
  padding-left: var(--hd-s-8);
  padding-bottom: var(--hd-s-6);
  border-left: var(--hd-hairline) solid var(--hd-border);
  margin-left: 15px;
}
.hd-steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.hd-steps > li::before {
  content: counter(hdstep);
  position: absolute;
  left: -16px;
  top: 0;
  width: 31px; height: 31px;
  display: grid; place-items: center;
  border-radius: var(--hd-radius-pill);
  background: var(--hd-surface-tint);
  color: var(--hd-c-blueprint-800);
  border: var(--hd-rule) solid var(--hd-surface);
  font-family: var(--hd-font-mono);
  font-size: var(--hd-text-sm);
  font-weight: var(--hd-weight-semibold);
}
.hd-steps__title { font-weight: var(--hd-weight-semibold); margin-bottom: var(--hd-s-1); }
