/**
 * Editorial UI (body.okp-editorial-ui).
 * Values tuned against irodori-x SP computed styles (375–390px survey).
 *
 * Reference (SP ~390px):
 * - Body: ShipporiGothicB2 14px / 400 / lh 25.2px (1.8)
 * - H1: 18px / 700 / lh 25.2px
 * - H2: 20px / 700 / lh 28px / mt 30px
 * - Content inset L/R: 45px; images same
 * - Header sticky 56px
 * - Tools fixed top 71px / right 15px / gap 10px
 * - Filter 28px, bg rgba(245,245,245,.7), border #bbb
 * - Search 28px circle, same chrome
 */

body.okp-editorial-ui {
  /* Restore site paper palette (style.css :root) */
  --okp-ed-bg: var(--paper); /* #f6f1e8 */
  --okp-ed-ink: var(--ink); /* #2a241c */
  --okp-ed-ink-soft: var(--ink-soft);
  --okp-ed-mute: #888888;
  --okp-ed-line: var(--line); /* #d8cbb8 */
  --okp-ed-panel: var(--paper-2); /* #eee6d8 */
  --okp-ed-surface: var(--white); /* #fffcf7 — inputs / chips */
  --okp-ed-pad-right: 45px;
  --okp-ed-vrail: 45px;
  --okp-ed-header-h: 56px;
  --okp-ed-tools-top: calc(var(--okp-ed-header-h) + var(--admin-bar-h) + 15px);
  --gothic: "Shippori Gothic B2", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  --serif: "Shippori Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
  --sans: var(--gothic);
  --en: "Fjalla One", futura-pt, "Helvetica Neue", sans-serif;
  background: var(--okp-ed-bg);
  color: var(--okp-ed-ink);
  font-family: var(--gothic);
}

body.okp-editorial-ui .okp-main {
  padding-top: var(--okp-ed-header-h);
  background: var(--okp-ed-bg);
}

/* ---------- Header (SP: logo + hamburger; tools float below) ---------- */
body.okp-editorial-ui .okp-header {
  height: var(--okp-ed-header-h);
  min-height: var(--okp-ed-header-h);
  background: rgba(246, 241, 232, 0.96);
  border-bottom: 1px solid var(--okp-ed-line);
  backdrop-filter: blur(10px);
  overflow: visible;
}

body.okp-editorial-ui .okp-header::before {
  display: none;
}

body.okp-editorial-ui .okp-header__inner {
  width: 100%;
  max-width: none;
  height: var(--okp-ed-header-h);
  padding: 0 15px;
  margin: 0;
}

body.okp-editorial-ui .okp-logo {
  font-family: var(--en);
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--okp-ed-ink);
}

body.okp-editorial-ui .okp-logo span {
  color: var(--okp-ed-ink);
}

body.okp-editorial-ui .okp-logo img {
  width: 28px;
  height: 28px;
}

body.okp-editorial-ui .okp-nav {
  background: var(--okp-ed-bg);
}

/*
 * backdrop-filter on .okp-header makes it a containing block for position:fixed
 * descendants, so the mobile nav only covers the header strip. Remove the filter
 * (and hide floating tools) while the menu is open so the overlay fills the viewport.
 */
