/* KanjiHybrid marketing site.
   Tokens come from the app's own src/theme/theme.ts so the site and the product agree,
   with two additions the app has no use for: a vermilion used only as a seal mark, and a
   deeper teal for large type on light ground. */

:root {
  --paper: #f4f6f6;
  --card: #ffffff;
  --sunken: #eaeeee;
  --ink: #101413;
  --ink-2: #4e5856;
  --ink-3: #7f8a88;
  --rule: #dfe5e4;
  --rule-2: #c8d2d0;
  --teal: #0a7362;
  --teal-deep: #064b40;
  --mist: #dcf1ec;
  --seal: #a8342a;
  --on-teal: #ffffff;

  --lift-1: 0 1px 2px rgb(16 20 19 / 6%);
  --lift-2: 0 2px 4px rgb(16 20 19 / 5%), 0 18px 40px -24px rgb(6 75 64 / 32%);
  --lift-3: 0 2px 6px rgb(16 20 19 / 7%), 0 30px 70px -30px rgb(6 75 64 / 38%);

  /* Tracking is size-specific, never one value: large type reads too loose as it grows. */
  --t-hero: clamp(2.6rem, 1.4rem + 5vw, 5.6rem);
  --t-h2: clamp(1.9rem, 1.35rem + 2.3vw, 3.1rem);
  --t-h3: clamp(1.12rem, 1.05rem + 0.3vw, 1.3rem);
  --t-lede: clamp(1.1rem, 1rem + 0.5vw, 1.38rem);
  --t-body: clamp(1rem, 0.97rem + 0.15vw, 1.07rem);
  --t-small: 0.875rem;
  --t-micro: 0.78rem;

  --gutter: clamp(1.15rem, 5vw, 4rem);
  --measure: 63ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #0c100f;
    --card: #151a19;
    --sunken: #111615;
    --ink: #e9eeec;
    --ink-2: #a3aeab;
    --ink-3: #78837f;
    --rule: #232b29;
    --rule-2: #333d3a;
    --teal: #5cc9b0;
    --teal-deep: #93e3cd;
    --mist: #13302b;
    --seal: #e0705f;
    --on-teal: #05211c;
    --lift-1: 0 1px 2px rgb(0 0 0 / 40%);
    --lift-2: 0 2px 4px rgb(0 0 0 / 40%), 0 18px 40px -24px rgb(0 0 0 / 85%);
    --lift-3: 0 2px 6px rgb(0 0 0 / 45%), 0 30px 70px -30px rgb(0 0 0 / 90%);
  }
}

:root[data-theme='dark'] {
  --paper: #0c100f;
  --card: #151a19;
  --sunken: #111615;
  --ink: #e9eeec;
  --ink-2: #a3aeab;
  --ink-3: #78837f;
  --rule: #232b29;
  --rule-2: #333d3a;
  --teal: #5cc9b0;
  --teal-deep: #93e3cd;
  --mist: #13302b;
  --seal: #e0705f;
  --on-teal: #05211c;
  --lift-1: 0 1px 2px rgb(0 0 0 / 40%);
  --lift-2: 0 2px 4px rgb(0 0 0 / 40%), 0 18px 40px -24px rgb(0 0 0 / 85%);
  --lift-3: 0 2px 6px rgb(0 0 0 / 45%), 0 30px 70px -30px rgb(0 0 0 / 90%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    'Hanken Grotesk',
    ui-sans-serif,
    system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
  font-size: var(--t-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  width: 100%;
  max-width: 74rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

h1,
h2,
h3 {
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: var(--t-hero);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 700;
}

h2 {
  font-size: var(--t-h2);
  line-height: 1.08;
  letter-spacing: -0.024em;
  font-weight: 600;
}

h3 {
  font-size: var(--t-h3);
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 600;
}

p {
  margin: 0;
}

a {
  color: var(--teal);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 0.06em;
}

a:hover {
  color: var(--teal-deep);
}

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

img {
  max-width: 100%;
  height: auto;
}

/* The mechanic. A kanji standing in for a first letter reads as part of the word, so it
   keeps the surrounding size and ink exactly - the app's own rule from KH-60. */
.k {
  font-family: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  font-weight: 700;
  font-feature-settings: 'palt' 1;
}

/* ---------- chrome ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
}

.topbar::after {
  /* A fade where content passes under the chrome, rather than a hard 1px divider. */
  content: '';
  position: absolute;
  inset: 100% 0 auto;
  height: 1.25rem;
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--paper) 60%, transparent),
    transparent
  );
  pointer-events: none;
}

.topbar-in {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
  margin-right: auto;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.brand img {
  width: 30px;
  height: 30px;
  display: block;
}

/* The delivered artwork comes in two inks. The light-background lockup sets "KANJI" in
   black, so on a dark ground it disappears and only "HYBRID" is left. Both variants ship
   and the theme picks one, through the same three-state logic the colours use. */
.on-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .on-light {
    display: none;
  }

  :root:not([data-theme='light']) .on-dark {
    display: block;
  }
}

:root[data-theme='dark'] .on-light {
  display: none;
}

:root[data-theme='dark'] .on-dark {
  display: block;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2.5vw, 2rem);
}

