/* schematron-rust site stylesheet
 *
 * Built on the Lily Design System contract: Lily ships headless components
 * that render semantic HTML carrying one stable kebab-case class hook each,
 * and no CSS at all. Every rule below targets one of those hooks, so this
 * file *is* the theme. Swap it and the markup is unchanged.
 *
 * Lily hooks styled here:
 *   .skip-link .button .card .tag .alert .details .code-block .separator
 *   .section-heading .section-heading-eyebrow .section-heading-heading
 *   .section-heading-subtitle .inset-text .warning-callout
 *   .information-callout .table .table-head .table-body .table-row
 *   .table-th .table-td .summary-list .summary-list-item .theme-picker
 *   .text-size-picker .share-picker
 *
 * Site-local hooks (this site's own layout, not Lily) are prefixed `site-`.
 *
 * This file carries no colour of its own: every custom property it
 * consumes (--rust, --page-bg, --border, …) is defined by whichever theme
 * stylesheet is currently linked — themes/light.css or themes/dark.css,
 * swapped by ThemePicker (see src/app.html and src/routes/+layout.svelte).
 * Structural values that do not vary by theme (radii, breakpoints, fonts)
 * are still theme-file custom properties, not literals here, because a
 * theme file is the only stylesheet guaranteed to be linked at all times.
 */

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

html[data-text-size="small"]   { font-size: 87.5%; }  /* 14px at a 16px default */
html[data-text-size="medium"]  { font-size: 100%; }    /* 16px — same as no attribute */
html[data-text-size="large"]   { font-size: 112.5%; }  /* 18px */
html[data-text-size="x-large"] { font-size: 125%; }    /* 20px */

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--rust);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
a:hover { color: var(--rust-hover); }
a:focus-visible {
  outline: 3px solid var(--rust);
  outline-offset: 2px;
  border-radius: 2px;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin: 2rem 0 1rem;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }

p { margin: 0 0 1rem; }

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
code {
  background: var(--rust-tint);
  color: var(--rust-hover);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
pre {
  /* Deliberately fixed, not themed: a code block reads as a terminal in
   * both themes, not as a themed surface. In dark mode this sits close in
   * luminance to --card-bg, so the border is what keeps it legible as its
   * own box rather than the palette. */
  background: #1c1917;
  color: #e7e5e4;
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.55;
}
pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.1em 0.4em;
}

/* ---------------------------------------------------------------- *
 * Lily component hooks
 * ---------------------------------------------------------------- */

/* Lily: SkipLink */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--button-fill);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  text-decoration: none;
  z-index: 100;
  transition: top 150ms;
}
.skip-link:focus {
  top: 1rem;
  color: #fff;
}

/* Lily: Button */
.button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms;
  line-height: 1.2;
}
.button-primary {
  background: var(--button-fill);
  color: #fff;
  border-color: var(--button-fill);
}
.button-primary:hover {
  background: var(--button-fill-hover);
  border-color: var(--button-fill-hover);
  color: #fff;
}
.button-secondary {
  background: var(--card-bg);
  color: var(--rust);
  border-color: var(--rust);
}
.button-secondary:hover { background: var(--rust-tint); }

.button-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: 1.5rem 0;
}

/* Lily: Card */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform 150ms, box-shadow 150ms;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.card > h2, .card > h3, .card > h4 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}
.card > h3 > a { text-decoration: none; }
.card > h3 > a:hover { text-decoration: underline; }
.card p { color: var(--text-muted); }
.card p:last-child { margin-bottom: 0; }
.card-meta {
  font-size: 0.875rem;
  color: var(--text-subtle);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

/* Lily: SectionHeading */
.section-heading {
  text-align: center;
  margin-bottom: 2rem;
}
.section-heading-eyebrow {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ember);
  margin: 0 0 0.5rem;
}
.section-heading-heading { margin: 0; }
.section-heading-subtitle {
  margin: 0.75rem auto 0;
  max-width: 40rem;
  color: var(--text-muted);
}
.section-heading-start { text-align: left; }
.section-heading-start .section-heading-subtitle { margin-left: 0; }

