/* ============================================================
   MAIL DEPOT — design system
   Direction: Postal Manifest (Brutalist Editorial x Post Office)
   Tokens first. No images. No emoji. Prefix: md-
   ============================================================ */

:root {
  /* palette */
  --bg: #F0EBE0;          /* 便箋クリーム */
  --bg2: #E5DFD0;         /* 封筒の影 */
  --ink: #26221F;         /* 消印黒 */
  --muted: #5F584E;       /* 窓口プレートグレー */
  --paper: #FBF9F3;       /* 白封筒 */
  --line: #26221F;        /* 罫線は消印インクで引く */
  --line-soft: #D2CBBB;
  --accent: #D7000F;      /* 郵便赤 */
  --accent-ink: #A80010;
  --kraft: #C9A063;       /* クラフト封筒 */
  --steel: #2B5EA7;       /* エアメールブルー */
  --hazard: #E8B93B;      /* 切手ゴールド */

  /* type */
  --f-body: 'M PLUS 1', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  --f-display: 'Zilla Slab', 'M PLUS 1', serif;
  --f-mono: 'IBM Plex Mono', 'Consolas', monospace;

  /* scale 1.333 */
  --fs-0: 13px;
  --fs-1: 16px;
  --fs-2: 21px;
  --fs-3: 28px;

  --rad: 3px;             /* 郵便物は角ばっている */
  --gap: 16px;
  --maxw: 1180px;
  --shadow: 4px 4px 0 rgba(38,34,31,.9);
  --shadow-soft: 0 10px 30px rgba(38,34,31,.12);
}
[data-theme="dark"] {
  --bg: #171310;          /* 消灯後の郵便局 */
  --bg2: #201B16;
  --ink: #EFEAE1;
  --muted: #A29A8D;
  --paper: #211D18;
  --line: #EFEAE1;
  --line-soft: #3D372E;
  --accent: #F2333F;
  --accent-ink: #FF5560;
  --kraft: #B08A55;
  --steel: #7FA8DC;
  --shadow: 4px 4px 0 rgba(0,0,0,.7);
  --shadow-soft: 0 10px 30px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--fs-1);
  line-height: 1.9;
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--hazard); color: #1B1A17; }
:focus-visible { outline: 3px solid var(--steel); outline-offset: 2px; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.3; margin: 0; }

.md-skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 10px 18px; font-weight: 700;
}
.md-skip:focus { left: 0; }

/* ---------------- header ---------------- */
.md-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--line);
}
.md-header-in {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 20px;
}
/* airmail border stripe (red / white / blue) */
.md-hazard {
  height: 8px;
  background: repeating-linear-gradient(-45deg,
    var(--accent) 0 14px, var(--paper) 14px 28px,
    var(--steel) 28px 42px, var(--paper) 42px 56px);
}
.md-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.md-logo-mark {
  width: 26px; height: 26px; display: grid;
  grid-template-columns: 1fr 1fr; grid-template-rows: 8px 1fr; gap: 3px;
}
.md-logo-mark i { background: var(--accent); }
.md-logo-mark i:first-child { grid-column: 1 / -1; background: var(--ink); }
.md-logo-mark i:last-child { background: var(--hazard); }
.md-logo b {
  font-family: var(--f-display); font-size: 17px; letter-spacing: .02em; font-weight: 400;
}
.md-logo b span { color: var(--accent); }

