/* ============================================================
   Capykraft Brand Layer — pixel-blueprint identity
   Ink on cream, letterpress feel, pixel-dissolve motif.
   Applied to brand surfaces only (landing, nav, chrome).
   Product/ebook themes remain warm and untouched.
   ============================================================ */

/* ---- Brand palette overrides (mono-forward) ---- */
:root {
  /* Brand explicitly names its own vars so there is no bleed into product */
  --brand-ink:      #1F1B15;   /* near-black, the "printed" tone */
  --brand-paper:    #F6F1E4;   /* warm cream, the press sheet */
  --brand-paper-lt: #FAF7ED;   /* lightest cream for lifted surfaces */
  --brand-rule:     rgba(31, 27, 21, 0.18);  /* hairline on cream */
  --brand-rule-dk:  rgba(31, 27, 21, 0.42);  /* stronger rule */
  --brand-clay:     #C06A41;   /* clay — single accent colour on brand surfaces */
  --brand-clay-dk:  #A4542F;
  --brand-ghost:    rgba(31, 27, 21, 0.06);  /* very faint ink fill */

  /* Blueprint / dot grid */
  --brand-dot-size: 1.5px;
  --brand-dot-gap:  20px;
  --brand-dot-color: rgba(31, 27, 21, 0.10);

  /* Display headline type */
  --font-brand-display: 'Hanken Grotesk', system-ui, sans-serif;
  --weight-brand-display: 800;
}

/* ---- Letterpress / distressed texture overlay ---- */
/*  A subtle noise via SVG filter so no external asset is needed. */
@keyframes bpNone { to {} }

/* ============================================================
   Blueprint framing utilities
   ============================================================ */

/* Dotted/dashed card border */
.bp-frame {
  border: 1.5px dashed var(--brand-rule-dk);
  border-radius: 3px;
  position: relative;
}

/* Corner ticks (crop marks) — pure CSS, no extra elements */
.bp-ticks {
  position: relative;
}
.bp-ticks::before,
.bp-ticks::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: none;
}
.bp-ticks::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--brand-ink);
  border-left: 2px solid var(--brand-ink);
}
.bp-ticks::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--brand-ink);
  border-right: 2px solid var(--brand-ink);
}

/* Full four-corner ticks */
.bp-ticks-4 {
  position: relative;
}
.bp-ticks-4::before,
.bp-ticks-4::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  pointer-events: none;
}
.bp-ticks-4::before {
  top: 0; left: 0;
  border-top: 1.5px solid var(--brand-rule-dk);
  border-left: 1.5px solid var(--brand-rule-dk);
}
.bp-ticks-4::after {
  bottom: 0; right: 0;
  border-bottom: 1.5px solid var(--brand-rule-dk);
  border-right: 1.5px solid var(--brand-rule-dk);
}

/* Faint dot-grid background */
.bp-grid {
  background-image: radial-gradient(
    circle, var(--brand-dot-color) var(--brand-dot-size), transparent var(--brand-dot-size)
  );
  background-size: var(--brand-dot-gap) var(--brand-dot-gap);
}

/* Mono small-caps label */
.label-mono {
  font-family: var(--font-mono);
  font-size: 0.6875rem;   /* 11px */
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-ink);
  opacity: 0.5;
  line-height: 1;
}
.label-mono--clay {
  color: var(--brand-clay);
  opacity: 1;
}

/* ============================================================
   Pixel motif primitives
   ============================================================ */

/* Pixel bullet row — a scattered trail of small squares */
.pixel-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}
.pixel-row__sq {
  width: 7px;
  height: 7px;
  background: var(--brand-ink);
  border-radius: 1px;
  opacity: 0.85;
  flex: none;
}
.pixel-row__sq:nth-child(2) { opacity: 0.55; }
.pixel-row__sq:nth-child(3) { opacity: 0.30; }
.pixel-row__sq:nth-child(4) { opacity: 0.14; }
.pixel-row__sq:nth-child(5) { opacity: 0.07; }

/* Clay-accent pixel trail */
.pixel-row--clay .pixel-row__sq {
  background: var(--brand-clay);
}

