/*
Theme Name: Monoread for note
Author: 構文野郎
Author URI: https://mymlan.com/
Description: A note backup theme with integrated ZIP import.
Version: 1.0.3
Requires at least: 6.6
Requires PHP: 7.4
Text Domain: monoread-for-note
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
:root { --mr-ink:#242424; --mr-muted:#777; --mr-line:#eaeaea; --mr-paper:#fff; }
html { scroll-behavior:auto; }
body { -webkit-font-smoothing:antialiased; }
a { text-underline-offset: .18em; text-decoration-thickness: .05em; }
a:hover { opacity:.76; }
:focus-visible { outline:2px solid currentColor; outline-offset:4px; }
.wp-site-blocks { min-height:100vh; display:flex; flex-direction:column; }
.wp-site-blocks > footer { margin-top:auto; }
.mr-header .wp-block-site-title { --mr-site-title-size:var(--wp--custom--monoread--header-title-size, 32px); --mr-site-title-weight:var(--wp--custom--monoread--header-title-weight, 750); --mr-site-title-leading:var(--wp--custom--monoread--header-title-leading, 1.25); --mr-site-title-tracking:var(--wp--custom--monoread--header-title-tracking, -.04em); margin:0; }
.mr-header .wp-block-site-title a { text-decoration:none; }
.mr-footer { padding:25px 18px; color:var(--mr-muted); font-size:12px; }
.mr-footer .wp-block-site-title { --mr-site-title-size:inherit; --mr-site-title-weight:500; --mr-site-title-leading:inherit; --mr-site-title-tracking:inherit; }
.mr-article, .mr-page { padding:76px 20px 100px; }
.mr-article-title { --mr-post-title-weight:750; overflow-wrap:anywhere; }
.mr-meta { color:var(--mr-muted); font-size:13px; }
.mr-article-body { overflow-wrap:anywhere; }
/* Gutenberg owns block-to-block spacing through theme.json (blockGap: 1em).
   Do not add separate sibling margins or heading top margins here. */

