/* ==========================================================================
   Nosy House — a forensic receipt
   Mobile-first. No framework, no build step.
   ========================================================================== */

:root {
  /* Brand colours (exact) */
  --paper: #F4F4EF;   /* background: cool receipt white, never cream */
  --ink: #111111;     /* text, rules */
  --lime: #D4FF3A;    /* Snoop Lime: highlight behind ONE phrase per page, never as text colour */
  --blue: #2340FF;    /* Audit Blue: links, stamps */
  --carbon: #8A8A85;  /* Carbon: decorative small print, non-text marks */

  /* Carbon darkened for small text only: #8A8A85 on paper is ~3.1:1, below WCAG AA.
     This keeps the same grey family at ~5.4:1. */
  --carbon-text: #64645F;

  /* Type */
  --font-display: "Archivo", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;

  /* Rhythm */
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1280px;
  --rule: 1px solid var(--ink);
  --rule-dashed: 1px dashed var(--ink);
  --label-size: 0.75rem;
  --label-track: 0.14em;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; }

h1, h2, h3, p, dl, dd, ol { margin: 0; }
ol { padding: 0; list-style: none; }

::selection { background: var(--ink); color: var(--paper); }

a {
  color: var(--blue);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: var(--label-size);
  letter-spacing: var(--label-track);
  text-transform: uppercase;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Small print / labels ---------- */
.label {
  font-family: var(--font-mono);
  font-size: var(--label-size);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: var(--label-track);
  text-transform: uppercase;
  color: var(--carbon-text);
}

/* ---------- Header + wordmark ---------- */
.site-header { border-bottom: var(--rule); }

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 18px;
}

.wordmark {
  display: inline-block;
  color: var(--ink);
  line-height: 0;
}

.wordmark__svg {
  display: block;
  width: 124px;
  height: auto;
  overflow: visible;
}

.wordmark__nosy {
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 125%;
}

.wordmark__house {
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(56px, 11vw, 136px) clamp(48px, 7vw, 96px);
}

.hero__title {
  margin-top: 20px;
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 125%;
  font-size: clamp(2.5rem, 0.9rem + 8.2vw, 8.75rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
}

/* The one lime highlight on the page */
mark {
  background: var(--lime);
  color: var(--ink);
  padding-inline: 0.06em;
  margin-inline: -0.06em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.hero__lede {
  margin-top: clamp(20px, 3vw, 32px);
  max-width: 34ch;
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.5rem);
  line-height: 1.4;
}

.meta {
  margin-top: clamp(40px, 6vw, 72px);
  border-top: var(--rule);
  font-family: var(--font-mono);
  font-size: var(--label-size);
  letter-spacing: var(--label-track);
  text-transform: uppercase;
}

.meta__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-block: 10px;
  border-bottom: var(--rule-dashed);
}

.meta dt { color: var(--carbon-text); }
.meta dd { text-align: right; }

/* ---------- Sections ---------- */
.section {
  position: relative;
  display: grid;
  gap: 24px;
  padding-block: clamp(48px, 8vw, 112px);
}

/* Dashed divider aligned to the content column, not the gutters */
.section::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  border-top: var(--rule-dashed);
}

/* ---------- How we work: receipt line items ---------- */
.items { border-top: var(--rule); }

.item {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  column-gap: 8px;
  row-gap: 6px;
  padding-block: 20px;
  border-bottom: var(--rule-dashed);
}

.item:last-child { border-bottom: 0; }

.item__num {
  grid-row: 1;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  padding-top: 0.35em;
  color: var(--ink);
}

