.note-article { max-width: none; padding: 0; }
main { padding: 0; }

/* ===================================================================
   DEFAULT HERO — full-width cover with overlaid title
   =================================================================== */
.ab-hero {
  position: relative;
  width: 100%;
  min-height: 80vh;
  overflow: hidden;
}
.ab-hero img {
  width: 100%;
  height: 80vh;
  object-fit: cover;
  object-position: center top;
  display: block;
  cursor: zoom-in;
}
.ab-hero.contain {
  background: var(--bg-primary);
  cursor: pointer;
}
.ab-hero.contain img {
  object-fit: contain;
  object-position: center center;
  cursor: pointer;
}
.ab-hero.contain .ab-hero-overlay {
  background: none;
  pointer-events: none;
}
.ab-hero.contain .ab-hero-overlay * {
  pointer-events: none;
}
.ab-hero.contain img:hover {
  transform: none;
}
/* Portrait hero — art book catalog: object + text side by side */
.ab-hero.portrait {
  min-height: auto;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 3.5rem;
  padding: 4rem 5rem;
  background: var(--bg-primary);
}
.ab-hero.portrait img {
  height: 72vh;
  width: auto;
  max-width: 45%;
  object-fit: contain;
  filter: drop-shadow(0 6px 24px rgba(0,0,0,0.18));
  flex-shrink: 0;
}
.ab-hero.portrait .ab-hero-overlay {
  position: static;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding-top: 1rem;
  padding: 0;
  background: none;
  max-width: 400px;
  flex-shrink: 1;
}
.ab-hero.portrait .ab-hero-inner {
  text-align: left;
  max-width: 100%;
}
.ab-hero.portrait .ab-hero-title {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: none;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}
/* JP subtitle line — sits directly under EN title */
.ab-hero.portrait .ab-hero-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.4;
}
/* Metadata line — small caps: publisher / year / format */
.ab-hero.portrait .ab-hero-byline {
  color: var(--text-muted);
  text-shadow: none;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}
/* Body prose on the text side */
.ab-hero.portrait .ab-hero-prose {
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--text-secondary);
}
.ab-hero.portrait .ab-hero-prose p {
  margin: 0 0 0.75rem 0;
}
.ab-hero.portrait .ab-hero-prose p:last-child {
  margin-bottom: 0;
}
.ab-hero.portrait .ab-badges {
  margin-bottom: 1rem;
}
.ab-hero.portrait .ab-badges .badge {
  background: rgba(0,0,0,0.06);
  color: var(--text-muted);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ab-hero-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background: rgba(0,0,0,0.3);
  will-change: opacity;
  transition: opacity 0.05s linear;
}
.ab-hero.light .ab-hero-overlay { background: rgba(0,0,0,0.35); }
.ab-hero-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.ab-hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  margin: 0 0 1rem 0;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6), 0 4px 16px rgba(0,0,0,0.4);
}
.ab-hero-byline {
  font-family: var(--font-body);
  font-size: 1rem;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* Narrow text container */
.ab-narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.ab-hero + .ab-narrow { margin-top: 2rem; }

.ab-badges {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* Details row */
.ab-details {
  padding: 1.25rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2rem;
}
.ab-details-row {
  display: flex;
  flex-wrap: wrap;
  font-size: 1rem;
  color: var(--text-muted);
}
.ab-details-row span + span::before {
  content: " / ";
  color: var(--text-muted);
  opacity: 0.4;
}

/* Intro prose */
.ab-intro {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 2.5rem;
}
.ab-intro p { margin-bottom: 1.25rem; }
.ab-intro p:last-child { margin-bottom: 0; }

/* === IMAGE GRID — default bento box === */
.ab-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
  max-width: 1100px;
  margin: 0 auto 2.5rem;
  padding: 0 1.5rem;
  align-items: start;
}

/* Image panel */
.ab-panel {
  position: relative;
  overflow: hidden;
  background: transparent;
  border-radius: 2px;
}
.ab-panel img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
  transition: transform 0.3s ease;
}
.ab-panel:hover img { transform: scale(1.02); }
.ab-panel.padded {
  padding: 1.5rem;
  background: var(--bg-secondary);
}
.ab-panel-cap {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-muted);
  padding: 0.5rem 0;
  background: transparent;
  border: none;
}

