/* EasySchool user guide.
   Palette is taken from the application itself (navy #1a2035, blue #3b5998)
   so the documentation and the product look like the same thing. */

:root {
  --ink:        #1a2035;
  --text:       #232a3d;
  --muted:      #5b6478;
  --faint:      #8892a6;
  --bg:         #ffffff;
  --surface:    #f6f8fb;
  --surface-2:  #eef2f8;
  --border:     #dfe5ef;
  --accent:     #3b5998;
  --accent-ink: #2c4478;
  --accent-bg:  #eaf0fb;
  --warn-bg:    #fdf4e3;
  --warn-br:    #e8c98a;
  --note-bg:    #eaf0fb;
  --note-br:    #a8bfe6;
  --radius: 5px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:        #e8ecf5;
    --text:       #dbe1ec;
    --muted:      #99a3b8;
    --faint:      #7c8699;
    --bg:         #11151d;
    --surface:    #171c27;
    --surface-2:  #1e2431;
    --border:     #2a3243;
    --accent:     #7fa3e0;
    --accent-ink: #a8c2ef;
    --accent-bg:  #1b2436;
    --warn-bg:    #2a2318;
    --warn-br:    #6b5629;
    --note-bg:    #1b2436;
    --note-br:    #35507e;
  }
}

:root[data-theme="dark"] {
  --ink: #e8ecf5; --text: #dbe1ec; --muted: #99a3b8; --faint: #7c8699;
  --bg: #11151d; --surface: #171c27; --surface-2: #1e2431; --border: #2a3243;
  --accent: #7fa3e0; --accent-ink: #a8c2ef; --accent-bg: #1b2436;
  --warn-bg: #2a2318; --warn-br: #6b5629; --note-bg: #1b2436; --note-br: #35507e;
}

:root[data-theme="light"] {
  --ink: #1a2035; --text: #232a3d; --muted: #5b6478; --faint: #8892a6;
  --bg: #ffffff; --surface: #f6f8fb; --surface-2: #eef2f8; --border: #dfe5ef;
  --accent: #3b5998; --accent-ink: #2c4478; --accent-bg: #eaf0fb;
  --warn-bg: #fdf4e3; --warn-br: #e8c98a; --note-bg: #eaf0fb; --note-br: #a8bfe6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 16px;
  height: 56px; padding: 0 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex; align-items: baseline; gap: 9px;
  white-space: nowrap;
}
/* Two separate links: the product name leaves the guide, the label stays. */
.brand-home {
  font-weight: 650; color: var(--ink); letter-spacing: -0.01em;
}
.brand-home:hover { color: var(--accent); text-decoration: none; }
.brand .sub {
  font-size: 12px; font-weight: 500; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.09em;
}
.brand-guide:hover { color: var(--ink); text-decoration: none; }

.searchwrap { position: relative; margin-left: auto; width: min(340px, 42vw); }
#search {
  width: 100%; padding: 7px 12px 7px 32px;
  font: inherit; font-size: 14px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
#search::placeholder { color: var(--faint); }
.searchwrap::before {
  content: ""; position: absolute; left: 11px; top: 50%;
  width: 12px; height: 12px; margin-top: -6px; opacity: .5;
  background: var(--muted);
  -webkit-mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M11.7 10.3a6 6 0 1 0-1.4 1.4l3 3a1 1 0 0 0 1.4-1.4zM7 11a4 4 0 1 1 0-8 4 4 0 0 1 0 8z'/%3E%3C/svg%3E");
          mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M11.7 10.3a6 6 0 1 0-1.4 1.4l3 3a1 1 0 0 0 1.4-1.4zM7 11a4 4 0 1 1 0-8 4 4 0 0 1 0 8z'/%3E%3C/svg%3E");
}

#results {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: min(460px, 82vw); max-height: 62vh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 28px rgba(16,22,38,.14);
  display: none;
}
#results.open { display: block; }
#results a {
  display: block; padding: 9px 13px;
  border-bottom: 1px solid var(--border); color: var(--text);
}
#results a:last-child { border-bottom: 0; }
#results a:hover, #results a.active { background: var(--surface); text-decoration: none; }
#results .r-t { font-weight: 600; font-size: 14px; color: var(--ink); }
#results .r-c { font-size: 12.5px; color: var(--muted); }
#results .r-none { padding: 13px; font-size: 14px; color: var(--muted); }