body.okp-editorial-ui.is-nav-open .okp-header {
  background: var(--okp-ed-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: 200;
}

body.okp-editorial-ui.is-nav-open .okp-ed-tools {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

body.okp-editorial-ui.is-nav-open .okp-nav {
  z-index: 210;
}

body.okp-editorial-ui.is-nav-open .okp-nav-toggle {
  z-index: 220;
}

/* ---------- Floating Filter / Search (separated from header) ---------- */
body.okp-editorial-ui .okp-ed-tools {
  position: fixed;
  top: var(--okp-ed-tools-top);
  right: 15px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

body.okp-editorial-ui .okp-tool-filter,
body.okp-editorial-ui .okp-tool-search {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  border: 1px solid var(--okp-ed-line);
  background: rgba(255, 252, 247, 0.85);
  box-shadow: none;
  color: var(--okp-ed-ink);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

body.okp-editorial-ui .okp-tool-filter {
  gap: 4px;
  height: 28px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 0;
  font-family: var(--en);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1;
}

body.okp-editorial-ui .okp-tool-search {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
}

body.okp-editorial-ui .okp-tool-filter:hover,
body.okp-editorial-ui .okp-tool-search:hover {
  opacity: 0.65;
}

body.okp-editorial-ui .okp-tool-filter:focus-visible,
body.okp-editorial-ui .okp-tool-search:focus-visible,
body.okp-editorial-ui .okp-nav-toggle:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

/* Enlarge tap target without changing visual size */
body.okp-editorial-ui .okp-tool-filter::before,
body.okp-editorial-ui .okp-tool-search::before {
  content: "";
  position: absolute;
  inset: -8px;
}

body.okp-editorial-ui .okp-tool-filter,
body.okp-editorial-ui .okp-tool-search {
  position: relative;
}

/* ---------- Vertical rail (H1 always + H2 dynamic) ---------- */
/*
 * Use explicit height (svh/dvh) instead of top+bottom.
 * iOS Safari often collapses fixed elements that only use top+bottom,
 * which made the rail invisible on phones.
 */
body.okp-editorial-ui .okp-vrail {
  position: fixed;
  top: calc(var(--okp-ed-header-h) + var(--admin-bar-h) + 12px);
  bottom: auto;
  left: max(0px, env(safe-area-inset-left, 0px));
  width: var(--okp-ed-vrail);
  height: calc(100vh - var(--okp-ed-header-h) - var(--admin-bar-h) - 36px);
  height: calc(100svh - var(--okp-ed-header-h) - var(--admin-bar-h) - 36px);
  height: calc(100dvh - var(--okp-ed-header-h) - var(--admin-bar-h) - 36px);
  z-index: 40;
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
}

body.okp-editorial-ui .okp-vrail__inner {
  width: 100%;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding: 4px 0 0;
  box-sizing: border-box;
  min-height: 0;
}

body.okp-editorial-ui .okp-vrail__h1,
body.okp-editorial-ui .okp-vrail__h2 {
  writing-mode: vertical-rl;
  -webkit-writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--gothic);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: 0.08em;
  color: var(--okp-ed-ink);
  margin: 0;
  /* Column width (= physical width for vertical text); avoid % max-width iOS bugs */
  width: 1.35em;
  max-width: calc(var(--okp-ed-vrail) - 10px);
  height: auto;
  max-height: 100%;
  overflow: hidden;
  flex-shrink: 1;
  min-height: 0;
}

body.okp-editorial-ui .okp-vrail__h1 {
  flex: 0 1 auto;
}

body.okp-editorial-ui .okp-vrail__h2 {
  flex: 0 1 auto;
  max-height: 42%;
  transition: opacity 0.2s ease;
}

body.okp-editorial-ui .okp-vrail__h2.is-fading {
  opacity: 0;
}

body.okp-editorial-ui .okp-vrail__h1.is-truncated,
body.okp-editorial-ui .okp-vrail__h2.is-truncated {
  mask-image: linear-gradient(to bottom, #000 0%, #000 82%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 82%, transparent 100%);
}

body.okp-editorial-ui .okp-vrail__rule {
  display: block;
  flex: 0 0 auto;
  width: 14px;
  height: 1px;
  margin: 8px 0;
  background: var(--okp-ed-ink);
  opacity: 0.35;
}

body.okp-editorial-ui .okp-vrail__rule[hidden],
body.okp-editorial-ui .okp-vrail__h2[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  body.okp-editorial-ui .okp-vrail__h2,
  body.okp-editorial-ui .okp-tool-filter,
  body.okp-editorial-ui .okp-tool-search {
    transition: none;
  }
}

/* ---------- Article shell ---------- */
body.okp-editorial-ui .okp-editorial {
  position: relative;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 0 72px;
}

body.okp-editorial-ui .okp-article--editorial {
  width: auto;
  max-width: none;
  margin: 0;
  padding: 8px var(--okp-ed-pad-right) 40px var(--okp-ed-vrail);
  color: var(--okp-ed-ink);
  box-sizing: border-box;
  overflow-x: clip;
}

body.okp-editorial-ui .okp-article__header {
  padding: 0;
  margin-bottom: 24px;
}

body.okp-editorial-ui .okp-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-family: var(--en);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--okp-ed-mute);
}

body.okp-editorial-ui .okp-meta a {
  color: var(--okp-ed-mute);
  text-decoration: none;
}

body.okp-editorial-ui .okp-meta a:hover {
  color: var(--okp-ed-ink);
}

body.okp-editorial-ui .okp-article__title {
  margin: 0;
  font-family: var(--gothic);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: -0.005em;
  color: var(--okp-ed-ink);
}

body.okp-editorial-ui .okp-article__hero {
  margin: 0 0 30px;
  padding: 0;
}

body.okp-editorial-ui .okp-article__hero img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 85vh;
  height: auto !important;
  margin-inline: auto;
  object-fit: contain;
}

/* ---------- Content typography + Gutenberg ---------- */
body.okp-editorial-ui .okp-post-content {
  font-family: var(--gothic);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.8;
  letter-spacing: -0.002em;
  color: var(--okp-ed-ink);
  overflow-wrap: anywhere;
}

body.okp-editorial-ui .okp-post-content > * {
  max-width: none;
}

body.okp-editorial-ui .okp-post-content p {
  margin: 0 0 1.8em;
}

/* Speech balloons: equal vertical spacing (match top/bottom) */
body.okp-editorial-ui .okp-post-content .liquid-speech-balloon-wrap {
  margin: 1.25em 0;
  align-items: flex-start;
}

body.okp-editorial-ui .okp-post-content .liquid-speech-balloon-text {
  padding: 12px 16px;
  background-color: var(--okp-ed-surface);
  border-color: rgba(42, 36, 28, 0.18);
}

body.okp-editorial-ui .okp-post-content .liquid-speech-balloon-text p {
  margin: 0;
}

body.okp-editorial-ui .okp-post-content .liquid-speech-balloon-wrap + .liquid-speech-balloon-wrap {
  margin-top: 1.25em;
}

body.okp-editorial-ui .okp-post-content a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: rgba(17, 17, 17, 0.35);
}

