/* ===========================================================================
   Katha AI — katha.thetractionlabs.com
   Same dark ground as the studio site, warmer accent. The token block below
   is deliberately duplicated from sites/studio/style.css rather than shared:
   the two sites deploy as independent Cloudflare Pages projects with no build
   step, and a copied token block is cheaper to reason about than a bundler.
   If you change a token here, change it there.
   ======================================================================== */

:root {
  --ground:    #0A0A0B;
  --raised:    #121214;
  --raised-2:  #17171A;

  --ink:       #F0EDE6;
  --ink-dim:   #A8A39A;
  --ink-faint: #6E6A63;

  --line:      #232327;
  --line-lit:  #323238;

  /* Katha's brand orange, taken from expo/src/theme/theme.ts (colors.accent)
     and from the app icon itself. 6.95:1 on --ground, so it is safe for link
     text and not only for decoration. */
  --accent:      #FF6B1A;
  --accent-dim:  #8C3A0C;
  --accent-wash: rgba(255, 107, 26, 0.10);

  --danger:      #E8674D;
  --danger-wash: rgba(232, 103, 77, 0.10);
  --ok:          #6BC08A;
  --ok-wash:     rgba(107, 192, 138, 0.10);

  --measure: 36rem;
  --page:    58rem;
  --doc:     44rem;   /* legal pages read narrower than the landing page */

  --s1: 0.25rem; --s2: 0.5rem;  --s3: 0.75rem; --s4: 1rem;
  --s6: 1.5rem;  --s8: 2rem;    --s12: 3rem;   --s16: 4rem;
  --s24: 6rem;   --s32: 8rem;

  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wrap { max-width: var(--page); margin-inline: auto; padding-inline: var(--s6); }
.wrap--doc { max-width: var(--doc); }
@media (max-width: 30rem) { .wrap { padding-inline: var(--s4); } }

/* --- masthead ------------------------------------------------------------ */

.masthead {
  padding-block: var(--s6);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4);
  flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
}
.brand img {
  display: block; width: 28px; height: 28px; flex: 0 0 auto;
}

/* The wordmark as the app sets it: Baloo 2 at 800, an orange K against ink
   letters, and "AI" trailing at 43% of the size on the same baseline.
   Mirrors expo/src/components/BrandWordmark.tsx — keep the two in step. */
.wordmark {
  font-family: "Baloo 2", "Hanken Grotesk", -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 800;
  font-size: 1.125rem;
  line-height: 1;
  letter-spacing: 0;
  display: inline-flex; align-items: baseline; gap: 2px;
  color: var(--ink);
}
.wordmark i { font-style: normal; color: var(--accent); }
.wordmark b { font-weight: inherit; font-size: 0.43em; color: var(--accent); }
.brand small {
  font-size: 0.75rem; color: var(--ink-faint); font-weight: 400;
  border-left: 1px solid var(--line-lit); padding-left: var(--s3); margin-left: var(--s1);
  letter-spacing: 0.01em;
}
@media (max-width: 30rem) { .brand small { display: none; } }
.masthead nav { display: flex; gap: var(--s6); flex-wrap: wrap; font-size: 0.875rem; }
.masthead nav a {
  color: var(--ink-dim); text-decoration: none; transition: color 160ms ease;
}
.masthead nav a:hover, .masthead nav a[aria-current="page"] { color: var(--ink); }

a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- landing ------------------------------------------------------------- */

.display {
  font-family: "Bricolage Grotesque", "Hanken Grotesk", -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
  font-size: clamp(2.375rem, 1.7rem + 3.2vw, 3.75rem);
  margin: 0;
  text-wrap: balance;
}
@media (max-width: 34rem) { .display { letter-spacing: -0.025em; } }

.hero { padding-block: clamp(var(--s16), 12vh, var(--s24)); }
.lede {
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  color: var(--ink-dim);
  max-width: var(--measure);
  margin: var(--s8) 0 0;
}

.features {
  display: grid; gap: var(--s8);
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  padding-block: var(--s16);
  border-top: 1px solid var(--line);
}
.feature h3 { margin: 0 0 var(--s2); font-size: 0.9375rem; font-weight: 550; }
.feature p { margin: 0; color: var(--ink-dim); font-size: 0.9375rem; }

.notice {
  border: 1px solid var(--line);
  background: var(--raised);
  border-radius: 12px;
  padding: var(--s6);
  margin-block: var(--s8);
}
.notice p { margin: 0; color: var(--ink-dim); font-size: 0.9375rem; }
.notice p + p { margin-top: var(--s3); }

/* --- document pages (privacy / terms / support / delete) ----------------- */

.doc { padding-block: var(--s16) var(--s24); }

