/*
 * The public site's stylesheet.
 *
 * Deliberately a copy of the product's tokens rather than an import of them. This site is
 * deployed as its own Static Web App from plain files with no build step, so it cannot reach
 * into `apps/web`; and the two have different jobs, so a shared stylesheet would couple a
 * public page to the app's layout every time a screen changed. What must stay in step is the
 * palette, the two typefaces and the shape of a button, which are copied below and are the
 * whole of the brand.
 *
 * Source: `apps/web/app/globals.css`. The landing layout follows the prototype's own landing
 * page — `Docs/kindred_courier_prototype_final/screens/landing_page` — hero text beside a soft
 * blob, then a three-feature strip.
 */

:root {
  --surface: #f7f9fb;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f2f4f6;
  --surface-container: #eceef0;
  --surface-container-high: #e6e8ea;

  --on-surface: #191c1e;
  --on-surface-variant: #41474f;
  --outline: #717880;
  --outline-variant: #c1c7d1;

  --primary: #106399;
  --on-primary: #ffffff;
  --primary-container: #5a9bd5;
  --primary-fixed: #cee5ff;
  --on-primary-fixed: #001d33;
  --on-primary-fixed-variant: #004a77;

  --secondary: #8f4e00;
  --secondary-container: #fc9d41;
  --secondary-fixed: #ffdcc2;
  --on-secondary-fixed: #2e1500;
  --on-secondary-fixed-variant: #6d3a00;

  --tertiary: #006b5b;
  --tertiary-container: #14a991;
  --tertiary-fixed: #7cf8dd;
  --on-tertiary-container: #00362d;

  --font-headline: 'Quicksand', system-ui, -apple-system, sans-serif;
  --font-body: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;

  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-full: 9999px;
  --shadow-pillowy: 0 4px 20px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);
  --shadow-squishy: 0 8px 30px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);

  --tap: 44px;
  --measure: 66ch;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-headline);
  font-weight: 700;
  line-height: 1.2;
  color: var(--on-surface);
}

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Buttons: the app's, copied ---------------------------------------------------------- */

/*
 * The product's primary button is filled, rounded, and sits on a 4px darker "shelf" that
 * compresses on press — the prototype calls it pressable. It is what a parent taps forty
 * times a week, and the one thing on this site that should feel exactly like the app.
 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-headline);
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.1s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-bottom: 4px solid var(--on-primary-fixed-variant);
  box-shadow: var(--shadow-pillowy);
}

.btn-primary:hover {
  box-shadow: var(--shadow-squishy);
  text-decoration: none;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: var(--surface-container-lowest);
  color: var(--primary);
  border: 1px solid var(--outline-variant);
  border-bottom: 3px solid var(--outline-variant);
  box-shadow: var(--shadow-pillowy);
}

.btn-secondary:hover {
  border-color: var(--primary);
  text-decoration: none;
}

.btn-secondary:active {
  transform: scale(0.97);
}

/* The header's Log in is the secondary button at a size that sits beside text links. */
.btn-compact {
  min-height: var(--tap);
  padding: 8px 18px;
  font-size: 16px;
}

/* --- Header ------------------------------------------------------------------------------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(247, 249, 251, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--outline-variant);
}

.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 12px;
  padding-bottom: 12px;
}

/* The app's sidebar mark: a round tinted badge carrying the family glyph, then the name. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 4px 0;
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 20px;
  color: var(--primary);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--primary-container);
  color: var(--on-primary);
  box-shadow: var(--shadow-pillowy);
}

.badge svg {
  width: 24px;
  height: 24px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.site-nav a:not(.btn) {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--on-surface-variant);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:not(.btn):hover {
  background: var(--surface-container);
  color: var(--on-surface);
}

.site-nav a[aria-current='page'] {
  color: var(--primary);
  font-weight: 600;
}

.site-nav .btn {
  margin-left: 8px;
}

/* --- Hero --------------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: 48px;
  padding: 72px 0 40px;
}

.hero-copy .eyebrow {
  display: inline-block;
  margin-bottom: 20px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--secondary-fixed);
  color: var(--on-secondary-fixed);
  font-size: 14px;
  font-weight: 600;
}

.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: -0.02em;
}

.hero .tagline {
  max-width: 34rem;
  margin: 0 0 32px;
  font-size: clamp(1.05rem, 1.9vw, 1.3rem);
  color: var(--on-surface-variant);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-note {
  margin: 18px 0 0;
  font-size: 15px;
  color: var(--on-surface-variant);
}

/*
 * The prototype's soft blob. A gradient from the light primary to the light tertiary, with
 * an organic radius, and the product's own digest inside it rather than an illustration —
 * nothing to license, and it is literally the thing being described.
 */
