/* Halfwise site styles. Tokens follow specs/design.md. */
:root {
  --paper: #f4f3ff;
  --surface: #ffffff;
  --ink: #1b1d33;
  --muted: #6e7191;
  --line: #e4e3f5;
  --indigo: #3346d3;
  --graphite: #5a6072;
  --amber: #c77a00;
  --on-indigo: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14152a;
    --surface: #1f2140;
    --ink: #eef0ff;
    --muted: #a3a6c8;
    --line: #2e3158;
    --indigo: #8b98ff;
    --graphite: #a7adbd;
    --amber: #f0b04a;
    --on-indigo: #14152a;
  }
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN',
    'Noto Sans JP', Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a {
  color: var(--indigo);
  text-underline-offset: 3px;
}
a:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
  border-radius: 4px;
}
.wrap {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

/* header / footer */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
}
.brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: block;
}
.site-nav {
  display: flex;
  gap: 16px;
  font-size: 14px;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 0;
}
.site-nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 72px;
  padding: 32px 0 48px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-bottom: 12px;
}
.site-footer a {
  color: var(--muted);
}

/* hero */
.hero {
  padding: 56px 0 40px;
}
.hero h1 {
  font-size: clamp(26px, 7vw, 44px); text-wrap: balance;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.hero .lead {
  margin-top: 16px;
  color: var(--muted);
  font-size: 17px;
}
.gauge {
  margin-top: 36px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px 16px 16px;
}
.gauge-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.gauge-label {
  font-size: 13px;
  color: var(--muted);
}
.gauge-count {
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.gauge-count.reached {
  color: var(--indigo);
  font-weight: 800;
}
.bar { display: flex; align-items: center; gap: 4px; min-width: 0; }
.seg { display: block; flex: 1 1 0; min-width: 0; height: 20px; border-radius: 4px; }
.seg.high { background: var(--indigo); }
.seg.low { border: 1.5px solid var(--graphite); }
.mid { flex: none; width: 2px; height: 32px; margin: 0 2px; border-radius: 1px; background: var(--ink); }
.gauge-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}
.store {
  margin-top: 28px;
}
.store-badge {
  display: inline-block;
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.store-note {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

/* sections */
section {
  padding-top: 56px;
}
h2 {
  font-size: 22px;
  line-height: 1.4;
  font-weight: 700;
  margin-bottom: 12px;
}
h3 {
  font-size: 17px;
  line-height: 1.4;
  font-weight: 600;
  margin: 24px 0 8px;
}
p {
  margin-bottom: 12px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
  line-height: 1.7;
}

/* swap */
.swap {
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
}
.swap-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.swap-item:first-child {
  border-top: 0;
}
.swap-item .state {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}

/* quadrants */
.quad {
  list-style: none;
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 4px 16px;
}
.quad li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  margin: 0;
}
.quad li:first-child {
  border-top: 0;
}
.quad .name {
  font-weight: 600;
}
.quad .desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.mark {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  margin-top: 6px;
  border: 2px solid currentColor;
  box-sizing: border-box;
}
.mark.i {
  color: var(--indigo);
}
.mark.g {
  color: var(--graphite);
}
.mark.fill {
  background: currentColor;
}

/* feature list */
.features {
  list-style: none;
  margin-top: 8px;
}
.features li {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.features li:first-child {
  border-top: 0;
}
.features strong {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
}
.features span {
  color: var(--muted);
  font-size: 15px;
}

/* pricing */
.plans {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.plan {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px 16px;
}
.plan.pro {
  border-color: var(--indigo);
}
.plan h3 {
  margin-top: 0;
}
.plan ul {
  padding-left: 1.2em;
  font-size: 15px;
}
.plan li {
  margin-bottom: 4px;
}
@media (min-width: 640px) {
  .plans {
    grid-template-columns: 1fr 1fr;
  }
}

/* document pages */
.doc {
  padding-top: 40px;
}
.doc h1 {
  font-size: 28px;
  line-height: 1.3;
  font-weight: 700;
  margin-bottom: 8px;
}
.doc .updated {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 32px;
}
.doc h2 {
  font-size: 18px;
  margin-top: 36px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.doc ul,
.doc ol {
  padding-left: 1.5em;
  margin-bottom: 16px;
}
.doc li {
  margin-bottom: 6px;
}
.table-scroll {
  overflow-x: auto;
  margin: 16px 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 520px;
}
th,
td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
th {
  background: var(--surface);
  font-weight: 600;
}
details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 16px;
  margin-bottom: 12px;
}
summary {
  cursor: pointer;
  padding: 14px 0;
  font-weight: 600;
  list-style-position: outside;
}
details[open] summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
details p,
details ol,
details ul {
  font-size: 15px;
}
details ol,
details ul {
  padding-left: 1.4em;
  margin-bottom: 12px;
}

/* v2: pill gauge, quadrant cards */
.gauge-row + .gauge-row { margin-top: 22px; }
.seg { border-radius: 999px; }
.mid { position: relative; overflow: visible; }
.mid b { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 400; line-height: 1.4; color: var(--muted); white-space: nowrap; }
.gauge-row:first-child { margin-top: 14px; }
.matrix { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.cell { border-radius: 20px; padding: 14px; min-height: 110px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cell b { font-weight: 700; }
.cell span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.q1 { background: #e2e6ff; } .q1 b { color: var(--indigo); }
.q2 { background: #eef0ff; } .q2 b { color: var(--indigo); }
.q3 { background: #ffede6; } .q3 b { color: #b4472b; }
.q4 { background: #f1f1f6; } .q4 b { color: var(--graphite); }
.q1 span, .q2 span, .q3 span, .q4 span { color: #6e7191; }
@media (prefers-color-scheme: dark) {
  .q1 { background: #262c6b; } .q2 { background: #22264f; } .q3 { background: #3a2626; } .q3 b { color: #ffb39e; } .q4 { background: #202233; }
  .q1 span, .q2 span, .q3 span, .q4 span { color: #a3a6c8; }
}
.gauge-count { font-size: 15px; }
.gauge-row { gap: 8px; }
.seg { height: 14px; min-width: 6px; }
.bar { gap: 3px; }
@media (min-width: 640px) { .gauge-count { font-size: 18px; } .seg { height: 18px; } }