.item__title {
  grid-column: 2;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 125%;
  font-size: clamp(1.25rem, 0.95rem + 1.5vw, 2.125rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.item__note {
  grid-column: 2;
  color: var(--ink);
  max-width: 40ch;
}

.total {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 3px double var(--ink);
  font-family: var(--font-mono);
  font-size: var(--label-size);
  font-weight: 500;
  letter-spacing: var(--label-track);
  text-transform: uppercase;
}
.total span:last-child { text-align: right; }

/* ---------- Receipt card ---------- */
.receipt {
  position: relative;
  max-width: 26rem;
  padding: 22px 22px 20px;
  border: var(--rule);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.receipt__head {
  padding-bottom: 14px;
  border-bottom: var(--rule-dashed);
  text-align: center;
}
.receipt__head p:first-child {
  font-weight: 500;
  letter-spacing: 0.28em;
}
.receipt__head p:last-child {
  margin-top: 2px;
  color: var(--carbon-text);
}

.receipt__rows { padding-block: 12px; }
.receipt__rows div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-block: 2px;
}
.receipt__rows dt { color: var(--carbon-text); }
.receipt__rows dd { text-align: right; }

.receipt__main {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 125%;
  font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.625rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-transform: none;
}

/* The one Instrument Serif italic line on the page */
.receipt__thanks {
  padding-top: 16px;
  border-top: var(--rule-dashed);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.375rem;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
}

.receipt__barcode {
  display: block;
  width: 100%;
  height: 34px;
  margin-top: 16px;
  color: var(--ink);
}

/* ---------- Rubber stamp ---------- */
.receipt__status {
  display: flex;
  flex-direction: column;
  padding-block: 22px 18px;
  border-block: var(--rule-dashed);
}

.stamp {
  position: relative;
  align-self: flex-end;
  margin-top: 14px;
  margin-right: -4px;
  padding: 8px 14px 7px;
  border: 3px solid currentColor;
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.2em;
  white-space: nowrap;
  transform: rotate(-6deg);
  mix-blend-mode: multiply;
  pointer-events: none;
  /* Ink grain: knock tiny holes out of the stamp, like a real rubber stamp */
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' seed='11'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -6 4.4'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' seed='11'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -6 4.4'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* inner hairline frame */
.stamp::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid currentColor;
}

/* Stamp lands when the slip scrolls into view (where supported). */
@keyframes stamp-down {
  from { opacity: 0; transform: rotate(-14deg) scale(1.7); }
  70%  { opacity: 1; transform: rotate(-5deg) scale(0.97); }
  to   { opacity: 1; transform: rotate(-6deg) scale(1); }
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .receipt { view-timeline: --slip block; }
    .stamp {
      animation: stamp-down linear both;
      animation-timeline: --slip;
      animation-range: entry 55% entry 100%;
    }
  }
}

/* ---------- Footer ---------- */
.site-footer { border-top: var(--rule); }

.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-block: 22px 28px;
  font-family: var(--font-mono);
  font-size: var(--label-size);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--carbon-text);
}

/* ---------- 404 ---------- */
.notfound__actions { margin-top: clamp(32px, 5vw, 56px); }

.notfound__link {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: var(--label-track);
  text-transform: uppercase;
}

/* ==========================================================================
   Larger screens
   ========================================================================== */
@media (min-width: 640px) {
  .wordmark__svg { width: 148px; }

  .meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-bottom: var(--rule-dashed);
  }
  .meta__row {
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px 14px 0;
    border-bottom: 0;
  }
  .meta__row + .meta__row {
    padding-left: 16px;
    border-left: var(--rule-dashed);
  }
  .meta dd { text-align: left; }

  .item { grid-template-columns: 3.5rem minmax(0, 1fr); }

  .site-footer__inner {
    flex-direction: row;
    justify-content: space-between;
    gap: 24px;
  }

  .stamp { margin-right: -34px; }
}

@media (min-width: 960px) {
  .section {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr);
    gap: 48px;
  }
  .section__label { padding-top: 4px; }

  .item {
    grid-template-columns: 4rem minmax(0, 1.25fr) minmax(0, 1fr);
    column-gap: 16px;
    align-items: baseline;
    padding-block: 26px;
  }
  .item__num { padding-top: 0; }
  .item__note { grid-column: 3; grid-row: 1; }
}

@media (min-width: 1200px) {
  .wordmark__svg { width: 164px; }
}

/* ==========================================================================
   Motion + print preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .skip-link { display: none; }
  .stamp { mix-blend-mode: normal; }
}