.hero-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  padding: 40px;
  border-radius: 46% 54% 52% 48% / 52% 44% 56% 48%;
  background: linear-gradient(135deg, var(--primary-fixed) 0%, #e3f6f2 100%);
}

.digest-preview {
  width: 100%;
  max-width: 400px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface-container-lowest);
  box-shadow: var(--shadow-squishy);
  font-size: 15px;
}

.digest-preview header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.digest-preview header .badge {
  width: 38px;
  height: 38px;
  background: var(--primary-fixed);
  color: var(--on-primary-fixed-variant);
  box-shadow: none;
}

.digest-preview header .badge svg {
  width: 20px;
  height: 20px;
}

.digest-preview h3 {
  margin: 0;
  font-size: 17px;
}

.digest-preview header p {
  margin: 0;
  font-size: 13px;
  color: var(--on-surface-variant);
}

.digest-preview ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.digest-preview li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--surface-container);
}

.digest-preview li:first-child {
  border-top: 0;
}

.child-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--surface-container);
  font-size: 13px;
  font-weight: 600;
}

.child-pill i {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--primary-container);
}

.child-pill.tone-1 i {
  background: var(--secondary-container);
}

.child-pill.tone-2 i {
  background: var(--tertiary-container);
}

.digest-preview .item {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.digest-preview .when {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--on-surface-variant);
}

.digest-preview .when.due {
  color: var(--secondary);
  font-weight: 600;
}

/* --- Feature strip ------------------------------------------------------------------------ */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 20px;
  padding: 40px 0 8px;
  border-top: 1px solid var(--outline-variant);
}

.feature {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.feature .badge {
  box-shadow: none;
}

.feature .badge.blue {
  background: var(--primary-fixed);
  color: var(--on-primary-fixed-variant);
}

.feature .badge.orange {
  background: var(--secondary-fixed);
  color: var(--on-secondary-fixed-variant);
}

.feature .badge.teal {
  background: var(--tertiary-fixed);
  color: var(--on-tertiary-container);
}

.feature h3 {
  margin: 8px 0 4px;
  font-size: 1.15rem;
}

.feature p {
  margin: 0;
  color: var(--on-surface-variant);
  font-size: 16px;
}

/* --- Sections ----------------------------------------------------------------------------- */

section {
  padding: 56px 0 0;
}

section h2 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 3.2vw, 2rem);
}

section > p,
section > ul {
  max-width: var(--measure);
}

.lede {
  color: var(--on-surface-variant);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 20px;
  margin-top: 28px;
}

.card {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  box-shadow: var(--shadow-pillowy);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.card p {
  margin: 0;
  color: var(--on-surface-variant);
  font-size: 16px;
}

/* The security cards lead with the app's tinted icon badge rather than a number. */
.card .badge {
  margin-bottom: 14px;
  box-shadow: none;
}

/* Six cards read as two rows of three, not four and two orphans. */
.trust {
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
}

.trust .card {
  border-top: 4px solid var(--primary-container);
}

.card .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: 14px;
  border-radius: var(--radius-full);
  background: var(--primary-fixed);
  color: var(--on-primary-fixed);
  font-family: var(--font-headline);
  font-weight: 700;
}

.panel {
  margin-top: 28px;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--primary-fixed);
  color: var(--on-primary-fixed);
}

.panel h2 {
  margin-top: 0;
  color: var(--on-primary-fixed);
}

.panel a {
  color: var(--on-primary-fixed-variant);
}

.never {
  max-width: var(--measure);
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.never li {
  position: relative;
  padding: 10px 0 10px 34px;
  border-bottom: 1px solid var(--outline-variant);
}

.never li:last-child {
  border-bottom: 0;
}

.never li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 16px;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--tertiary-fixed);
  /* A check mark, drawn rather than fetched: the CSP allows no image hosts. */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E")
    center / 12px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E")
    center / 12px no-repeat;
  background: var(--tertiary);
}

