/* Tibetan Toolbox - light theme only. Every colour comes from a token. */
:root {
  --lapis: #23408e;
  --lapis-dark: #162b63;
  --ink: #17192b;
  --muted: #4b4e63;
  --saffron: #e8a33d;
  --soft: #f2f4fb;
  --pill: #eef1fb;
  --line: #e3e6f1;
  --field: #cfd3e4;
  --white: #ffffff;
  --page: #ffffff;
  --page-cat: #f7f8fc;
  --band: #262a44;
  --band-text: #c3c6d8;
  --focus: #8a5a00;
  /* Need tiles take four of the five prayer-flag colours. */
  --flag-blue: #2f63c9; --flag-blue-bg: #eaf0fc; --flag-blue-tint: #c9d7f4;
  --flag-red: #d0473a; --flag-red-bg: #fcecea; --flag-red-tint: #f6c9c3;
  --flag-green: #23935f; --flag-green-bg: #e6f5ee; --flag-green-tint: #bfe3d0;
  --flag-yellow: #c4800f; --flag-yellow-bg: #fdf3e1; --flag-yellow-tint: #f2cf94;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bo: "Jomolhari", "Noto Serif Tibetan", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--page);
  line-height: 1.5;
}
body.catalogue { background: var(--page-cat); }
a { color: var(--lapis); }
a:hover { color: var(--lapis-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.15; margin: 0; }
p { margin: 0; }
kbd {
  font: inherit; font-size: 0.92em; font-weight: 600;
  background: var(--soft); border: 1px solid var(--field); border-bottom-width: 2px;
  border-radius: 6px; padding: 0 0.35em; white-space: nowrap;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -9999px; top: 0; background: var(--white); padding: 10px 14px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
[hidden] { display: none !important; }

.wrap { max-width: 1200px; margin: 0 auto; padding-left: 32px; padding-right: 32px; }
.wrap--wide { max-width: 1240px; }

/* Header */
.site-header .header-row { padding-top: 26px; padding-bottom: 26px; display: flex; flex-wrap: wrap; gap: 16px 20px; align-items: center; justify-content: space-between; }
.site-header--bar { background: var(--white); border-bottom: 1px solid var(--line); }
.site-header--bar .header-row { padding-top: 22px; padding-bottom: 22px; justify-content: flex-start; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); flex: none; }
.brand:hover { color: var(--ink); }
.brand__icon { width: 36px; height: 36px; display: block; }
.brand__name { font-weight: 800; font-size: 22px; letter-spacing: -0.01em; }
.brand__bo { font-family: var(--bo); font-size: 18px; color: var(--lapis); }
.nav { display: flex; flex-wrap: wrap; gap: 8px 26px; font-size: 15px; font-weight: 500; }
.nav a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.nav a:hover { color: var(--lapis); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav .nav__suggest { color: var(--lapis); font-weight: 600; }
.header-search { flex: 1 1 360px; }
.header-search input, .hero-search input {
  width: 100%; font: inherit; font-size: 16px; padding: 12px 16px; color: var(--ink);
  background: var(--white); border: 1.5px solid var(--field); border-radius: 10px;
}

/* Buttons */
.btn {
  display: inline-block; flex: none; background: var(--lapis); color: var(--white);
  text-decoration: none; font-weight: 600; padding: 11px 18px; border-radius: 10px; border: 1.5px solid var(--lapis);
  font-family: inherit; font-size: 16px; cursor: pointer; text-align: center;
}
.btn:hover { background: var(--lapis-dark); border-color: var(--lapis-dark); color: var(--white); }
.btn--outline { background: var(--white); color: var(--ink); border-color: var(--field); font-size: 15px; }
.btn--outline:hover { background: var(--soft); color: var(--ink); border-color: var(--lapis); }
.btn--saffron { background: var(--saffron); color: var(--ink); border-color: var(--saffron); font-weight: 700; padding: 13px 22px; }
.btn--saffron:hover { background: #f1b455; border-color: #f1b455; color: var(--ink); }

/* Home */
.hero { padding-top: 64px; padding-bottom: 40px; display: flex; flex-direction: column; gap: 22px; }
.hero h1 { font-size: 60px; font-weight: 800; line-height: 1.05; letter-spacing: -0.03em; max-width: 880px; }
.lead { font-size: 20px; line-height: 1.55; color: var(--muted); max-width: 680px; }
.hero-search { display: flex; flex-wrap: wrap; gap: 10px; max-width: 640px; margin-top: 8px; }
.hero-search input { flex: 1 1 200px; font-size: 17px; padding: 15px 18px; border-radius: 12px; }
.hero-search__go { padding: 15px 22px; border-radius: 12px; font-size: 17px; }
.home-results { max-width: 640px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 8px; }
.home-results__list { list-style: none; margin: 0; padding: 0; }
.home-results__item { display: block; padding: 12px 14px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.home-results__item:hover { background: var(--soft); color: var(--ink); }
.home-results__by { color: var(--muted); font-size: 14px; }
.home-results__desc { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.home-results__more, .home-results__none { padding: 10px 14px; font-size: 15px; color: var(--muted); }
.needs { padding-top: 24px; padding-bottom: 72px; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.tile { text-decoration: none; color: var(--ink); background: var(--soft); border-radius: 20px; padding: 26px; display: flex; flex-direction: column; gap: 10px; min-height: 180px; height: 100%; border: 2px solid transparent; }
.tile:hover { color: var(--ink); border-color: var(--lapis); }
.tile strong { font-size: 21px; }
.tile--blue { --c: var(--flag-blue); --c-bg: var(--flag-blue-bg); --c-tint: var(--flag-blue-tint); }
.tile--red { --c: var(--flag-red); --c-bg: var(--flag-red-bg); --c-tint: var(--flag-red-tint); }
.tile--green { --c: var(--flag-green); --c-bg: var(--flag-green-bg); --c-tint: var(--flag-green-tint); }
.tile--yellow { --c: var(--flag-yellow); --c-bg: var(--flag-yellow-bg); --c-tint: var(--flag-yellow-tint); }
.tile[class*="tile--"] { background: var(--c-bg); }
.tile[class*="tile--"]:hover { border-color: var(--c); }
.tile__icon { width: 76px; height: 76px; display: block; }
.tile__icon .i-f { fill: var(--c); }
.tile__icon .i-s { stroke: var(--c); }
.tile__icon .i-p { fill: var(--white); }
.tile__icon .i-t { fill: var(--c-tint); }
.tile__icon .i-ink { fill: var(--ink); }
.tile__icon .i-ink-s { stroke: var(--ink); }
.tile__icon .i-glass { fill: var(--white); fill-opacity: 0.85; }
.tile__icon .i-mute { stroke: var(--field); }
.tile__icon .i-mute-f { fill: var(--field); }
.tile__icon .i-bo { font-family: var(--bo); }
.tile__icon .i-bo-alt { font-family: "Noto Serif Tibetan", serif; }
.tile__icon .i-sans { font-family: var(--sans); }
.tile__icon .i-serif { font-family: Georgia, serif; }
.tile__text { font-size: 15px; color: var(--muted); }

.band { background: var(--ink); color: var(--white); }
.band__row { padding-top: 64px; padding-bottom: 64px; display: flex; flex-wrap: wrap; gap: 40px; align-items: center; }
.band__text { flex: 1 1 420px; display: flex; flex-direction: column; gap: 14px; }
.band__kicker { font-size: 15px; font-weight: 600; color: var(--saffron); }
.band h2 { font-size: 38px; font-weight: 800; letter-spacing: -0.02em; }
.band p { font-size: 18px; line-height: 1.55; color: var(--band-text); }
.band .btn { align-self: flex-start; }
.band__tiles { flex: 1 1 420px; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.band__tiles a { background: var(--band); border-radius: 14px; min-height: 120px; padding: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--band-text); border: 2px solid transparent; height: 100%; }
.band__tiles a:hover { border-color: var(--saffron); color: var(--white); }
.band__device { font-size: 20px; font-weight: 700; color: var(--white); text-align: center; }
.band__state { font-size: 14px; }

.dev { padding-top: 64px; padding-bottom: 64px; display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.dev__intro { flex: 1 1 340px; display: flex; flex-direction: column; gap: 10px; }
.dev__intro h2 { font-size: 30px; font-weight: 800; }
.dev__intro p { font-size: 17px; color: var(--muted); }
.dev__list { flex: 2 1 560px; margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 32px; font-size: 16px; }
.dev__list a { text-decoration: none; color: var(--ink); }
.dev__list a:hover strong { text-decoration: underline; }
.dev__list span { color: var(--muted); }

/* Inner pages */
.page { padding-top: 8px; padding-bottom: 72px; max-width: 920px; }
.crumbs { font-size: 14px; color: var(--muted); margin: 8px 0 22px; }
.crumbs a { color: var(--muted); }
.page__title { font-size: 46px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.08; margin-bottom: 20px; }
.prose { display: flex; flex-direction: column; gap: 14px; max-width: 720px; font-size: 17px; line-height: 1.6; }
.prose--lead { font-size: 19px; color: var(--ink); }
.tool-section { margin-top: 48px; display: flex; flex-direction: column; gap: 14px; }
.tool-section h2, .guide h2 { font-size: 28px; font-weight: 800; letter-spacing: -0.015em; }
.note { margin-top: 18px; color: var(--muted); font-size: 15px; }
.small { font-size: 14px; color: var(--muted); line-height: 1.6; margin-top: 8px; }
.actions { margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.notes, .steps { margin: 18px 0 0; padding-left: 24px; line-height: 1.65; font-size: 17px; max-width: 720px; }
.steps li, .notes li { padding-left: 4px; margin-bottom: 10px; }
.notes { color: var(--muted); }

/* Tool cards */
.tool-list { display: flex; flex-direction: column; gap: 14px; }
.tool { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; }
.tool--dev { border: 1px dashed var(--field); }
.tool__body { flex: 1 1 380px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tool__head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.tool__name { font-size: 19px; font-weight: 700; overflow-wrap: anywhere; }
.tool__by { font-size: 14px; color: var(--muted); }
.tool__by a { color: var(--muted); }
.tool__desc { font-size: 15px; color: var(--muted); }
.tool__needs { font-size: 13px; color: var(--muted); }
.tool__needs a { color: var(--muted); }
.tool__link { flex: none; color: var(--lapis); font-weight: 600; padding: 11px 6px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; font-weight: 600; margin: 4px 0 0; padding: 0; list-style: none; }
.pills li { background: var(--pill); color: var(--lapis); padding: 4px 10px; border-radius: 999px; }

/* Typing guide */
.guide { margin-top: 40px; }
.device-cards { list-style: none; margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.device-cards a { display: flex; flex-direction: column; gap: 4px; background: var(--soft); border-radius: 16px; padding: 20px 22px; text-decoration: none; color: var(--ink); border: 2px solid transparent; height: 100%; }
.device-cards a:hover { border-color: var(--lapis); color: var(--ink); }
.device-cards strong { font-size: 20px; }
.device-cards span { font-size: 15px; color: var(--muted); }
.credit { margin-top: 16px; font-size: 14px; color: var(--muted); }
.device { margin-top: 56px; scroll-margin-top: 16px; }
.device h2 { margin-bottom: 8px; }
.device__lead { font-size: 18px; line-height: 1.55; max-width: 720px; margin-bottom: 20px; }
.video { position: relative; aspect-ratio: 16 / 9; max-width: 720px; background: var(--ink); border-radius: 14px; overflow: hidden; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video__caption { margin-top: 8px; font-size: 14px; color: var(--muted); }
.callout, .font-box { margin-top: 28px; background: var(--soft); border-radius: 16px; padding: 22px 24px; max-width: 720px; }
.callout h3, .font-box h3 { font-size: 20px; margin-bottom: 8px; }
.callout p, .font-box p { line-height: 1.6; }
.callout p + *, .font-box p + * { margin-top: 12px; }
.keys { border-collapse: collapse; margin: 12px 0; }
.keys th { text-align: left; font-weight: 600; font-size: 14px; color: var(--muted); padding: 0 32px 6px 0; }
.keys td { padding: 4px 32px 4px 0; }
.keycap { display: inline-flex; min-width: 40px; height: 36px; align-items: center; justify-content: center; border: 1.5px solid var(--field); border-radius: 8px; background: var(--white); padding: 0 8px; font-weight: 600; }

/* Catalogue */
.cat { padding-top: 32px; padding-bottom: 64px; display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.filters { flex: 1 1 220px; max-width: 260px; font-size: 15px; }
.filters form { display: flex; flex-direction: column; gap: 26px; }
.filters fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.filters legend { font-weight: 700; font-size: 14px; color: var(--muted); margin-bottom: 8px; padding: 0; }
.filters label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.filters input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--lapis); flex: none; }
.linkbtn { background: none; border: 0; color: var(--lapis); font: inherit; font-weight: 600; padding: 0; text-align: left; cursor: pointer; text-decoration: underline; }
.results { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.results__title { font-size: 32px; font-weight: 800; }
.results__summary { font-size: 15px; color: var(--muted); margin-bottom: 4px; }
.empty { padding: 24px; background: var(--white); border: 1px dashed var(--field); border-radius: 16px; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--white); font-size: 14px; color: var(--muted); }
.footer-row { padding-top: 28px; padding-bottom: 8px; display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; align-items: center; }
.footer-who { display: flex; align-items: center; gap: 10px; }
.footer-who img { border-radius: 50%; }
.footer-links a { color: var(--muted); }
.footer-note { padding-bottom: 28px; font-size: 13px; }

@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero h1 { font-size: 46px; }
}
@media (max-width: 640px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .site-header .header-row { padding-top: 18px; padding-bottom: 18px; }
  .hero { padding-top: 32px; padding-bottom: 24px; }
  .hero h1 { font-size: 38px; letter-spacing: -0.02em; }
  .lead { font-size: 18px; }
  .tiles { grid-template-columns: 1fr; }
  .tile { min-height: 0; padding: 20px; }
  .band__row { padding-top: 40px; padding-bottom: 40px; }
  .band h2 { font-size: 30px; }
  .dev { padding-top: 40px; padding-bottom: 40px; }
  .dev__list { grid-template-columns: 1fr; }
  .page__title { font-size: 34px; }
  .device-cards { grid-template-columns: 1fr; }
  .tool { padding: 18px; }
  .cat { padding-top: 20px; }
  .filters { max-width: none; flex-basis: 100%; }
  .filters form { gap: 18px; }
  .filters fieldset { flex-direction: row; flex-wrap: wrap; gap: 8px 18px; }
  .filters legend { width: 100%; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