body.okp-editorial-ui .okp-post-content strong {
  font-weight: 700;
}

body.okp-editorial-ui .okp-post-content h2,
body.okp-editorial-ui .okp-post-content h3,
body.okp-editorial-ui .okp-post-content h4 {
  font-family: var(--gothic);
  font-weight: 700;
  color: var(--okp-ed-ink);
  scroll-margin-top: calc(var(--okp-ed-header-h) + var(--admin-bar-h) + 20px);
}

body.okp-editorial-ui .okp-post-content h2 {
  font-size: 20px;
  line-height: 1.4;
  margin: 30px 0 14px;
  letter-spacing: -0.002em;
}

body.okp-editorial-ui .okp-post-content h3 {
  font-size: 17px;
  line-height: 1.45;
  margin: 28px 0 12px;
}

body.okp-editorial-ui .okp-post-content h4 {
  font-size: 15px;
  margin: 24px 0 10px;
}

body.okp-editorial-ui .okp-post-content ul,
body.okp-editorial-ui .okp-post-content ol {
  margin: 0 0 1.8em;
  padding-left: 1.35em;
}

body.okp-editorial-ui .okp-post-content ul {
  list-style: disc;
}

body.okp-editorial-ui .okp-post-content ol {
  list-style: decimal;
}

body.okp-editorial-ui .okp-post-content li {
  margin-bottom: 0.35em;
}

body.okp-editorial-ui .okp-post-content blockquote,
body.okp-editorial-ui .okp-post-content .wp-block-quote,
body.okp-editorial-ui .okp-post-content .wp-block-pullquote {
  margin: 2em 0;
  padding: 0 0 0 0.9em;
  border-left: 2px solid #ccc;
  background: none;
  border-radius: 0;
  box-shadow: none;
  font-style: normal;
}

body.okp-editorial-ui .okp-post-content .wp-block-pullquote {
  border-left: 0;
  border-top: 1px solid var(--okp-ed-line);
  border-bottom: 1px solid var(--okp-ed-line);
  padding: 1.2em 0;
  text-align: left;
}

/* Image blocks (standalone / inside groups) — exclude gallery overrides below */
body.okp-editorial-ui .okp-post-content .wp-block-image {
  margin: 0 0 30px;
  max-width: 100%;
  height: auto;
}

body.okp-editorial-ui .okp-post-content .wp-block-image img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  object-fit: contain;
  object-position: center;
}

body.okp-editorial-ui .okp-post-content .wp-block-image a {
  display: block;
  max-width: 100%;
  line-height: 0;
}

