/* ==========================================================================
   マンマチャオ不動前店 / Mamma Ciao Fudomae — 共通のレイアウト / Shared layout
   スマホ優先(モバイルファースト)。標準はライト。ダークはヘッダーのボタンで切り替え。
   色・角丸・影は theme.css で定義し、ここでは変数(var(--…))として使うだけ。
   Mobile-first. Light by default; dark is switched on with the header button.
   Colors, radius and shadow live in theme.css; this file only uses the tokens.
   ========================================================================== */

:root {
  --header-h: 48px;
  --font: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
}

/* ---- 基本 / Base ---- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: 112.5%; /* 18px。高齢の方にも読みやすい基準。ブラウザの文字サイズ設定にも追従する / 18px base for older readers; still follows the browser's text-size setting */
  scroll-padding-top: calc(var(--header-h) + 12px);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.7 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-underline-offset: 0.2em; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

.container {
  width: min(100% - 32px, 960px);
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 8px; top: -60px;
  z-index: 20;
  padding: 10px 14px;
  background: var(--brand);
  color: var(--brand-ink);
  border-radius: 8px;
}
.skip:focus { top: 8px; }

.icon {
  width: 1.15em; height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- ヘッダー / Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-line);
  padding-top: env(safe-area-inset-top);
}
.site-header :focus-visible { outline-color: var(--header-fg); }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 48px;
  color: var(--header-fg);
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
}
/* ロゴ(白一色・横長)。メニューの残りの幅に合わせて、縦横比を保ったまま縮む。
   Wordmark logo (white, wide): shrinks to the room left by the menu, keeping its aspect ratio. */
