*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── 伝統テーマ変数（デフォルト） ─── */
:root {
  --bg-deep:       #080c14;
  --bg-dark:       #0f1625;
  --bg-card:       #151e30;
  --bg-card-hover: #1c2840;
  --accent:        #c8a44a;
  --accent-light:  #e8c86a;
  --text:          #f0e6ce;
  --text-dim:      #b0a090;
  --icon-bg:       rgba(107, 63, 160, 0.2);
  --icon-border:   rgba(107, 63, 160, 0.4);
  --border:        rgba(200, 164, 74, 0.25);
  --border-hover:  rgba(200, 164, 74, 0.6);
  --shadow:        0 8px 40px rgba(0, 0, 0, 0.6);
  --header-bg:     rgba(8, 12, 20, 0.75);
  --meta-border:   rgba(200, 164, 74, 0.12);
  --card-radius:   6px;
  --icon-radius:   50%;
  --heading-font:  'Noto Serif JP', serif;
}

/* ─── モダンテーマ変数 ─── */
body[data-theme="modern"] {
  --bg-deep:       #f3f4f6;
  --bg-dark:       #ffffff;
  --bg-card:       #ffffff;
  --bg-card-hover: #f9fafb;
  --accent:        #4f46e5;
  --accent-light:  #111827;
  --text:          #111827;
  --text-dim:      #6b7280;
  --icon-bg:       rgba(79, 70, 229, 0.07);
  --icon-border:   rgba(79, 70, 229, 0.2);
  --border:        rgba(17, 24, 39, 0.1);
  --border-hover:  rgba(79, 70, 229, 0.4);
  --shadow:        0 4px 24px rgba(17, 24, 39, 0.08);
  --header-bg:     rgba(255, 255, 255, 0.85);
  --meta-border:   rgba(17, 24, 39, 0.08);
  --card-radius:   10px;
  --icon-radius:   10px;
  --heading-font:  'Inter', 'Noto Sans JP', sans-serif;
}

html, body { height: 100%; }

body {
  background-color: var(--bg-deep);
  color: var(--text);
  font-family: 'Noto Sans JP', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.3s, color 0.3s;
}

body[data-theme="modern"] {
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
}

/* ─── 背景装飾 ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(107, 63, 160, 0.18) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(200, 164, 74, 0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.3s;
}
body[data-theme="modern"]::before {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(79, 70, 229, 0.05) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(79, 70, 229, 0.03) 0%, transparent 60%);
}

/* ─── ヘッダー ─── */
header {
  position: relative;
  z-index: 10;
  padding: 24px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  transition: background 0.3s, border-color 0.3s;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-emblem {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}
.header-emblem svg { width: 100%; height: 100%; }

.header-title h1 {
  font-family: var(--heading-font);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: 0.1em;
  line-height: 1;
  transition: color 0.3s;
}
body[data-theme="modern"] .header-title h1 {
  letter-spacing: -0.01em;
}

.header-title p {
  font-size: 0.68rem;
  font-weight: 300;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  margin-top: 4px;
  text-transform: uppercase;
}

/* ─── テーマトグル ─── */
.theme-toggle {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(128, 128, 128, 0.06);
  gap: 2px;
  flex-shrink: 0;
  transition: border-color 0.3s;
}

.theme-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 5px 14px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
}
.theme-btn.active {
  background: var(--accent);
  color: #fff;
}
body[data-theme="traditional"] .theme-btn.active {
  color: var(--bg-deep);
}
.theme-btn:not(.active):hover { color: var(--text); }

/* ─── メイン ─── */
main {
  position: relative;
  z-index: 1;
  flex: 1;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 64px 24px 80px;
}

.section-heading {
  text-align: center;
  margin-bottom: 52px;
}
.section-heading .label {
  display: inline-block;
  font-size: 0.65rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  transition: color 0.3s;
}
.section-heading h2 {
  font-family: var(--heading-font);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.08em;
}
body[data-theme="modern"] .section-heading h2 {
  letter-spacing: -0.01em;
  font-weight: 600;
}
.divider {
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin: 14px auto 0;
  transition: background 0.3s;
}

/* ─── カードグリッド ─── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* ─── サービスカード ─── */
.service-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 32px 28px 28px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: background 0.25s, border-color 0.25s, transform 0.2s, box-shadow 0.25s, border-radius 0.3s;
}
.service-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}
.service-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.service-card:hover::before { opacity: 1; }

/* ─── アーカイブカード ─── */
.service-card.archived { opacity: 0.72; }
.service-card.archived .card-icon {
  filter: grayscale(0.6);
}
.service-card.archived .card-name { color: var(--text-dim); }

.archive-badge {
  position: absolute;
  top: 12px; right: 12px;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(128, 128, 128, 0.1);
  border: 1px solid rgba(128, 128, 128, 0.25);
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ─── カード内要素 ─── */
.card-icon {
  width: 48px;
  height: 48px;
  background: var(--icon-bg);
  border: 1px solid var(--icon-border);
  border-radius: var(--icon-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  font-size: 1.3rem;
  flex-shrink: 0;
  transition: background 0.3s, border-color 0.3s, border-radius 0.3s;
}

.card-name {
  font-family: var(--heading-font);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--accent-light);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  line-height: 1.5;
  transition: color 0.3s, font-family 0.3s;
}
body[data-theme="modern"] .card-name {
  letter-spacing: -0.01em;
  font-weight: 600;
}

.card-name-en {
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.card-desc {
  font-size: 0.82rem;
  line-height: 1.85;
  color: var(--text-dim);
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--meta-border);
  transition: border-color 0.3s;
}

.card-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.card-status[data-state="checking"] .status-dot {
  background: #888;
  animation: blink 1.4s ease-in-out infinite;
}
.card-status[data-state="checking"] .status-text { color: #888; }
.card-status[data-state="online"] .status-dot {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}
.card-status[data-state="online"] .status-text { color: #22c55e; }
.card-status[data-state="offline"] .status-dot { background: #ef4444; }
.card-status[data-state="offline"] .status-text { color: #ef4444; }

@keyframes blink {
  0%, 100% { opacity: 0.3; }
  50%       { opacity: 1; }
}

.card-updated {
  font-size: 0.62rem;
  color: var(--text-dim);
  opacity: 0.5;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.card-arrow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  font-size: 0.73rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  transition: color 0.3s;
}
.card-arrow svg {
  width: 15px; height: 15px;
  transition: transform 0.2s;
}
.service-card:hover .card-arrow svg { transform: translateX(4px); }

/* ─── テーマ別テキスト表示制御 ─── */
body[data-theme="traditional"] .v-modern { display: none; }
body[data-theme="modern"]      .v-classic { display: none; }

/* ─── フッター ─── */
footer {
  position: relative;
  z-index: 10;
  border-top: 1px solid var(--border);
  padding: 24px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  transition: background 0.3s, border-color 0.3s;
}
.footer-org {
  font-family: var(--heading-font);
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}
.footer-copy {
  font-size: 0.68rem;
  color: var(--text-dim);
  opacity: 0.45;
}

/* ─── レスポンシブ ─── */
@media (max-width: 600px) {
  header, footer {
    padding: 18px 20px;
    flex-direction: column;
    gap: 14px;
    text-align: center;
  }
  .header-brand { flex-direction: column; gap: 10px; text-align: center; }
  .header-title h1 { font-size: 1.4rem; }
  main { padding: 48px 16px 64px; }
  .card-grid { grid-template-columns: 1fr; }
}