/*
 * Gutenberg Gallery
 * - Do not let standalone img rules fight is-cropped (cover tiles).
 * - min-width:0 is required so flex columns can shrink below intrinsic
 *   image width (otherwise PC shows broken 1–2 col "mystery columns").
 */
body.okp-editorial-ui .okp-post-content .wp-block-gallery {
  --wp--style--unstable-gallery-gap: 10px;
  gap: var(--wp--style--unstable-gallery-gap);
  margin: 0 0 30px;
}

body.okp-editorial-ui .okp-post-content .wp-block-gallery.wp-block-gallery,
body.okp-editorial-ui .okp-post-content figure.wp-block-gallery {
  margin: 0 0 30px;
}

body.okp-editorial-ui .okp-post-content .wp-block-gallery > .wp-block-image,
body.okp-editorial-ui .okp-post-content .wp-block-gallery > figure.wp-block-image {
  margin: 0 !important;
  min-width: 0 !important;
  max-width: 100%;
  box-sizing: border-box;
}

body.okp-editorial-ui .okp-post-content .wp-block-gallery.is-cropped > .wp-block-image,
body.okp-editorial-ui .okp-post-content .wp-block-gallery.is-cropped > figure.wp-block-image {
  align-self: stretch;
}

body.okp-editorial-ui .okp-post-content .wp-block-gallery.is-cropped .wp-block-image img,
body.okp-editorial-ui .okp-post-content .wp-block-gallery.is-cropped img {
  width: 100% !important;
  max-width: none !important;
  max-height: none !important;
  height: 100% !important;
  margin: 0 !important;
  object-fit: cover !important;
  object-position: center center !important;
}

body.okp-editorial-ui .okp-post-content .wp-block-gallery:not(.is-cropped) .wp-block-image img,
body.okp-editorial-ui .okp-post-content .wp-block-gallery:not(.is-cropped) img {
  width: 100% !important;
  max-width: 100% !important;
  max-height: none !important;
  height: auto !important;
  margin: 0 !important;
  object-fit: contain !important;
}

/* Reinforce WP column widths (flex-grow alone was collapsing to 2-col) */
@media (min-width: 600px) {
  body.okp-editorial-ui .okp-post-content .wp-block-gallery.has-nested-images.columns-default > .wp-block-image,
  body.okp-editorial-ui .okp-post-content .wp-block-gallery.has-nested-images.columns-default > figure.wp-block-image {
    width: calc(33.333% - var(--wp--style--unstable-gallery-gap) * 0.66667) !important;
    flex: 0 0 auto !important;
  }

  /* WP: exactly 2 images in a default gallery → 2 columns */
  body.okp-editorial-ui .okp-post-content .wp-block-gallery.has-nested-images.columns-default > .wp-block-image:first-child:nth-last-child(2),
  body.okp-editorial-ui .okp-post-content .wp-block-gallery.has-nested-images.columns-default > .wp-block-image:first-child:nth-last-child(2) ~ .wp-block-image,
  body.okp-editorial-ui .okp-post-content .wp-block-gallery.has-nested-images.columns-default > figure.wp-block-image:first-child:nth-last-child(2),
  body.okp-editorial-ui .okp-post-content .wp-block-gallery.has-nested-images.columns-default > figure.wp-block-image:first-child:nth-last-child(2) ~ figure.wp-block-image {
    width: calc(50% - var(--wp--style--unstable-gallery-gap) * 0.5) !important;
  }

  body.okp-editorial-ui .okp-post-content .wp-block-gallery.has-nested-images.columns-2 > .wp-block-image,
  body.okp-editorial-ui .okp-post-content .wp-block-gallery.has-nested-images.columns-2 > figure.wp-block-image {
    width: calc(50% - var(--wp--style--unstable-gallery-gap) * 0.5) !important;
    flex: 0 0 auto !important;
  }

  body.okp-editorial-ui .okp-post-content .wp-block-gallery.has-nested-images.columns-3 > .wp-block-image,
  body.okp-editorial-ui .okp-post-content .wp-block-gallery.has-nested-images.columns-3 > figure.wp-block-image {
    width: calc(33.333% - var(--wp--style--unstable-gallery-gap) * 0.66667) !important;
    flex: 0 0 auto !important;
  }

  body.okp-editorial-ui .okp-post-content .wp-block-gallery.has-nested-images.columns-4 > .wp-block-image,
  body.okp-editorial-ui .okp-post-content .wp-block-gallery.has-nested-images.columns-4 > figure.wp-block-image {
    width: calc(25% - var(--wp--style--unstable-gallery-gap) * 0.75) !important;
    flex: 0 0 auto !important;
  }
}