/* Scoped to plain nav links only. `.topbar nav a` is specificity 0-2-1 and `.btn-primary`
   is 0-1-0, so without the :not() the bar's muted grey won the cascade and painted the
   Get started button's label almost into its own teal fill. */
.topbar nav a:not(.btn) {
  color: var(--ink-2);
  text-decoration: none;
  font-size: var(--t-small);
  font-weight: 500;
}

.topbar nav a:not(.btn):hover {
  color: var(--ink);
}

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

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  padding: 0.78rem 1.35rem;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  /* Feedback belongs on the press, and it has to be instant. */
  transition:
    transform 90ms ease-out,
    background-color 140ms ease-out,
    border-color 140ms ease-out;
}

.btn:active {
  transform: scale(0.972);
}

.btn-primary {
  background: var(--teal);
  color: var(--on-teal);
  box-shadow: var(--lift-2);
}

.btn-primary:hover {
  background: var(--teal-deep);
  color: var(--on-teal);
}

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

.btn-ghost:hover {
  border-color: var(--ink-3);
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}

.btn-sm {
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
}

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--rule);
  margin-top: clamp(4rem, 9vw, 7rem);
  padding-block: clamp(2.75rem, 5vw, 4rem) 2.5rem;
  background: var(--sunken);
}

.foot-grid {
  display: grid;
  gap: 2.5rem;
  grid-template-columns: minmax(14rem, 1.4fr) repeat(auto-fit, minmax(9rem, 1fr));
  align-items: start;
}

/* The brand column's 14rem floor plus one 9rem auto-fit track and the gap comes to 408px,
   which is wider than a 390px phone can give it - the footer was pushing the page into a
   horizontal scroll. Below this width the tracks stop being fixed minimums. */
@media (max-width: 46rem) {
  .foot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem 1.5rem;
  }

  .foot-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 24rem) {
  .foot-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.foot-brand {
  display: grid;
  gap: 1rem;
  justify-items: start;
}

.foot-brand img {
  width: 150px;
  max-width: 100%;
}

.foot-brand p {
  color: var(--ink-3);
  font-size: var(--t-small);
  line-height: 1.55;
  max-width: 30ch;
}

.foot-col {
  display: grid;
  gap: 0.6rem;
  align-content: start;
}

.foot-col h4 {
  margin: 0 0 0.2rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--t-micro);
  font-weight: 600;
  color: var(--ink-3);
}

.foot-col a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: var(--t-small);
}

.foot-col a:hover {
  color: var(--ink);
}

.foot-legal {
  margin-top: 2.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  color: var(--ink-3);
  font-size: var(--t-micro);
}

/* Deliberately no `overflow-x: hidden` backstop on html or body. It masks a real overflow
   rather than fixing it, and on html it makes the viewport propagate overflow, which kills
   `position: sticky` on the topbar. Wide tables scroll inside .tbl-scroll and the hero
   glyph is clipped by .hero; the footer grid, which was the actual overflow at phone
   width, is fixed above. */

.topbar-in {
  flex-wrap: nowrap;
}

@media (max-width: 30rem) {
  .brand {
    font-size: 1rem;
  }

  .brand img {
    width: 26px;
    height: 26px;
  }
}

/* ---------- document pages ---------- */

.doc-head {
  padding-block: clamp(3rem, 7vw, 5.5rem) clamp(1.75rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--rule);
}

.doc-head h1 {
  max-width: 16ch;
}

.doc-head p {
  color: var(--ink-3);
  font-size: var(--t-small);
  margin-top: 0.9rem;
}

.doc {
  max-width: var(--measure);
  padding-block: clamp(2.25rem, 4vw, 3.25rem);
}

.doc h2 {
  font-size: clamp(1.3rem, 1.15rem + 0.5vw, 1.6rem);
  margin: 2.75rem 0 0.85rem;
}

.doc h2:first-child {
  margin-top: 0;
}

.doc p,
.doc li {
  color: var(--ink-2);
}

.doc p {
  margin-bottom: 1.05rem;
}

.doc strong {
  color: var(--ink);
  font-weight: 600;
}

.doc ul {
  margin: 0 0 1.15rem;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.5rem;
}

.doc li::marker {
  color: var(--teal);
}

.doc-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.doc-toc a {
  font-size: var(--t-micro);
  color: var(--ink-2);
  text-decoration: none;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
}

.doc-toc a:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.tbl-scroll {
  overflow-x: auto;
  margin: 1.5rem 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 32rem;
  font-size: var(--t-small);
}

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

th {
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--t-micro);
  font-weight: 600;
  color: var(--ink-3);
  border-bottom-color: var(--rule-2);
}

td {
  color: var(--ink-2);
}

td:first-child {
  color: var(--ink);
  font-weight: 500;
}

.note {
  border-left: 2px solid var(--seal);
  background: var(--card);
  padding: 1.1rem 1.3rem;
  border-radius: 0 10px 10px 0;
  margin: 1.6rem 0;
  display: grid;
  gap: 0.45rem;
  box-shadow: var(--lift-1);
}

.note p {
  margin: 0;
}

.note p:first-child {
  color: var(--ink);
  font-weight: 600;
}

@media (prefers-reduced-transparency: reduce) {
  .topbar {
    background: var(--paper);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid var(--rule);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