.md-headsearch {
  position: relative; flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 8px;
  border: 2px solid var(--line); background: var(--paper);
  padding: 7px 12px; border-radius: var(--rad);
}
.md-headsearch svg { flex: none; opacity: .6; }
.md-gsearch {
  border: none; background: none; font-family: inherit; font-size: 14px;
  color: var(--ink); width: 100%; padding: 0;
}
.md-gsearch:focus { outline: none; }
.md-gsearch-pop {
  position: absolute; top: calc(100% + 6px); left: -2px; right: -2px; z-index: 60;
  background: var(--paper); border: 2px solid var(--line); border-radius: var(--rad);
  box-shadow: var(--shadow); max-height: 340px; overflow: auto;
}
.md-gsearch-pop a {
  display: flex; align-items: baseline; gap: 10px;
  padding: 10px 14px; text-decoration: none; font-size: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.md-gsearch-pop a:last-child { border-bottom: none; }
.md-gsearch-pop a:hover, .md-gsearch-pop a:focus { background: var(--bg2); }
.md-gsearch-pop .sku { font-family: var(--f-mono); font-size: 11px; color: var(--accent); flex: none; }
.md-gsearch-pop .cat { margin-left: auto; font-size: 11px; color: var(--muted); flex: none; }
.md-gsearch-pop .none { padding: 12px 14px; font-size: 13px; color: var(--muted); }

.md-nav { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.md-nav a {
  text-decoration: none; font-size: 14px; font-weight: 700;
  border-bottom: 2px solid transparent;
}
.md-nav a:hover { border-bottom-color: var(--accent); }
.md-theme {
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  border: 2px solid var(--line); background: var(--paper); color: var(--ink);
  font-family: var(--f-mono); font-size: 11px; font-weight: 700;
  padding: 6px 10px; border-radius: var(--rad);
}
.md-theme:hover { background: var(--bg2); }
.md-theme .i-sun { display: none; }
[data-theme="dark"] .md-theme .i-sun { display: block; }
[data-theme="dark"] .md-theme .i-moon { display: none; }

/* ---------------- hero ---------------- */
.md-hero {
  max-width: var(--maxw); margin: 0 auto; padding: 84px 24px 48px;
  position: relative;
}
.md-hero-kick {
  font-family: var(--f-mono); font-size: 12px; font-weight: 700;
  letter-spacing: .22em; color: var(--accent); margin: 0 0 18px;
}
.md-hero h1 {
  font-size: clamp(38px, 6vw, 72px); font-weight: 900;
  line-height: 1.18; letter-spacing: -.01em; max-width: 940px;
}
/* break at phrase boundaries, never orphan a particle */
.md-hero h1 span { display: inline-block; }
.md-hero h1 em {
  font-style: normal; color: var(--accent);
  text-decoration: underline; text-decoration-thickness: 6px;
  text-underline-offset: 10px; text-decoration-color: var(--hazard);
}
.md-hero-lead {
  font-size: 17px; color: var(--muted); max-width: 34em;
  margin: 28px 0 36px; font-weight: 500;
}
.md-hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.md-btn-main {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff; text-decoration: none;
  font-weight: 900; font-size: 16px; padding: 16px 30px;
  border: 2px solid var(--ink); border-radius: var(--rad);
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.md-btn-main:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 rgba(27,26,23,.9); }
.md-btn-main:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(27,26,23,.9); }
.md-btn-main.inv { background: var(--paper); color: var(--ink); }
.md-btn-sub {
  display: inline-flex; align-items: center;
  background: var(--paper); color: var(--ink); text-decoration: none;
  font-weight: 700; font-size: 16px; padding: 16px 26px;
  border: 2px solid var(--line); border-radius: var(--rad);
}
.md-btn-sub:hover { background: var(--bg2); }

.md-stats {
  display: flex; gap: 0; flex-wrap: wrap; margin: 56px 0 0;
  border: 2px solid var(--line); background: var(--paper);
}
.md-stats div {
  flex: 1; min-width: 140px; padding: 20px 24px;
  border-right: 2px solid var(--line);
}
.md-stats div:last-child { border-right: none; }
.md-stats dt {
  font-family: var(--f-mono); font-size: 36px; font-weight: 700;
  line-height: 1; font-variant-numeric: tabular-nums;
}
.md-stats dd { margin: 8px 0 0; font-size: 12px; font-weight: 700; color: var(--muted); }

/* ---------------- conveyor belt marquee ---------------- */
.md-belt {
  overflow: hidden; background: var(--ink); padding: 14px 0;
  border-top: 2px solid var(--line); border-bottom: 2px solid var(--line);
}
.md-belt-in { display: flex; width: max-content; animation: md-belt-run 26s linear infinite; }
.md-belt-row {
  display: flex; gap: 34px; padding-right: 34px; align-items: center;
  font-family: var(--f-display); font-size: 17px; color: var(--bg);
  white-space: nowrap; letter-spacing: .04em;
}
.md-belt-row i { font-family: var(--f-mono); font-style: normal; font-weight: 700; }
@keyframes md-belt-run { to { transform: translateX(-50%); } }

/* ---------------- sections ---------------- */
.md-sec { max-width: var(--maxw); margin: 0 auto; padding: 84px 24px 20px; }
.md-sec-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; margin-bottom: 30px;
}
.md-kick {
  font-family: var(--f-mono); font-size: 12px; font-weight: 700;
  letter-spacing: .22em; color: var(--accent); margin: 0 0 10px;
}
.md-sec h2 { font-size: clamp(28px, 4.4vw, 44px); font-weight: 900; letter-spacing: -.01em; }
.md-sec-note { font-size: 14px; color: var(--muted); max-width: 300px; margin: 0; font-weight: 500; }