body.okp-editorial-ui .okp-post-content figcaption,
body.okp-editorial-ui .okp-post-content .wp-element-caption {
  margin-top: 0.55em;
  font-family: var(--gothic);
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0;
  color: var(--okp-ed-mute);
  text-align: left;
}

body.okp-editorial-ui .okp-post-content .alignwide {
  width: 100%;
  max-width: none;
}

/* Keep full-bleed inside content box on SP (no horizontal scroll) */
body.okp-editorial-ui .okp-post-content .alignfull {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

body.okp-editorial-ui .okp-post-content .wp-block-table {
  overflow-x: auto;
  margin: 1.8em 0;
  -webkit-overflow-scrolling: touch;
}

body.okp-editorial-ui .okp-post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

body.okp-editorial-ui .okp-post-content th,
body.okp-editorial-ui .okp-post-content td {
  border: 1px solid #ddd;
  padding: 0.5em 0.65em;
  text-align: left;
}

body.okp-editorial-ui .okp-post-content .wp-block-separator {
  border: 0;
  border-top: 1px solid #ddd;
  margin: 2.4em 0;
}

body.okp-editorial-ui .okp-post-content .wp-block-code,
body.okp-editorial-ui .okp-post-content pre {
  overflow-x: auto;
  padding: 0.9em;
  background: var(--okp-ed-panel);
  border: 1px solid #ddd;
  border-radius: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
}

body.okp-editorial-ui .okp-post-content .wp-block-button__link {
  border-radius: 0;
  background: var(--okp-ed-ink);
  color: #fff;
  padding: 0.65em 1.1em;
  font-family: var(--gothic);
  font-size: 13px;
  font-weight: 500;
}

body.okp-editorial-ui .okp-post-content .wp-block-embed,
body.okp-editorial-ui .okp-post-content .wp-block-video {
  margin: 0 0 30px;
  padding: 0;
  background: none;
  box-shadow: none;
  max-width: none;
}

body.okp-editorial-ui .okp-post-content .wp-block-embed iframe,
body.okp-editorial-ui .okp-post-content video {
  width: 100%;
  max-width: 100%;
}

/* Easy TOC */
body.okp-editorial-ui .ez-toc-container,
body.okp-editorial-ui [class*="ez-toc-container"],
body.okp-editorial-ui .okp-post-content .ez-toc {
  background: var(--okp-ed-panel) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 14px 14px !important;
  margin: 1.6em 0 2em !important;
  max-width: none;
}

body.okp-editorial-ui .ez-toc-title,
body.okp-editorial-ui .ez-toc-title-container {
  font-family: var(--gothic) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: var(--okp-ed-ink) !important;
}

body.okp-editorial-ui .ez-toc-list a {
  font-family: var(--gothic);
  font-size: 13px;
  color: var(--okp-ed-ink-soft);
  text-decoration: none;
}

body.okp-editorial-ui .ez-toc-list a:hover {
  color: var(--okp-ed-ink);
  text-decoration: underline;
}

/* Tags / prev-next */
body.okp-editorial-ui .okp-article__footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid #e6e6e6;
}

body.okp-editorial-ui .okp-article__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

body.okp-editorial-ui .okp-article__tags a {
  font-family: var(--gothic);
  font-size: 12px;
  color: var(--okp-ed-mute);
  text-decoration: none;
  border: 1px solid var(--okp-ed-line);
  background: var(--okp-ed-panel);
  padding: 4px 10px;
}

body.okp-editorial-ui .okp-page-nav--editorial {
  width: auto;
  max-width: none;
  margin: 0;
  padding: 24px var(--okp-ed-pad-right) 0 var(--okp-ed-vrail);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  border-top: 1px solid #e6e6e6;
  box-sizing: border-box;
}

body.okp-editorial-ui .okp-page-nav--editorial a {
  display: block;
  text-decoration: none;
  color: var(--okp-ed-ink);
}

body.okp-editorial-ui .okp-page-nav__label {
  display: block;
  font-family: var(--en);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--okp-ed-mute);
  margin-bottom: 6px;
}

body.okp-editorial-ui .okp-page-nav__title {
  display: block;
  font-family: var(--gothic);
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
}