.brand-logo { flex: 0 1 111px; min-width: 0; width: 111px; height: auto; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.header-right { display: flex; align-items: center; flex: none; gap: 2px; }
.nav { display: flex; flex: none; }

/* ライト/ダーク切替ボタン。現在と逆のモードのアイコンを出す / Theme toggle: shows the icon of the mode you would switch to */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  background: transparent;
  color: var(--header-muted);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { color: var(--header-fg); background: var(--header-hover); }
.theme-toggle .icon { width: 22px; height: 22px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.nav a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 7px;
  color: var(--header-muted);
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 8px;
}
.nav a:hover { color: var(--header-fg); background: var(--header-hover); }

/* 文字を大きくした分、スマホのヘッダーはロゴとメニューだけにする(店名は直下の見出しに大きく出る)。
   With larger text, phones show only the logo and the menu in the header (the store name is in the heading right below). */
.brand > span { display: none; }
@media (min-width: 640px) {
  .brand > span { display: inline; }
}
@media (max-width: 379px) {
  .nav a { padding: 0 6px; font-size: 0.875rem; }
}
/* 320px級の極小画面だけ、ロゴとメニューを2段に分ける / On tiny 320px screens only, the menu drops under the logo */
@media (max-width: 339px) {
  :root { --header-h: 96px; }
  .bar { flex-wrap: wrap; justify-content: center; gap: 0; }
  .brand { min-height: 48px; }
  .brand-logo { flex-basis: 111px; }
}

/* ---- ヒーロー / Hero ---- */
/* 最初の画面に8台すべてが入るよう、できるだけ低くしている / Kept low so all 8 machines fit on the first screen of a phone */
.hero {
  padding: 10px 0 12px;
  background: var(--hero-bg);
  color: var(--hero-fg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.hero :focus-visible { outline-color: var(--hero-fg); }

.hero h1 {
  font-size: clamp(1.25rem, 0.9rem + 1.8vw, 2.25rem);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.hero-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-top: 6px;
}
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badges li {
  padding: 3px 12px;
  background: var(--hero-chip-bg);
  color: var(--hero-chip-fg);
  border: 1px solid var(--hero-chip-line);
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 800;
  line-height: 1.4;
}
/* ヒーロー内の「更新」ボタンは、帯の色に合わせて白抜きにする / The refresh button inside the hero follows the band's colors */
.hero .btn-ghost { min-height: 40px; padding: 0 14px; color: var(--hero-fg); border-color: var(--hero-fg); }
.hero .btn-ghost:hover { background: var(--hero-chip-bg); color: var(--hero-chip-fg); }

/* ---- セクション共通 / Sections ---- */
.section { padding: 34px 0; }
.section--alt { background: var(--bg-alt); }
.section--status { padding: 6px 0 24px; }
/* 稼働状況の見出し: 小さめにして、最初の画面に8台を収める / A compact heading so all 8 machines still fit on the first screen */
.status-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 12px; margin-bottom: 6px; }
.section--status h2 { width: fit-content; font-size: 1.25rem; line-height: 1.4; }
/* 「10:12 現在」: 小さな文字。見出しと同じ行なので、高さは増えない / small label on the heading's row, so it adds no height */
.status-asof { margin-left: auto; color: var(--muted); font-size: 1rem; line-height: 1.4; white-space: nowrap; font-variant-numeric: tabular-nums; }
.status-asof time { color: var(--text); font-weight: 700; }
.status-asof[hidden] { display: none; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section h2 {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.5;
  background: linear-gradient(transparent 62%, var(--marker) 62%);
}

/* ---- ボタン / Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  background: var(--brand);
  color: var(--brand-ink);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.btn-line { background: var(--line-green); color: var(--line-ink); }
.btn-small { min-height: 44px; padding: 0 14px; font-size: 0.9375rem; }
.btn[disabled] { opacity: 0.6; cursor: progress; }

/* ---- 稼働状況 / Status ---- */
/* 稼働表: 最初の画面に8台すべてが入るよう、1行をコンパクトにする(スマホは1列・1号機→8号機の順)。
   1行 =「号機・機種名・状態」。運転中は状態ラベルに「あと○分」を入れるので、どの行も同じ高さ。
   Status list: compact single-line rows so all 8 machines fit on the first screen of a phone (one column, No. 1 to 8).
   A running machine shows "あと○分" inside its status label, so every row has the same height. */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
}

.card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  min-height: 46px;
  padding: 4px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card-no { grid-column: 1; font-size: 1.25rem; font-weight: 800; line-height: 1.2; white-space: nowrap; }
.card-model { grid-column: 2; color: var(--muted); font-size: 0.9375rem; line-height: 1.35; }
.card-end { display: none; }

/* 状態は「色 + アイコン + 文字」の3つで伝える / State is conveyed by color + icon + text */
.pill {
  grid-column: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.4;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* 少し広い画面(480px〜): 運転中は終了予定時刻も出す / From 480px: also show the end time of a running machine */
@media (min-width: 480px) {
  .card { grid-template-columns: auto minmax(0, 1fr) auto auto; }
  .card-end { display: block; grid-column: 3; color: var(--muted); font-size: 0.9375rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .pill { grid-column: 4; }
  /* 4つとも1行目に固定する。指定しないと、列の順序の都合で終了時刻が2行目へ落ちる / Pin all four to row 1; otherwise the end time drops to row 2 */
  .card-no, .card-model, .card-end, .pill { grid-row: 1; }
}

/* 360〜399px: 機種名の文字をわずかに小さく(15.8px)して、運転中の行も1行に収める / 360-399px: slightly smaller model name (15.8px) so a running row still fits on one line */
@media (max-width: 399px) {
  .card { column-gap: 6px; }
  .card-model { font-size: 0.875rem; }
  .pill { gap: 4px; padding: 3px 7px 3px 5px; }
}

/* 幅の狭いスマホ(〜359px): 文字が大きいので、機種名を2行目に回して窮屈にならないようにする。
   360px以上は1行のままで、入りきらない機種名だけが折り返す。
   Narrow phones (up to 359px): the model name moves to its own line so the larger text fits.
   From 360px a row stays on one line and only a model name that does not fit wraps. */
@media (max-width: 359px) {
  .card { row-gap: 0; padding: 8px 12px; }
  .card-no, .pill { grid-row: 1; }
  .card-model { grid-column: 1 / -1; grid-row: 2; }
}

.card[data-status="idle"]    { background: var(--idle-bg); border-color: var(--idle-line); }
.card[data-status="idle"] .pill { background: var(--idle-pill-bg); color: var(--idle-pill-fg); }
.card[data-status="running"] .pill { background: var(--run-bg); color: var(--run-fg); border: 1px solid var(--run-line); }
.card[data-status="error"]   { background: var(--err-bg); border-color: var(--err-line); }
.card[data-status="error"] .pill { background: var(--err-pill-bg); color: var(--err-pill-fg); }
.card[data-status="stopped"],
.card[data-status="check"],
.card[data-status="unknown"] { background: var(--off-bg); border-color: var(--off-line); }
.card[data-status="stopped"] .pill,
.card[data-status="check"] .pill,
.card[data-status="unknown"] .pill { background: var(--off-fg); color: var(--off-bg); }

@media (prefers-reduced-motion: no-preference) {
  .card[data-status="running"] .icon-spin { animation: spin 2.4s linear infinite; transform-origin: center; }
  .refreshing .icon { animation: spin 0.9s linear infinite; }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 読み込み中の骨組み。実際の行と同じ高さ(46px。〜359pxは約72px)にして、切り替わりの画面のずれを防ぐ。
   Loading skeleton: same height as the real rows (46px; ~72px up to 359px) to avoid layout shift. */
.skeleton .card { background: var(--surface-2); border-color: transparent; }
@media (max-width: 359px) {
  .skeleton .card { min-height: 72px; }
}
@media (prefers-reduced-motion: no-preference) {
  .skeleton .card { animation: pulse 1.4s ease-in-out infinite; }
}
@keyframes pulse { 50% { opacity: 0.55; } }

.status-note { margin-top: 10px; color: var(--muted); font-size: 0.9375rem; }

/* ---- 料金 / Pricing ---- */
.price-grid { display: grid; gap: 14px; }

.price-card {
  position: relative;
  overflow: hidden;
  padding: 22px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
/* 上端のアクセント線。カードの角丸で切り抜くので、両端が細くならない / Accent bar clipped by the rounded corners, so the ends do not taper */
.price-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--card-accent);
}
.price-card h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 1.25rem; }
.price-card h3 small { color: var(--muted); font-size: 0.9375rem; font-weight: 600; }

.price-table { width: 100%; margin-top: 10px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.price-table th,
.price-table td { padding: 11px 4px; border-top: 1px solid var(--line); text-align: left; }
.price-table th { padding-right: 10px; font-weight: 500; }
.price-table td { text-align: right; white-space: nowrap; }
.price-table td:first-of-type { font-weight: 800; }
.price-table td:last-of-type { width: 4.5em; color: var(--muted); font-size: 1rem; }
.price-table thead th { padding-top: 0; border-top: 0; color: var(--muted); font-size: 0.875rem; font-weight: 600; }
.price-table thead th:not(:first-child) { text-align: right; }

/* 元ページの「1回分の目安」画像 / Original 'one load' guide images */
.guide-img { margin-top: 12px; }
.guide-img img { width: 100%; max-width: 340px; height: auto; border: 1px solid var(--line); border-radius: 10px; }

/* ---- 機種の型式・容量・特長(料金カード内) / Model, capacity and features inside the price cards ---- */
.spec-model { margin-top: 2px; color: var(--muted); font-size: 1rem; font-weight: 700; letter-spacing: 0.04em; }
.spec-cap { display: flex; gap: 10px; margin-top: 12px; }
.spec-cap > div { flex: 1; padding: 8px 12px; background: var(--surface-2); border-radius: 10px; }
.spec-cap dt { color: var(--muted); font-size: 0.875rem; font-weight: 600; }
.spec-cap dd { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tags + .price-table { margin-top: 14px; }
.tags li { padding: 3px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.875rem; font-weight: 600; }

/* ---- 店舗情報 / Store info ---- */
.map {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.map iframe { width: 100%; height: 100%; border: 0; }

.map-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 18px; }

.info { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.info > div { display: grid; gap: 2px; padding: 12px 16px; }
.info > div + div { border-top: 1px solid var(--line); }
.info dt { color: var(--muted); font-size: 0.9375rem; font-weight: 600; }
.info dd { font-weight: 600; }
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.copy-msg { color: var(--idle-fg); font-size: 0.9375rem; font-weight: 700; }

/* ---- LINE ---- */
.line-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 32px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.line-card h2 { font-size: 1.25rem; background: none; }
.line-card p { margin: 4px 0 14px; color: var(--muted); font-size: 1rem; }
.line-qr { display: none; padding: 8px; background: #fff; border-radius: 10px; }

/* ---- フッター / Footer ---- */
.site-footer {
  padding: 26px 0 calc(30px + env(safe-area-inset-bottom));
  background: var(--footer-bg);
  color: var(--footer-fg);
  font-size: 0.9375rem;
  text-align: center;
}

/* ---- 広い画面 / Wider screens ---- */
@media (min-width: 640px) {
  .brand { font-size: 1.0625rem; }
  .brand-logo { flex-basis: 131px; width: 131px; }
  .nav a { padding: 0 14px; font-size: 1rem; }
  .section { padding: 52px 0; }
  .section--status { padding: 28px 0 40px; }
  .hero { padding: 40px 0 44px; }
  .price-grid { grid-template-columns: repeat(2, 1fr); align-items: start; }
}

/* 稼働表の2列: 号機・機種名・終了時刻・状態の4つが1行に収まる幅(カード1枚あたり約470px)が必要なので、約1000px以上から。
   Two-column status list: a row needs about 470px for its four parts, so only from about 1000px. */
@media (min-width: 1000px) {
  .cards { grid-template-columns: repeat(2, 1fr); gap: 6px 10px; }
}

@media (min-width: 800px) {
  .access { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; }
  .access .map-actions { margin-bottom: 0; }
  .access .info { margin-top: 0; }
}

/* マウス操作の広い画面ではQRコードを表示(スマホは自分でタップできるので不要) */
/* Show the QR code only on wide, mouse-driven screens (phones can just tap the button) */
@media (min-width: 640px) and (hover: hover) {
  .line-qr { display: block; width: 132px; height: auto; flex: none; }
}

@media print {
  .site-header, .refresh, .line-card, .map { display: none; }
}