/* ---------------- filter ---------------- */
.md-filterbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }
.md-filter-wrap {
  display: flex; align-items: center; gap: 8px; flex: 1; max-width: 380px;
  border: 2px solid var(--line); background: var(--paper);
  padding: 9px 12px; border-radius: var(--rad);
}
.md-filter-wrap svg { opacity: .6; flex: none; }
.md-filter { border: none; background: none; font-family: inherit; font-size: 14px; color: var(--ink); width: 100%; }
.md-filter:focus { outline: none; }
.md-favonly {
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  border: 2px solid var(--line); background: var(--paper); color: var(--ink);
  font-family: inherit; font-weight: 700; font-size: 13px;
  padding: 9px 14px; border-radius: var(--rad);
}
.md-favonly.on { background: var(--hazard); color: #1B1A17; }
.md-empty { font-size: 14px; color: var(--muted); font-weight: 700; padding: 8px 0; }

/* ---------------- bento crates ---------------- */
.md-bento {
  display: grid; grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 190px; gap: var(--gap); grid-auto-flow: dense;
}
.md-crate {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 18px; text-decoration: none; overflow: hidden;
  background: var(--paper);
  border: 2px solid var(--line); border-radius: var(--rad);
  box-shadow: inset 0 0 0 6px var(--bg), inset 0 0 0 8px var(--crate);
  transition: transform .18s cubic-bezier(.2, .8, .3, 1), box-shadow .18s;
}
.md-crate:hover {
  transform: translate(-3px, -3px);
  box-shadow: inset 0 0 0 6px var(--bg), inset 0 0 0 8px var(--crate), 6px 6px 0 rgba(27,26,23,.85);
}
.md-crate.big { grid-column: span 2; grid-row: span 2; }
.md-crate.wide { grid-column: span 2; }
.md-crate-top {
  display: flex; justify-content: space-between; align-items: center;
  margin: 8px 8px 0;
}
.md-sku { font-family: var(--f-mono); font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.md-crate-top .md-sku { color: var(--crate); }
.md-count {
  font-family: var(--f-mono); font-size: 11px; font-weight: 700;
  background: var(--crate); color: #fff; padding: 2px 8px; border-radius: var(--rad);
}
.md-crate-demo {
  flex: 1; display: flex; align-items: center; justify-content: center;
  min-height: 40px; margin: 0 8px; overflow: hidden;
}
.md-crate-label { margin: 0 8px 8px; }
.md-crate-label b { display: block; font-size: 19px; font-weight: 900; line-height: 1.4; }
.md-crate.big .md-crate-label b { font-size: 26px; }
.md-crate-label span {
  display: block; font-size: 11.5px; color: var(--muted); font-weight: 500;
  line-height: 1.6; margin-top: 2px;
}

/* --- crate mini demos (pure CSS, one per category) --- */
[data-demo="cta-button"]::before {
  content: "SHOP NOW"; font-family: var(--f-mono); font-size: 13px; font-weight: 700;
  letter-spacing: .08em; color: #fff; background: var(--crate);
  padding: 10px 22px; border-radius: 4px;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--crate) 60%, #000);
  animation: md-demo-press 2.4s ease-in-out infinite;
}
@keyframes md-demo-press {
  0%, 78%, 100% { transform: translateY(0); box-shadow: 0 4px 0 color-mix(in srgb, var(--crate) 60%, #000); }
  86% { transform: translateY(4px); box-shadow: 0 0 0 color-mix(in srgb, var(--crate) 60%, #000); }
}

[data-demo="layout"] { gap: 8px; }
[data-demo="layout"]::before, [data-demo="layout"]::after {
  content: ""; width: 34%; height: 56px; border-radius: 3px;
  border: 2px solid var(--crate);
  background: linear-gradient(color-mix(in srgb, var(--crate) 30%, transparent) 18px, transparent 18px);
}

[data-demo="header"] { flex-direction: column; gap: 7px; }
[data-demo="header"]::before {
  content: ""; width: 78%; height: 20px; border-radius: 3px;
  border: 2px solid var(--crate);
  background: linear-gradient(90deg, var(--crate) 0 26px, transparent 26px);
}
[data-demo="header"]::after {
  content: "PREHEADER TEXT…"; font-family: var(--f-mono); font-size: 9px;
  letter-spacing: .14em; color: var(--muted);
}

[data-demo="hero"] { flex-direction: column; gap: 8px; }
[data-demo="hero"]::before {
  content: "SUMMER SALE"; font-family: var(--f-display); font-weight: 700; font-size: 21px;
  color: #fff; background: var(--crate); padding: 6px 18px; border-radius: 3px;
  animation: md-demo-float 3s ease-in-out infinite;
}
[data-demo="hero"]::after {
  content: "UP TO 50% OFF"; font-family: var(--f-mono); font-size: 10px; font-weight: 700;
  letter-spacing: .2em; color: var(--crate);
}
@keyframes md-demo-float { 50% { transform: translateY(-4px); } }

[data-demo="typography"]::before {
  content: "Aa 見出し"; font-family: var(--f-display); font-size: 26px; font-weight: 700;
  color: var(--crate); border-bottom: 3px solid var(--crate); padding-bottom: 4px;
}

[data-demo="product-card"] { gap: 10px; }
[data-demo="product-card"]::before, [data-demo="product-card"]::after {
  content: "¥2,980"; display: flex; align-items: flex-end; justify-content: center;
  width: 62px; height: 74px; border-radius: 3px; border: 2px solid var(--crate);
  background: linear-gradient(color-mix(in srgb, var(--crate) 30%, transparent) 42px, transparent 42px);
  font-family: var(--f-mono); font-size: 10px; font-weight: 700; color: var(--crate);
  padding-bottom: 4px;
}
[data-demo="product-card"]::after { content: "¥1,480"; animation: md-demo-float 3s ease-in-out infinite .4s; }

[data-demo="pricing"] { flex-direction: column; gap: 5px; }
[data-demo="pricing"]::before, [data-demo="pricing"]::after {
  content: "小計 ------------ ¥5,800"; font-family: var(--f-mono); font-size: 10px;
  color: var(--muted); letter-spacing: .04em;
}
[data-demo="pricing"]::after { content: "合計 ------------ ¥6,380"; color: var(--crate); font-weight: 700; }

[data-demo="notice"]::before {
  content: "COUPON: DEPOT10"; font-family: var(--f-mono); font-size: 11px; font-weight: 700;
  letter-spacing: .08em; color: var(--crate);
  border: 2px dashed var(--crate); padding: 8px 14px; border-radius: 3px;
  background: color-mix(in srgb, var(--crate) 10%, transparent);
}

[data-demo="divider"] { flex-direction: column; gap: 10px; }
[data-demo="divider"]::before {
  content: ""; width: 82%; height: 8px;
  background: repeating-linear-gradient(-45deg,
    var(--accent) 0 8px, var(--paper) 8px 16px,
    var(--steel) 16px 24px, var(--paper) 24px 32px);
}
[data-demo="divider"]::after { content: ""; width: 82%; border-top: 2px dashed var(--crate); }

[data-demo="social"] { gap: 10px; }
[data-demo="social"]::before, [data-demo="social"]::after {
  content: "X"; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-mono); font-size: 11px; font-weight: 700;
  background: var(--crate); color: #fff;
}
[data-demo="social"]::after { content: "IG"; background: transparent; color: var(--crate); border: 2px solid var(--crate); }

[data-demo="order"] { flex-direction: column; gap: 8px; }
[data-demo="order"]::before {
  content: "受付 ─── 発送 ─── 配達"; font-family: var(--f-mono); font-size: 10.5px; font-weight: 700;
  color: var(--crate); letter-spacing: .04em;
}
[data-demo="order"]::after {
  content: "MD11-001-JP"; font-family: var(--f-mono); font-size: 9px; letter-spacing: .22em;
  color: var(--muted); border: 1.5px solid var(--line-soft); padding: 3px 10px; border-radius: 3px;
}

[data-demo="footer"] { flex-direction: column; gap: 6px; }
[data-demo="footer"]::before {
  content: "UNSUBSCRIBE / 配信停止"; display: flex; align-items: center; justify-content: center;
  width: 84%; height: 34px; background: var(--crate); color: #fff; border-radius: 3px;
  font-family: var(--f-mono); font-size: 9px; letter-spacing: .14em;
}
[data-demo="footer"]::after {
  content: "© YOUR SHOP"; font-family: var(--f-mono); font-size: 9px; letter-spacing: .12em; color: var(--muted);
}

/* ---------------- how ---------------- */
.md-how {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap);
  counter-reset: how;
}
.md-how li {
  background: var(--paper); border: 2px solid var(--line); border-radius: var(--rad);
  padding: 28px; position: relative;
}
.md-how-no {
  font-family: var(--f-mono); font-size: 13px; font-weight: 700;
  color: var(--accent); letter-spacing: .18em; display: block; margin-bottom: 14px;
}
.md-how b { font-size: 21px; font-weight: 900; display: block; margin-bottom: 8px; }
.md-how p { margin: 0; font-size: 14px; color: var(--muted); font-weight: 500; }

/* ---------------- SEO / FAQ ---------------- */
.md-seo { max-width: 860px; }
.md-seo h1 { font-size: clamp(28px, 4.4vw, 40px); font-weight: 900; margin-bottom: 20px; }
.md-seo h2 { font-size: 24px; font-weight: 900; margin: 44px 0 14px; }
.md-seo p, .md-seo li { font-size: 15px; color: var(--muted); font-weight: 500; }
.md-seo strong { color: var(--ink); }
.md-faq details {
  border: 2px solid var(--line); border-radius: var(--rad);
  background: var(--paper); margin-bottom: 10px;
}
.md-faq summary {
  cursor: pointer; font-weight: 900; font-size: 15px; padding: 16px 18px;
  list-style: none; position: relative; padding-right: 44px;
}
.md-faq summary::-webkit-details-marker { display: none; }
.md-faq summary::after {
  content: "+"; position: absolute; right: 18px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--f-mono); font-size: 18px; color: var(--accent);
}
.md-faq details[open] summary::after { content: "−"; }
.md-faq details div { padding: 0 18px 16px; font-size: 14px; color: var(--muted); font-weight: 500; }

/* ---------------- CTA band ---------------- */
.md-cta-band {
  background: var(--ink); color: var(--bg);
  border: 2px solid var(--line); border-radius: var(--rad);
  padding: 60px 36px; text-align: center; position: relative; overflow: hidden;
  margin-bottom: 60px;
}
.md-cta-band::before {
  content: ""; position: absolute; inset: auto 0 0 0; height: 10px;
  background: repeating-linear-gradient(-45deg, var(--hazard) 0 14px, transparent 14px 28px);
}
.md-cta-band h2 { font-size: clamp(28px, 4.4vw, 42px); font-weight: 900; margin-bottom: 14px; }
.md-cta-band p { font-size: 15px; opacity: .85; margin: 0 0 28px; font-weight: 500; }

/* ---------------- category page head ---------------- */
.md-pagehead {
  max-width: var(--maxw); margin: 0 auto; padding: 56px 24px 8px;
  border-bottom: 2px dashed var(--line-soft);
}
.md-crumb { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 26px; display: flex; gap: 10px; }
.md-crumb a { text-decoration: none; border-bottom: 2px solid var(--line-soft); }
.md-crumb a:hover { border-bottom-color: var(--accent); }
.md-pagehead h1 {
  font-size: clamp(34px, 5.6vw, 62px); font-weight: 900; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.md-count-big {
  font-family: var(--f-mono); font-size: 13px; font-weight: 700;
  background: var(--crate, var(--accent)); color: #fff;
  padding: 6px 12px; border-radius: var(--rad); letter-spacing: .06em;
}
.md-pagehead-lead { font-size: 15px; color: var(--muted); max-width: 40em; margin: 16px 0 30px; font-weight: 500; }

/* ---------------- part cards (signature: cargo label) ---------------- */
.md-partgrid-wrap { padding-top: 40px; }
.md-partgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}
.md-part {
  background: var(--paper); border: 2px solid var(--line); border-radius: var(--rad);
  display: flex; flex-direction: column; overflow: hidden;
  transition: transform .18s cubic-bezier(.2, .8, .3, 1), box-shadow .18s;
}
.md-part:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow); }
.md-part-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 2px solid var(--line);
}
.md-barcode {
  flex: 1; height: 16px; opacity: .85;
  background: repeating-linear-gradient(90deg,
    var(--ink) 0 2px, transparent 2px 5px,
    var(--ink) 5px 6px, transparent 6px 11px,
    var(--ink) 11px 14px, transparent 14px 17px);
}
.md-fav {
  cursor: pointer; border: 2px solid var(--line); background: var(--paper);
  color: var(--muted); width: 30px; height: 30px; border-radius: var(--rad);
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
  transition: transform .12s;
}
.md-fav:hover { transform: scale(1.1); color: var(--ink); }
.md-fav.on { background: var(--hazard); color: #1B1A17; border-color: var(--ink); }
.md-fav.on svg { fill: currentColor; }
/* stage keeps fixed light colors: emails are previewed on a light "inbox"
   background independent of site theme. The preview itself is an iframe
   (srcdoc) so mail CSS and site CSS can never interfere */
.md-stage {
  min-height: 150px;
  padding: 12px; background: #EDEAE3; color: #1B1A17;
  background-image: radial-gradient(#D8D2C6 1px, transparent 1px);
  background-size: 16px 16px;
  border-bottom: 2px solid var(--line);
  overflow: hidden;
}
.md-frame {
  display: block; width: 100%; max-width: var(--mailw, 600px);
  height: 150px; margin: 0 auto; border: none; background: transparent;
}
.md-part-body { padding: 14px 14px 0; }
.md-part-title { font-size: 16px; font-weight: 900; display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.md-part-title span { font-family: var(--f-mono); font-size: 11px; font-weight: 400; color: var(--muted); letter-spacing: .06em; }
.md-tabs { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.md-tab {
  cursor: pointer; border: 2px solid var(--line-soft); background: none; color: var(--muted);
  font-family: var(--f-mono); font-size: 11px; font-weight: 700;
  padding: 4px 12px; border-radius: var(--rad);
}
.md-tab.on { border-color: var(--line); background: var(--ink); color: var(--bg); }
.md-copy {
  cursor: pointer; margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  border: 2px solid var(--ink); background: var(--accent); color: #fff;
  font-family: inherit; font-size: 12px; font-weight: 900;
  padding: 5px 14px; border-radius: var(--rad);
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform .12s, box-shadow .12s, background .2s;
}
.md-copy:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.md-copy:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.md-copy.done { background: var(--steel); }
.md-code {
  display: none; margin: 0; background: #1B1A17; color: #EDEBE4;
  border-radius: var(--rad); padding: 14px; overflow: auto;
  font-family: var(--f-mono); font-size: 12px; line-height: 1.7;
  max-height: 240px;
}
[data-theme="dark"] .md-code { background: #000; color: #EDEBE4; }
.md-code.on { display: block; }
.md-part-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; margin-top: 12px;
  border-top: 2px dashed var(--line-soft);
}
.md-wt { font-family: var(--f-mono); font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.md-stamp {
  font-family: var(--f-mono); font-size: 10px; font-weight: 700; letter-spacing: .14em;
  color: var(--accent); border: 2px solid var(--accent);
  padding: 3px 10px; border-radius: var(--rad);
  transform: rotate(-2deg); text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px;
}
.md-stamp.oss { color: var(--steel); border-color: var(--steel); }
.md-stamps { display: inline-flex; gap: 8px; align-items: center; }
/* delivery-certificate badges: client compatibility */
.md-compat { display: inline-flex; gap: 4px; }
.md-compat i {
  font-family: var(--f-mono); font-style: normal; font-size: 9.5px; font-weight: 700;
  letter-spacing: .04em; padding: 2px 7px; border-radius: var(--rad);
  border: 1.5px solid var(--steel); color: var(--steel);
}
.md-compat i.partial {
  border-style: dashed; border-color: #B98A00; color: #A07800;
  background: rgba(232, 185, 59, .14); cursor: help;
}
[data-theme="dark"] .md-compat i.partial { color: #E8B93B; border-color: #B98A00; }

/* ---------------- ad slot (only rendered when AdSense is configured) ---------------- */
.md-ad {
  display: block;
  max-width: var(--maxw);
  margin: 8px auto 40px;
  padding: 14px 24px 18px;
  border-top: 2px dashed var(--line-soft);
  border-bottom: 2px dashed var(--line-soft);
}
.md-ad-label {
  display: block;
  margin-bottom: 10px;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .22em;
  color: var(--muted);
}

/* ---------------- prev / next ---------------- */
.md-prevnext {
  max-width: var(--maxw); margin: 40px auto 0; padding: 0 24px 70px;
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap);
}
.md-prevnext a {
  text-decoration: none; border: 2px solid var(--line); background: var(--paper);
  border-radius: var(--rad); padding: 20px 22px;
  transition: transform .15s, box-shadow .15s;
}
.md-prevnext a:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow); }
.md-prevnext a.nx { text-align: right; }
.md-prevnext span { display: block; font-family: var(--f-mono); font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: .12em; margin-bottom: 6px; }
.md-prevnext b { font-size: 19px; font-weight: 900; }

/* ---------------- license table ---------------- */
.md-table-wrap { overflow-x: auto; }
.md-lictable {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
  border: 2px solid var(--line); background: var(--paper);
}
.md-lictable th, .md-lictable td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.md-lictable th { font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; background: var(--ink); color: var(--bg); }
.md-lictable a { display: inline-flex; align-items: center; gap: 4px; }

/* ---------------- footer ---------------- */
.md-footer { border-top: 2px solid var(--line); background: var(--bg2); margin-top: 40px; }
.md-footer-in { max-width: var(--maxw); margin: 0 auto; padding: 44px 24px 30px; }
.md-footer-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.md-footer-note { font-size: 13px; color: var(--muted); font-weight: 500; margin: 0; }
.md-footer-links {
  list-style: none; margin: 0 0 26px; padding: 22px 0;
  border-top: 2px solid var(--line-soft); border-bottom: 2px solid var(--line-soft);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 18px;
}
.md-footer-links a { font-size: 13px; font-weight: 700; text-decoration: none; color: var(--muted); }
.md-footer-links a:hover { color: var(--accent); }
.md-footer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.md-copyright { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.md-footer-meta { list-style: none; margin: 0; padding: 0; display: flex; gap: 20px; }
.md-footer-meta a { font-size: 13px; font-weight: 700; }

/* ---------------- reveal (IntersectionObserver) ---------------- */
.md-reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .3, 1); }
.md-reveal.in { opacity: 1; transform: none; }

/* ---------------- responsive ---------------- */
@media (max-width: 900px) {
  .md-bento { grid-template-columns: repeat(2, 1fr); }
  .md-crate.big { grid-row: span 1; }
  .md-how { grid-template-columns: 1fr; }
  .md-headsearch { max-width: none; }
  .md-stats div { min-width: 40%; border-bottom: 2px solid var(--line); }
}
@media (max-width: 560px) {
  .md-header-in { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .md-headsearch { order: 3; flex-basis: 100%; }
  .md-nav { margin-left: auto; gap: 12px; }
  .md-nav a { display: none; }
  .md-bento { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .md-crate { min-height: 170px; }
  .md-crate.big, .md-crate.wide { grid-column: auto; grid-row: auto; }
  .md-hero { padding-top: 52px; }
  .md-partgrid { grid-template-columns: 1fr; }
  .md-prevnext { grid-template-columns: 1fr; }
  .md-sec { padding-top: 60px; }
}

/* ============================================================
   POSTAL SKIN — post-office layer on top of Postal Manifest.
   Letterpress display type, perforated edges, counter sidebar.
   ============================================================ */

/* postmark + stamp in hero (replaces decorative sparkles) */
.md-hero::before {
  content: "MAIL DEPOT ・ NIPPON ・ 2026";
  position: absolute; top: 66px; right: 56px; width: 128px; height: 128px;
  border: 2.5px solid color-mix(in srgb, var(--ink) 45%, transparent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-family: var(--f-mono); font-size: 9px; font-weight: 700; letter-spacing: .2em;
  color: color-mix(in srgb, var(--ink) 45%, transparent);
  transform: rotate(-12deg); padding: 12px; box-sizing: border-box;
  z-index: -1;
}
.md-hero::after {
  content: "¥84";
  position: absolute; top: 230px; right: 170px; width: 54px; height: 66px;
  border: 2px dashed var(--kraft); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-mono); font-size: 12px; font-weight: 700; color: var(--kraft);
  background: color-mix(in srgb, var(--kraft) 12%, transparent);
  transform: rotate(8deg); z-index: -1;
}
@media (max-width: 560px) {
  .md-hero::before, .md-hero::after { display: none; }
}

/* perforated stamp edge on footer */
.md-footer {
  border-top: none;
  background-image:
    radial-gradient(circle at 8px 0, var(--bg) 4px, transparent 4.5px),
    linear-gradient(var(--bg2), var(--bg2));
  background-size: 16px 7px, 100% 100%;
  background-repeat: repeat-x, no-repeat;
  padding-top: 8px;
}
.md-header { border-bottom-width: 3px; }

/* ---------------- counter sidebar (post-office booth) ---------------- */
.md-console { display: none; }
@media (min-width: 1440px) {
  body { padding-left: 252px; }
  .md-console {
    display: block;
    position: fixed;
    left: 14px;
    top: 14px;
    bottom: 14px;
    width: 222px;
    z-index: 60;
  }
  .md-console-shell {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 12px 16px;
    box-sizing: border-box;
    background: #26221F;
    border-radius: 10px;
    box-shadow: 6px 6px 0 rgba(38, 34, 31, .25);
    overflow-y: auto;
    scrollbar-width: none;
  }
  .md-console-shell::-webkit-scrollbar { display: none; }

  /* station name board */
  .md-console-screen {
    padding: 14px 10px;
    text-align: center;
    border: 2px solid rgba(251, 249, 243, .75);
    border-radius: 6px;
    background: rgba(255, 255, 255, .06);
  }
  .md-console-screen b {
    display: block;
    font-family: var(--f-display);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #FBF9F3;
    margin-bottom: 5px;
  }
  .md-console-screen span {
    display: block;
    font-family: var(--f-mono);
    font-size: 8px;
    letter-spacing: .24em;
    color: #A29A8D;
  }

  .md-console-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 2px;
  }
  .md-console-nav a {
    font-family: var(--f-mono);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .12em;
    color: #D2CBBB;
    text-decoration: none;
    padding: 8px 10px 8px 24px;
    position: relative;
    border-radius: 4px;
  }
  .md-console-nav a:hover { color: #FBF9F3; background: rgba(255, 255, 255, .08); }
  .md-console-nav a.on { color: var(--hazard); }
  .md-console-nav a.on::before {
    content: ">";
    position: absolute;
    left: 8px;
    animation: md-console-cursor 1s steps(2, jump-none) infinite;
  }
  @keyframes md-console-cursor { 50% { opacity: 0; } }

  .md-console-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    border: 2px solid rgba(251, 249, 243, .55);
    border-radius: 6px;
    background: rgba(255, 255, 255, .05);
  }
  .md-console-stats > b {
    font-family: var(--f-mono);
    font-size: 9px;
    letter-spacing: .3em;
    color: #A29A8D;
  }
  .md-console-stats > div {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #F2555F;
  }
  .md-console-stats svg { flex: none; }
  .md-console-stats em {
    display: block;
    font-family: var(--f-mono);
    font-size: 13px;
    font-weight: 700;
    font-style: normal;
    color: #FBF9F3;
    margin-bottom: 2px;
  }
  .md-console-stats > div span {
    font-family: var(--f-mono);
    font-size: 8px;
    letter-spacing: .14em;
    color: #A29A8D;
  }

  /* round pillar post box (丸型ポスト) */
  .md-console-pad {
    margin-top: auto;
    display: flex;
    justify-content: center;
    padding: 10px 8px 0;
  }
  .md-console-pad .postbox {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .md-console-pad .postbox i { display: block; }
  .md-console-pad .postbox .cap {
    width: 74px;
    height: 22px;
    background: #D7000F;
    border-radius: 37px 37px 4px 4px;
    box-shadow: inset 0 3px 0 rgba(255, 255, 255, .22);
  }
  .md-console-pad .postbox .pbody {
    position: relative;
    width: 58px;
    height: 76px;
    margin-top: 3px;
    background: linear-gradient(90deg, #A80010, #E4222E 32%, #D7000F 68%, #8F000C);
    border-radius: 0 0 4px 4px;
  }
  .md-console-pad .postbox .slot {
    position: absolute;
    left: 50%;
    top: 13px;
    transform: translateX(-50%);
    width: 36px;
    height: 7px;
    background: #1A1714;
    border-radius: 2px;
    box-shadow: 0 2px 0 rgba(255, 255, 255, .16);
  }
  .md-console-pad .postbox .mark {
    position: absolute;
    left: 50%;
    top: 34px;
    transform: translateX(-50%);
    font-family: var(--f-mono);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    color: #FBF9F3;
  }
  .md-console-pad .postbox .base {
    width: 44px;
    height: 10px;
    margin-top: 2px;
    background: #3A3531;
    border-radius: 2px;
  }
  .md-console-pad .postbox .base::after {
    content: "";
    display: block;
    width: 62px;
    height: 8px;
    margin: 10px 0 0 -9px;
    background: #2C2825;
    border-radius: 2px;
  }

  /* address lines */
  .md-console-speaker {
    align-self: stretch;
    height: 32px;
    margin: 4px 8px 0;
    background: repeating-linear-gradient(0deg, rgba(251, 249, 243, .35) 0 2px, transparent 2px 10px);
    border-radius: 4px;
  }
}
@media (min-width: 1440px) and (max-height: 720px) {
  .md-console-pad, .md-console-speaker { display: none; }
}

/* ---------------- reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01s !important;
  }
  html { scroll-behavior: auto; }
}
