/* Mamori guides wide layout (gw2), 11 Nov 2026. Loads after /assets/v3/site.css and /assets/guides-v1/guide.css.
   >=1200: sticky "On this page" | article (about 72ch) | sticky rail. 768-1199: TOC box on top, rail below the article.
   <768: phone layout unchanged except the TOC box. /guides/: card grid 1/2/3/4 columns with topic chips. */
.fl .gw2, .fl .gidx-top { visibility: hidden; }

/* ---------- guide pages ---------- */
.gw2 { max-width: 1480px; margin: 0 auto; padding: 0 var(--gut); }
.gw2 > .g-wrap { max-width: 72ch; margin: 0 auto; padding-left: 0; padding-right: 0; }
.gw2 > .toc, .gw2 > .rail { display: none; }
.gw2 > .rail { font-size: 1.125rem; }
.g-wrap h2[id] { scroll-margin-top: 96px; }

/* TOC box (phone and tablet) */
.toc-m { margin: 0 0 32px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--paper-3); font-size: 1rem; }
.toc-m summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 8px 18px; cursor: pointer; font-weight: 700; color: var(--ink); list-style: none; }
.toc-m summary::-webkit-details-marker { display: none; }
.toc-m summary::after { content: ""; width: 9px; height: 9px; border-right: 1.6px solid var(--ink-2); border-bottom: 1.6px solid var(--ink-2); transform: rotate(45deg) translateY(-3px); flex: none; margin-left: 12px; }
.toc-m[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.toc-m ol { list-style: none; margin: 0; padding: 0 18px 12px; border-top: 1px solid var(--line); }
.toc-m li { margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.toc-m li:last-child { border-bottom: 0; }
.toc-m a { display: block; padding: 11px 0; line-height: 1.4; color: var(--ink-2); text-decoration: none; }
.toc-m a:hover { color: var(--ink); text-decoration: underline; }

/* rail parts */
.rail-card { position: relative; display: grid; justify-items: center; gap: 12px; text-align: center; padding: 24px 20px 20px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--paper-3); overflow: hidden; }
.rail-glow { position: absolute; left: 50%; top: 14px; width: 150px; height: 150px; margin-left: -75px; border-radius: 50%; background: radial-gradient(closest-side, rgba(233, 183, 166, .75), rgba(233, 183, 166, .28) 55%, rgba(233, 183, 166, 0)); pointer-events: none; }
.rail-charm { position: relative; width: 64px; height: 112px; filter: drop-shadow(0 8px 10px rgba(60, 30, 12, .22)); }
.rail-line { position: relative; margin: 0; font: 800 1.1875rem/1.3 var(--f-display); color: var(--ink); text-wrap: balance; }
.rail-mb { position: relative; display: grid; gap: 8px; width: 100%; }
.rail-mb a { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px 14px; border-radius: var(--r-ctl); border: 1px solid var(--ink); background: var(--ink); color: var(--on-ink); font: 500 0.9375rem/1.25 var(--f-body); text-decoration: none; transition: background-color .2s var(--ease); }
.rail-mb a:hover { background: var(--shu-deep); border-color: var(--shu-deep); }
.rail-mb a + a { background: transparent; color: var(--ink); }
.rail-mb a + a:hover { background: var(--paper); border-color: var(--ink); }
.mcta-ios .rail-mb a.a, .mcta-and .rail-mb a.i { display: none !important; }
.mcta-ios .rail-mb a.i, .mcta-and .rail-mb a.a { background: var(--ink); color: var(--on-ink); }
.rail-rel .rail-h, .toc .toc-h { margin: 0 0 10px; font: 700 0.9375rem/1.4 var(--f-body); color: var(--ink); }
.rail-rel ul { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.rail-rel li { margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.rail-rel a { display: block; padding: 12px 0; font: 800 1rem/1.35 var(--f-display); color: var(--ink); text-decoration: none; }
.rail-rel a:hover { color: var(--shu-deep); }

@media (min-width: 768px) {
  /* the related block moves from the article into the rail */
  .gw2 > .g-wrap > a.gl, .gw2 > .g-wrap h2:has(+ a.gl) { display: none; }
  .gw2 > .rail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 32px; align-items: start; max-width: 72ch; margin: 0 auto clamp(64px, 9vw, 112px); }
  .gw2 > .g-wrap { padding-bottom: 48px; }
}

@media (min-width: 1200px) {
  .gw2 { display: grid; grid-template-columns: minmax(180px, 230px) minmax(0, 72ch) minmax(240px, 280px); column-gap: clamp(36px, 3.4vw, 64px); justify-content: center; align-items: start; }
  .gw2 > .g-wrap { max-width: none; margin: 0; padding-bottom: clamp(64px, 9vw, 112px); }
  .gw2 .toc-m { display: none; }
  .gw2 > .toc, .gw2 > .rail { display: block; position: sticky; top: 96px; margin: clamp(32px, 6vw, 72px) 0 48px; max-height: calc(100vh - 116px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .gw2 > .rail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .toc ol { list-style: none; margin: 0; padding: 0 0 0 14px; position: relative; display: grid; gap: 0; }
  .toc ol::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 2px; background: var(--line); border-radius: 1px; }
  .toc a { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; padding: 7px 0; font-size: 0.875rem; line-height: 1.45; color: var(--ink-3); text-decoration: none; position: relative; transition: color .2s var(--ease); }
  .toc a:hover { color: var(--ink); }
  .toc a[aria-current="true"] { color: var(--ink); font-weight: 700; }
  .toc a[aria-current="true"]::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 2px; background: var(--shu); border-radius: 1px; }
  /* wider than the text column: the app boxes */
  .gw2 > .g-wrap .mcta { margin-left: -28px; margin-right: -28px; }
}

/* ---------- /guides/ index ---------- */
.g-wrap.gidx { max-width: var(--max); }
.gidx h1 { max-width: 20ch; }
.gidx .intro { max-width: none; }   /* one line on desktop, wraps only when it has to */
.gidx-top { position: relative; margin: 0 0 28px; border-bottom: 1px solid var(--line); }
/* topic tabs: plain text, same size and weight, even spacing; the active one gets a thin vermilion brush line */
.chips { display: flex; gap: clamp(20px, 2.4vw, 32px); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 0 2px; margin: 0 -2px; }
.chips::-webkit-scrollbar { display: none; }
.gidx-top.more .chips { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); }
.gidx-top.more .chips::after { content: ""; flex: 0 0 24px; }
.chips a { position: relative; flex: none; display: inline-flex; align-items: center; min-height: 48px; padding: 0; color: var(--ink-3); font: 500 0.9375rem/1 var(--f-body); letter-spacing: 0; text-decoration: none; white-space: nowrap; transition: color .2s var(--ease); }
.chips a::after { content: ""; position: absolute; left: -2px; right: -2px; bottom: 7px; height: 7px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'%3E%3Cpath d='M1.5 5.6C18 4 38 3.2 62 3.5c16 .2 27 .9 36.5.2' fill='none' stroke='%23c3371f' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%; transform: scaleX(0); transform-origin: left center; transition: transform .28s var(--ease); }
.chips a:hover, .chips a[aria-current="true"] { color: var(--ink); }
.chips a[aria-current="true"]::after { transform: scaleX(1); }
@media (hover: hover) { .chips a:hover::after { transform: scaleX(1); } }
.chips a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
@media (prefers-reduced-motion: reduce) { .chips a::after { transition: none; } }
.gl-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; grid-auto-flow: row dense; }
.gl-grid > .gc, .gl-grid > a.gl { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 18px 20px 20px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--paper-3); transition: border-color .2s var(--ease); }
.gl-grid > .gc:hover, .gl-grid > a.gl:hover { border-color: var(--ink); }
.gl-grid > .gc::before { content: attr(data-label); display: block; margin: 0 0 8px; color: var(--ink-3); font: 700 0.6875rem/1.3 var(--f-body); letter-spacing: 0.1em; text-transform: uppercase; }
.gidx .gl-grid a.gl { display: block; padding: 0; border: 0; text-decoration: none; color: inherit; }
.gidx .gl-grid > .gc a.gl::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-panel); }
.gidx .gl-grid a.gl b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; font: 800 1.1875rem/1.3 var(--f-display); color: var(--ink); }
.gidx .gl-grid a.gl span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-top: 8px; font-size: 0.9375rem; line-height: 1.55; color: var(--ink-2); }
.gidx .gl-grid a.gl:hover b { color: var(--shu-deep); }
.gidx .gl-grid a.gl:focus-visible { outline: none; }
.gidx .gl-grid a.gl:focus-visible::after { outline: 2px solid var(--focus); outline-offset: 3px; }
.gidx .g-wrap h2 + a.gl { border-top: 0; }
.gx-banner { grid-column: 1 / -1; position: relative; display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-radius: var(--r-panel); background: var(--ink); color: var(--on-ink); overflow: hidden; }
.gx-banner .rail-glow { left: 44px; top: 50%; width: 110px; height: 110px; margin: -55px 0 0 -55px; background: radial-gradient(closest-side, rgba(233, 183, 166, .45), rgba(233, 183, 166, 0)); }
.gx-banner .rail-charm { width: 48px; height: 84px; flex: none; }
.gidx .gx-banner p { position: relative; margin: 0; flex: 1 1 auto; min-width: 0; font-size: 1rem; line-height: 1.5; color: #d8cfc2; }
.gidx .gx-banner b { color: var(--on-ink); }
.gx-banner .btn { position: relative; flex: none; background: var(--paper); border-color: var(--paper); color: var(--ink); }
.gx-banner .btn:hover { background: var(--shu-soft); border-color: var(--shu-soft); color: var(--ink); }
.gl-grid > [hidden] { display: none !important; }
@media (max-width: 560px) {
  .gx-banner { flex-wrap: wrap; gap: 12px 14px; padding: 14px 16px 16px; }
  .gidx .gx-banner p { flex: 1 1 200px; font-size: 0.9375rem; }
  .gidx .gl-grid a.gl b { font-size: 1.0625rem; -webkit-line-clamp: 3; }
  .gidx .gl-grid a.gl span { font-size: 0.875rem; }
  .gx-banner .btn { flex: 1 1 100%; }
  .gl-grid > .gc, .gl-grid > a.gl { padding: 16px 16px 18px; }
}
@media (min-width: 700px) { .gl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1200px) { .gl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } .gidx-top { margin-bottom: 28px; } }
@media (min-width: 1600px) { .g-wrap.gidx { max-width: 1520px; } .gl-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

@media print {
  .toc, .toc-m, .rail, .gidx-top, .gx-banner { display: none !important; }
  .gw2 { display: block; }
}
.gidx .gl-grid > a.gl { padding: 18px 20px 20px; border: 1px solid var(--line); border-radius: var(--r-panel); }