/* Row-spanning panels — fill grid area (opt-in via rows: N in frontmatter) */
.ab-panel[style*="grid-row"] {
  height: 100%;
}
.ab-panel[style*="grid-row"] img {
  height: 100%;
  object-fit: cover;
}

/* Background zones — opt-in via bg: "dark" | "light" | "muted" in frontmatter */
.ab-bg-dark { background: #111; }
.ab-bg-dark .ab-panel-cap { color: rgba(255,255,255,0.5); }
.ab-bg-light { background: #f5f3f0; }
.ab-bg-muted { background: var(--bg-secondary); }

/* Text panel inside the grid */
.ab-text-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 1rem 0.75rem;
}
.ab-text-panel h2 {
  display: none;
}
.ab-text-panel p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-secondary);
  margin: 0 0 0.75rem 0;
}
.ab-text-panel p:last-child { margin-bottom: 0; }

/* Float-wrap panel — image floats within text */
.ab-float-wrap {
  padding: 1rem 0;
  overflow: hidden;
}
.ab-float-wrap .ab-float-img {
  float: left;
  width: 40%;
  margin: 0 1.5rem 1rem 0;
  shape-margin: 1rem;
}
.ab-float-wrap.float-right .ab-float-img {
  float: right;
  margin: 0 0 1rem 1.5rem;
}
.ab-float-wrap .ab-float-img img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
}
.ab-float-wrap h2 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.75rem 0;
}
.ab-float-wrap p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-secondary);
  margin: 0 0 0.75rem 0;
}
.ab-float-wrap p:last-child { margin-bottom: 0; }

/* Body prose */
.ab-body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
}
.ab-body p { margin-bottom: 1rem; }
.ab-body p:last-child { margin-bottom: 0; }
.ab-body h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}
.ab-body blockquote {
  border-left: 2px solid var(--border-subtle);
  padding-left: 1.5rem;
  margin: 2rem 0;
  color: var(--text-secondary);
  font-style: italic;
}
.ab-body img {
  width: 100%;
  display: block;
  margin: 2rem 0;
}

/* Blockquote inside text panels */
.ab-text-panel blockquote {
  border-left: 2px solid var(--border-subtle);
  padding-left: 1.25rem;
  margin: 0 0 0.75rem 0;
  font-style: italic;
}
.ab-text-panel blockquote p {
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.75;
}
.ab-quote-attr {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: normal;
  letter-spacing: 0.02em;
}

