/* Trulevel: privacy and support pages. One stylesheet, nothing loaded from elsewhere.
   The look is the app's A2 (docs/DESIGN-DIRECTION.md): warm paper with a faint grid, ink text,
   pencil red for the one thing that matters; the same design on graphite in dark mode. Headings
   are Barlow (fonts/, cut by scripts/web_fonts.py); the text is the system's face, as in the app. */

@font-face {
  font-family: "Barlow";
  src: url("fonts/Barlow-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow";
  src: url("fonts/Barlow-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --paper: #f4f1e8;     /* page */
  --surface: #fbfaf5;   /* cards */
  --ink: #16181b;       /* text */
  --ink-2: #4c4f55;     /* secondary text */
  --line: #d3cdbf;      /* hairlines */
  --grid: rgba(22, 24, 27, 0.045);
  --red: #c43c2b;       /* pencil red */
  --measure: 42rem;
  --display: "Barlow", ui-sans-serif, -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111316;
    --surface: #1a1d21;
    --ink: #f2efe8;
    --ink-2: #a8acb3;
    --line: #2e3238;
    --grid: rgba(242, 239, 232, 0.035);
    --red: #ff6b57;
  }
}

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

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

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

:lang(ja) body,
body:lang(ja) {
  line-height: 1.8;
}

a {
  color: var(--ink);
  text-decoration-color: var(--red);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1.5px;
}

a:hover {
  color: var(--red);
}

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

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border-radius: 12px;
}

header.site,
nav.langs,
main,
footer.site {
  max-width: var(--measure);
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* Header */

header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-top: 1.25rem;
  padding-bottom: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--display);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.brand:hover {
  color: var(--ink);
}

nav.site ul,
nav.langs ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

nav.site li + li,
nav.langs li + li {
  margin-top: 0;
}

nav.site ul {
  gap: 0.25rem 1.25rem;
  font-size: 0.9375rem;
}

nav.site a,
nav.langs a {
  display: inline-block;
  padding: 0.375rem 0;
  text-decoration: none;
}

nav.site a:hover {
  text-decoration: underline;
  text-decoration-color: var(--red);
}

/* The page you are on is the active tool: red, as in the app's tab bar. */
nav.site a[aria-current="page"] {
  color: var(--red);
  font-weight: 600;
}

/* Language switcher: on every page, under the header. */

nav.langs {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

nav.langs ul {
  gap: 0 1rem;
  font-size: 0.875rem;
}

nav.langs a {
  color: var(--ink-2);
}

nav.langs a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--red);
}

nav.langs a[aria-current="true"] {
  color: var(--ink);
  font-weight: 600;
}

/* Text */

main {
  padding-top: 1.75rem;
  padding-bottom: 3rem;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.002em;
  text-wrap: balance;
}

h1 {
  font-size: 2.5rem;
  margin: 0 0 0.375rem;
}

h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 0.5rem;
  scroll-margin-top: 1rem;
}

h3 {
  font-size: 1.125rem;
  margin: 1.5rem 0 0.25rem;
  scroll-margin-top: 1rem;
}

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

ul,
ol {
  padding-left: 1.25rem;
}

li + li {
  margin-top: 0.3rem;
}

li > ul {
  margin: 0.3rem 0 0;
}

.meta {
  color: var(--ink-2);
  font-size: 0.9375rem;
}

/* A label in the app's small capitals: 14 pt, tracked 0.16 em. */
.label {
  margin: 0 0 0.25rem;
  color: var(--ink-2);
  font-family: var(--display);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* A control's name in the app. */
.ui {
  font-weight: 600;
}

/* Blocks */

.card {
  margin: 1.5rem 0;
  padding: 1.125rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.card > :first-child {
  margin-top: 0;
}

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

.card h2 {
  font-size: 1.25rem;
}

.notice {
  margin: 1rem 0 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-left: 3px solid var(--red);
  border-radius: 0 12px 12px 0;
  font-size: 0.9375rem;
}

.toc {
  padding-left: 1.5rem;
  font-size: 0.9375rem;
  columns: 2 15rem;
  column-gap: 2rem;
}

.toc li {
  break-inside: avoid;
}

/* Tables */

.table-wrap {
  margin: 0 0 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  background: var(--surface);
}

th,
td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 600;
}

/* Footer */

footer.site {
  padding-top: 1rem;
  padding-bottom: 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.875rem;
}

footer.site p {
  margin: 0 0 0.375rem;
}

footer.site a {
  color: var(--ink-2);
}

/* The home page: one screen. */

body.home {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}

body.home main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  padding-top: 1rem;
  padding-bottom: 1.5rem;
  text-align: center;
}

body.home nav.langs {
  width: 100%;
  padding-top: 1rem;
  border-bottom: 0;
}

body.home nav.langs ul {
  justify-content: center;
}

body.home footer.site {
  width: 100%;
  text-align: center;
}

.icon {
  display: block;
  width: 112px;
  height: 112px;
  margin: 0 auto 1rem;
  border-radius: 25px;
  box-shadow: 0 0 0 1px var(--line);
}

body.home h1 {
  font-size: 3.25rem;
  margin-bottom: 0.75rem;
}

.lede {
  max-width: 31rem;
  margin: 0 auto 1.75rem;
  font-size: 1.125rem;
}

.links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem;
  max-width: 26rem;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.links li + li {
  margin-top: 0;
}

.links a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 3.25rem;
  padding: 0.625rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
}

.links a:hover {
  color: var(--ink);
  border-color: var(--red);
}

/* Phones */

@media (max-width: 34rem) {
  body {
    font-size: 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.3125rem;
  }

  body.home h1 {
    font-size: 2.625rem;
  }

  .icon {
    width: 96px;
    height: 96px;
    border-radius: 21px;
  }

  .links {
    grid-template-columns: 1fr;
  }

  /* Each table row becomes a small card with labelled cells. */
  table.stack,
  table.stack tbody,
  table.stack tr,
  table.stack td {
    display: block;
    width: 100%;
  }

  table.stack {
    background: none;
  }

  table.stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  table.stack tr {
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.875rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  table.stack td {
    padding: 0.25rem 0;
    border: 0;
  }

  table.stack td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink-2);
  }

  table.stack td:first-child {
    font-weight: 600;
  }

  table.stack td:first-child::before {
    display: none;
  }
}

@media print {
  nav,
  .skip {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  a {
    color: #000;
  }
}
