/* Inkso Word Editor — write.html */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('vendor/fonts/outfit-latin-var.woff2') format('woff2');
}

:root { --w-page-w: 794px; }            /* ~ A4 width at 96dpi */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--inkso-washi);
  color: var(--inkso-sumi);
}

/* ---------- header ---------- */
#w-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: var(--inkso-kinari);
  border-bottom: 1px solid var(--inkso-divider);
}
/* discrete switch to the PDF editor (top-left) */
.w-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--inkso-ai);
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.w-switch:hover { background: rgba(42,74,115,.08); border-color: rgba(42,74,115,.25); }
.w-switch-ico { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.w-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; flex: none; }
.w-brand svg { width: 30px; height: 30px; }
.w-brand-name { font-size: 19px; font-weight: 600; color: var(--inkso-sumi); white-space: nowrap; }
.w-brand-name .bn-ink { color: var(--inkso-ai); }
.w-brand-name .bn-so { color: var(--inkso-ai-tint); }
.w-brand-name .bn-tm { font-size: .5em; vertical-align: super; color: var(--inkso-ai-tint); }

#doc-title {
  flex: 1;
  min-width: 80px;
  max-width: 420px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--inkso-sumi);
  background: #fff;
  border: 1px solid var(--inkso-divider);
  border-radius: 8px;
  padding: 8px 12px;
  outline: none;
}
#doc-title:focus { border-color: var(--inkso-ai); }

.w-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.w-actions button {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(192,70,46,.45);
  background: #fff;
  color: var(--inkso-shu);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.w-actions button:hover { background: rgba(192,70,46,.08); border-color: var(--inkso-shu); }
.w-actions button.primary { background: var(--inkso-shu); color: #fff; border-color: var(--inkso-shu); }
.w-actions button.primary:hover { background: var(--inkso-shu-hover); }

/* ---------- formatting toolbar ---------- */
#w-toolbar {
  position: sticky;
  top: 52px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: var(--inkso-washi);
  border-bottom: 1px solid var(--inkso-divider);
}
#w-toolbar select {
  font-family: inherit;
  font-size: 13px;
  padding: 5px 6px;
  border: 1px solid var(--inkso-divider);
  border-radius: 6px;
  background: #fff;
  color: var(--inkso-sumi);
  cursor: pointer;
}
#w-toolbar button {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--inkso-sumi);
  cursor: pointer;
  line-height: 1;
}
#w-toolbar button:hover { background: var(--inkso-kinari); }
#w-toolbar button.on { background: var(--inkso-shu); color: #fff; }
.tb-sep { width: 1px; height: 22px; background: var(--inkso-divider); margin: 0 4px; }

#tb-color-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
}
#tb-color-wrap:hover { background: var(--inkso-kinari); }
.tb-color-glyph { font-size: 13px; font-weight: 700; line-height: 1; }
#tb-color {
  width: 22px; height: 6px; padding: 0; border: none; background: none; cursor: pointer;
}

/* ---------- the page ---------- */
#w-canvas {
  flex: 1;
  overflow-y: auto;
  padding: 28px 16px 80px;
  display: flex;
  justify-content: center;
}
.doc-page {
  width: var(--w-page-w);
  max-width: 100%;
  min-height: 1000px;
  background: #fff;
  border: 1px solid var(--inkso-divider);
  box-shadow: 0 6px 30px rgba(33,30,28,.14);
  border-radius: 2px;
  padding: 76px;          /* ~ 2cm page margin at 96dpi */
  outline: none;
  font-size: 16px;        /* 12pt body */
  line-height: 1.5;
  color: #000;
}
.doc-page:empty::before {
  content: "Start writing…";
  color: #9aa0a6;
}
/* block styles (these drive the export sizes too, via getComputedStyle) */
.doc-page h1 { font-size: 32px; font-weight: 700; margin: 0 0 10px; line-height: 1.2; }
.doc-page h2 { font-size: 24px; font-weight: 700; margin: 14px 0 8px; line-height: 1.25; }
.doc-page h3 { font-size: 19px; font-weight: 600; margin: 12px 0 6px; line-height: 1.3; }
.doc-page p  { margin: 0 0 10px; }
.doc-page ul, .doc-page ol { margin: 0 0 10px; padding-left: 28px; }
.doc-page li { margin: 2px 0; }
.doc-page a { color: var(--inkso-ai); text-decoration: underline; }
.doc-page img { max-width: 100%; height: auto; }

/* auto-saved toast */
#w-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--inkso-sumi);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 22px rgba(33,30,28,.32);
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  transition: opacity .25s ease, transform .25s ease;
}
#w-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- status + footer ---------- */
#w-status {
  margin: 0;
  padding: 4px 18px;
  min-height: 20px;
  font-size: 12.5px;
  color: var(--inkso-cha);
  text-align: center;
}
#w-footer {
  padding: 14px 18px 22px;
  text-align: center;
  font-size: 12.5px;
  color: var(--inkso-cha);
  border-top: 1px solid var(--inkso-divider);
}
#w-footer a { color: var(--inkso-ai); text-decoration: none; }
#w-footer a:hover { text-decoration: underline; }

@media (max-width: 680px) {
  #w-header { flex-wrap: wrap; }
  #doc-title { order: 3; max-width: none; flex-basis: 100%; }
  .doc-page { padding: 40px 28px; }
}