/* --- Closing call ------------------------------------------------------------------------- */

.cta {
  margin: 64px 0 0;
  padding: 40px 32px;
  border-radius: var(--radius-lg);
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  box-shadow: var(--shadow-pillowy);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
}

.cta h2 {
  margin: 0 0 4px;
  font-size: 1.5rem;
}

.cta p {
  margin: 0;
  color: var(--on-surface-variant);
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* --- Footer ------------------------------------------------------------------------------- */

.site-foot {
  margin-top: 64px;
  padding: 32px 0 48px;
  border-top: 1px solid var(--outline-variant);
  color: var(--on-surface-variant);
  font-size: 15px;
}

.site-foot .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  justify-content: space-between;
}

.site-foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.site-foot nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 8px 12px;
}

/* --- Legal documents --------------------------------------------------------------------- */

.doc {
  max-width: var(--measure);
  padding-top: 48px;
}

.doc h1 {
  margin: 0 0 4px;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
}

.doc .meta {
  margin: 0 0 32px;
  color: var(--on-surface-variant);
  font-size: 15px;
}

.doc h2 {
  margin: 40px 0 8px;
  font-size: 1.3rem;
}

.doc h3 {
  margin: 24px 0 4px;
  font-size: 1.05rem;
}

.doc table {
  width: 100%;
  margin: 16px 0;
  border-collapse: collapse;
  font-size: 16px;
}

.doc th,
.doc td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--outline-variant);
  text-align: left;
  vertical-align: top;
}

.doc th {
  font-family: var(--font-headline);
}

.scroll-x {
  overflow-x: auto;
}

.callout {
  margin: 24px 0;
  padding: 18px 20px;
  border-left: 4px solid var(--secondary);
  border-radius: var(--radius);
  background: var(--secondary-fixed);
  color: var(--on-secondary-fixed);
}

.callout :first-child {
  margin-top: 0;
}

.callout :last-child {
  margin-bottom: 0;
}

.toc {
  margin: 0 0 8px;
  padding: 20px 24px;
  border-radius: var(--radius-md);
  background: var(--surface-container-low);
}

.toc h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--on-surface-variant);
}

.toc ol {
  margin: 0;
  padding-left: 20px;
  columns: 2;
  column-gap: 28px;
  font-size: 16px;
}

.toc li {
  margin-bottom: 4px;
  break-inside: avoid;
}

/* --- Phone -------------------------------------------------------------------------------- */

@media (max-width: 880px) {
  .hero {
    /* `minmax(0, 1fr)`, not `1fr`: a bare `1fr` is `minmax(auto, 1fr)`, whose minimum is the
       widest unbreakable content in the column — the digest preview's rows plus their padding,
       449px on a 390px phone. `pnpm audit:site` caught both hero children 83px past the edge. */
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    padding-top: 40px;
  }

  .hero-copy,
  .hero-art {
    min-width: 0;
  }

  .hero-art {
    min-height: 320px;
    padding: 28px;
  }

  /* The prototype stacks the two buttons full-width on a phone. */
  .hero-actions .btn {
    width: 100%;
  }

  .cta {
    padding: 28px 20px;
  }

  .cta-actions,
  .cta-actions .btn {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .toc ol {
    columns: 1;
  }

  .site-nav a:not(.btn):not([aria-current='page']) {
    display: none;
  }
}

/* --- Dark mode ---------------------------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #111417;
    --surface-container-lowest: #171a1d;
    --surface-container-low: #1c2023;
    --surface-container: #23282c;
    --surface-container-high: #2a3034;

    --on-surface: #e2e6e9;
    --on-surface-variant: #b6bec6;
    --outline-variant: #3a4046;

    --primary: #8fcbff;
    --on-primary: #00365a;
    --primary-container: #2f6f9f;
    --primary-fixed: #00405f;
    --on-primary-fixed: #cee5ff;
    --on-primary-fixed-variant: #cee5ff;

    --secondary-fixed: #4a2800;
    --on-secondary-fixed: #ffdcc2;
    --on-secondary-fixed-variant: #ffb77a;

    --tertiary-fixed: #00504a;
    --on-tertiary-container: #7cf8dd;
  }

  .site-head {
    background: rgba(17, 20, 23, 0.9);
  }

  .hero-art {
    background: linear-gradient(135deg, #00405f 0%, #0d3a36 100%);
  }
}