.mr-article-body blockquote:not(.wp-block-quote) { border-left:2px solid #888; padding-left:1.4em; margin-left:0; }
.mr-article-body :is(img, video, iframe) { max-width:100%; }
.mr-article-body figure { margin-inline:0; }
.mr-article-body figcaption { color:var(--mr-muted); font-size:12px; }
.mr-article-body pre, .mr-article-body .wp-block-table { overflow-x:auto; }
.mr-article-body pre:not(.wp-block-code), .mr-article-body code:not(.wp-block-code code) { font-size:.85em; }
.mr-article-body .wp-block-separator { border-color:var(--mr-line); opacity:1; padding:0; }
.mr-back { margin-top:60px; padding-top:20px; border-top:1px solid var(--mr-line); font-size:13px; }
.mr-index { padding:70px 20px 100px; }
.mr-index-title { font-size:clamp(28px,5vw,42px); letter-spacing:-.035em; line-height:1.25; margin-bottom:38px; }
.mr-feed { margin:0; padding:0; }
.mr-feed-item { padding:28px 0 30px; border-bottom:1px solid var(--mr-line); }
.mr-feed-item:first-child { border-top:1px solid var(--mr-line); }
.mr-feed-item .wp-block-post-title { margin:0 0 10px; font-size:23px; line-height:1.45; }
.mr-feed-item .wp-block-post-title a { text-decoration:none; }
.mr-feed-item .wp-block-post-excerpt { color:#555; font-size:14px; line-height:1.85; }
.mr-feed-item .wp-block-post-excerpt__more-link { display:none; }
.mr-feed-item .wp-block-post-date { color:var(--mr-muted); font-size:12px; }
.mr-feed .wp-block-query-pagination { padding-top:32px; font-size:13px; }
/* Reading layout: no global theme sticky elements; reader owns its UI. */

/* Wide layout allows WP alignwide/full plus long tables and diagrams. */

/* Blank canvas: article title/header/footer deliberately absent. */
/* WordPress content insertion: do not override scoped reader UI controls */
@media(max-width:640px) {
 .mr-article, .mr-page { padding:44px 16px 76px; }

 .mr-feed-item .wp-block-post-title { font-size:20px; }
 .mr-index { padding:44px 16px 75px; }
}

/* Monoread 0.2: note-like reading with extension-friendly surfaces. */
:root {
  --mr-standard-width:620px;
  --mr-reader-width:850px;
  --mr-glass-bg:rgba(255,255,255,.1);
  --mr-glass-blur:5px;
  --mr-screen-gutter:clamp(12px,3vw,36px);
}
/* Featured artwork belongs above the title: no featured image => no visible element. */
.mr-featured { margin:0 0 clamp(28px,4vw,44px); }
.mr-featured img { display:block; width:100%;height:auto; border-radius:0; }
.mr-article-header { border-bottom:0; padding-bottom:0; margin-bottom:38px; }
.mr-article-title { margin-bottom:.6em; }
.mr-meta { gap:.65em; }
/* Long prose is the default; rich elements inherit it rather than create a separate visual mode. */
.mr-article-body :where(.wp-block-table, .wp-block-image, .wp-block-gallery, .wp-block-embed, figure.source-figure) { margin-block:1.8em; }
.mr-article-body .wp-block-table { overflow-x:auto; -webkit-overflow-scrolling:touch; max-width:100%; }
.mr-article-body .wp-block-table table { width:100%; border-collapse:collapse; font-size:.9em; line-height:1.7; }
.mr-article-body .wp-block-table :is(th,td) { padding:.75em .85em; border:0; border-bottom:1px solid var(--mr-line); vertical-align:top; }
.mr-article-body .wp-block-table th { text-align:left; font-weight:650; }
.mr-article-body .wp-block-table.is-style-mr-minimal table { border-top:1px solid var(--mr-line); }
.mr-article-body .wp-block-table.is-style-mr-scroll { overflow-x:auto; }
.mr-article-body .wp-block-table.is-style-mr-scroll table { width:max-content; min-width:100%; }
.mr-article-body :is(.mr-horizontal-scroll, .mr-math-scroll) { max-width:100%;overflow-x:auto;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch; }
.mr-article-body math { max-width:none; }
.mr-article-body figure :is(img,svg) { display:block; height:auto;max-width:100%;margin-inline:auto; }
.mr-article-body details.mr-fold { border-top:1px solid var(--mr-line);border-bottom:1px solid var(--mr-line);padding:.7em 0; }
.mr-article-body details.mr-fold summary { cursor:pointer; font-size:.85em; }
.mr-article-body .mr-note { font-size:.84em;line-height:1.85;color:#555; }
/* Thin glass is an opt-in design material, not compulsory styling for every widget. */
.mr-glass { background:var(--mr-glass-bg);-webkit-backdrop-filter:blur(var(--mr-glass-blur));backdrop-filter:blur(var(--mr-glass-blur)); }
.mr-glass-rail { position:relative;left:50%;width:100vw;max-width:none;margin-left:-50vw;margin-right:0;box-sizing:border-box;
  padding-inline:max(var(--mr-screen-gutter),env(safe-area-inset-left));
  background:var(--mr-glass-bg);-webkit-backdrop-filter:blur(var(--mr-glass-blur));backdrop-filter:blur(var(--mr-glass-blur)); }
/* Reader CSS/JS owns all gestures and sticky behavior. The theme never intercepts pointer/touch/wheel. */
.mr-standard .mr-article-body { min-width:0; }
.mr-standard .wp-block-post-content { min-width:0; }
/* Optional true full-bleed embed surface for block editor + independent interactive HTML. */
/* No forced max-width on wide embedded tables/diagrams; scrolling belongs to the local wrapper. */
@media (max-width:640px) {
  .mr-article-header { margin-bottom:28px; }
  .mr-featured { margin-bottom:24px; }
  .mr-article-body .wp-block-table :is(th,td) { padding:.55em .65em; }
}
@media (prefers-reduced-motion:reduce) {
  .mr-glass, .mr-glass-rail { transition:none; }
}

/* v0.3.4 — default note-like 620px article column,
   optional empty rails, and per-post WordPress account identity. */
.mr-standard { --mr-reader-width:620px; padding:54px clamp(16px,2.5vw,36px) 110px; }
.mr-reading-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,620px) minmax(0,1fr); column-gap:clamp(20px,2.8vw,48px); align-items:start; width:100%; max-width:1580px; margin-inline:auto; }
.mr-reading-grid > .mr-reading-center { min-width:0; width:100%; max-width:620px; margin:0; }
.mr-reading-grid > :is(.mr-reading-left,.mr-reading-right) { min-width:0; margin:0; }
.mr-standard .mr-featured { margin:0 0 72px; }
.mr-standard .mr-featured img { width:100%; height:auto; display:block; }
.mr-standard .mr-article-header { margin:0 0 56px; padding:0; border:0; }
.mr-standard .mr-article-title { --mr-post-title-weight:700; margin:0 0 16px; }

.mr-standard .mr-article-body > * { max-width:100%; }
/* v0.2.5: inline-only shortcode HTML. Use one flex row and one two-line stack.
   In particular, do not permit global block spacing to separate the avatar from
   its label/date. This remains scoped to the standard article header. */
.mr-standard .mr-reading-identity {
  display:inline-flex !important;
  align-items:center;
  gap:8px;
  width:100%;
  min-width:0;
  min-height:32px;
  margin:0 !important;
  color:var(--mr-muted);
  vertical-align:middle;
}
.mr-standard .mr-reading-identity-avatar {
  flex:0 0 32px;
  width:32px;
  height:32px;
  display:block;
  border-radius:50%;
  overflow:hidden;
  margin:0 !important;
}
.mr-standard .mr-reading-author-avatar { display:block; width:32px; height:32px; border-radius:50%; }
.mr-standard .mr-reading-identity-details {
  display:flex !important;
  flex:1 1 auto;
  min-width:0;
  flex-direction:column;
  justify-content:center;
  gap:2px;
  margin:0 !important;
}
.mr-standard .mr-reading-identity-name {
  display:block;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--mr-ink);
  text-decoration:none;
  font-weight:600;
  font-size:12px;
  line-height:15px;
}
.mr-standard .mr-reading-identity-name:hover { text-decoration:underline; }
.mr-standard .mr-reading-identity-dates {
  display:flex;
  align-items:baseline;
  gap:0;
  min-width:0;
  font-size:11px;
  line-height:14px;
  color:var(--mr-muted);
  white-space:nowrap;
}
.mr-standard .mr-reading-identity-dates > time { flex:none; }
.mr-standard .mr-reading-modified { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mr-standard .mr-reading-rail-content { max-width:260px; }
/* Rails do not squeeze the reading column on tablets or phones. */
@media (max-width:1140px) {
 .mr-reading-grid { grid-template-columns:minmax(0,620px); justify-content:center; column-gap:0; }
 .mr-reading-left,.mr-reading-right { display:none; }
}
@media (max-width:640px) {
 .mr-standard { padding:26px 16px 76px; }
 .mr-standard .mr-featured { margin-bottom:42px; }

 .mr-standard .mr-article-header { margin-bottom:48px; }
 .mr-standard .mr-reading-identity-dates { font-size:10.5px; }
}

/* Note reference: article width and viewport padding are distinct controls.
   At tablet widths the article contracts inside 40px gutters;
   on phones gutters contract to 16px. No padding is inserted inside the 620px article. */
@media (min-width:641px) and (max-width:768px) {
  .mr-standard { padding-inline:40px; }
}

/* WordPress may insert an empty paragraph between shortcode nodes. */
/* WordPress shortcode rendering can inject a paragraph between the avatar
   and details. It is not an authored part of the account display. */
.mr-standard .mr-reading-identity > p { display:none !important; }
/* Suppress block-flow margins inside the compact author header. */
.mr-standard .mr-article-header > .wp-block-shortcode,
.mr-standard .mr-article-header > .mr-reading-identity { margin-block-start:0 !important; }
.mr-standard .mr-reading-identity > :is(.mr-reading-identity-avatar,.mr-reading-identity-details) { margin:0 !important; }
/* Maintain hierarchy without enlarging the body text. */

/* v0.3.6: Gutenberg blockGap (theme.json: 1em) is the single source
   of vertical spacing for paragraph, heading and separator blocks in every
   article template. Reset only trailing margins so they cannot add to gap.
   Critically, leave margin-block-start untouched: Gutenberg's layout engine
   assigns it to adjacent blocks. */
.mr-article-body :is(h1,h2,h3,h4,h5,h6,p,hr,.wp-block-separator) {
  margin-block-end:0;
}
.mr-article-body :is(hr,.wp-block-separator) { padding:0; }

/* 0.3.1: standard posts adopt the verified 620px reading frame.
   Standard-only afterword/navigation and comments remain inside the same column. */
.mr-standard .mr-standard-after {
  max-width:620px;
  width:100%;
  margin:0 auto;
  padding-top:32px;
  min-width:0;
}
.mr-standard .mr-standard-after .mr-back { margin-top:24px; }

.mr-pattern-reading-column { box-sizing:border-box; min-width:0; width:100%; max-width:620px; margin-inline:auto; }
/* v0.3.7: article body font family, font size, and line height follow
   the site-wide theme.json Global Styles (and block-level overrides).
   Do not hard-code those values on post-content wrappers. */

/* v0.3.10 — sidebars anchored to the viewport edges.
   Center column remains exactly 620px, independent of viewport width.
   Each sidebar keeps 204px of readable content within a 252px minimum slot. */
:root { --mr-sidebar-slot:252px; --mr-sidebar-edge-padding:30px; --mr-sidebar-inner-padding:18px; --mr-sidebar-content:204px; }
.mr-reading-grid {
  box-sizing:border-box;
  display:grid;
  align-items:start;
  column-gap:0;
  margin-inline:auto;
  width:100%;
  max-width:none;
}
.mr-reading-grid {
  grid-template-columns:minmax(var(--mr-sidebar-slot),1fr) minmax(0,620px) minmax(var(--mr-sidebar-slot),1fr);
}
.mr-reading-grid > .mr-reading-center {
  width:100%;
  min-width:0;
  margin:0;
}
.mr-reading-grid > :is(.mr-reading-left,.mr-reading-right) {
  box-sizing:border-box;
  min-width:0;
  width:100%;
  margin:0;
  padding-inline:0;
}
/* Padding is mirrored: 30px on the viewport edge, 18px toward the article.
   Combined padding remains 48px, preserving the 204px sidebar content width. */
.mr-reading-grid > .mr-reading-left {
  padding-left:var(--mr-sidebar-edge-padding);
  padding-right:var(--mr-sidebar-inner-padding);
}
.mr-reading-grid > .mr-reading-right {
  padding-left:var(--mr-sidebar-inner-padding);
  padding-right:var(--mr-sidebar-edge-padding);
}
.mr-reading-grid .mr-sidebar-content {
  box-sizing:border-box;
  max-width:var(--mr-sidebar-content);
  min-width:0;
  overflow-wrap:break-word;
}
.mr-reading-grid > .mr-reading-left .mr-sidebar-content {
  margin-inline:0 auto;
}
.mr-reading-grid > .mr-reading-right .mr-sidebar-content {
  margin-inline:auto 0;
}
/* Below each breakpoint hide both rails without affecting central content width. */
@media (min-width:1125px) {
  .mr-standard { padding-inline:0; }
}
@media (max-width:1124px) {
  .mr-reading-grid { grid-template-columns:minmax(0,620px); justify-content:center; }
  .mr-reading-grid > :is(.mr-reading-left,.mr-reading-right) { display:none; }
}

/* v0.3.10: author card defaults. Core blocks own their editable typography,
   dimensions and spacing attributes; only defensive layout rules live here. */
.mr-sidebar-author-card { box-sizing:border-box; min-width:0; }
.mr-sidebar-author-row { min-width:0; }
.mr-sidebar-author-row .wp-block-avatar { flex:0 0 auto; }
.mr-sidebar-author-row .wp-block-post-author-name { min-width:0; overflow-wrap:anywhere; }
.mr-sidebar-author-row .wp-block-post-author-name a { text-decoration:none; }
.mr-sidebar-author-card .wp-block-post-author-biography { overflow-wrap:anywhere; }

/* v0.3.11 — initial avatar shape: circle in the front end.
   The individual Avatar block remains freely editable in the Site Editor. */
.mr-sidebar-author-row .wp-block-avatar img,
.mr-sidebar-author-row .wp-block-avatar .wp-block-avatar__image {
  border-radius:50%;
  object-fit:cover;
  aspect-ratio:1 / 1;
}

/* Monoread 0.4.0 — viewport-aligned header, independently editable Gutenberg navigation. */
.mr-header {
  box-sizing:border-box;
  padding:12px 24px;
  width:100%;
}
.mr-header-inner {
  box-sizing:border-box;
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,620px) minmax(0,1fr);
  align-items:center;
  gap:0;
  max-width:none;
  width:100%;
  margin:0;
}
.mr-header-left, .mr-header-right { min-width:0; }
.mr-header-left { justify-self:start; }
.mr-header-right { justify-self:end; }
.mr-header .wp-block-navigation { font-size:13px; }
/* Keep the side areas editable; no fixed template-wide header max-width. */
@media (max-width:720px) {
  .mr-header { padding:12px 16px; }
  .mr-header-inner { grid-template-columns:minmax(0,1fr) auto; gap:12px; }
  .mr-header-center { display:none; }
  .mr-header .wp-block-site-title { --mr-site-title-size:clamp(22px,6vw,32px); }
}


