/* ============================================================================
   KuroEditor — published CONTENT styles
   ----------------------------------------------------------------------------
   Styles for the class-based content blocks that KuroEditor writes into saved
   HTML (rounded box, custom list markers, tables). These must render on the
   PUBLIC site too, which does NOT load editor.css — so they live here.

   Rules:
   - Plain CSS only. NO `@import "tailwindcss"` / preflight — must never reset
     or fight the host page's own styles.
   - Theme-neutral via CSS variables (--kuro-*) with light/neutral defaults that
     read on both light and dark backgrounds. A theme = override the variables.
   - Intentionally UNLAYERED: unlayered styles beat any @layer (Tailwind base/
     components/utilities, template `.prose`, editor.css @layer), so authored
     content renders consistently without specificity battles.

   editor.css @imports this file and overrides --kuro-* to its dark values, so
   the in-editor appearance is unchanged.
   ========================================================================== */

:root {
  --kuro-box-border: rgba(128, 128, 128, 0.35);
  --kuro-box-bg: rgba(128, 128, 128, 0.06);
  --kuro-box-border-nested: rgba(128, 128, 128, 0.28);
  --kuro-box-bg-nested: rgba(128, 128, 128, 0.1);
  --kuro-table-border: rgba(128, 128, 128, 0.4);
  --kuro-table-head-bg: rgba(128, 128, 128, 0.12);

  /* Content typography COLORS — light/theme-neutral defaults for the PUBLIC
     site. editor2.css overrides these to its dark palette so the in-editor
     appearance is unchanged. Sizes/spacing are NOT themed (shared). */
  --kuro-h1-color: inherit;
  --kuro-h2-color: inherit;
  --kuro-h3-color: inherit;
  --kuro-h4-color: inherit;
  --kuro-h5-color: inherit;
  --kuro-link: #4f46e5;
  --kuro-link-hover: #4338ca;
  --kuro-quote-text: inherit;
  --kuro-quote-border: #6366f1;
  --kuro-hr: rgba(128, 128, 128, 0.4);
  --kuro-list-color: inherit;
  /* kbd */
  --kuro-kbd-bg: #f3f4f6;
  --kuro-kbd-text: #1f2937;
  --kuro-kbd-border: #9ca3af;
  /* table cells (border/head-bg already defined above) */
  --kuro-table-cell-text: inherit;
  --kuro-table-head-text: inherit;
  /* callouts (light tints by default; editor overrides to dark) */
  --kuro-callout-tip-bg: rgba(59, 130, 246, 0.1);
  --kuro-callout-tip-border: #3b82f6;
  --kuro-callout-tip-text: inherit;
  --kuro-callout-warn-bg: rgba(245, 158, 11, 0.12);
  --kuro-callout-warn-border: #f59e0b;
  --kuro-callout-warn-text: inherit;
  --kuro-callout-danger-bg: rgba(239, 68, 68, 0.1);
  --kuro-callout-danger-border: #ef4444;
  --kuro-callout-danger-text: inherit;
  --kuro-callout-note-bg: rgba(128, 128, 128, 0.1);
  --kuro-callout-note-border: #9ca3af;
  --kuro-callout-note-text: inherit;
}

/* ════════════════════════════════════════════════════════════════════════
   CONTENT TYPOGRAPHY — SINGLE SOURCE OF TRUTH.
   Both the editor and the published page use these rules, so output is WYSIWYG.
   Sizes/weights/spacing are shared; COLOR is themed via --kuro-* (editor2.css
   sets the dark palette). Scoped to authored content: the `.kuro-content`
   wrapper (editor) AND headings carrying KuroEditor's `kuro-h-*` id (public),
   so the host template's own headings are never affected.
   (Migrated from editor.css; values = the prior @apply Tailwind output.)
   ════════════════════════════════════════════════════════════════════════ */