/* Bottom gallery section label */
.ab-bottom-gallery-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 1.5rem 0 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* Sources */
.ab-sources {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border-subtle);
  margin-bottom: 2rem;
}
.ab-sources-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}
.ab-source-list { list-style: none; padding: 0; margin: 0; }
.ab-source-list li {
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ab-source-list a {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.2s;
}
.ab-source-list a:hover { color: var(--text-primary); }
.ab-source-tier {
  font-size: 0.6875rem;
  padding: 0.1rem 0.4rem;
  background: var(--bg-secondary);
  border-radius: 3px;
  color: var(--text-muted);
}

/* Default responsive */
@media (max-width: 900px) {
  .ab-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 1rem;
  }
  .ab-grid > * {
    grid-column: span 2 !important;
  }
  /* Images that should stay side-by-side (pairs and trios) */
  .ab-panel[style*="span 4"],
  .ab-panel[style*="span 6"],
  .ab-panel[style*="span 7"],
  .ab-panel[style*="span 8"] {
    grid-column: span 1 !important;
  }
  /* Text panels always full width */
  .ab-text-panel {
    grid-column: span 2 !important;
  }
  /* Reset row-spanning at tablet — stack cleanly */
  .ab-panel[style*="grid-row"],
  .ab-text-panel[style*="grid-row"] {
    grid-row: span 1 !important;
    height: auto;
  }
  .ab-panel[style*="grid-row"] img {
    height: auto;
    object-fit: contain;
  }
}
@media (max-width: 600px) {
  .ab-grid {
    grid-template-columns: 1fr;
    padding: 0 1rem;
    width: 100%;
    box-sizing: border-box;
  }
  .ab-grid > * {
    grid-column: span 1 !important;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .ab-hero { min-height: 60vh; }
  .ab-hero img { height: 60vh; }
  .ab-float-wrap .ab-float-img,
  .ab-float-wrap.float-right .ab-float-img {
    float: none;
    width: 100%;
    margin: 0 0 1rem 0;
  }
  .ab-hero.portrait {
    flex-direction: column;
    gap: 2rem;
    padding: 2rem 1.5rem;
    min-height: auto;
  }
  .ab-hero.portrait img { height: 45vh; width: auto; max-width: 80%; }
  .ab-hero.portrait .ab-hero-overlay { max-width: 100%; }
  .ab-hero.portrait .ab-hero-inner { text-align: left; }
  .ab-text-panel {
    padding: 1rem 1.25rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
  .ab-text-panel p {
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
}

/* ===================================================================
   MASONRY LAYOUT — opt-in via gallery_layout: masonry
   Scoped under .layout-masonry on <body>
   =================================================================== */

/* 2-column CSS columns masonry on main */
.layout-masonry main {
  column-count: 2;
  column-gap: 12px;
  max-width: 1000px;
  margin: 0 auto;
}

/* Hero becomes a normal left-column image with title below */
.layout-masonry .ab-hero {
  min-height: auto;
  break-inside: avoid;
  column-span: all;
  padding: 0 1.5rem;
  margin-bottom: 12px;
}
.layout-masonry .ab-hero img {
  height: auto;
}
.layout-masonry .ab-hero.portrait { min-height: auto; background: transparent; }
.layout-masonry .ab-hero.portrait img { height: auto; }
.layout-masonry .ab-hero-overlay {
  position: static;
  display: block;
  padding: 0;
  background: transparent;
}
.layout-masonry .ab-hero-inner {
  max-width: 100%;
  margin: 0;
  text-align: left;
  padding: 1rem 0 0 0;
}
.layout-masonry .ab-hero-title {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text-primary);
  text-shadow: none;
}
.layout-masonry .ab-hero-byline {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-shadow: none;
}

/* Narrow sections flow in columns */
.layout-masonry .ab-narrow {
  max-width: 100%;
  margin: 0;
  break-inside: avoid;
}
/* Details bar spans full width after hero */
.layout-masonry .ab-hero + .ab-narrow {
  column-span: all;
  padding: 0.75rem 1.5rem;
  margin: 0;
}

/* Details compact */
.layout-masonry .ab-details {
  padding: 0.75rem 0;
  margin-top: 0;
  border-top: none;
  border-bottom: none;
  margin-bottom: 0.75rem;
}
.layout-masonry .ab-details-row {
  font-size: 0.95rem;
  line-height: 1.6;
}
.layout-masonry .ab-intro {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 0;
}
.layout-masonry .ab-intro p { margin-bottom: 0.5rem; }

/* Grid flows in columns instead of CSS Grid */
.layout-masonry .ab-grid {
  display: block;
  max-width: 100%;
  padding: 0 1.5rem;
  margin: 0;
}

/* Image panels in masonry */
.layout-masonry .ab-panel {
  break-inside: avoid;
  margin-bottom: 12px;
  border-radius: 0;
}
.layout-masonry .ab-panel img {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.layout-masonry .ab-panel:hover img { transform: scale(1.015); }

/* Text panels in masonry */
.layout-masonry .ab-text-panel {
  break-inside: avoid;
  margin-bottom: 12px;
}

/* Masonry responsive */
@media (max-width: 600px) {
  .layout-masonry main {
    column-count: 1;
  }
  .layout-masonry .ab-hero { min-height: auto; }
  .layout-masonry .ab-hero img { height: auto; }
}