/* v0.4.1: reading primitives; global editor settings remain authoritative. */
/* Note-style quote: preserve WP's editable citation field, right aligned. */
:where(.mr-article-body .wp-block-quote) { box-sizing:border-box; }
.mr-article-body .wp-block-quote cite,
.mr-article-body .wp-block-quote .wp-block-quote__citation {
  display:block;
  margin-block-start:.8em;
  color:var(--mr-muted);
  font-size:.78em;
  font-style:normal;
  font-weight:400;
  line-height:1.5;
  text-align:right;
}
/* Do not style arbitrary <pre> in custom HTML readers; target the native code block. */
:where(.mr-article-body .wp-block-code) {
  box-sizing:border-box;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  tab-size:2;
}
:where(.mr-article-body .wp-block-code code) {
  font-family:inherit;
  font-size:.85em;
  white-space:pre;
  overflow-wrap:normal;
}
/* Non-synchronized patterns, editable with core blocks. */
.mr-article-body .mr-link-card {
  box-sizing:border-box;
  border:1px solid var(--mr-line);
  border-radius:5px;
  padding:1em 1.2em;
  min-width:0;
  background:transparent;
}
.mr-article-body .mr-link-card .wp-block-heading {font-size:1em;line-height:1.5;letter-spacing:normal;}
.mr-article-body .mr-link-card p {font-size:.875em;line-height:1.6;}
.mr-article-body .mr-link-card a {overflow-wrap:anywhere;}
.mr-article-body .mr-link-card > * + * {margin-block-start:.5em;}
.mr-article-body .mr-callout {
  box-sizing:border-box;
  border-left:3px solid #d5d5d5;
  padding:.75em 1.1em;
  background:#f8f8f8;
}
.mr-article-body .mr-callout > * + * {margin-block-start:.5em;}
.mr-article-body .mr-callout .wp-block-heading {font-size:.95em;line-height:1.5;}

