/* Tabhand site — shared styles.
   Two colours carry meaning everywhere: 藍 (ai) is the agent at work, 朱 (shu)
   is you approving. Everything else is ink on paper. */

@font-face {
  font-family: "Young Serif";
  src: url("/assets/young-serif-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Plex Mono";
  src: url("/assets/plex-mono-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --paper: #f3efe6;
  --paper-2: #e9e3d5;
  --card: #fbf9f4;
  --ink: #17140f;
  --ink-2: #4a443b;
  --ink-3: #6f6759;
  --rule: #d6cebe;
  --ai: #24395c;
  --ai-soft: #dfe4ec;
  --shu: #d9431e;
  --shu-ink: #a8300f;
  --shu-soft: #f6dcd2;

  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  --display: "Young Serif", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  --mono: "Plex Mono", ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;

  --wrap: 72rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --radius: 14px;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.8;
  font-feature-settings: "palt" 0;
  -webkit-font-smoothing: antialiased;
  /* Faint paper grain. */
  background-image:
    radial-gradient(rgba(23, 20, 15, 0.035) 1px, transparent 1px),
    radial-gradient(rgba(23, 20, 15, 0.025) 1px, transparent 1px);
  background-size: 7px 7px, 11px 11px;
  background-position: 0 0, 3px 5px;
}

:lang(en) body,
body:lang(en) {
  line-height: 1.65;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--shu-ink);
}

:focus-visible {
  outline: 2px solid var(--shu);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 1rem;
  z-index: 10;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
}

.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

.mono {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.label {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

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

.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--display);
  font-size: 1.45rem;
  line-height: 1;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.wordmark svg {
  width: 1.6rem;
  height: 1.6rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2.5vw, 1.75rem);
  font-size: 0.875rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--ink-2);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
}

.site-nav .lang {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  color: var(--ink);
}

.site-nav .lang:hover {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

@media (max-width: 34rem) {
  .site-nav .hide-sm {
    display: none;
  }
}

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

.site-foot {
  margin-top: clamp(4rem, 10vw, 7rem);
  border-top: 1px solid var(--ink);
  padding-block: 2rem 3rem;
  font-size: 0.875rem;
  color: var(--ink-2);
}

.site-foot .foot-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5rem 3rem;
}

.site-foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.site-foot p {
  margin: 0;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn:hover {
  color: var(--paper);
  background: var(--ai);
  border-color: var(--ai);
}

.btn:active {
  transform: translateY(1px);
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
}

.btn.ghost:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.btn.shu {
  background: var(--shu);
  border-color: var(--shu);
  color: #fff;
}

.btn.shu:hover {
  background: var(--shu-ink);
  border-color: var(--shu-ink);
}

/* ---------- Documents (privacy, terms, support) ---------- */

.doc {
  width: min(100% - 2 * var(--gutter), 46rem);
  margin-inline: auto;
  padding-top: clamp(2.5rem, 7vw, 4.5rem);
}

.doc-head {
  border-bottom: 1px solid var(--ink);
  padding-bottom: 1.75rem;
  margin-bottom: 2rem;
}

.doc-head .label {
  display: block;
  margin-bottom: 0.75rem;
}

.doc h1 {
  font-family: var(--sans);
  font-weight: 800;
  font-size: clamp(1.9rem, 5.5vw, 2.75rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
}

.doc:lang(en) h1,
:lang(en) .doc h1 {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: -0.015em;
}

.doc .meta {
  margin: 0;
  font-size: 0.875rem;
  color: var(--ink-2);
}

.doc .lede {
  font-size: 1.05rem;
  color: var(--ink-2);
}

.doc h2 {
  display: flex;
  gap: 0.9rem;
  align-items: baseline;
  font-size: 1.3rem;
  line-height: 1.45;
  font-weight: 800;
  margin: 3rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 1rem;
}

.doc h2 .num {
  flex: none;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--shu-ink);
  transform: translateY(-0.1em);
}

.doc h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 2rem 0 0.5rem;
}

.doc p,
.doc ul,
.doc ol,
.doc dl {
  margin: 0 0 1rem;
}

.doc ul,
.doc ol {
  padding-left: 1.4rem;
}

.doc li + li {
  margin-top: 0.35rem;
}

.doc strong {
  font-weight: 800;
}

.doc code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--paper-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.doc .toc {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  margin: 0 0 2rem;
  font-size: 0.95rem;
}

.doc .toc ol {
  margin: 0.5rem 0 0;
  padding-left: 1.6rem;
}

.doc .toc a {
  text-decoration: none;
}

.doc .toc a:hover {
  text-decoration: underline;
}

.table-scroll {
  overflow-x: auto;
  margin: 0 0 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.6;
}

.doc th,
.doc td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--rule);
}

.doc tr:last-child th,
.doc tr:last-child td {
  border-bottom: 0;
}

.doc thead th {
  font-size: 0.8rem;
  color: var(--ink-3);
  font-weight: 700;
  background: var(--paper-2);
}

.doc tbody th {
  font-weight: 800;
  width: 32%;
  min-width: 7rem;
}

/* Phones: each row becomes a small card (heading cell first). */
@media (max-width: 36rem) {
  .doc table,
  .doc tbody,
  .doc tr,
  .doc th,
  .doc td {
    display: block;
    width: auto;
  }

  .doc thead {
    display: none;
  }

  .doc tr {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--rule);
  }

  .doc tr:last-child {
    border-bottom: 0;
  }

  .doc th,
  .doc td {
    padding: 0;
    border: 0;
  }

  .doc tbody th + td,
  .doc td + td {
    margin-top: 0.3rem;
  }

  .doc tbody th {
    width: auto;
    min-width: 0;
  }
}

[hidden] {
  display: none !important;
}

/* The three-line summary and other callouts. */
.points,
.doc .points {
  list-style: none;
  counter-reset: point;
  padding: 0;
  margin: 0 0 1.5rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}

.points li {
  position: relative;
  counter-increment: point;
  padding: 0.9rem 1.1rem 0.9rem 3.5rem;
  font-weight: 700;
  line-height: 1.6;
}

.points li + li {
  margin: 0;
  border-top: 1px solid var(--rule);
}

.points li::before {
  content: counter(point, decimal-leading-zero);
  position: absolute;
  left: 1.1rem;
  top: 1.05rem;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--shu-ink);
}

.points small {
  display: block;
  font-weight: 400;
  color: var(--ink-2);
  font-size: 0.875rem;
}

.note {
  border-left: 3px solid var(--shu);
  background: var(--shu-soft);
  padding: 0.9rem 1.1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 0 0 1.25rem;
}

.note > :last-child {
  margin-bottom: 0;
}

.email-img {
  display: inline-block;
  height: 1.15em;
  width: auto;
  vertical-align: -0.2em;
}

/* FAQ (support). */
.faq details {
  border-bottom: 1px solid var(--rule);
}

.faq details:first-of-type {
  border-top: 1px solid var(--rule);
}

.faq summary {
  cursor: pointer;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: start;
  padding: 1rem 0;
  font-weight: 800;
  line-height: 1.55;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  font-family: var(--mono);
  font-weight: 500;
  font-size: 1.2rem;
  line-height: 1.2;
  color: var(--shu-ink);
  transition: transform 0.2s ease;
}

.faq details[open] summary::after {
  transform: rotate(45deg);
}

.faq .answer {
  padding: 0 0 1.1rem;
  color: var(--ink-2);
}

.faq .answer > :last-child {
  margin-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