/* Pixel divider — horizontal rule made of squares */
.pixel-divider {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 100%;
  overflow: hidden;
}
.pixel-divider__sq {
  width: 5px;
  height: 5px;
  background: var(--brand-ink);
  border-radius: 1px;
  opacity: 0.18;
  flex: none;
}
.pixel-divider__sq:nth-child(1) { opacity: 0.65; }
.pixel-divider__sq:nth-child(2) { opacity: 0.40; }
.pixel-divider__sq:nth-child(3) { opacity: 0.22; }
.pixel-divider__sq:nth-child(4) { opacity: 0.12; }
.pixel-divider__sq:nth-child(5),
.pixel-divider__sq:nth-child(6),
.pixel-divider__sq:nth-child(7) { opacity: 0.06; }

/* ============================================================
   Pixel-dissolve hero element
   The capybara mark + a cloud of scattered pixel squares
   radiating outward from it.  Purely CSS — the .png sits inside.
   ============================================================ */
.pixel-dissolve {
  position: relative;
  display: inline-block;
}

/* The primary mark image */
.pixel-dissolve__mark {
  display: block;
  position: relative;
  z-index: 2;
  /* slight ink treatment so the transparent png looks printed */
  filter: contrast(1.08) brightness(0.96);
}

/* Scattered pixel squares that bleed outward */
.pixel-dissolve__cloud {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: visible;
}

/* Each scatter square is an inline element positioned by data attrs via JS,
   OR we define a set of pseudo-element positions here for pure CSS. */
.pixel-dissolve__cloud::before,
.pixel-dissolve__cloud::after {
  content: '';
  position: absolute;
  border-radius: 1px;
  background: var(--brand-ink);
}
/* Bottom-left trail — largest squares */
.pixel-dissolve__cloud::before {
  width: 9px; height: 9px;
  bottom: 12%; left: -8%;
  opacity: 0.72;
}
.pixel-dissolve__cloud::after {
  width: 6px; height: 6px;
  bottom: 4%; left: 5%;
  opacity: 0.42;
}

/* Additional scatter squares via CSS custom properties + generated content */
.pixel-dissolve__px {
  position: absolute;
  border-radius: 1px;
  background: var(--brand-ink);
  pointer-events: none;
}

/* ============================================================
   Display type setup
   ============================================================ */
.brand-headline {
  font-family: var(--font-brand-display);
  font-weight: var(--weight-brand-display);
  letter-spacing: -0.04em;
  line-height: 1.0;
  color: var(--brand-ink);
}

.brand-headline--xl {
  font-size: clamp(3rem, 7vw, 5.5rem);
}
.brand-headline--lg {
  font-size: clamp(2rem, 4.5vw, 3.5rem);
}
.brand-headline--md {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
}

/* ============================================================
   Blueprint card variant
   ============================================================ */
.bp-card {
  background: var(--brand-paper-lt);
  border: 1.5px dashed var(--brand-rule-dk);
  border-radius: 3px;
  position: relative;
  padding: 28px 24px;
}
/* corner ticks */
.bp-card::before,
.bp-card::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  pointer-events: none;
  z-index: 1;
}
.bp-card::before {
  top: -1px; left: -1px;
  border-top: 2px solid var(--brand-ink);
  border-left: 2px solid var(--brand-ink);
}
.bp-card::after {
  bottom: -1px; right: -1px;
  border-bottom: 2px solid var(--brand-ink);
  border-right: 2px solid var(--brand-ink);
}

/* ============================================================
   App chrome — light blueprint accents
   Overrides select kit.css rules for the brand feeling.
   All changes are additive / scoped tightly.
   ============================================================ */

/* Nav: subtle blueprint rule at the bottom */
.nav {
  border-bottom: 1.5px solid var(--brand-rule);
  background: color-mix(in srgb, var(--brand-paper-lt) 90%, transparent);
}

/* Nav brand wordmark: use display weight */
.nav__word {
  font-family: var(--font-brand-display);
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* Card: replace soft radius with blueprint feel on brand surfaces */
.bp-card-light {
  border: 1px dashed var(--brand-rule);
  border-radius: 2px;
  position: relative;
}

/* Primary button: clay stays, add slight letterpress depth */
.btn--primary {
  letter-spacing: 0.01em;
  font-weight: 700;
}

/* Small mono label pill (for nav/card context labels) */
.bp-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  border: 1px solid var(--brand-rule-dk);
  border-radius: 2px;
  padding: 3px 7px;
  color: var(--brand-ink);
  opacity: 0.6;
  line-height: 1;
  background: transparent;
}

/* ============================================================
   Letterpress grain — very subtle SVG filter
   ============================================================ */
.brand-grain {
  position: relative;
  isolation: isolate;
}
.brand-grain::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px 128px;
  mix-blend-mode: multiply;
  border-radius: inherit;
}
