/* Tahutu Assistant — stylesheet
   Design tokens aligned with Tahutu Playground (hi.tahutu.tech):
   Bricolage Grotesque typography, JetBrains Mono details,
   warm paper #ece7df, deep pine accent #1f4d3a, hairline borders. */

:root {
  --fg-primary: #0f1512;
  --fg-secondary: #6b6459;
  --fg-tertiary: #968e82;
  --fg-brand: #1f4d3a;
  --bg-surface-primary: #f5f2eb;
  --bg-surface-secondary: #e6e0d5;
  --bg-brand-subtle: #e2ebe5;
  --border-primary: #cfc9bd;
  --border-secondary: #dfd9cc;
  --app-bg: #ece7df;
  --font-sans: 'Bricolage Grotesque', -apple-system, sans-serif;
  --font-display: 'Bricolage Grotesque', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius-card: 12px;
  --radius-pill: 6px;
  color-scheme: light;
}

[data-theme="dark"] {
  --fg-primary: #ece7df;
  --fg-secondary: #9ea89f;
  --fg-tertiary: #6b776c;
  --fg-brand: #48c78e;
  --bg-surface-primary: #17211c;
  --bg-surface-secondary: #1f2c25;
  --bg-brand-subtle: #193829;
  --border-primary: #2d3d34;
  --border-secondary: #223028;
  --app-bg: #0f1512;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fg-primary: #ece7df;
    --fg-secondary: #9ea89f;
    --fg-tertiary: #6b776c;
    --fg-brand: #48c78e;
    --bg-surface-primary: #17211c;
    --bg-surface-secondary: #1f2c25;
    --bg-brand-subtle: #193829;
    --border-primary: #2d3d34;
    --border-secondary: #223028;
    --app-bg: #0f1512;
    color-scheme: dark;
  }
}

/* ---- base ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--app-bg);
  color: var(--fg-primary);
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}
@media (min-width: 640px) {
  .wrap { padding: 48px 24px 80px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

/* ---- focus & skip link ---- */
:focus-visible { outline: 3px solid var(--fg-brand); outline-offset: 3px; }
.skip-link {
  position: absolute; left: 16px; top: -120px; z-index: 100;
  padding: 10px 18px; border-radius: var(--radius-pill);
  background: var(--fg-primary); color: var(--app-bg);
  font-family: var(--font-mono); font-size: .85rem; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 16px; }

/* ---- header ---- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 16px;
  margin-bottom: 40px;
}
.wordmark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1;
  letter-spacing: -.01em;
  color: var(--fg-primary);
  text-decoration: none;
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wordmark .logo {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: block;
}
.wordmark .slash { color: var(--fg-brand); margin: 0 2px; }
.wordmark .sub { color: var(--fg-secondary); font-weight: 500; }

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
#theme-toggle {
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 500;
  color: var(--fg-secondary);
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
#theme-toggle:hover {
  border-color: var(--fg-brand);
  color: var(--fg-brand);
  background: var(--bg-surface-primary);
}

.site-nav { flex-basis: 100%; }
.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.site-nav a {
  display: inline-block;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-secondary);
  background: var(--bg-surface-primary);
  color: var(--fg-secondary);
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color .2s, color .2s;
}
.site-nav a:hover {
  border-color: var(--fg-brand);
  color: var(--fg-brand);
}
.site-nav a[aria-current="page"] {
  background: var(--fg-brand);
  border-color: var(--fg-brand);
  color: #ffffff;
  font-weight: 600;
}

/* ---- landing: hero ---- */
.hero {
  margin-bottom: 56px;
  text-align: left;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fg-secondary);
  margin-bottom: 16px;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.5rem, 8vw, 3.75rem);
  line-height: 1.08;
  letter-spacing: -.03em;
  margin-bottom: 16px;
  color: var(--fg-primary);
}
.hero h1 .highlight {
  color: var(--fg-brand);
}
.tagline {
  font-size: clamp(1.2rem, 3.5vw, 1.4rem);
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 16px;
  color: var(--fg-brand);
}
.lede {
  color: var(--fg-secondary);
  font-size: 1.05rem;
  max-width: 64ch;
  margin-bottom: 28px;
}

/* Download section with QR */
.download-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  background: var(--bg-surface-primary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-card);
  padding: 20px;
  max-width: 540px;
  margin-bottom: 32px;
}
.qr-container {
  background: #ffffff;
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.qr-code {
  width: 120px;
  height: 120px;
  display: block;
}
.qr-label {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: #0f1512;
  font-weight: 500;
}
.download-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.download-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg-primary);
}
.download-info p {
  font-size: .88rem;
  color: var(--fg-secondary);
  line-height: 1.4;
}
.appstore-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--fg-brand);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .2s, transform .2s;
  width: fit-content;
}
.appstore-button:hover {
  opacity: .92;
  transform: translateY(-1px);
}
.appstore-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ---- landing: sections ---- */
.section { margin-bottom: 56px; }
.section h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.3;
  letter-spacing: -.01em;
  margin-bottom: 20px;
}
.section-lede {
  color: var(--fg-secondary);
  margin: -8px 0 24px;
  max-width: 64ch;
}

