@charset "utf-8";

/* ===============================
   テラス 自動見積り - 完全版スタイル
   =============================== */

/* -------- CSSカスタムプロパティ -------- */
body{
  width: 1440px;
}
:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --ink: #1b1f24;
  --ink-muted: #5a6473;
  --brand: #2563eb;         /* Indigo/Blue */
  --brand-strong: #1e40af;
  --accent: #14b8a6;        /* Teal */
  --danger: #ef4444;
  --warning: #f59e0b;
  --ok: #10b981;
  --border: #e2e8f0;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.06);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --gap-xs: 6px;
  --gap-sm: 10px;
  --gap-md: 16px;
  --gap-lg: 24px;
  --gap-xl: 36px;
  --container: 1080px;
  --focus: 3px solid #8ab4ff;
}

/* -------- リセット + ベース -------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Inter", "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

img, svg, video { display: block; max-width: 100%; height: auto; }

h1, h2, h3 {
  margin: 0 0 var(--gap-md);
  line-height: 1.25;
  font-weight: 700;
}

h1 { 
  font-size: clamp(1.6rem, 1.1rem + 2.2vw, 2.4rem); 
  margin-top: 300px;
  text-align: center;
}
h2 { font-size: clamp(1.3rem, 1rem + 1.2vw, 1.5rem); }
h3 { font-size: clamp(1.05rem, 0.95rem + 0.6vw, 1.25rem); }

p { margin: 0 0 var(--gap-md); color: var(--ink-muted); }

/* -------- アクセシビリティ -------- */
:focus-visible { outline: var(--focus); outline-offset: 2px; }

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

/* -------- レイアウト -------- */
.main {
  max-width: var(--container);
  margin: 40px auto 80px;
  padding: 0 var(--gap-lg);
}

.carport-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(18px, 2vw, 28px);
}

.carport-section > h2 {
  color: var(--brand-strong);
  display: flex;
  align-items: center;
  gap: 10px;
}

.carport-section > h2::before {
  content: "";
  width: 8px; height: 24px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--brand) 0%, var(--accent) 100%);
}

/* -------- 画像エリア -------- */
.image-area {
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 0 0 var(--gap-xl);
  position: relative;
  aspect-ratio: 16 / 9;
}

.image-area img {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.02);
}

/* -------- ラジオグループ（カード選択） -------- */
h3 + .radio-group { margin-top: var(--gap-sm); }

.radio-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--gap-md);
  margin: 0 0 var(--gap-xl);
}

.select-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
  user-select: none;
}

.select-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(17, 24, 39, 0.08);
  border-color: #d6dde8;
}

.select-card input[type="radio"] {
  position: absolute;
  inline-size: 1px; block-size: 1px;
  inset-inline-start: -10000px; /* 視覚的に非表示 */
}

/* 選択中の視覚表現（フォールバック：内側要素を強調） */
.select-card input[type="radio"]:checked + .select-card__media {
  outline-offset: -2px;
  filter: saturate(1.05) contrast(1.05);
}

.select-card input[type="radio"]:checked + .select-card__media + .select-card__label {
  color: var(--brand-strong);
  font-weight: 700;
}

/* 最新ブラウザ向け：カード全体を強調 */
@supports selector(label:has(input:checked)) {
  .select-card:has(input:checked) {
    border-color: color-mix(in oklab, var(--brand) 40%, var(--border));
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand) 14%, transparent), var(--shadow);
  }
}

/* キーボードフォーカス可視化 */
.select-card input[type="radio"]:focus-visible + .select-card__media {
  outline: var(--focus);
  outline-offset: -2px;
}

/* メディアとラベル */
.select-card__media {
  width: 20%;
  margin: 0 auto;
  border-radius: 10px;
  background: #eef2ff;
  object-fit: cover;
}

.select-card__media2 {
  width: 40%;
  margin: 0 auto;
  border-radius: 10px;
  background: #eef2ff;
  object-fit: cover;
}

.select-card__media img {
  width: 25%;
  height: 100%;
  margin: 40px auto;
}

.select-card__label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-pill);
  background: #f3f6fb;
  color: #2a3342;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* 必須グループの未選択警告（data-required） */
.radio-group[data-required="true"][data-invalid="true"] .select-card {
  border-color: color-mix(in oklab, var(--danger) 40%, var(--border));
}