/* Headings — h1=text-3xl … h5=text-base. */
.kuro-content h1,
h1[id^='kuro-h-'] {
  font-size: 1.875rem;
  line-height: 1.25;
  font-weight: 700;
  margin: 1.75rem 0 0.75rem;
  color: var(--kuro-h1-color);
}
.kuro-content h2,
h2[id^='kuro-h-'] {
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 700;
  margin: 1.5rem 0 0.625rem;
  color: var(--kuro-h2-color);
}
.kuro-content h3,
h3[id^='kuro-h-'] {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
  color: var(--kuro-h3-color);
}
.kuro-content h4,
h4[id^='kuro-h-'] {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1rem 0 0.375rem;
  color: var(--kuro-h4-color);
}
.kuro-content h5,
h5[id^='kuro-h-'] {
  font-size: 1rem;
  font-weight: 600;
  margin: 0.75rem 0 0.25rem;
  color: var(--kuro-h5-color);
}

/* Paragraphs */
.kuro-content p {
  margin: 0.375rem 0;
  line-height: 1.625;
}
.kuro-content br {
  line-height: 1.2;
}

/* Inline */
.kuro-content a {
  color: var(--kuro-link);
  text-decoration: underline;
  transition: color 0.15s;
}
.kuro-content a:hover {
  color: var(--kuro-link-hover);
}
.kuro-content strong {
  font-weight: 700;
}
.kuro-content em {
  font-style: italic;
}
.kuro-content u {
  text-decoration: underline;
}
.kuro-content s {
  text-decoration: line-through;
}

/* Blockquote — left vertical accent bar */
.kuro-content blockquote {
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  border-left: 4px solid var(--kuro-quote-border);
  color: var(--kuro-quote-text);
  font-style: italic;
}
.kuro-content blockquote p {
  margin: 0.25rem 0;
}

/* Lists — base spacing/indent. Marker GLYPH classes (.kuro-ul-* / .kuro-list-*)
   below win for the marker symbol. */
.kuro-content ul {
  list-style-type: disc;
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  color: var(--kuro-list-color);
}
.kuro-content ol {
  list-style-type: decimal;
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  color: var(--kuro-list-color);
}
.kuro-content li {
  line-height: 1.625;
}
.kuro-content ul > li + li,
.kuro-content ol > li + li {
  margin-top: 0.125rem;
}

/* Horizontal rule */
.kuro-content hr,
.kuro-hr {
  border: 0;
  border-top: 2px solid var(--kuro-hr);
  margin: 1.25rem 0;
}

/* Justified text — CJK 均等割り (interior + last line). */
.kuro-content [style*='text-align: justify'],
.kuro-content [style*='text-align:justify'] {
  text-justify: inter-character;
  text-align-last: justify;
}