.card-grid {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 580px) {
  .card-grid { grid-template-columns: 1fr 1fr; }
}
.card {
  background: var(--bg-surface-primary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .2s;
}
.card:hover {
  border-color: var(--fg-brand);
}
.card .card-tag {
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 600;
  color: var(--fg-brand);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.3;
  color: var(--fg-primary);
}
.card p {
  color: var(--fg-secondary);
  font-size: .95rem;
  line-height: 1.5;
}

/* ---- document pages (privacy, terms, support) ---- */
.prose h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 7vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -.02em;
  margin-bottom: 12px;
}
.meta {
  font-family: var(--font-mono);
  color: var(--fg-secondary);
  font-size: .8rem;
  margin-bottom: 24px;
}
.prose h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.3;
  margin: 40px 0 14px;
  scroll-margin-top: 24px;
  border-bottom: 1px solid var(--border-secondary);
  padding-bottom: 6px;
}
.prose h3 {
  font-weight: 600;
  font-size: 1.1rem;
  line-height: 1.4;
  margin: 28px 0 8px;
  scroll-margin-top: 24px;
}
.prose h4 {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
  margin: 20px 0 8px;
  color: var(--fg-secondary);
}
.prose p, .prose li { max-width: 72ch; }
.prose p { margin-bottom: 14px; }
.prose ul, .prose ol { padding-left: 1.4em; margin-bottom: 14px; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--fg-brand); font-weight: 700; }
.prose a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--fg-brand);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
.prose a:hover {
  text-decoration-thickness: 2px;
  background: var(--bg-brand-subtle);
}
.ui { font-weight: 600; }

.summary {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-card);
  padding: 24px;
  margin-bottom: 16px;
}
.summary h2, .summary h3 {
  margin-top: 0;
  font-size: 1.1rem;
  border-bottom: none;
  padding-bottom: 0;
  color: var(--fg-brand);
}
.summary ul { margin-bottom: 0; }
.summary li:last-child, .summary p:last-child { margin-bottom: 0; }

.callout {
  background: var(--bg-surface-primary);
  border-left: 3px solid var(--fg-brand);
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
  padding: 16px 20px;
  margin: 20px 0;
  font-size: .95rem;
}
.callout p:last-child { margin-bottom: 0; }

.callout-warning {
  border-left-color: #d97706;
  background: var(--bg-surface-primary);
}

.toc { margin: 24px 0 16px; }
.toc ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
}
.toc li { margin: 0; }
.toc a {
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-secondary);
  background: var(--bg-surface-primary);
  color: var(--fg-secondary);
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 500;
  text-decoration: none;
}
.toc a:hover {
  border-color: var(--fg-brand);
  color: var(--fg-brand);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 20px 0;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-card);
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-surface-primary);
  font-size: .92rem;
}
th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-secondary);
  vertical-align: top;
}
th {
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 600;
  color: var(--fg-primary);
  background: var(--bg-surface-secondary);
  text-transform: uppercase;
  letter-spacing: .03em;
}
tr:last-child td { border-bottom: none; }

/* FAQ accordion / details */
details {
  background: var(--bg-surface-primary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  margin-bottom: 12px;
  transition: border-color .2s;
}
details[open] {
  border-color: var(--fg-brand);
}
summary {
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  outline: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--fg-brand);
  margin-left: 12px;
}
details[open] summary::after {
  content: "−";
}
details .faq-content {
  margin-top: 14px;
  color: var(--fg-secondary);
  font-size: .95rem;
  line-height: 1.6;
}
details .faq-content p:last-child { margin-bottom: 0; }

.contact-card {
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-card);
  background: var(--bg-surface-primary);
  padding: 24px;
  margin-top: 24px;
}
.contact-card p:last-child { margin-bottom: 0; }
.contact-card .mail {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.05rem;
  word-break: break-all;
  color: var(--fg-brand);
}

/* ---- footer ---- */
.site-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  align-items: center;
  font-size: .85rem;
  color: var(--fg-secondary);
}
.site-footer ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}
.site-footer a {
  color: var(--fg-primary);
  text-decoration: underline;
  text-decoration-color: var(--border-primary);
  text-underline-offset: 3px;
}
.site-footer a:hover, .site-footer a[aria-current="page"] {
  text-decoration-color: var(--fg-brand);
}
.site-footer a[aria-current="page"] { font-weight: 600; }

@media print {
  #theme-toggle, .skip-link, .toc, .download-box { display: none; }
  body { background: #fff; color: #000; }
}

/* FAQ item and contact box */
.faq-item {
  background: var(--bg-surface-primary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  margin-bottom: 12px;
}
.faq-item strong {
  display: block;
  font-size: 1.05rem;
  color: var(--fg-primary);
  margin-bottom: 6px;
}
.faq-item p {
  color: var(--fg-secondary);
  margin-bottom: 6px;
}
.faq-item p:last-child, .faq-item ul:last-child {
  margin-bottom: 0;
}

.contact-box {
  background: var(--bg-surface-primary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-card);
  padding: 24px;
  margin: 20px 0 32px;
}
.contact-box h3 {
  margin-top: 0;
  color: var(--fg-brand);
  font-size: 1.15rem;
  border-bottom: none;
  padding-bottom: 0;
}
.contact-box p:last-child {
  margin-bottom: 0;
}

.updated {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--fg-secondary);
  margin-bottom: 24px;
}
.version {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--fg-secondary);
  margin-top: 24px;
}
