/* The reader (read.html, src/client/reader.ts): an empty page to paste or drop a document on,
   then the document itself under a slim bar of actions. Only this page loads this file; the
   tokens, buttons and code blocks are site.css's. The document's own look is drawn inside its
   shadow root (doc.css, styles.css and the reader's page rules in reader.ts). */

/* ---- the empty page ------------------------------------------------------------------- */

.rd-start { max-width: 1080px; margin: 0 auto; padding: 64px 24px 24px; font-family: var(--ui); }
.rd-intro h1 { margin: 0 0 14px; font: 680 clamp(34px, 4.4vw, 50px)/1.04 var(--ui); letter-spacing: -0.04em; }
.rd-lede { max-width: 44rem; margin: 0 0 28px; font: 18px/1.6 var(--ui); color: var(--muted); text-wrap: pretty; }

.rd-box { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; transition: border-color 0.15s; }
.rd-box:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.rd-paste {
  display: block;
  width: 100%;
  min-height: 210px;
  max-height: 55vh;
  margin: 0;
  padding: 18px 20px;
  border: 0;
  outline: none;
  resize: vertical;
  background: transparent;
  color: var(--fg);
  font: 13.5px/1.6 var(--mono);
  tab-size: 2;
}
.rd-paste::placeholder { color: var(--muted); font-family: var(--ui); font-size: 16px; }
.rd-box-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--surface-2); }
.rd-box-row .cta { padding: 10px 16px; font-size: 14.5px; cursor: pointer; border: 0; }
.rd-box-row .cta-ghost { border: 1px solid var(--border); }
.rd-hint { font-size: 14px; color: var(--muted); }
.rd-hint code, .rd-tile code, .rd-embed p code { font: 0.9em var(--mono); background: var(--code-inline-bg); padding: 0.1em 0.35em; border-radius: 5px; }

.rd-private { display: flex; align-items: flex-start; gap: 10px; margin: 18px 2px 0; font: 15px/1.5 var(--ui); color: var(--fg); }
.rd-lock { flex: none; margin-top: 1px; fill: none; stroke: var(--accent); stroke-width: 1.9; stroke-linecap: round; }
.rd-status { min-height: 1.4em; margin: 8px 2px 0; font-size: 14px; color: var(--warning); }

.rd-more { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 40px; }
.rd-tile { padding: 20px 22px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.rd-tile h2 { margin: 0 0 8px; font: 650 17px/1.25 var(--ui); letter-spacing: -0.015em; }
.rd-tile p { margin: 0; font: 14.5px/1.55 var(--ui); color: var(--muted); }
.rd-samples { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font: 600 15px/1.4 var(--ui); }
.rd-samples a { text-decoration: none; }
.rd-samples a::after { content: ' →'; }
.rd-samples a:hover { text-decoration: underline; }

.rd-embed { max-width: 46rem; margin: 56px 0 0; }
.rd-embed h2 { margin: 0 0 8px; font: 650 22px/1.2 var(--ui); letter-spacing: -0.02em; }
.rd-embed p { margin: 0 0 14px; font: 15.5px/1.6 var(--ui); color: var(--muted); }
.rd-embed .codeblock pre { margin: 0; padding: 12px 14px; overflow-x: auto; font: 13px/1.6 var(--mono); }
.rd-embed .codeblock { margin-bottom: 12px; }

.rd-foot .footer { max-width: 1080px; margin: 72px auto 0; padding: 18px 24px 32px; }
body[data-reader="open"] .rd-foot { display: none; }

/* ---- an open document ------------------------------------------------------------------ */

.rd-bar {
  position: sticky;
  top: var(--topbar);
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  font-family: var(--ui);
}
.rd-bar-in { display: flex; align-items: center; gap: 8px 16px; min-height: 52px; padding: 7px 20px; }
.rd-name { flex: 1 1 auto; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 650 15px/1.3 var(--ui); letter-spacing: -0.01em; }
.rd-problems { margin-left: 6px; padding: 2px 9px; border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent); border-radius: 99px; background: color-mix(in srgb, var(--warning) 10%, transparent); color: var(--warning); font: 600 12px/1.4 var(--ui); cursor: pointer; vertical-align: 1px; }
.rd-actions { display: flex; flex: none; gap: 6px; }
.rd-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  font: 500 13.5px/1.25 var(--ui);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.rd-btn:hover { border-color: var(--border-strong); }
#rd-text[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }

.rd-notes { padding: 8px 20px; border-bottom: 1px solid var(--border); background: var(--note-bg); font: 14px/1.5 var(--ui); }
.rd-notes p { margin: 0; }
.rd-notes p + p { margin-top: 2px; }
.rd-link { padding: 0; border: 0; background: none; color: var(--link); font: 600 14px var(--ui); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }

.rd-page { display: block; }

.rd-source { max-width: 110ch; margin: 0 auto; padding: 28px 24px 64px; }
.rd-diags { list-style: none; margin: 0 0 16px; padding: 12px 16px; border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border)); border-radius: 12px; background: var(--note-bg); font: 14px/1.55 var(--ui); }
.rd-diag-error { color: var(--error); }
.rd-diag-warning { color: var(--warning); }
.rd-code { margin: 0; padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--code-bg); overflow-x: auto; font: 13px/1.6 var(--mono); tab-size: 4; white-space: pre; }
.rd-code code { font: inherit; }

/* Dragging files over the page. */
.rd-drop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  margin: 0;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(3px);
  pointer-events: none;
}
.rd-drop p { margin: 0; padding: 30px 46px; border: 3px dashed var(--accent); border-radius: 22px; background: var(--surface); color: var(--fg); font: 650 24px/1.2 var(--ui); letter-spacing: -0.02em; box-shadow: var(--shadow); }

@media (max-width: 900px) {
  .rd-more { grid-template-columns: minmax(0, 1fr); }
  .rd-bar-in { flex-wrap: wrap; padding: 8px 16px; }
  .rd-name { flex-basis: 100%; }
  /* The actions in one row that scrolls sideways. */
  .rd-actions { flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
  .rd-actions::-webkit-scrollbar { display: none; }
}
@media (max-width: 640px) {
  .rd-start { padding: 36px 16px 16px; }
  .rd-lede { font-size: 16.5px; }
  .rd-paste { min-height: 170px; padding: 14px 16px; }
  .rd-hint { flex-basis: 100%; }
  .rd-notes { padding: 8px 16px; }
  .rd-source { padding: 18px 12px 48px; }
  .rd-foot .footer { padding: 18px 16px 28px; }
}

/* ---- print: the document alone, on white ---------------------------------------------------- */

@media print {
  :root {
    color-scheme: light !important;
    --bg: #ffffff !important;
    --surface: #ffffff !important;
    --surface-2: #f5f5f2 !important;
    --fg: #16181d !important;
    --muted: #5d636d !important;
    --border: #e7e6e1 !important;
    --border-strong: #d0cfc8 !important;
    --link: #c2410c !important;
    --code-bg: #f7f6f3 !important;
    --code-inline-bg: rgba(120, 112, 96, 0.11) !important;
    --mark-bg: #f6e6a4 !important;
    --table-head-bg: #f5f5f2 !important;
  }
  body { background: #ffffff !important; }
  .topbar, .skip, .rd-start, .rd-bar, .rd-notes, .rd-source, .rd-drop, .rd-foot, .noscript { display: none !important; }
  .rd-page { display: block !important; }
}
