/* =============================================================
   Method page readability & image sizing overrides
   Scope: #method-frag (Typing Method page only)
   Date: 2025-10-09
   ============================================================= */
@media (min-width: 821px){
  /* Avoid overlapping the fixed side menu on desktop */
  #method-frag{ margin-right: var(--sideW); }
}

/* Constrain reading width and add breathing room */
#method-frag .doc{
  max-width: 920px;
  margin: 0 auto;
  padding-inline: clamp(12px, 2vw, 20px);
}

/* Comfortable measure (~72ch) for main paragraphs/lists (tables stay full) */
#method-frag .doc article > p,
#method-frag .doc article > ul,
#method-frag .doc article > ol{
  max-width: 72ch;
  margin-inline: auto;
}

/* Typographic sizing tuned for this page */
#method-frag .doc p{  font-size: clamp(17px, 1.8vw, 19px); }
#method-frag .doc li{ font-size: clamp(17px, 1.8vw, 19px); }
#method-frag .doc h2{ font-size: clamp(26px, 3.2vw, 34px); scroll-margin-top: 96px; }
#method-frag .doc h3{ font-size: clamp(20px, 2.6vw, 26px); }
#method-frag .lead{   font-size: clamp(18px, 2.0vw, 20px); }

/* Subtle TOC panel */
#method-frag .toc{
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px;
  background: var(--panel);
}

/* Hero becomes a tidy two-column grid on wide, stacks on small */
#method-frag .hero.hero-method .container{
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: clamp(16px, 3vw, 28px);
  align-items: center;
}
@media (max-width: 1024px){
  #method-frag .hero.hero-method .container{
    grid-template-columns: 1fr;
  }
}
#method-frag .hero.hero-method h1{
  margin: 0;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.15;
}

/* Carded images with capped height (prevents overly tall heroes) */
#method-frag .figure-card{
  border:1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow);
}
#method-frag .figure-card img{
  width: 100%;
  height: auto;
  display:block;
  max-height: clamp(220px, 40vh, 420px);
  object-fit: cover;
}

/* Gallery grid: responsive tiles with safe aspect ratio */
#method-frag .fig-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 820px){
  #method-frag .fig-grid{ grid-template-columns: 1fr; }
}
#method-frag .fig-grid .figure-card img{
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

/* Tables: prevent overflow */
#method-frag .table-nice{
  width: 100%;
  overflow-x: auto;
}

/* Language visibility (keep parity with site rules) */
html[lang="ja"] #method-frag .lang-en{ display:none !important; }
html[lang="en"] #method-frag .lang-ja{ display:none !important; }