body.okp-editorial-ui .okp-page-nav__item--next {
  text-align: right;
}

body.okp-editorial-ui .okp-footer {
  background: var(--okp-ed-bg);
  border-top: 1px solid #e6e6e6;
  color: var(--okp-ed-mute);
}

/* ---------- Panels ---------- */
body.okp-editorial-ui .okp-filter-panel,
body.okp-editorial-ui .okp-search-panel {
  position: fixed;
  inset: 0;
  z-index: 200;
}

body.okp-editorial-ui .okp-filter-panel[hidden],
body.okp-editorial-ui .okp-search-panel[hidden] {
  display: none !important;
}

body.okp-editorial-ui .okp-filter-panel__backdrop,
body.okp-editorial-ui .okp-search-panel__backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

body.okp-editorial-ui .okp-filter-panel__dialog,
body.okp-editorial-ui .okp-search-panel__dialog {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--okp-ed-header-h) + var(--admin-bar-h));
  max-height: min(70vh, 520px);
  overflow: auto;
  background: var(--okp-ed-panel);
  border-bottom: 1px solid var(--okp-ed-line);
  padding: 28px 15px 20px;
  animation: okp-panel-in 0.22s ease;
}

@keyframes okp-panel-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  body.okp-editorial-ui .okp-filter-panel__dialog,
  body.okp-editorial-ui .okp-search-panel__dialog {
    animation: none;
  }
}

body.okp-editorial-ui .okp-filter-panel__close,
body.okp-editorial-ui .okp-search-panel__close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: 22px auto 4px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #111;
  cursor: pointer;
}

body.okp-editorial-ui .okp-filter-tabs__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 18px;
  border-bottom: 1px solid #ddd;
}

body.okp-editorial-ui .okp-filter-tabs__tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 6px 12px 10px;
  margin: 0;
  font-family: var(--en);
  font-size: 14px;
  font-weight: 400;
  color: #999;
  cursor: pointer;
  position: relative;
}

body.okp-editorial-ui .okp-filter-tabs__tab.is-active,
body.okp-editorial-ui .okp-filter-tabs__tab[aria-selected="true"] {
  color: #bd293c;
}

body.okp-editorial-ui .okp-filter-tabs__tab.is-active::after,
body.okp-editorial-ui .okp-filter-tabs__tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  background: #bd293c;
}

body.okp-editorial-ui .okp-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.okp-editorial-ui .okp-filter-chip {
  display: inline-grid;
  place-items: center;
  padding: 5px 12px;
  border: 1px solid var(--okp-ed-line);
  border-radius: 0;
  background: var(--okp-ed-surface);
  color: var(--okp-ed-ink);
  text-decoration: none;
  font-family: var(--gothic);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
}

body.okp-editorial-ui .okp-filter-chip:hover {
  opacity: 0.7;
}

body.okp-editorial-ui .okp-filter-empty {
  margin: 8px 0;
  font-family: var(--gothic);
  font-size: 13px;
  color: var(--okp-ed-mute);
}

body.okp-editorial-ui .okp-search-form {
  display: flex;
  align-items: stretch;
  gap: 0;
  max-width: 520px;
  margin: 0 auto;
}

body.okp-editorial-ui .okp-search-form input[type="search"] {
  flex: 1;
  height: 40px;
  border: 1px solid var(--okp-ed-line);
  border-right: 0;
  border-radius: 0;
  padding: 6px 10px;
  font-family: var(--gothic);
  font-size: 16px;
  appearance: none;
  background: var(--okp-ed-surface);
  color: var(--okp-ed-ink);
}

body.okp-editorial-ui .okp-search-form input[type="search"]::placeholder {
  color: #999;
}

body.okp-editorial-ui .okp-search-form button[type="submit"] {
  width: 54px;
  height: 40px;
  border: 1px solid var(--okp-ed-line);
  background: var(--okp-ed-surface);
  color: var(--okp-ed-ink);
  cursor: pointer;
  display: grid;
  place-items: center;
}

body.okp-editorial-ui .okp-search-form button[type="submit"]:hover {
  opacity: 0.7;
}

body.okp-editorial-ui .screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

body.okp-editorial-ui .okp-post-content .wp-block-image,
body.okp-editorial-ui .okp-article__hero,
body.okp-editorial-ui .main-image {
  background: transparent;
  box-shadow: none;
  padding: 0;
  max-width: none;
}