/* Keyboard key (<kbd>) — physical key look */
.kuro-content kbd {
  display: inline-block;
  padding: 0.1em 0.5em;
  min-width: 1.2em;
  text-align: center;
  background: var(--kuro-kbd-bg);
  color: var(--kuro-kbd-text);
  border: 1px solid var(--kuro-kbd-border);
  border-bottom-width: 2px;
  border-radius: 0.3em;
  font-family: ui-monospace, 'JetBrains Mono', Consolas, monospace;
  font-size: 0.85em;
  line-height: 1.2;
  vertical-align: baseline;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

/* Callout / admonition blocks — icon column on the left + left accent bar */
.kuro-content .kuro-callout {
  margin: 1rem 0;
  padding: 0.75rem 1rem 0.75rem 3rem;
  border-radius: 0.5rem;
  border-left: 4px solid;
  position: relative;
}
.kuro-content .kuro-callout::before {
  position: absolute;
  left: 0.875rem;
  top: 0.625rem;
  font-size: 1.25rem;
  line-height: 1;
}
.kuro-content .kuro-callout p {
  margin: 0.25rem 0;
}
.kuro-content .kuro-callout--tip {
  background-color: var(--kuro-callout-tip-bg);
  border-color: var(--kuro-callout-tip-border);
  color: var(--kuro-callout-tip-text);
}
.kuro-content .kuro-callout--tip::before {
  content: '💡';
}
.kuro-content .kuro-callout--warn {
  background-color: var(--kuro-callout-warn-bg);
  border-color: var(--kuro-callout-warn-border);
  color: var(--kuro-callout-warn-text);
}
.kuro-content .kuro-callout--warn::before {
  content: '⚠️';
}
.kuro-content .kuro-callout--danger {
  background-color: var(--kuro-callout-danger-bg);
  border-color: var(--kuro-callout-danger-border);
  color: var(--kuro-callout-danger-text);
}
.kuro-content .kuro-callout--danger::before {
  content: '❗';
}
.kuro-content .kuro-callout--note {
  background-color: var(--kuro-callout-note-bg);
  border-color: var(--kuro-callout-note-border);
  color: var(--kuro-callout-note-text);
}
.kuro-content .kuro-callout--note::before {
  content: '📌';
}

/* Media float clearfix — a paragraph after a floated media shouldn't overlap it */
.kuro-content p {
  clear: none;
}
.kuro-content .kuro-media-wrap--left + p,
.kuro-content .kuro-media-wrap--right + p {
  clear: none;
}

/* ── Ordered-list counter styles (must be top-level, not inside @layer) ── */
@counter-style kuro-circled {
  system: fixed;
  symbols: ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳;
  suffix: ' ';
}
@counter-style kuro-paren-num {
  system: extends decimal;
  prefix: '(';
  suffix: ') ';
}
@counter-style kuro-paren-alpha {
  system: extends upper-alpha;
  prefix: '(';
  suffix: ') ';
}
@counter-style kuro-paren-kata {
  system: extends katakana;
  prefix: '(';
  suffix: ') ';
}

/* ── Rounded box (.kuro-roundbox) ── */
.kuro-roundbox {
  margin: 0.75rem 0;
  border: 1px solid var(--kuro-box-border);
  border-radius: 1rem;
  padding: 1rem;
  background: var(--kuro-box-bg);
  box-sizing: border-box;
  overflow: hidden; /* clearfix for floated children */
}
.kuro-roundbox .kuro-roundbox {
  border-color: var(--kuro-box-border-nested);
  background: var(--kuro-box-bg-nested);
}
.kuro-roundbox[data-align='left'] {
  float: left;
  margin-right: 1rem;
}
.kuro-roundbox[data-align='right'] {
  float: right;
  margin-left: 1rem;
}

/* ── Tables (.kuro-table class AND bare <table> inside .kuro-content) ── */
.kuro-table,
.kuro-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.875rem;
}
.kuro-table {
  table-layout: fixed;
}
.kuro-table th,
.kuro-table td,
.kuro-content th,
.kuro-content td {
  border: 1px solid var(--kuro-table-border);
  padding: 0.75rem;
  line-height: 1.5;
  color: var(--kuro-table-cell-text);
}
.kuro-table th,
.kuro-content th {
  background: var(--kuro-table-head-bg);
  font-weight: 600;
  text-align: left;
  color: var(--kuro-table-head-text);
}

/* ── List custom markers ── */
ul.kuro-ul-disc {
  list-style-type: disc;
}
ul.kuro-ul-circle {
  list-style-type: circle;
}
ul.kuro-ul-square {
  list-style-type: square;
}
ul.kuro-ul-dash {
  list-style-type: '- ';
}
ul.kuro-ul-hash {
  list-style-type: '# ';
}
ul.kuro-ul-asterisk {
  list-style-type: '* ';
}
ul.kuro-ul-arrow {
  list-style-type: '> ';
}
ul.kuro-ul-bullseye {
  list-style-type: '◎ ';
}
ul.kuro-ul-star {
  list-style-type: '★ ';
}
ul.kuro-ul-star-open {
  list-style-type: '☆ ';
}
ul.kuro-ul-tri {
  list-style-type: '▶ ';
}
ul.kuro-ul-tri-open {
  list-style-type: '▷ ';
}
ol.kuro-list-decimal {
  list-style-type: decimal;
}
ol.kuro-list-circled {
  list-style-type: kuro-circled;
}
ol.kuro-list-paren-num {
  list-style-type: kuro-paren-num;
}
ol.kuro-list-alpha {
  list-style-type: upper-alpha;
}
ol.kuro-list-paren-alpha {
  list-style-type: kuro-paren-alpha;
}
ol.kuro-list-kata {
  list-style-type: katakana;
}
ol.kuro-list-paren-kata {
  list-style-type: kuro-paren-kata;
}

/* Marker color — set inline as --kuro-marker-color on the list element. */
li::marker {
  color: var(--kuro-marker-color, inherit);
}
