/* Sigil site. Colours are the app's Graphite theme and ember accent (rust/crates/desktop/src/ui.rs). */

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

:root {
  --page: oklch(0.185 0 0);        /* well */
  --field: oklch(0.245 0 0);       /* between page and raised: the hero backdrop */
  --raised: oklch(0.268 0 0);
  --ink: oklch(0.96 0 0);
  --prose: oklch(0.88 0 0);
  --muted: oklch(0.72 0 0);
  --line: rgb(255 255 255 / 0.085);
  --line-strong: rgb(255 255 255 / 0.15);
  --accent: oklch(0.735 0.155 52);
  --accent-hover: oklch(0.79 0.13 55);
  --accent-ink: oklch(0.2 0.04 50);
  --focus: oklch(0.82 0.12 60);

  --size-display: clamp(2rem, 1.2rem + 2.6vw, 3rem);   /* 32 to 48 */
  --size-heading: clamp(1.375rem, 1.2rem + 0.6vw, 1.625rem); /* 22 to 26 */
  --size-body: 1.0625rem;  /* 17 */
  --size-fine: 0.9375rem;  /* 15 */

  --gutter: 32px;
  --max: 1200px;
  --bar-h: 60px;
  --section: clamp(80px, 9vw, 128px);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bar-h) + 16px);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--page);
  color: var(--prose);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--size-body);
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
h1, h2, h3 { margin: 0; color: var(--ink); font-weight: 600; }
p { margin: 0; }
a { color: inherit; }
code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.92em;
  color: var(--ink);
  background: var(--raised);
  padding: 0.05em 0.3em;
  border-radius: 2px;
  overflow-wrap: anywhere;
}
pre {
  margin: 0;
  background: var(--raised);
  border: 1px solid var(--line);
  padding: 16px 20px;
  overflow-x: auto;
  border-radius: 2px;
}
pre code { background: none; padding: 0; overflow-wrap: normal; font-size: var(--size-fine); line-height: 1.6; }

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

.wrap {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 14px;
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 12px; }

/* Type: three sizes do the work, plus a fine size for notes. */
.display {
  font-size: var(--size-display);
  line-height: 1.12;
  letter-spacing: -0.022em;
  font-weight: 600;
  color: var(--ink);
}
.display--muted { color: var(--muted); font-weight: 400; }
.heading {
  font-size: var(--size-heading);
  line-height: 1.25;
  letter-spacing: -0.012em;
}
.note { font-size: var(--size-fine); color: var(--muted); max-width: 62ch; }
.note + .note { margin-top: 6px; }

/* Buttons and links */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  border-radius: 2px;
  transition: background-color 120ms ease;
}
.btn:hover { background: var(--accent-hover); }
.btn--small { min-height: 36px; padding: 0 14px; font-size: var(--size-fine); }
.textlink {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 120ms ease;
}
.textlink:hover { text-decoration-color: var(--ink); }
.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  margin: 32px 0 18px;
}

/* Top bar */
.bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--page);
  border-bottom: 1px solid var(--line);
}
.bar__in {
  display: flex;
  align-items: center;
  gap: 28px;
  height: var(--bar-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-height: 44px;
}
.brand__word { height: 25px; width: auto; }
.nav { display: flex; align-items: center; gap: 4px; margin-right: auto; }
.nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  color: var(--muted);
  font: inherit;
  font-size: var(--size-fine);
  text-decoration: none;
  background: none;
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  transition: color 120ms ease;
}
.nav__link:hover, .nav__link[aria-expanded="true"] { color: var(--ink); }