/* ---------- Narrow phones ---------- */
@media (max-width: 359px) {
  body.okp-editorial-ui {
    --okp-ed-vrail: 40px;
    --okp-ed-pad-right: 36px;
  }

  body.okp-editorial-ui .okp-vrail__h1,
  body.okp-editorial-ui .okp-vrail__h2 {
    font-size: 13px;
  }
}

/* ---------- Tablet+ ---------- */
@media (min-width: 768px) {
  body.okp-editorial-ui {
    --okp-ed-vrail: 56px;
    --okp-ed-pad-right: 48px;
  }

  body.okp-editorial-ui .okp-vrail__h1,
  body.okp-editorial-ui .okp-vrail__h2 {
    font-size: 15px;
    letter-spacing: 0.1em;
  }

  body.okp-editorial-ui .okp-editorial {
    padding-top: 40px;
  }

  body.okp-editorial-ui .okp-article--editorial {
    padding: 12px var(--okp-ed-pad-right) 64px calc(var(--okp-ed-vrail) + 12px);
  }

  body.okp-editorial-ui .okp-article__title {
    font-size: clamp(28px, 3.6vw, 40px);
    line-height: 1.35;
  }

  body.okp-editorial-ui .okp-post-content {
    font-size: 15px;
    line-height: 1.9;
  }

  body.okp-editorial-ui .okp-post-content > * {
    max-width: 40em;
  }

  body.okp-editorial-ui .okp-post-content > .alignwide,
  body.okp-editorial-ui .okp-post-content > .alignfull,
  body.okp-editorial-ui .okp-post-content > .wp-block-image,
  body.okp-editorial-ui .okp-post-content > .wp-block-gallery,
  body.okp-editorial-ui .okp-post-content > .wp-block-cover,
  body.okp-editorial-ui .okp-post-content > .wp-block-embed,
  body.okp-editorial-ui .okp-post-content > .wp-block-video {
    max-width: none;
  }

  body.okp-editorial-ui .okp-post-content h2 {
    font-size: 22px;
  }

  body.okp-editorial-ui .okp-page-nav--editorial {
    padding-left: calc(var(--okp-ed-vrail) + 12px);
    padding-right: var(--okp-ed-pad-right);
  }

  body.okp-editorial-ui .okp-vrail {
    left: max(8px, calc((100vw - 980px) / 2));
  }
}

/* Desktop nav (≥901): tools return to header row */
@media (min-width: 901px) {
  body.okp-editorial-ui .okp-header {
    display: flex;
    align-items: center;
    padding-inline: clamp(40px, 4.5vw, 56px);
  }

  body.okp-editorial-ui .okp-header__inner {
    flex: 1;
    width: auto;
    padding: 0;
    gap: clamp(16px, 2.5vw, 28px);
  }

  body.okp-editorial-ui .okp-ed-tools {
    position: static;
    top: auto;
    right: auto;
    margin-left: 24px;
    gap: 18px;
    flex-shrink: 0;
    z-index: 2;
  }

  body.okp-editorial-ui .okp-nav ul {
    gap: clamp(16px, 2vw, 28px);
  }

  body.okp-editorial-ui .okp-filter-panel__dialog,
  body.okp-editorial-ui .okp-search-panel__dialog {
    left: auto;
    right: clamp(40px, 4.5vw, 64px);
    width: min(420px, 92vw);
    max-height: min(70vh, 640px);
    border: 1px solid #e0e0e0;
  }
}

@media (min-width: 1024px) {
  body.okp-editorial-ui .okp-header {
    padding-inline: clamp(48px, 5vw, 64px);
  }

  body.okp-editorial-ui .okp-ed-tools {
    margin-left: 24px;
    gap: 18px;
  }

  body.okp-editorial-ui .okp-post-content .alignfull {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
}

@media (min-width: 1440px) {
  body.okp-editorial-ui .okp-header {
    padding-inline: 64px;
  }

  body.okp-editorial-ui .okp-editorial {
    max-width: 1040px;
  }

  body.okp-editorial-ui .okp-vrail {
    left: max(16px, calc((100vw - 1040px) / 2));
  }

  body.okp-editorial-ui .okp-vrail__h1,
  body.okp-editorial-ui .okp-vrail__h2 {
    font-size: 15.5px;
  }
}
