/* The fake Docs frame. Metrics follow the real thing at 100% zoom;
   the icons (in index.html) are original and deliberately a bit off. */

:root {
  --chrome-bg: #f9fbfd;
  --toolbar-bg: #edf2fa;
  --ink: #1f1f1f;
  --icon: #444746;
  --muted: #5e5e5e;
  --line: #c7c7c7;
  --tab-active-bg: #d3e3fd;
  --tab-active-ink: #0b57d0;
  --sidebar-w: 280px;
  --rail-w: 56px;
  --page-w: 672px;          /* her doc: max-width 504pt */
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--chrome-bg);
  color: var(--ink);
  font: 14px/1.4 var(--ui);
  overflow: hidden;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.ic { width: 20px; height: 20px; display: block; fill: var(--icon); }
.ic.fill { fill: var(--icon); stroke: none; }

/* ---------- layout ---------- */
.app {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--rail-w);
  grid-template-rows: 64px minmax(0, 1fr);
}
.header { grid-column: 1 / -1; }
.work {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
}
.below {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 0;
  border-top: 1px solid var(--line);
  background: #fff;
}

/* ---------- header ---------- */
.header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 16px 0 12px;
  min-width: 0;
}
.logo { width: 40px; height: 40px; flex: none; margin-right: 4px; }
.titles { min-width: 0; flex: 1; padding-top: 6px; }
.title-row { display: flex; align-items: center; gap: 2px; min-width: 0; }
.doc-title {
  font-size: 18px; line-height: 24px; padding: 0 6px; border: 1px solid transparent; border-radius: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.doc-title:hover { border-color: var(--icon); }
.title-row .icon-btn { width: 28px; height: 28px; }
.title-row .ic { width: 18px; height: 18px; }
.menubar { display: flex; gap: 0; margin-top: 1px; white-space: nowrap; }
.menubar button { padding: 2px 7px; border-radius: 4px; font-size: 14px; line-height: 20px; }
.menubar button:hover { background: rgba(68,71,70,.08); }

.header-right { display: flex; align-items: center; gap: 10px; flex: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.icon-btn:hover { background: rgba(68,71,70,.08); }
.header-right .ic { width: 22px; height: 22px; }
.share {
  display: flex; align-items: center; height: 40px; border-radius: 20px; background: #c2e7ff; color: #001d35; overflow: hidden;
}
.share > button { height: 40px; display: flex; align-items: center; gap: 8px; }
.share-main { padding: 0 16px 0 14px; font-weight: 500; }
.share-caret { padding: 0 10px; border-left: 1px solid rgba(0,29,53,.25) !important; }
.share .ic { fill: #001d35; }
.avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex: none; }

/* ---------- toolbar ---------- */
.toolbar {
  margin: 0 16px 0 16px;
  height: 40px;
  background: var(--toolbar-bg);
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
}
.tb { flex: none; height: 28px; min-width: 28px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; color: var(--icon); }
.tb:hover { background: rgba(68,71,70,.08); }
.tb .ic { width: 20px; height: 20px; }
.tb.drop { gap: 4px; padding: 0 6px; font-size: 14px; color: var(--ink); }
.tb.drop .caret { width: 18px; height: 18px; margin: 0 -4px 0 -2px; }
.tb.zoom { width: 70px; justify-content: space-between; }
.tb.style { width: 118px; justify-content: space-between; }
.tb.font { width: 96px; justify-content: space-between; }
.tb.font span { overflow: hidden; text-overflow: ellipsis; }
.sep { width: 1px; height: 20px; background: #c7c7c7; margin: 0 6px; flex: none; }
.size { display: inline-flex; align-items: center; gap: 2px; }
.size-box {
  width: 36px; height: 26px; border: 1px solid #747775; border-radius: 4px; display: grid; place-items: center; font-size: 14px; color: var(--ink); background: transparent;
}
.glyph { font: 700 15px/1 Georgia, "Times New Roman", serif; width: 20px; text-align: center; color: var(--icon); }
.glyph.i { font-style: italic; font-weight: 400; font-size: 17px; }
.glyph.u { text-decoration: underline; font-weight: 400; font-size: 16px; text-underline-offset: 2px; }
.text-color { display: inline-flex; flex-direction: column; align-items: center; gap: 0; }
.text-color .bar { width: 20px; height: 4px; background: #111; margin-top: -1px; }
.toolbar .spacer { flex: 1; }

/* ---------- ruler ---------- */
.ruler-row {
  height: 24px;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  margin-top: 4px;
}
.ruler-track { position: relative; overflow: hidden; }
.ruler {
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: var(--page-w); transform: translateX(-50%);
}
.marker { position: absolute; top: 2px; width: 14px; height: 18px; }
.marker.left { left: -7px; }
.marker.right { right: -7px; top: 6px; }

/* ---------- sidebar (doc tabs) ---------- */
.sidebar { overflow: auto; padding: 8px 16px 24px 16px; background: #fff; border-right: 1px solid var(--line); }
.back { width: 40px; height: 40px; margin: 0 0 16px -4px; }
.back .ic { width: 24px; height: 24px; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 0 12px; margin-bottom: 10px; }
.side-head h2 { font-size: 15px; font-weight: 500; margin: 0; color: var(--ink); letter-spacing: .1px; }
.side-head .icon-btn { width: 32px; height: 32px; }
.tabs { list-style: none; margin: 0; padding: 0; }
.tab {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 18px; border-radius: 20px;
  width: 100%; text-align: left; font-size: 14px; color: var(--ink); margin-bottom: 0;
}
.tab:hover { background: rgba(68,71,70,.06); }
.tab[aria-current="true"] { background: var(--tab-active-bg); color: var(--tab-active-ink); font-weight: 500; }
.tab .emoji { width: 20px; text-align: center; flex: none; font-size: 17px; line-height: 1; }
.tab .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab .kebab { width: 28px; height: 28px; display: none; place-items: center; border-radius: 50%; }
.tab[aria-current="true"] .kebab { display: grid; }
.tab .kebab .ic { fill: var(--tab-active-ink); }
.tab .ic.page { width: 20px; height: 20px; }

/* ---------- the doc (pageless) ---------- */
.canvas { overflow: auto; background: #fff; position: relative; scrollbar-width: auto; scrollbar-color: #dadce0 transparent; }
.canvas::-webkit-scrollbar { width: 16px; }
.canvas::-webkit-scrollbar-thumb { background: #dadce0; border: 4px solid #fff; border-radius: 8px; min-height: 40px; }
/* Google's export assumes content-box sizing; her page widths depend on it. */
.canvas, .canvas * { box-sizing: content-box; }
.canvas .doc-tab { margin: 0 auto; }
.canvas .doc-tab img { max-width: none; }
/* Export wraps images (incl. her dividers) in a clipped box; without this the
   image sits on the text baseline, falls out of the box, and only the border shows. */
.canvas .doc-tab span[style*="overflow: hidden"] > img { display: block; }
.doc-missing { max-width: var(--page-w); margin: 72px auto; padding: 0 72px; color: var(--muted); }

/* Legal footer: never a target for effects. */
.legal {
  max-width: var(--page-w); margin: 48px auto 0; padding: 24px 72px 48px;
  font: 12px/1.5 var(--ui); color: var(--muted);
}
.legal a { color: inherit; }
.legal-fallback { margin-top: 24px; color: var(--ink); font-size: 14px; }
.legal-fallback h2 { font-size: 16px; margin: 0 0 8px; }

/* ---------- right rail ---------- */
.rail {
  grid-row: 2; grid-column: 2;
  display: flex; flex-direction: column; align-items: center; gap: 22px; padding-top: 4px;
}
.rail .app-ic { width: 22px; height: 22px; display: block; }
.rail hr { width: 20px; border: 0; border-top: 1px solid var(--line); margin: 0; }
.rail .bottom { margin-top: auto; margin-bottom: 18px; }

/* ---------- the "always slightly wrong" pixelation ---------- */
/* Set by js/pixelate.js: the whole frame, a touch blocky on arrival and
   worse the further down you scroll. Never applied to the doc canvas. */
.header, .toolbar, .ruler-row, .sidebar, .rail {
  filter: var(--px, grayscale(0)) grayscale(var(--gray, 0));
  transition: transform .45s cubic-bezier(.2,.7,.3,1), opacity .3s, --gray .3s;
}

/* ---------- the spine: chrome dies, page stays ---------- */
@property --gray { syntax: "<number>"; inherits: true; initial-value: 0; }
body { transition: background-color .6s .4s; }
.below { transition: border-color .3s .4s; }
.chrome-dead { --gray: 1; background: #fff; }
.chrome-dead .below { border-color: transparent; }
.chrome-dead .header, .chrome-dead .toolbar, .chrome-dead .ruler-row,
.chrome-dead .sidebar, .chrome-dead .rail {
  pointer-events: none;
  transition: transform 1.1s cubic-bezier(.55,0,.85,.35) .45s, opacity .4s 1.3s, --gray .35s;
  opacity: 0;
}
.chrome-dead .header    { transform: translateY(-160%) rotate(-2deg); }
.chrome-dead .toolbar   { transform: translateY(-260%) rotate(1.5deg); transition-delay: .55s, 1.3s, 0s; }
.chrome-dead .ruler-row { transform: translateY(-600%); transition-delay: .65s, 1.3s, 0s; }
.chrome-dead .sidebar   { transform: translateY(110vh) rotate(-7deg); transform-origin: 0 0; transition-delay: .75s, 1.6s, 0s; }
.chrome-dead .rail      { transform: translateY(110vh) rotate(9deg); transition-delay: .6s, 1.6s, 0s; }

@media (prefers-reduced-motion: reduce) {
  .header, .toolbar, .ruler-row, .sidebar, .rail,
  .chrome-dead .header, .chrome-dead .toolbar, .chrome-dead .ruler-row,
  .chrome-dead .sidebar, .chrome-dead .rail { transition: none !important; }
  .chrome-dead .header, .chrome-dead .toolbar, .chrome-dead .ruler-row,
  .chrome-dead .sidebar, .chrome-dead .rail { transform: none; visibility: hidden; }
}

/* ---------- anonymous visitors ---------- */
.anons { display: flex; align-items: center; margin-right: 6px; }
.anon {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--chrome-bg); margin-left: -6px;
}
.anon:first-child { margin-left: 0; }
.anon .ic { width: 20px; height: 20px; fill: #fff; }
.anon-more { background: #e9eef6; color: #444746; font: 500 12px/1 var(--ui); }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .toolbar .wide { display: none; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .rail, .ruler-row, .menubar, .header-right .hide-sm, .back, .side-head { display: none; }
  .app { grid-template-columns: minmax(0,1fr); }
  .toolbar { margin: 0 8px; }
  .below { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr); }
  /* tabs become a swipeable strip above the doc */
  .sidebar { padding: 8px; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid var(--line); }
  .tabs { display: flex; gap: 4px; }
  .tab { width: auto; max-width: 220px; margin: 0; padding: 0 14px !important; }
  .tab .kebab { display: none !important; }
  .legal { padding: 24px; }
}

/* ---------- signup form, dressed as a Docs "email draft" building block ---------- */
.canvas .bb-email {
  box-sizing: border-box; width: 100%; max-width: 480px; margin: 12px 0 16px;
  border: 1px solid #c4c7c5; border-radius: 8px; background: #fff;
  font: 14px/20px var(--ui); color: var(--ink);
}
.canvas .bb-email * { box-sizing: border-box; }
.bb-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid #e3e3e3; font-weight: 500; color: #444746; }
.bb-head .ic { width: 18px; height: 18px; fill: #c5221f; }
.bb-row { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid #e3e3e3; min-height: 40px; }
.bb-label { width: 56px; flex: none; color: #5e5e5e; }
.bb-row input { flex: 1; min-width: 0; border: 0; outline: 0; font: inherit; color: inherit; background: transparent; padding: 0; }
.bb-row input::placeholder { color: #9aa0a6; }
.bb-row:focus-within { background: #f8fafd; }
.bb-fixed { color: var(--ink); }
.bb-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 8px 10px 8px 14px; }
.bb-note { flex: 1; color: #5e5e5e; font-size: 13px; }
.bb-send { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #0b57d0; }
.bb-send .ic { fill: #fff; width: 18px; height: 18px; }
.bb-send:hover { background: #0842a0; }
.bb-email.sent .bb-send { background: #146c2e; }
