/* CLAVIS web pages — same tokens as the app (Assets.xcassets), light and dark. */
:root {
  --bg: #F4F4F2;
  --surface1: #FFFFFF;
  --surface2: #ECECEA;
  --surface3: #E2E2DF;
  --separator: #E3E3E0;
  --border: #D2D2CE;
  --text1: #121214;
  --text2: #5B5B63;
  --text3: #6B6B73;
  --inverse: #121214;
  --on-inverse: #FFFFFF;
  --accent: #8A6420;
  --accent-subtle: #F1EADB;
  --success: #1E8A54;
  --danger: #C2372C;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --measure: 680px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0B0C;
    --surface1: #141416;
    --surface2: #1C1C1F;
    --surface3: #26262B;
    --separator: #232327;
    --border: #313136;
    --text1: #F2F2F3;
    --text2: #A1A1A9;
    --text3: #7C7C85;
    --inverse: #F2F2F3;
    --on-inverse: #0B0B0C;
    --accent: #D6B26E;
    --accent-subtle: #2A2419;
    --success: #5BC08A;
    --danger: #F06B5F;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text1);
  font: 17px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text1); text-decoration-color: var(--border); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header / footer (hidden inside the app) ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--separator);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 650;
  letter-spacing: 0.18em;
  font-size: 14px;
}
.brand img { width: 30px; height: 30px; border-radius: 8px; display: block; box-shadow: 0 0 0 1px var(--border); }

.site-nav {
  margin-left: auto;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  font-size: 15px;
  color: var(--text2);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--text1); background: var(--surface2); }
.site-nav a[aria-current="page"] { color: var(--text1); background: var(--surface2); }

.site-footer {
  margin-top: 64px;
  border-top: 1px solid var(--separator);
  color: var(--text3);
  font-size: 14px;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 24px;
  padding-bottom: 40px;
}
.site-footer a { color: var(--text2); }

/* ---------- Page structure ---------- */

main { padding: 40px 0 8px; }

.page-title {
  font-size: 34px;
  line-height: 41px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.lead {
  font-size: 19px;
  line-height: 1.5;
  color: var(--text2);
  margin: 0 0 32px;
  max-width: 60ch;
}

.meta { color: var(--text3); font-size: 14px; margin: 0 0 28px; }

h2 {
  font-size: 22px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 44px 0 12px;
}
h3 { font-size: 17px; font-weight: 650; margin: 24px 0 6px; }
p, ul, ol { margin: 0 0 14px; }
ul, ol { padding-left: 22px; }
li { margin: 4px 0; }
li::marker { color: var(--text3); }
strong { font-weight: 650; }

code, .token {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.88em;
}

/* Grouped card — the app's Settings section look. */
.group {
  background: var(--surface1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 0 0 16px;
}
.group > * + * { border-top: 1px solid var(--separator); }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  min-height: 52px;
  color: var(--text1);
  text-decoration: none;
}
a.row:hover { background: var(--surface2); }
.row .icon {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface2);
  display: grid;
  place-items: center;
  color: var(--text1);
}
.row .icon svg { width: 18px; height: 18px; }
.row .text { flex: 1; min-width: 0; }
.row .title { font-weight: 600; display: block; }
.row .detail { display: block; color: var(--text3); font-size: 15px; }
.row .chevron { color: var(--text3); flex: none; }

/* Primary action — inverse fill, one per page. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 14px;
  background: var(--inverse);
  color: var(--on-inverse);
  font-weight: 600;
  text-decoration: none;
}
.button:hover { opacity: 0.9; }
.button.secondary { background: var(--surface2); color: var(--text1); }

.note {
  background: var(--accent-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: var(--text1);
  font-size: 15px;
  margin: 0 0 16px;
}

/* ---------- FAQ (native disclosure) ---------- */

details {
  background: var(--surface1);
  border-radius: var(--radius-md);
  margin: 0 0 8px;
}
summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 44px 15px 16px;
  font-weight: 600;
  position: relative;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text3);
  border-bottom: 2px solid var(--text3);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.2s ease;
}
details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
details > div { padding: 0 16px 14px; color: var(--text2); }
details > div p:last-child { margin-bottom: 0; }

/* ---------- Privacy at a glance ---------- */

.glance {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 8px;
}
.glance section {
  background: var(--surface1);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.glance h3 { margin: 0 0 8px; font-size: 15px; color: var(--text2); font-weight: 600; }
.glance ul { list-style: none; padding: 0; margin: 0; font-size: 15px; }
.glance li { display: flex; gap: 10px; align-items: baseline; margin: 6px 0; }
.glance li::before { flex: none; font-weight: 700; }
.glance .stays li::before { content: "✓"; color: var(--success); }
.glance .leaves li::before { content: "↗"; color: var(--accent); }

/* ---------- Licenses ---------- */

.license {
  background: var(--surface1);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 0 0 8px;
}
.license .name { font-weight: 600; }
.license .kind {
  float: right;
  font-size: 13px;
  color: var(--text2);
  background: var(--surface2);
  border-radius: 999px;
  padding: 2px 10px;
  margin-left: 12px;
}
.license p { color: var(--text3); font-size: 15px; margin: 4px 0 0; }

/* ---------- Home ---------- */

.hero {
  padding: 32px 0 8px;
  display: grid;
  gap: 28px;
}
.hero .mark {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  display: block;
  box-shadow: 0 0 0 1px var(--border), 0 18px 40px -18px rgba(0, 0, 0, 0.45);
}
.hero h1 {
  font-size: clamp(40px, 9vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 750;
  margin: 0;
}
.hero p { font-size: 19px; color: var(--text2); margin: 0; max-width: 34ch; }

/* The library, as the app shows it. */
.stack {
  background: var(--surface1);
  border-radius: 22px;
  padding: 6px 0;
  margin: 8px 0 0;
}
.prompt {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 16px;
  padding: 12px 18px;
  align-items: center;
}
.prompt + .prompt { border-top: 1px solid var(--separator); }
.prompt .t { font-weight: 600; font-size: 16px; }
.prompt .x { grid-column: 1; color: var(--text2); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prompt .m { grid-column: 1; color: var(--text3); font-size: 13px; }
.prompt .copy {
  grid-row: 1 / span 3;
  grid-column: 2;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface2);
  display: grid;
  place-items: center;
  color: var(--text1);
}
.prompt .copy svg { width: 16px; height: 16px; }
.token {
  color: var(--accent);
  background: var(--accent-subtle);
  border-radius: 5px;
  padding: 0 4px;
}
.star { color: var(--accent); font-size: 12px; margin-left: 4px; }

.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 28px 0 0;
}
.facts div { background: var(--surface1); border-radius: var(--radius-md); padding: 14px 16px; }
.facts b { display: block; font-weight: 650; margin-bottom: 2px; }
.facts span { color: var(--text3); font-size: 15px; }

/* ---------- Inside the app: no site chrome, tighter top ---------- */

.in-app .site-header,
.in-app .site-footer,
.in-app .web-only { display: none; }
.in-app main { padding-top: 12px; }
.in-app .page-title { display: none; }

@media (max-width: 600px) {
  .glance, .facts { grid-template-columns: 1fr; }
  .page-title { font-size: 30px; line-height: 36px; }
  .site-header .wrap { gap: 8px; }
  .brand .wordmark { display: none; }
  .site-nav a { font-size: 14px; padding: 6px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