.menubtn {
  display: none; padding: 5px 9px; font: inherit; font-size: 18px; line-height: 1;
  color: var(--muted); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}

/* ---------- layout ---------- */

.shell {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr) 200px;
  gap: 40px;
  max-width: 1400px; margin: 0 auto; padding: 0 20px;
  align-items: start;
}

.sidebar {
  position: sticky; top: 56px;
  max-height: calc(100vh - 56px); overflow-y: auto;
  padding: 26px 8px 60px 0;
}
.sidebar h4 {
  margin: 22px 0 7px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--faint);
}
.sidebar h4:first-child { margin-top: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.sidebar a {
  display: block; padding: 5px 11px; font-size: 14.5px;
  color: var(--muted); border-radius: var(--radius);
  border-left: 2px solid transparent;
}
.sidebar a:hover { color: var(--ink); background: var(--surface); text-decoration: none; }
.sidebar a.current {
  color: var(--accent-ink); background: var(--accent-bg);
  border-left-color: var(--accent); font-weight: 600;
}

.content { padding: 34px 0 90px; min-width: 0; }

.toc { position: sticky; top: 56px; padding: 34px 0 60px; max-height: calc(100vh - 56px); overflow-y: auto; }
.toc b {
  display: block; margin-bottom: 9px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--faint);
}
.toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.toc a { font-size: 13.5px; color: var(--muted); display: block; line-height: 1.4; }
.toc a:hover { color: var(--ink); text-decoration: none; }
.toc a.h3 { padding-left: 11px; font-size: 13px; }
.toc a.active { color: var(--accent-ink); font-weight: 600; }

/* ---------- typography ---------- */

.content h1 {
  margin: 0 0 10px; font-size: 32px; line-height: 1.2;
  letter-spacing: -0.02em; color: var(--ink); text-wrap: balance;
}
.content .lede {
  margin: 0 0 28px; font-size: 17.5px; line-height: 1.6; color: var(--muted);
  max-width: 68ch;
}
.content h2 {
  margin: 42px 0 12px; padding-top: 14px; font-size: 22px;
  letter-spacing: -0.01em; color: var(--ink);
  border-top: 1px solid var(--border); text-wrap: balance;
}
.content h3 { margin: 28px 0 8px; font-size: 16.5px; color: var(--ink); }
.content p, .content li { max-width: 72ch; }
.content p { margin: 0 0 14px; }
.content ul, .content ol { margin: 0 0 16px; padding-left: 22px; }
.content li { margin-bottom: 5px; }
.content li > ul, .content li > ol { margin: 5px 0 0; }
.content strong { color: var(--ink); font-weight: 640; }
.content hr { margin: 34px 0; border: 0; border-top: 1px solid var(--border); }

.anchor {
  margin-left: 8px; font-weight: 400; color: var(--faint);
  opacity: 0; transition: opacity .12s;
}
h2:hover .anchor, h3:hover .anchor { opacity: 1; }

code {
  font-family: var(--mono); font-size: 0.875em;
  padding: 1.5px 5px; color: var(--accent-ink);
  background: var(--surface-2); border-radius: 3px;
}
pre {
  margin: 0 0 18px; padding: 13px 15px; overflow-x: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); line-height: 1.55;
}
pre code { padding: 0; background: none; color: var(--text); font-size: 13.5px; }

blockquote {
  margin: 0 0 18px; padding: 12px 16px;
  background: var(--note-bg); border-left: 3px solid var(--note-br);
  border-radius: 0 var(--radius) var(--radius) 0;
}
blockquote p { margin: 0; }
blockquote p + p { margin-top: 9px; }

/* Tables scroll inside their own box so the page never scrolls sideways. */
.tablewrap { overflow-x: auto; margin: 0 0 20px; }
table {
  border-collapse: collapse; width: 100%; font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}
