/*
 * mdeasy.app legal and support pages. Colours and type follow the app's
 * tokens (theme/tokens.js, CLAUDE.md §5). Contrast (WCAG AA):
 *   plum on cream 15.3:1 · plum on lilac 7.5:1 · plum on white 16.1:1
 *   cream on clay 4.8:1 (the draft banner and the review flags)
 * Clay is never used for text on cream or lilac; links are plum and
 * underlined, with a clay underline on the cream sheet.
 */

:root {
  /* Primitives */
  --plum-900: #2b1b33;
  --lilac-300: #cd9ef5;
  --cream-50: #fff9ed;
  --clay-500: #c4432b;
  --white: #ffffff;

  /* Semantic */
  --bg-frame: var(--lilac-300);
  --bg-sheet: var(--cream-50);
  --bg-note: var(--white);
  --text-primary: var(--plum-900);
  --text-inverse: var(--cream-50);
  --accent: var(--clay-500);
  --outline: var(--plum-900);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg-frame);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

/* Skip link: hidden until focused */
.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 10;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--plum-900);
  color: var(--text-inverse);
  font-weight: 500;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

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

.skip-link:focus-visible {
  outline-color: var(--plum-900);
  outline-offset: 2px;
  border-radius: 999px;
  box-shadow: 0 0 0 5px var(--cream-50);
}

/* Draft banner: stays until legal review is done */
.draft-banner {
  margin: 0;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--text-inverse);
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.01em;
}

/* Layout */
.site-header,
main,
.site-footer {
  width: 100%;
  max-width: 50rem;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

.site-header {
  padding-top: 24px;
}

.wordmark {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.625rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-decoration: none;
  padding: 4px 0;
}

.page-title {
  margin: 20px 0 24px;
  font-family: var(--font-display);
  font-weight: 600;
  font-optical-sizing: auto;
  font-size: 2.25rem;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.sheet {
  background: var(--bg-sheet);
  border-radius: 28px;
  padding: 28px 20px 36px;
}

.sheet > :first-child {
  margin-top: 0;
}

.sheet > :last-child {
  margin-bottom: 0;
}

/* Text */
.sheet h2,
.sheet h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-optical-sizing: auto;
  letter-spacing: -0.02em;
  scroll-margin-top: 16px;
}

.sheet h2 {
  margin: 2.25em 0 0.5em;
  font-size: 1.75rem;
  line-height: 1.15;
}

.sheet h3 {
  margin: 1.75em 0 0.4em;
  font-size: 1.5rem;
  line-height: 1.2;
}

.sheet h2 + h3 {
  margin-top: 1em;
}

.sheet p,
.sheet ul,
.sheet ol,
.sheet table {
  margin: 0 0 1em;
  max-width: 68ch;
}

.sheet ul,
.sheet ol {
  padding-left: 1.4em;
}

.sheet li {
  margin-bottom: 0.4em;
}

.sheet li::marker {
  color: var(--accent);
}

.sheet ol li::marker {
  color: var(--text-primary);
  font-weight: 500;
}

strong {
  font-weight: 600;
}

.updated {
  font-size: 0.9375rem;
}

a {
  color: var(--text-primary);
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.sheet a {
  text-decoration-color: var(--accent);
}

a:hover {
  text-decoration-color: currentColor;
  text-decoration-thickness: 3px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-note);
  border-radius: 4px;
  padding: 0.05em 0.3em;
}

/* Placeholders still to fill in, like [date] */
mark.placeholder {
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  background: var(--lilac-300);
  color: var(--text-primary);
  border-radius: 4px;
  padding: 0.05em 0.25em;
}

/* "FOR LEGAL REVIEW" markers */
.flag {
  display: inline-block;
  background: var(--accent);
  color: var(--text-inverse);
  border-radius: 999px;
  padding: 0 0.55em;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.6;
}

/* Notes from the drafts: the draft note and the notes for the lawyer */
.note {
  max-width: 68ch;
  margin: 0 0 1.25em;
  padding: 14px 18px;
  background: var(--bg-note);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  font-size: 0.9375rem;
}

.note p {
  margin: 0;
}

.note code {
  background: var(--bg-sheet);
}

.note p + p {
  margin-top: 0.6em;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.45;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px 10px 0;
}

thead th {
  font-weight: 600;
  border-bottom: 2px solid var(--outline);
}

tbody td {
  border-bottom: 1px solid rgba(43, 27, 51, 0.25);
}

/* Footer */
.site-footer {
  padding-top: 32px;
  padding-bottom: 40px;
  font-size: 0.9375rem;
}

.site-footer ul {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.site-footer li a {
  display: inline-block;
  padding: 8px 0;
}

.site-footer a[aria-current="page"] {
  font-weight: 600;
  text-decoration-thickness: 3px;
}

.site-footer p {
  margin: 0 0 4px;
}

/* Narrow screens: table rows become stacked blocks */
@media (max-width: 599px) {
  .stack-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .stack-table,
  .stack-table tbody,
  .stack-table tr,
  .stack-table td {
    display: block;
    width: 100%;
  }

  .stack-table tr {
    padding: 12px 0;
    border-bottom: 1px solid rgba(43, 27, 51, 0.25);
  }

  .stack-table tbody tr:first-child {
    border-top: 2px solid var(--outline);
  }

  .stack-table td {
    border: 0;
    padding: 2px 0;
  }

  .stack-table td::before {
    content: attr(data-label) ": ";
    font-weight: 600;
  }
}

@media (min-width: 600px) {
  body {
    font-size: 1.0625rem;
  }

  .site-header,
  main,
  .site-footer {
    padding-left: 24px;
    padding-right: 24px;
  }

  .site-header {
    padding-top: 32px;
  }

  .page-title {
    font-size: 2.75rem;
    margin: 28px 0 32px;
  }

  .sheet {
    padding: 48px 56px 56px;
  }

  .sheet h2 {
    font-size: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  .draft-banner,
  .note,
  .flag,
  mark.placeholder {
    border: 1px solid CanvasText;
  }
}

@media print {
  body {
    background: var(--white);
  }

  .skip-link,
  .site-footer ul {
    display: none;
  }

  .sheet {
    padding: 0;
  }
}
