/* OpenCraft legal pages — one small stylesheet, no external assets. */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f7f8f7;
  --surface: #ffffff;
  --surface-2: #f1f3f2;
  --text: #0d1413;
  --text-soft: #5b6b68;
  --text-faint: #76827f;
  --border: rgba(13, 20, 19, 0.1);
  --border-strong: rgba(13, 20, 19, 0.18);
  --accent-text: #0b5f59;
  --accent-solid: #0f766e;
  --accent-on-solid: #ffffff;
  --accent-soft: rgba(15, 118, 110, 0.08);
  --focus: #0f766e;
  --shadow: 0 1px 2px rgba(13, 20, 19, 0.04), 0 8px 28px rgba(13, 20, 19, 0.06);
  --header-height: 64px;
  --page-width: 1120px;
  --prose-width: 760px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1211;
  --bg-soft: #0f1716;
  --surface: #121b1a;
  --surface-2: #16211f;
  --text: #e8efed;
  --text-soft: #9ba9a6;
  --text-faint: #84918e;
  --border: rgba(232, 239, 237, 0.12);
  --border-strong: rgba(232, 239, 237, 0.2);
  --accent-text: #5eead4;
  --accent-solid: #14b8a6;
  --accent-on-solid: #04201d;
  --accent-soft: rgba(20, 184, 166, 0.1);
  --focus: #5eead4;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.24), 0 14px 36px rgba(0, 0, 0, 0.22);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 180ms ease, color 180ms ease;
}

main {
  flex: 1;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

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

a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-text);
  transition: color 140ms ease, text-decoration-color 140ms ease;
}

a:hover {
  color: var(--text);
  text-decoration-color: var(--text);
}

p,
ul,
ol,
table,
blockquote {
  margin-top: 0;
}

img,
svg {
  display: block;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 140ms ease;
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--bg);
}

.progress {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 120;
  height: 2px;
  background: var(--accent-solid);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  width: 100%;
  max-width: var(--page-width);
  height: var(--header-height);
  margin: 0 auto;
  padding: 0 max(24px, env(safe-area-inset-left)) 0
    max(24px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

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

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--accent-solid);
  color: var(--accent-on-solid);
  font-size: 13px;
  font-weight: 750;
  line-height: 1;
}

.header-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
}

.header-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 550;
  text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease;
}

.header-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.header-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-2);
}

.theme-toggle {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  margin-left: 4px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease,
    border-color 140ms ease;
}

.theme-toggle:hover {
  background: var(--surface-2);
  color: var(--text);
}

.theme-toggle svg {
  width: 19px;
  height: 19px;
}

[data-theme="dark"] .theme-icon-moon,
:root:not([data-theme="dark"]) .theme-icon-sun {
  display: none;
}

/* Page frame */

.page {
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 max(24px, env(safe-area-inset-left)) 96px
    max(24px, env(safe-area-inset-right));
}

.page-head {
  max-width: 780px;
  padding: 64px 0 34px;
}

.kicker {
  margin: 0 0 14px;
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.page-head h1 {
  margin: 0 0 18px;
  font-size: clamp(2.25rem, 5vw, 3.35rem);
  line-height: 1.04;
  font-weight: 720;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.lede {
  max-width: 62ch;
  margin: 0 0 20px;
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1.6;
  text-wrap: pretty;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.5;
}

.meta span + span::before {
  content: "·";
  margin-right: 8px;
  color: var(--border-strong);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease,
    color 140ms ease;
}

.button:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.button:active {
  transform: translateY(1px);
}

.button-primary {
  border-color: var(--accent-solid);
  background: var(--accent-solid);
  color: var(--accent-on-solid);
}

.button-primary:hover {
  border-color: var(--accent-text);
  background: var(--accent-text);
  color: var(--accent-on-solid);
}

/* Body layout */

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, var(--prose-width));
  gap: 64px;
  align-items: start;
  padding-top: 38px;
  border-top: 1px solid var(--border);
}

.toc {
  position: sticky;
  top: calc(var(--header-height) + 30px);
  max-height: calc(100vh - var(--header-height) - 60px);
  overflow: auto;
  padding: 2px 8px 16px 0;
  scrollbar-width: thin;
}