/* v0.4.2: article title inherits WordPress H1 typography from theme.json / Site Editor.
   No hard-coded font size or line height on .mr-article-title. */
/* Stable self-contained link cards: works in post body, wide and fullwidth. */
:where(.wp-block-monoread-link-card) {box-sizing:border-box;border:1px solid var(--mr-line);border-radius:5px;min-width:0;overflow:hidden;}
:where(.wp-block-monoread-link-card) .mr-autocard-link {display:flex;align-items:stretch;gap:12px;padding:14px 16px;color:inherit;text-decoration:none;}
:where(.wp-block-monoread-link-card) .mr-autocard-info {min-width:0;flex:1;display:flex;flex-direction:column;gap:6px;}
.wp-block-monoread-link-card .mr-autocard-title {font-size:1em;font-weight:700;line-height:1.45;letter-spacing:-.04em;font-feature-settings:"palt" 1;overflow-wrap:anywhere;}
:where(.wp-block-monoread-link-card) .mr-autocard-description {font-size:.82em;line-height:1.5;color:var(--mr-muted);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;}
:where(.wp-block-monoread-link-card) .mr-autocard-domain {font-size:.75em;line-height:1.4;color:var(--mr-muted);overflow-wrap:anywhere;}
:where(.wp-block-monoread-link-card) .mr-autocard-thumb {display:block;width:108px;min-width:108px;max-height:108px;object-fit:cover;align-self:center;}
@media(max-width:440px) {:where(.wp-block-monoread-link-card) .mr-autocard-thumb {width:76px;min-width:76px;max-height:90px;}}
.editor-styles-wrapper .mr-autocard-editor {border:1px solid #e0e0e0;border-radius:5px;padding:14px;margin:12px 0;}
.editor-styles-wrapper .mr-autocard-editor .mr-autocard-preview {display:flex;gap:12px;align-items:center;margin:12px 0;}
.editor-styles-wrapper .mr-autocard-editor .mr-autocard-preview img {width:90px;height:70px;object-fit:cover;}

/* 0.4.3: block editor preview styles reside in assets/editor.css. */

/* v0.4.5: native code block copy UI; sticky within its own wrapper. */
.mr-article-body .mr-code-copy-wrap {position:relative;min-width:0;}
.mr-article-body .mr-code-copy-wrap > .wp-block-code {margin:0;max-width:100%;padding-block-start:2.65em;}
.mr-code-copy-bar {position:sticky;top:12px;z-index:1;height:34px;margin-bottom:-34px;display:flex;justify-content:flex-end;align-items:flex-start;padding:6px 8px 0;box-sizing:border-box;pointer-events:none;}
body.admin-bar .mr-code-copy-bar {top:44px;}
@media(max-width:782px){body.admin-bar .mr-code-copy-bar {top:58px;}}
.mr-code-copy-button {pointer-events:auto;cursor:pointer;border:0;border-radius:4px;background:#f7f7f7;color:#666;font:inherit;font-size:11px;line-height:1.5;white-space:nowrap;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;box-sizing:border-box;}
.mr-code-copy-button:hover,.mr-code-copy-button:focus-visible {color:#242424;}
.mr-code-copy-status {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}

.mr-code-copy-button svg {display:block;flex:none;}

/* v0.5.1: imported note math typography; Core owns rendering and overflow. */
.wp-block-post-content .mr-note-math { font-size: 1.1em; }
.wp-block-post-content .mr-note-math-display { font-size: 1.4em; }



/* Original note link: retain its existing location and spacing. */
.mr-note-original-link { font-weight:700; text-decoration:none; }
.mr-note-original-link svg { vertical-align:-.12em; }
.mr-note-original-link:hover { opacity:.76; }
.mr-note-original-link:active { opacity:.5; }
.mr-note-original-link:focus-visible { outline:2px solid currentColor; outline-offset:4px; }