/* -------- 注意書き -------- */
.note .cautionary-note {
  margin-top: -4px;
  background: linear-gradient(180deg, #fff7e6 0%, #fff4d6 100%);
  color: #7a4a00;
  border: 1px solid #ffe5b2;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(122, 74, 0, 0.06) inset;
  font-size: 0.95rem;
}

/* -------- モーダル -------- */
#price-modal.hidden { display: none; }

#price-modal {
  position: fixed;
  inset: 0;
  background: color-mix(in oklab, #000 60%, transparent);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 1000;
  animation: overlayFade 200ms ease-out;
}

.modal__inner {
  width: min(500px, 96vw);
  background: var(--surface);
  color: var(--ink);
  border-radius: clamp(14px, 1.5vw, 18px);
  border: 1px solid var(--border);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
  padding: clamp(18px, 3vw, 28px);
  transform: translateY(8px);
  animation: modalIn 260ms cubic-bezier(.2,.75,.2,1) forwards;
}

.best-price {
  display: inline-block;
  background: conic-gradient(from 240deg at 50% 50%, #f97316, #f59e0b, #fde047, #f97316);
  color: #2a1500;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 10px rgba(251, 146, 60, 0.3);
  margin-bottom: 10px;
  font-size: 0.9rem;
  position: relative;
  left: 35%;
}

#estimate-title {
  margin-bottom: 6px;
}

.final-price {
  font-size: clamp(1.05rem, 0.9rem + 1.1vw, 1.4rem);
  color: var(--ink);
  background:
    radial-gradient(200px 24px at 0% 100%, rgba(37,99,235,0.08), transparent 60%),
    radial-gradient(200px 24px at 100% 0%, rgba(20,184,166,0.08), transparent 60%);
  border-radius: var(--radius-md);
  border: 1px dashed color-mix(in oklab, var(--brand) 30%, var(--border));
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
}

#price-output {
  font-size: 1.5em;
  font-variant-numeric: tabular-nums;
  color: var(--brand-strong);
  font-weight: 800;
}

/* 選択サマリー */
.selection-summary {
  margin-top: var(--gap-lg);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fbfdff 0%, #ffffff 70%);
}

.selection-summary h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--ink);
}

.selection-summary p {
  font-size: 16px;
  margin: 2px 0;
  color: var(--ink-muted);
}

.selection-summary .note {
  margin-top: 8px;
  color: #0f5132;
  background: #d1fae5;
  border: 1px solid #a7f3d0;
  padding: 6px 8px;
  border-radius: 8px;
  display: inline-block;
  position: relative;
  left: 30%;
}

/* モーダルのアクション */
.modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;

  margin-top: 10px;
}

/* -------- ボタン -------- */
.contact-button,
.close-button,
.reestimate-button {
  appearance: none;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 100ms ease, box-shadow 140ms ease, background 140ms ease, color 140ms ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
  width: 250px;
  height: 80px;
  font-size: 24px;
}

.contact-button {
  --btn: var(--brand);
  --btn-ink: #ffffff;
  background: linear-gradient(180deg, color-mix(in oklab, var(--brand) 86%, #ffffff) 0%, var(--brand) 100%);
  color: var(--btn-ink);
  box-shadow: 0 6px 18px color-mix(in oklab, var(--brand) 28%, transparent);
  margin-top: var(--gap-md);
  width: 200px;
  height: 50px;
  font-size: 20px;
  position: relative;
  left: 27%;
}

.contact-button:hover { transform: translateY(-1px); }
.contact-button:active { transform: translateY(0); box-shadow: none; }

.close-button {
  background: #f96767;
  color: #ffffff;
}

.close-button:hover {
  background: #e9eef7;
}

.reestimate-button {
  background: #111827;
  color: #ffffff;
}

.reestimate-button:hover {
  background: #0b1220;
}

/* -------- ユーティリティ -------- */
.hidden { display: none !important; }

.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "ss01" 1;
}

/* -------- アニメーション -------- */
@keyframes overlayFade {
  from { opacity: 0; } to { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* -------- レスポンシブ -------- */
@media (max-width: 900px) {
  .radio-group { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .select-card { min-height: 150px; }
}

@media (max-width: 640px) {
  .main { margin: 24px auto 56px; padding: 0 16px; }
  .radio-group { grid-template-columns: repeat(2, 1fr); }
  .select-card { min-height: 140px; padding: 10px; }
  .modal__inner { width: 96vw; }
}

/* -------- ダークモード（自動） -------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b111a;
    --surface: #0f1724;
    --ink: #edf2f7;
    --ink-muted: #a6b3c6;
    --border: #1f2a3a;
    --shadow: 0 2px 14px rgba(0, 0, 0, 0.4), 0 16px 36px rgba(0, 0, 0, 0.35);
  }

  body {
    background: radial-gradient(1200px 600px at 20% 0%, #0d1b2a 0%, #0b111a 60%, #0b111a 100%), var(--bg);
  }

  .carport-section {
    background: linear-gradient(180deg, #0f1724 0%, #0d1520 100%);
    border-color: var(--border);
  }

  .image-area { background: #0b1220; }

  .select-card {
    background: linear-gradient(180deg, #121a29 0%, #0f1724 100%);
    border-color: var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  }

  .select-card__label { background: #122032; color: #dbe7ff; }

  .note .cautionary-note {
    background: linear-gradient(180deg, #3b2f00 0%, #2a2000 100%);
    color: #ffe8b3;
    border-color: #5b4700;
  }

  #price-modal { background: color-mix(in oklab, #000 70%, transparent); }

  .modal__inner {
    background: #0f1724;
    border-color: var(--border);
  }

  .contact-button { box-shadow: 0 8px 26px color-mix(in oklab, var(--brand) 36%, transparent); }
  .close-button { background: #172132; color: #e2e8f0; }
  .close-button:hover { background: #1b2740; }
}

/* -------- 省アニメ設定への配慮 -------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

/* -------- 印刷 -------- */
@media print {
  .image-area { break-inside: avoid; }
  #price-modal { display: none !important; }
  .contact-button, .close-button, .reestimate-button { filter: grayscale(1); }
}