.toc-title {
  margin: 0 0 10px;
  color: var(--text-faint);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.toc nav {
  display: flex;
  flex-direction: column;
}

.toc a {
  display: block;
  margin-left: -2px;
  padding: 6px 0 6px 14px;
  border-left: 2px solid transparent;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
  transition: color 140ms ease, border-color 140ms ease;
}

.toc a:hover {
  color: var(--text);
}

.toc a[aria-current="location"] {
  border-left-color: var(--accent-solid);
  color: var(--accent-text);
  font-weight: 600;
}

.toc-mobile {
  display: none;
  margin-bottom: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.toc-mobile summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.toc-mobile summary::-webkit-details-marker {
  display: none;
}

.toc-mobile summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.toc-mobile[open] summary::after {
  transform: rotate(225deg) translateY(-2px);
}

.toc-mobile nav {
  padding: 4px 12px 12px;
  border-top: 1px solid var(--border);
}

.toc-mobile a {
  display: block;
  padding: 8px 2px;
  color: var(--text-soft);
  font-size: 14px;
  text-decoration: none;
}

.toc-mobile a[aria-current="location"] {
  color: var(--accent-text);
  font-weight: 600;
}

/* Prose */

.prose {
  max-width: var(--prose-width);
  min-width: 0;
}

.prose section {
  margin-bottom: 52px;
  scroll-margin-top: calc(var(--header-height) + 28px);
}

.prose section:last-child {
  margin-bottom: 0;
}

.prose h2 {
  position: relative;
  margin: 0 0 14px;
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 680;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.prose h3 {
  margin: 28px 0 10px;
  color: var(--text);
  font-size: 1.06rem;
  line-height: 1.4;
  font-weight: 650;
  letter-spacing: -0.012em;
}

.prose p {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.75;
  text-wrap: pretty;
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose ul,
.prose ol {
  margin: 0 0 18px;
  padding-left: 22px;
}

.prose li {
  margin: 7px 0;
  padding-left: 2px;
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.7;
}

.prose li::marker {
  color: var(--text-faint);
}

.prose strong {
  font-weight: 650;
}

.prose small {
  color: var(--text-faint);
  font-size: 13px;
}

.prose code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9em;
}

.prose hr {
  margin: 40px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.section-link {
  margin-left: 8px;
  color: var(--text-faint);
  font-weight: 600;
  text-decoration: none;
  opacity: 0;
  transition: opacity 140ms ease, color 140ms ease;
}

.prose h2:hover .section-link,
.section-link:focus {
  opacity: 1;
}

.section-link:hover {
  color: var(--accent-text);
}

.callout {
  margin: 22px 0;
  padding: 15px 17px;
  border-left: 3px solid var(--accent-solid);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft);
}

.callout p {
  margin: 0;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.65;
}

.callout p + p {
  margin-top: 10px;
}

.table-wrap {
  margin: 18px 0 22px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.55;
}

th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
  text-align: left;
  vertical-align: bottom;
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: 0;
}

td strong {
  color: var(--text);
  font-weight: 600;
}

.contact-block {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.contact-block p {
  margin: 0 0 8px;
  font-size: 15px;
}

.contact-block p:last-child {
  margin-bottom: 0;
}

.contact-block a {
  font-weight: 600;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 30px 0 40px;
}

.footer-inner {
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 max(24px, env(safe-area-inset-left)) 0
    max(24px, env(safe-area-inset-right));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
}

.footer-brand {
  margin: 0;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.footer-note {
  margin: 5px 0 0;
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.5;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding-top: 1px;
}

.footer-links a {
  color: var(--text-soft);
  font-size: 13px;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text);
}

/* Back to top */

.to-top {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 90;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-soft);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease,
    background-color 140ms ease, color 140ms ease;
}

.to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.to-top:hover {
  background: var(--surface-2);
  color: var(--text);
}

.to-top svg {
  width: 18px;
  height: 18px;
}

/* 404 */

.not-found {
  max-width: 620px;
  margin: 0 auto;
  padding: 112px 0 96px;
  text-align: center;
}

.not-found-code {
  margin: 0 0 14px;
  color: var(--accent-text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.not-found h1 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.08;
  font-weight: 720;
  letter-spacing: -0.04em;
}

.not-found p {
  max-width: 46ch;
  margin: 0 auto 26px;
  color: var(--text-soft);
  font-size: 16px;
  line-height: 1.65;
  text-wrap: pretty;
}

.not-found-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* Homepage */

.home-hero {
  max-width: 820px;
  padding: 76px 0 52px;
}

.home-app-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 26px;
  border-radius: 14px;
}

.home-hero h1 {
  margin: 0 0 20px;
  font-size: clamp(3rem, 7vw, 4.75rem);
  line-height: 0.98;
  font-weight: 720;
  letter-spacing: -0.06em;
  text-wrap: balance;
}

.home-summary {
  max-width: 62ch;
  margin: 0;
  color: var(--text-soft);
  font-size: 19px;
  line-height: 1.65;
  text-wrap: pretty;
}

.home-section {
  padding-top: 40px;
  margin-bottom: 56px;
  border-top: 1px solid var(--border);
}

.home-section:last-child {
  margin-bottom: 0;
}

.home-label {
  margin: 0 0 14px;
  color: var(--text-faint);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.home-section h2 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: clamp(1.45rem, 2.5vw, 1.9rem);
  line-height: 1.2;
  font-weight: 680;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.home-intro {
  max-width: 68ch;
  margin: 0;
  color: var(--text-soft);
  font-size: 15.5px;
  line-height: 1.75;
  text-wrap: pretty;
}

.home-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px;
  margin-top: 34px;
}

.home-feature h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.home-feature p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14.5px;
  line-height: 1.7;
  text-wrap: pretty;
}

.home-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 48px;
  max-width: 940px;
}