/* Lily: Tag */
.tag {
  display: inline-block;
  font-size: 0.8125rem;
  background: var(--rust-tint);
  color: var(--rust-hover);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-weight: 600;
}
.tag-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0 0 1.5rem;
}
/* Status variants, used by the conformance table. */
.tag-full    { background: var(--success-bg); color: var(--success); }
.tag-subset  { background: var(--warning-bg); color: var(--warning); }
.tag-refused { background: var(--danger-bg);  color: var(--danger); }

/* Lily: Alert — severity arrives as data-type */
.alert {
  border-radius: var(--radius);
  border-left: 4px solid var(--xml-blue);
  background: var(--info-bg);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.alert p:last-child { margin-bottom: 0; }
.alert[data-type="success"] { border-left-color: var(--success); background: var(--success-bg); }
.alert[data-type="warning"] { border-left-color: var(--warning); background: var(--warning-bg); }
.alert[data-type="error"]   { border-left-color: var(--danger);  background: var(--danger-bg); }

/* Lily: InsetText */
.inset-text {
  border-left: 4px solid var(--border-strong);
  padding: 0.25rem 0 0.25rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
}
.inset-text p:last-child { margin-bottom: 0; }

/* Lily: InformationCallout and WarningCallout */
.information-callout,
.warning-callout {
  display: block;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.information-callout {
  background: var(--rust-tint);
  border-left: 4px solid var(--rust);
}
.warning-callout {
  background: var(--warning-bg);
  border-left: 4px solid var(--warning);
}
.information-callout p:last-child,
.warning-callout p:last-child { margin-bottom: 0; }
.information-callout > h2, .information-callout > h3,
.warning-callout > h2, .warning-callout > h3 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
}

/* Lily: Details */
.details {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}
.details[open] { border-color: var(--rust); }
.details > summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
.details > summary::-webkit-details-marker { display: none; }
.details > summary::after {
  content: "+";
  float: right;
  font-size: 1.25rem;
  color: var(--rust);
  font-weight: 400;
}
.details[open] > summary::after { content: "\2212"; }
.details > summary + * { margin-top: 0.75rem; }
.details p:last-child { margin-bottom: 0; }

/* Lily: CodeBlock — a labelled wrapper around a <pre> */
.code-block { margin: 1.25rem 0; }
.code-block > pre { margin: 0; }
.code-block-caption {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.4rem;
}

/* Lily: Table family */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.table-th,
.table-td {
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table-head .table-th {
  background: var(--rust-tint);
  color: var(--rust-hover);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table-body .table-row:last-child .table-td,
.table-body .table-row:last-child .table-th { border-bottom: none; }
.table-body .table-row:hover { background: var(--row-hover-bg); }
.table-scroll { overflow-x: auto; }

/* Lily: SummaryList */
.summary-list {
  margin: 1.5rem 0;
  border-top: 1px solid var(--border);
}
.summary-list-item {
  display: grid;
  grid-template-columns: minmax(9rem, 14rem) 1fr;
  gap: 0 1.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.summary-list-item dt {
  font-weight: 600;
  margin: 0;
}
.summary-list-item dd {
  margin: 0;
  color: var(--text-muted);
}

/* Lily: Separator */
.separator {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* ---------------------------------------------------------------- *
 * Site layout (this site's own hooks)
 * ---------------------------------------------------------------- */

.site-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.site-header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-mono);
}
.site-brand:hover { color: var(--rust); }
.site-brand-mark { width: 1.75rem; height: 1.75rem; }

.site-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: background 150ms;
}
.site-nav a:hover { background: var(--border); color: var(--text); }
.site-nav a[aria-current="page"] {
  color: var(--rust);
  font-weight: 600;
  background: var(--rust-tint);
}

.site-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Lily: ThemePicker, TextSizePicker, SharePicker — an icon button opening
 * an absolutely-positioned listbox/menu. The three share one visual
 * treatment; only the class-name prefix differs per component. */
.theme-picker,
.text-size-picker,
.share-picker {
  position: relative;
}
.theme-picker-button,
.text-size-picker-button,
.share-picker-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 150ms, color 150ms, border-color 150ms;
}
.theme-picker-button:hover,
.text-size-picker-button:hover,
.share-picker-button:hover {
  background: var(--border);
  color: var(--text);
}
.theme-picker-button:focus-visible,
.text-size-picker-button:focus-visible,
.share-picker-button:focus-visible {
  outline: 3px solid var(--rust);
  outline-offset: 2px;
}
.theme-picker-icon,
.text-size-picker-icon,
.share-picker-icon {
  font-size: 1.05rem;
  line-height: 1;
}
.theme-picker-list,
.text-size-picker-list {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 60;
  min-width: 10rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.theme-picker-option,
.text-size-picker-option {
  padding: 0.5rem 0.6rem;
  border-radius: calc(var(--radius) - 0.15rem);
  font-size: 0.9rem;
  cursor: pointer;
}
.theme-picker-option:hover,
.text-size-picker-option:hover,
.theme-picker-option[data-active],
.text-size-picker-option[data-active] {
  background: var(--rust-tint);
  color: var(--rust-hover);
}
.theme-picker-option[aria-selected="true"],
.text-size-picker-option[aria-selected="true"] {
  font-weight: 600;
}
.share-picker-list {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 60;
  min-width: 11rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.share-picker-list-item + .share-picker-list-item { margin-top: 0.1rem; }
.share-picker-target,
.share-picker-copy {
  display: block;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: none;
  border-radius: calc(var(--radius) - 0.15rem);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.share-picker-target:hover,
.share-picker-copy:hover {
  background: var(--rust-tint);
  color: var(--rust-hover);
}
.share-picker-status {
  /* Announced via aria-live; not meant to take up layout space. */
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.site-main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.prose { max-width: var(--prose-max); }
.prose-center { margin-left: auto; margin-right: auto; }
/* For pages whose substance is code and terminal output, where the 44rem
 * reading measure would put almost every sample into horizontal scroll. */
.prose-wide { max-width: 58rem; }
.prose ul, .prose ol { padding-left: 1.5rem; }
.prose li { margin-bottom: 0.35rem; }

.section { margin: 4rem 0; }
.section:first-child { margin-top: 0; }

.hero {
  text-align: center;
  padding: 2.5rem 1rem 1rem;
  max-width: 50rem;
  margin: 0 auto;
}
.hero-eyebrow {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ember);
  background: var(--rust-tint);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  margin-bottom: 1rem;
}
.hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  margin: 0.5rem 0 1rem;
  color: var(--rust);
}
.hero-tagline {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin: 0 auto 2rem;
  max-width: 40rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1.5rem;
  margin: 2.5rem 0;
  text-align: center;
}
.stat { padding: 0.5rem; }
.stat-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--rust);
  line-height: 1;
  margin: 0;
}
.stat-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 2rem;
  align-items: start;
}

.page-header { max-width: var(--prose-max); margin-bottom: 2rem; }
.page-header h1 { margin-top: 0; }
.page-header p { font-size: 1.125rem; color: var(--text-muted); }

.back-link {
  display: inline-block;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.site-footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 2rem 1.5rem;
}
.site-footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2rem;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.site-footer p { margin: 0; }
.site-footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }

@media (max-width: 640px) {
  .site-nav { width: 100%; justify-content: flex-start; }
  .site-main { padding: 2rem 1rem; }
  .hero { padding: 2rem 1rem 1rem; }
  .summary-list-item { grid-template-columns: 1fr; gap: 0.25rem; }
}

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