/* Archer of Legend legal pages: one stylesheet, light and dark, readable on a phone. */
:root {
  --bg: #fbf7f2;
  --panel: #ffffff;
  --text: #2a1e1a;
  --muted: #6d5d55;
  --line: #e6dcd2;
  --accent: #a3141f;
  --accent-ink: #ffffff;
  --gold: #b8860b;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14090b;
    --panel: #1d1013;
    --text: #f1e6df;
    --muted: #b4a198;
    --line: #35202a;
    --accent: #e5484d;
    --accent-ink: #14090b;
    --gold: #e8b947;
  }
}

:root[data-theme="dark"] {
  --bg: #14090b;
  --panel: #1d1013;
  --text: #f1e6df;
  --muted: #b4a198;
  --line: #35202a;
  --accent: #e5484d;
  --accent-ink: #14090b;
  --gold: #e8b947;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

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

/* Top bar */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.25rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}
.brand img { border-radius: 8px; }

.links { display: flex; gap: 1rem; flex-wrap: wrap; }
.links a { color: var(--muted); text-decoration: none; font-size: 0.95rem; padding: 0.25rem 0; border-bottom: 2px solid transparent; }
.links a:hover { color: var(--text); }
.links a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

.theme {
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
  cursor: pointer;
}
.theme:hover { color: var(--text); border-color: var(--muted); }

/* Page layout: contents list on the left, the text on the right */
.layout {
  display: grid;
  grid-template-columns: 15rem minmax(0, 46rem);
  gap: 3rem;
  justify-content: center;
  max-width: 70rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.toc { position: sticky; top: 4.5rem; align-self: start; font-size: 0.92rem; max-height: calc(100vh - 6rem); overflow: auto; }
.toc-title { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 0.3rem 0.8rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--text); border-left-color: var(--accent); font-weight: 600; }

/* The text */
.doc h1 { margin: 0 0 0.25rem; font-size: 2.2rem; line-height: 1.2; }
.doc .meta { margin: 0 0 2rem; color: var(--muted); font-size: 0.95rem; }
.doc h2 { margin: 2.6rem 0 0.8rem; padding-top: 1.4rem; border-top: 1px solid var(--line); font-size: 1.4rem; line-height: 1.3; }
.doc h2:first-of-type { border-top: 0; padding-top: 0; }
.doc h3 { margin: 1.6rem 0 0.4rem; font-size: 1.1rem; }
.doc p { margin: 0 0 1rem; }
.doc ul, .doc ol { margin: 0 0 1rem; padding-left: 1.4rem; }
.doc li { margin: 0.3rem 0; }
.doc strong { color: var(--text); }
.doc table { width: 100%; border-collapse: collapse; margin: 0 0 1.2rem; font-size: 0.95rem; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 0.55rem 0.7rem; border: 1px solid var(--line); }
.doc th { background: var(--panel); }
.doc code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 0.05rem 0.35rem; }
.doc .end { margin-top: 2.5rem; padding: 1rem 1.2rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }

.doc .anchor { margin-left: 0.4rem; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 400; }
.doc h2:hover .anchor, .doc .anchor:focus { opacity: 1; }

/* Feedback page */
.page { max-width: 42rem; margin: 0 auto; padding: 2.5rem 1.25rem 3rem; }
.page h1 { margin: 0 0 0.5rem; font-size: 2.2rem; line-height: 1.2; }
.page .lead { margin: 0 0 2rem; color: var(--muted); }
.form label { display: block; margin: 1.2rem 0 0.4rem; font-weight: 600; }
.form .optional { color: var(--muted); font-weight: 400; font-size: 0.9rem; }
.form textarea, .form input[type="email"], .form input[type="text"] {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.form textarea { min-height: 11rem; resize: vertical; }
.form textarea:focus, .form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.form .count { margin: 0.3rem 0 0; text-align: right; color: var(--muted); font-size: 0.85rem; }
.form .count.over { color: var(--accent); }
.form .note { margin: 1.4rem 0 0; color: var(--muted); font-size: 0.92rem; }
.form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form .actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.4rem; }
.send {
  font: inherit;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.6rem;
  cursor: pointer;
}
.send:hover { filter: brightness(1.08); }
.send:disabled { opacity: 0.6; cursor: default; }
.status { margin: 0; font-weight: 600; }
.status.ok { color: #2e8b57; }
.status.error { color: var(--accent); }

/* Landing page */
.home { max-width: 46rem; margin: 0 auto; padding: 4rem 1.25rem; text-align: center; }
.home img { border-radius: 24px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35); }
.home h1 { margin: 1.2rem 0 0.4rem; font-size: 2.4rem; }
.home .lead { margin: 0 auto 2.2rem; max-width: 34rem; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; text-align: left; }
.card { display: block; padding: 1.3rem 1.4rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card strong { display: block; margin-bottom: 0.3rem; font-size: 1.15rem; }
.card span { color: var(--muted); font-size: 0.95rem; }
.card em { display: block; margin-top: 0.8rem; color: var(--accent); font-style: normal; font-weight: 600; font-size: 0.9rem; }

.foot { padding: 2rem 1.25rem 3rem; text-align: center; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line); }
.foot a { color: var(--muted); }

/* Phones and small windows: the contents list goes above the text, the bar wraps */
@media (max-width: 54rem) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 1.2rem; padding-top: 1.2rem; }
  .toc { position: static; max-height: none; padding: 0.8rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
  .toc ol { border-left: 0; columns: 2; column-gap: 1rem; }
  .toc a { border-left: 0; padding: 0.25rem 0; }
  .doc h1, .page h1 { font-size: 1.8rem; }
  .top { flex-wrap: wrap; }
  .links { order: 3; width: 100%; }
}

@media (max-width: 30rem) {
  body { font-size: 16px; }
  .toc ol { columns: 1; }
}

@media print {
  .top, .toc, .theme, .foot { display: none; }
  .layout { display: block; padding: 0; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; }
}