.menu { position: relative; }
.menu__trigger::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.menu__panel {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  left: -12px;
  width: min(620px, calc(100vw - 48px));
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 20px;
  grid-template-columns: 1fr 1fr;
  gap: 20px 24px;
  box-shadow: 0 16px 40px rgb(0 0 0 / 0.45);
}
/* Without script the menu opens while focus is inside it; with script, aria-expanded drives it. */
.menu:focus-within .menu__panel { display: grid; }
.js .menu:focus-within .menu__panel { display: none; }
.js .menu.is-open .menu__panel { display: grid; }
.menu__head { font-size: var(--size-fine); color: var(--muted); margin: 0 0 6px 10px; }
.menu__panel ul { list-style: none; margin: 0; padding: 0; }
.menu__panel a {
  display: block;
  padding: 8px 10px;
  text-decoration: none;
  border-radius: 2px;
}
.menu__panel a:hover, .menu__panel a:focus-visible { background: rgb(255 255 255 / 0.06); }
.menu__name { display: block; color: var(--ink); font-weight: 600; font-size: var(--size-fine); }
.menu__line { display: block; color: var(--muted); font-size: var(--size-fine); line-height: 1.4; }

/* Hero */
.hero { padding-top: clamp(48px, 6vw, 80px); }
@media (prefers-reduced-motion: no-preference) {
  .hero__text, .stage { animation: rise-in 520ms ease-out both; }
  .stage { animation-delay: 90ms; }
}
@keyframes rise-in { from { opacity: 0; } to { opacity: 1; } }
.hero__text .display { max-width: 22ch; }
.hero__text .display--muted { max-width: 30ch; margin-top: 4px; }
.stage {
  margin-top: clamp(40px, 4.5vw, 64px);
  background: var(--field);
  padding: clamp(16px, 4vw, 56px) 0;
}
.shot {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: oklch(0.225 0 0);
}

/* Feature rows */
.row { padding-top: var(--section); }
.row__in {
  display: grid;
  grid-template-columns: 4fr 8fr;
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
}
.row--flip .row__text { order: 2; }
.row--flip .row__in { grid-template-columns: 8fr 4fr; }
.row__text p { max-width: 44ch; margin-top: 16px; }
.row__text .heading { max-width: 20ch; }

/* Everything list */
.all { padding-top: var(--section); }
.all__cols {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 32px 28px;
  margin-top: 40px;
}
.all__col h3 { font-size: var(--size-fine); color: var(--muted); font-weight: 400; margin-bottom: 12px; }
.all__col ul, .related ul { list-style: none; margin: 0; padding: 0; }
.all__col li, .related li { margin-bottom: 14px; }
.all__col a, .related a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
}
.all__col a:hover, .related a:hover { text-decoration-color: var(--ink); }
.all__col span, .related span { display: block; font-size: var(--size-fine); color: var(--muted); line-height: 1.4; margin-top: 2px; }

/* Safety strip */
.safety { padding-top: var(--section); }
.cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.cols h3, .qa h3, .qa h2 { font-size: var(--size-body); line-height: 1.4; }
.cols p { margin-top: 8px; color: var(--prose); }

/* FAQ */
.faq { padding-top: var(--section); }
.faq__in { display: grid; grid-template-columns: 4fr 8fr; gap: 32px; }
.faq__list { max-width: 68ch; }
/* Questions are closed until asked for: a native details element, so it works without
   JavaScript and announces its state. */
.qa { border-top: 1px solid var(--line); }
.qa:last-of-type { border-bottom: 1px solid var(--line); }
.qa summary {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  min-height: 56px; padding: 14px 0; cursor: pointer; list-style: none;
}
.qa summary::-webkit-details-marker { display: none; }
.qa > summary > h2, .qa > summary > h3 { margin: 0; padding: 0; border: 0; }
.qa summary:hover h2, .qa summary:hover h3 { color: var(--accent-hover); }
.qa summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.qa__mark { position: relative; flex: none; width: 14px; height: 14px; }
.qa__mark::before, .qa__mark::after {
  content: ""; position: absolute; left: 0; top: 6px; width: 14px; height: 2px; background: var(--muted);
}
.qa__mark::after { transform: rotate(90deg); }
.qa[open] .qa__mark::after { display: none; }
.qa p { margin: 0; padding: 0 38px 20px 0; }
.qa a, .doc__body a { color: var(--ink); text-underline-offset: 3px; }