th, td { padding: 8px 13px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--faint);
  background: var(--surface); white-space: nowrap;
}
tbody tr:hover { background: var(--surface); }
td code { white-space: nowrap; }

/* ---------- components ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 13px; margin: 0 0 22px; }
.card {
  display: block; padding: 15px 17px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
}
.card:hover { border-color: var(--accent); text-decoration: none; }
.card b { display: block; margin-bottom: 3px; color: var(--ink); font-size: 15px; }
.card span { font-size: 13.5px; color: var(--muted); line-height: 1.5; display: block; }

.pill {
  display: inline-block; padding: 1px 8px; font-size: 11.5px; font-weight: 650;
  text-transform: uppercase; letter-spacing: 0.05em;
  border-radius: 20px; vertical-align: 2px;
}
.pill-draft { color: #8a6d1f; background: var(--warn-bg); border: 1px solid var(--warn-br); }

.note, .warn {
  margin: 0 0 18px; padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14.8px;
}
.note { background: var(--note-bg); border-left: 3px solid var(--note-br); }
.warn { background: var(--warn-bg); border-left: 3px solid var(--warn-br); }
.note p:last-child, .warn p:last-child { margin-bottom: 0; }
.note b, .warn b { color: var(--ink); }

.pagenav {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 52px; padding-top: 20px; border-top: 1px solid var(--border);
  font-size: 14.5px;
}
.pagenav span { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); }
.pagenav .next { text-align: right; margin-left: auto; }

.footmeta { margin-top: 36px; font-size: 13px; color: var(--faint); }

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .shell { grid-template-columns: 240px minmax(0, 1fr); gap: 32px; }
  .toc { display: none; }
}

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
  .menubtn { display: block; }
  .sidebar {
    display: none; position: fixed; top: 56px; left: 0;
    width: 280px; height: calc(100vh - 56px);
    padding: 20px 16px 60px; z-index: 30;
    background: var(--bg); border-right: 1px solid var(--border);
  }
  .sidebar.open { display: block; }
  .content { padding-top: 24px; }
  .content h1 { font-size: 27px; }
  .brand .sub { display: none; }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 70px; }

@media print {
  .topbar, .sidebar, .toc, .pagenav { display: none; }
  .shell { display: block; max-width: none; }
}

/* ---------- language picker in the guide topbar ---------- */

.topright { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.topright .searchwrap { margin-left: 0; }

.langpick select {
  font: inherit; font-size: 13.5px;
  padding: 6px 9px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; max-width: 150px;
}
.langpick select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.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;
}

/* Right-to-left languages: mirror the parts whose direction is structural. */
[dir="rtl"] .sidebar a { border-left: 0; border-right: 2px solid transparent; }
[dir="rtl"] .sidebar a.current { border-right-color: var(--accent); }
[dir="rtl"] .content ul, [dir="rtl"] .content ol { padding-left: 0; padding-right: 22px; }
[dir="rtl"] blockquote, [dir="rtl"] .note, [dir="rtl"] .warn {
  border-left: 0; border-right: 3px solid var(--note-br);
  border-radius: var(--radius) 0 0 var(--radius);
}
[dir="rtl"] .warn { border-right-color: var(--warn-br); }
[dir="rtl"] .toc a.h3 { padding-left: 0; padding-right: 11px; }
[dir="rtl"] .pagenav .next { text-align: left; margin-left: 0; margin-right: auto; }
[dir="rtl"] th, [dir="rtl"] td { text-align: right; }

@media (max-width: 820px) {
  /* Adding the language picker pushed the topbar past the viewport on a phone.
     Everything in the bar has to be allowed to shrink, and the search field is
     the piece that can afford to give up the most room. */
  .topbar { gap: 8px; padding: 0 12px; }
  .topright { gap: 8px; min-width: 0; }
  .brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .searchwrap { width: min(180px, 34vw); min-width: 0; }
  .langpick select {
    max-width: 74px;
    padding: 6px 4px;
    text-overflow: ellipsis;
  }
}