.doc-head { margin-bottom: var(--s12); }
.doc-head h1 {
  font-family: "Bricolage Grotesque", "Hanken Grotesk", -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 700;
  font-size: clamp(1.875rem, 1.5rem + 1.8vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0;
}
.doc-head .updated {
  margin: var(--s4) 0 0;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
  color: var(--ink-faint);
  letter-spacing: 0.01em;
}

.prose { font-size: 1rem; line-height: 1.7; }
.prose > * + * { margin-top: var(--s4); }

.prose h2 {
  font-family: "Bricolage Grotesque", "Hanken Grotesk", -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin-top: var(--s12);
  padding-top: var(--s6);
  border-top: 1px solid var(--line);
  scroll-margin-top: var(--s6);
}
.prose h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-top: var(--s8);
  color: var(--ink);
}
.prose p, .prose li { color: var(--ink-dim); }
.prose strong { color: var(--ink); font-weight: 550; }
.prose ul, .prose ol { padding-left: 1.25rem; margin-top: var(--s3); }
.prose li + li { margin-top: var(--s2); }
.prose li::marker { color: var(--ink-faint); }

.prose a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-dim);
  transition: border-color 160ms ease;
  overflow-wrap: anywhere;
}
.prose a:hover { border-color: var(--accent); }

.prose code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.875em;
  background: var(--raised-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

/* Tables carry the processor list and the delete/retain list. They are the
   densest thing on these pages, so they get their own scroll container and
   never widen the document. */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: var(--s6);
  -webkit-overflow-scrolling: touch;
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  font-size: 0.875rem;
  line-height: 1.55;
}
.prose thead th {
  text-align: left;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-weight: 500;
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--raised);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.prose tbody td {
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
  color: var(--ink-dim);
  vertical-align: top;
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody td:first-child { color: var(--ink); font-weight: 500; }

/* A callout for the one thing on the deletion page nobody should miss. */
.callout {
  border: 1px solid var(--line-lit);
  border-left: 3px solid var(--accent);
  background: var(--accent-wash);
  border-radius: 8px;
  padding: var(--s4) var(--s6);
  margin-top: var(--s6);
}
.callout p { color: var(--ink); margin: 0; }
.callout p + p { margin-top: var(--s3); }
.callout--warn { border-left-color: var(--danger); background: var(--danger-wash); }

/* Table of contents on the long documents. */
.toc {
  border: 1px solid var(--line);
  background: var(--raised);
  border-radius: 12px;
  padding: var(--s6);
  margin-bottom: var(--s12);
}
.toc h2 {
  margin: 0 0 var(--s3); padding: 0; border: 0;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 500;
}
.toc ol { margin: 0; padding-left: 1.1rem; font-size: 0.9375rem; }
.toc li + li { margin-top: var(--s1); }
.toc a { color: var(--ink-dim); text-decoration: none; border: 0; }
.toc a:hover { color: var(--accent); }

/* --- form ---------------------------------------------------------------- */

.form { margin-top: var(--s8); display: grid; gap: var(--s6); }
.field { display: grid; gap: var(--s2); }
.field label { font-size: 0.875rem; font-weight: 500; color: var(--ink); }
.field .hint { font-size: 0.8125rem; color: var(--ink-faint); }

input, select, textarea {
  font: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
  background: var(--raised-2);
  border: 1px solid var(--line-lit);
  border-radius: 8px;
  padding: var(--s3) var(--s4);
  width: 100%;
  transition: border-color 160ms ease;
}
input:hover, select:hover, textarea:hover { border-color: #3E3E45; }
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
textarea { min-height: 7rem; resize: vertical; line-height: 1.6; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%236E6A63' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s4) center;
  padding-right: var(--s12);
}

.check { display: flex; gap: var(--s3); align-items: flex-start; }
.check input { width: 1.05rem; height: 1.05rem; margin-top: 0.35rem; flex: 0 0 auto; accent-color: var(--accent); }
.check label { font-size: 0.875rem; color: var(--ink-dim); font-weight: 400; line-height: 1.6; }
.check label b { color: var(--ink); font-weight: 550; }

.btn {
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 550;
  color: #16130C;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: var(--s3) var(--s8);
  cursor: pointer;
  justify-self: start;
  transition: background-color 160ms ease, opacity 160ms ease;
}
.btn:hover:not(:disabled) { background: #F0B255; }
.btn:disabled { opacity: 0.55; cursor: progress; }

/* Honeypot: present for a bot filling every field, invisible and
   unreachable for a person or a screen reader. */
.hp {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.form-status { font-size: 0.9375rem; border-radius: 8px; padding: var(--s4); margin: 0; }
.form-status[data-state="ok"]   { background: var(--ok-wash);     border: 1px solid rgba(107,192,138,.35); color: var(--ink); }
.form-status[data-state="err"]  { background: var(--danger-wash); border: 1px solid rgba(232,103,77,.35);  color: var(--ink); }
.form-status[hidden] { display: none; }

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

footer {
  border-top: 1px solid var(--line);
  padding-block: var(--s8) var(--s12);
  display: flex; flex-wrap: wrap; gap: var(--s4) var(--s6);
  align-items: center; justify-content: space-between;
  color: var(--ink-faint);
  font-size: 0.8125rem;
}
footer nav { display: flex; flex-wrap: wrap; gap: var(--s4) var(--s6); }
footer a { color: inherit; text-decoration: none; transition: color 160ms ease; }
footer a:hover { color: var(--ink); }