.home-details h2 {
  font-size: 1.3rem;
}

.home-details p {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.7;
  text-wrap: pretty;
}

/* Responsive */

@media (max-width: 980px) {
  .layout {
    display: block;
    padding-top: 28px;
  }

  .toc {
    display: none;
  }

  .toc-mobile {
    display: block;
  }

  .prose {
    max-width: 760px;
  }
}

@media (max-width: 860px) {
  .home-features {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .home-details {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

@media (max-width: 720px) {
  :root {
    --header-height: 60px;
  }

  .header-inner {
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
    gap: 10px;
  }

  .header-nav {
    display: none;
  }

  .theme-toggle {
    margin-left: auto;
  }

  .page {
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
    padding-bottom: 72px;
  }

  .page-head {
    padding-top: 42px;
    padding-bottom: 28px;
  }

  .page-head h1 {
    font-size: clamp(2rem, 9vw, 2.75rem);
  }

  .lede {
    font-size: 16.5px;
  }

  .prose h2 {
    font-size: 1.34rem;
  }

  .prose p,
  .prose li {
    font-size: 15px;
  }

  .footer-inner {
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
    display: block;
  }

  .footer-links {
    margin-top: 18px;
    gap: 8px 16px;
  }

  .not-found {
    padding-top: 76px;
  }

  .home-hero {
    padding-top: 52px;
    padding-bottom: 38px;
  }

  .home-app-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 22px;
    border-radius: 12px;
  }

  .home-hero h1 {
    font-size: clamp(2.7rem, 14vw, 3.5rem);
  }

  .home-summary {
    font-size: 17px;
  }

  .home-section {
    padding-top: 30px;
    margin-bottom: 42px;
  }

  .home-section h2 {
    font-size: 1.4rem;
  }

  .home-intro {
    font-size: 15px;
  }

  .section-link {
    opacity: 0.38;
  }

  .to-top {
    right: 16px;
    bottom: 16px;
  }
}

@media (hover: none) {
  .section-link {
    opacity: 0.38;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  :root,
  [data-theme="dark"] {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f5f5f5;
    --text: #000000;
    --text-soft: #333333;
    --text-faint: #555555;
    --border: #d8d8d8;
    --border-strong: #bdbdbd;
    --accent-text: #000000;
    --accent-solid: #000000;
  }

  body {
    font-size: 10.5pt;
    line-height: 1.5;
    background: #ffffff;
    color: #000000;
  }

  .site-header,
  .site-footer,
  .page-actions,
  .toc,
  .toc-mobile,
  .to-top,
  .progress,
  .section-link,
  .skip-link {
    display: none !important;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  .page-head {
    padding-top: 0;
  }

  .layout {
    display: block;
    border-top: 0;
    padding-top: 0;
  }

  .prose,
  .prose section {
    max-width: none;
  }

  .prose section {
    margin-bottom: 28px;
  }

  .prose h2 {
    font-size: 15pt;
  }

  .prose h3 {
    font-size: 11.5pt;
  }

  .prose p,
  .prose li {
    font-size: 10.5pt;
  }

  a {
    color: #000000;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 8.5pt;
    color: #555555;
  }

  .table-wrap,
  table,
  tr,
  td,
  th,
  .callout,
  .contact-block {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
  }

  table {
    font-size: 9.5pt;
  }
}