/* Final call */
.final { padding: var(--section) 0 calc(var(--section) * 0.75); }
.final .display { max-width: 20ch; }

/* Feature and guide pages */
.doc { padding-top: 40px; padding-bottom: var(--section); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 40px; padding: 0; font-size: var(--size-fine); color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--muted); }
.crumbs a { color: var(--muted); text-underline-offset: 3px; display: inline-block; min-height: 24px; }
.crumbs a[aria-current] { color: var(--ink); text-decoration: none; }
.doc h1 { max-width: 24ch; }
.doc__body { max-width: 760px; margin-top: 32px; }
.doc__body > p, .doc__body > ul, .doc__body > ol { max-width: 68ch; }
.doc__body > * + * { margin-top: 18px; }
.doc__body > p:first-child { font-size: var(--size-heading); line-height: 1.4; color: var(--muted); letter-spacing: -0.01em; }
.doc__body h2 { font-size: var(--size-heading); line-height: 1.25; margin-top: 56px; }
.doc__body h3 { font-size: var(--size-body); margin-top: 32px; }
.doc__body ul, .doc__body ol { padding-left: 1.3em; }
.doc__body li + li { margin-top: 8px; }
.doc__fig { margin-top: 32px !important; margin-bottom: 8px; width: min(1040px, calc(100vw - 2 * var(--gutter))); }
.faq__list--page .qa h2 { font-size: var(--size-body); }
.getit {
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
  max-width: 760px;
}
.getit .cta { margin-top: 24px; }
.related { margin-top: 56px; max-width: 760px; }
.related ul { margin-top: 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 24px; }

/* Footer */
.foot { border-top: 1px solid var(--line); padding: 56px 0 48px; }
.foot__top { display: grid; grid-template-columns: 3fr 9fr; gap: 32px; }
.foot__brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; text-decoration: none; align-self: start; min-height: 44px; }
.foot__cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.foot__head { font-size: var(--size-fine); color: var(--muted); font-weight: 400; margin-bottom: 12px; }
.foot__col ul { list-style: none; margin: 0; padding: 0; }
.foot__col li { margin-bottom: 6px; }
.foot__col a { color: var(--prose); font-size: var(--size-fine); text-decoration: none; display: inline-block; min-height: 24px; }
.foot__col a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.foot__fine { margin-top: 48px; font-size: var(--size-fine); color: var(--muted); max-width: 80ch; }

/* Medium widths */
@media (max-width: 1100px) {
  .all__cols { grid-template-columns: repeat(3, 1fr); }
  .cols { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .row__in { grid-template-columns: 1fr; }
  .row--flip .row__text { order: 0; }
  .row--flip .row__in { grid-template-columns: 1fr; }
  .faq__in { grid-template-columns: 1fr; }
  .foot__top { grid-template-columns: 1fr; }
  .related ul { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .nav { display: none; }
  .bar__in { justify-content: space-between; }
}
/* Phones */
@media (max-width: 640px) {
  :root { --gutter: 16px; --bar-h: 56px; }
  .all__cols { grid-template-columns: 1fr 1fr; }
  .cols { grid-template-columns: 1fr; gap: 24px; }
  .foot__cols { grid-template-columns: 1fr 1fr; }
  .related ul { grid-template-columns: 1fr; }
  .btn { min-height: 48px; }
  .btn--small { min-height: 44px; }
  .cta .btn:not(.btn--small) { width: 100%; }
  .cta .textlink { min-height: 44px; display: inline-flex; align-items: center; }
  .stage { padding: 16px 0; }
  .hero__text .display--muted { font-size: 1.5rem; line-height: 1.3; margin-top: 10px; }
  .crumbs a { min-height: 44px; display: inline-flex; align-items: center; }
  .foot__col a { min-height: 44px; display: inline-flex; align-items: center; line-height: 1.3; }
  .foot__col li { margin-bottom: 0; }
}
@media (max-width: 360px) {
  .all__cols, .foot__cols { grid-template-columns: 1fr; }
}
