/* ============================================================
   羽地大川土地改良区 GISポータル - スタイルシート
   参考: 沖縄水土里GIS (midori-info)
   ============================================================ */

:root {
  color-scheme: light;
  --font-sans: "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* カラーパレット */
  --color-primary: #0d5c4e;
  --color-primary-light: #1a7a6a;
  --color-primary-dark: #0a4a3e;
  --color-secondary: #0a4a7a;
  --color-secondary-light: #1560a0;
  --color-teal: #0e7490;
  --color-teal-light: #0891b2;

  /* 背景・テキスト */
  --color-bg: #f0f4f8;
  --color-surface: #ffffff;
  --color-text: #1a2530;
  --color-text-muted: #4a5d6e;
  --color-text-faint: #7a8fa0;
  --color-border: #d0dae3;
  --color-border-light: #e4ecf1;

  /* バッジ色 */
  --color-badge-blue: #1e4d8c;
  --color-badge-blue-bg: #dbeafe;
  --color-badge-teal: #0d6e80;
  --color-badge-teal-bg: #cffafe;
  --color-badge-green: #0f6b41;
  --color-badge-green-bg: #dcfce7;
  --color-badge-gray: #4a5668;
  --color-badge-gray-bg: #e9eef3;

  /* シャドウ */
  --shadow-sm: 0 1px 3px rgba(10, 30, 50, 0.08), 0 1px 2px rgba(10, 30, 50, 0.06);
  --shadow-md: 0 4px 16px rgba(10, 30, 50, 0.10), 0 2px 6px rgba(10, 30, 50, 0.06);
  --shadow-lg: 0 10px 36px rgba(10, 30, 50, 0.14), 0 4px 12px rgba(10, 30, 50, 0.08);
  --shadow-card-hover: 0 16px 48px rgba(10, 30, 50, 0.16), 0 4px 16px rgba(10, 30, 50, 0.10);

  /* アニメーション */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* 角丸 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

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

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ============================================================
   背景デコレーション
   ============================================================ */
.bg-decoration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
}

.bg-circle--1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #0d5c4e 0%, transparent 70%);
  top: -200px;
  right: -200px;
  animation: float-slow 20s ease-in-out infinite alternate;
}

.bg-circle--2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #0a4a7a 0%, transparent 70%);
  bottom: -150px;
  left: -150px;
  animation: float-slow 25s ease-in-out infinite alternate-reverse;
}

.bg-circle--3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #0e7490 0%, transparent 70%);
  top: 40%;
  left: 30%;
  animation: float-slow 18s ease-in-out infinite alternate;
}

@keyframes float-slow {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 20px) scale(1.05); }
}

/* ============================================================
   メインシェル
   ============================================================ */
.shell {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 32px 20px 48px;
}

/* ============================================================
   ポータルラッパー
   ============================================================ */
.portal-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 860px;
  width: 100%;
  overflow: hidden;
}

/* ============================================================
   ヘッダー
   ============================================================ */
.portal-header {
  background: linear-gradient(135deg, #0d5c4e 0%, #0a4a7a 60%, #0e5a80 100%);
  padding: 36px 40px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  overflow: hidden;
}

.portal-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at top right, rgba(255,255,255,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at bottom left, rgba(14,116,144,0.3) 0%, transparent 50%);
  pointer-events: none;
}

.portal-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

.header-emblem {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.25));
  animation: emblem-pulse 4s ease-in-out infinite;
}

@keyframes emblem-pulse {
  0%, 100% { filter: drop-shadow(0 4px 12px rgba(0,0,0,0.25)); }
  50%       { filter: drop-shadow(0 6px 20px rgba(14,116,144,0.4)); }
}

.header-text {
  position: relative;
  z-index: 1;
}

.portal-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.portal-subtitle {
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
  letter-spacing: 0.02em;
}

/* ============================================================
   イントロ文
   ============================================================ */
.portal-intro {
  padding: 24px 40px 0;
  border-bottom: 1px solid var(--color-border-light);
  padding-bottom: 20px;
  margin-bottom: 0;
}

.portal-intro p {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.7;
}

/* ============================================================
   アプリグリッド
   ============================================================ */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  padding: 28px 40px;
}

@media (max-width: 680px) {
  .apps-grid {
    grid-template-columns: 1fr;
    padding: 20px 20px;
  }
}

/* ============================================================
   アプリカード
   ============================================================ */
.app-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  position: relative;
  overflow: hidden;
}

.app-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0;
  transition: opacity var(--transition-base);
}

#app-card-h28::before {
  background: linear-gradient(90deg, #1e4d8c, #2563eb);
}

#app-card-r02::before {
  background: linear-gradient(90deg, #0d5c4e, #0e7490);
}

.app-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(13, 92, 78, 0.2);
}

.app-card:hover::before {
  opacity: 1;
}

/* カードヘッダー */
.app-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.app-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.app-card:hover .app-icon {
  transform: scale(1.08) rotate(-2deg);
}

.app-icon--blue {
  background: linear-gradient(135deg, #1e4d8c, #2563eb);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.app-icon--teal {
  background: linear-gradient(135deg, #0d5c4e, #0e7490);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(14, 116, 144, 0.3);
}

.app-icon--green {
  background: linear-gradient(135deg, #166534, #16a34a);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.app-card-title-block {
  flex: 1;
  min-width: 0;
}

.app-version-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: #1e4d8c;
  color: #ffffff;
  margin-bottom: 5px;
  letter-spacing: 0.02em;
}

.app-version-badge--teal {
  background: #0d5c4e;
}

.app-version-badge--green {
  background: #166534;
}

.app-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 3px;
  line-height: 1.3;
}

.app-card-subtitle {
  font-size: 0.75rem;
  color: var(--color-text-faint);
  margin: 0;
  line-height: 1.4;
  word-break: break-all;
}

/* カード本文 */
.app-card-desc {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.65;
  margin: 0;
}

/* メタバッジ */
.app-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-badge {
  font-size: 0.73rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.01em;
}

.meta-badge--blue {
  background: var(--color-badge-blue-bg);
  color: var(--color-badge-blue);
}

.meta-badge--teal {
  background: var(--color-badge-teal-bg);
  color: var(--color-badge-teal);
}

.meta-badge--green {
  background: var(--color-badge-green-bg);
  color: var(--color-badge-green);
}

.meta-badge--gray {
  background: var(--color-badge-gray-bg);
  color: var(--color-badge-gray);
}

/* 用途テキスト */
.app-card-use {
  font-size: 0.84rem;
  color: #1e4d6e;
  background: linear-gradient(to right, #f0f7f5, #eef5fa);
  border-left: 3px solid var(--color-primary);
  padding: 10px 12px;
  margin: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.6;
}

/* アクションボタン */
.app-card-actions {
  margin-top: auto;
}

.button-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.button-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition-fast);
}

.button-link:hover::after {
  background: rgba(255,255,255,0.1);
}

.app-link {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(13, 92, 78, 0.30);
  width: 100%;
}

.app-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(13, 92, 78, 0.38);
}

.app-link:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(13, 92, 78, 0.25);
}

.launch-icon {
  font-size: 0.8rem;
  opacity: 0.85;
}

.external-label {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.7;
  margin-left: auto;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ============================================================
   注意事項ボックス
   ============================================================ */
.notice-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 40px 28px;
  background: #eef6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 14px 18px;
}

.notice-icon {
  font-size: 1rem;
  color: #2563eb;
  flex-shrink: 0;
  margin-top: 1px;
  font-style: normal;
}

.notice-box p {
  font-size: 0.86rem;
  color: #1e3a5f;
  margin: 0;
  line-height: 1.6;
}

@media (max-width: 680px) {
  .notice-box {
    margin: 0 20px 24px;
  }
}

/* ============================================================
   フッター
   ============================================================ */
.portal-footer {
  border-top: 1px solid var(--color-border-light);
  padding: 20px 40px;
  background: #f8fafc;
}

.footer-org {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin: 0 0 8px;
}

.footer-disclaimer {
  font-size: 0.78rem;
  color: var(--color-text-faint);
  margin: 0;
  line-height: 1.6;
}

@media (max-width: 680px) {
  .portal-header {
    padding: 24px 20px 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .portal-title {
    font-size: 1.4rem;
  }

  .portal-intro {
    padding: 16px 20px;
  }

  .portal-footer {
    padding: 16px 20px;
  }

  .app-card {
    padding: 18px;
  }
}

/* ============================================================
   フォーカス・アクセシビリティ
   ============================================================ */
.button-link:focus-visible {
  outline: 3px solid #8ac4ff;
  outline-offset: 2px;
}

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

/* ============================================================
   ゲートパネル（未ログイン）
   ============================================================ */
.gate-wrapper {
  max-width: 480px !important;
}

.gate-body {
  padding: 32px 40px 36px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.gate-icon {
  margin-bottom: 4px;
}

.gate-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

.gate-desc {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.75;
  margin: 0;
}

.gate-actions {
  width: 100%;
  max-width: 280px;
  margin-top: 6px;
}

.gate-actions .button-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: #fff;
  font-size: 0.96rem;
  font-weight: 700;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(13,92,78,0.30);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.gate-actions .button-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(13,92,78,0.38);
}

.gate-message {
  font-size: 0.84rem;
  min-height: 1.4em;
  margin: 0;
}

.gate-message[data-kind="error"] { color: #b3261e; }

/* ============================================================
   ログインユーザー表示
   ============================================================ */
.user-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #eef5f3;
  border: 1px solid #c9ded9;
  border-radius: 6px;
  color: #31546d;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  margin: 0 40px 0;
  padding: 10px 14px;
}

.user-summary::before {
  content: "👤";
  font-size: 1rem;
  flex-shrink: 0;
}

.user-summary[data-kind="error"] {
  background: #fdf2f2;
  border-color: #f5c2c2;
  color: #b3261e;
}

/* portal-intro の上マージン調整（user-summaryがある場合） */
.portal-intro {
  margin-top: 14px !important;
}

/* ============================================================
   ログアウトボタン
   ============================================================ */
.button-logout {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 20px;
  color: rgba(255,255,255,0.88);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 16px;
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.button-logout:hover {
  background: rgba(255,255,255,0.22);
  color: #ffffff;
}

@media (max-width: 680px) {
  .gate-body {
    padding: 24px 20px 28px;
  }
  .user-summary {
    margin: 0 20px 0;
  }
}


/* ============================================================
   新マップアプリ案内バナー
   ============================================================ */
.new-app-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 40px 20px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #0d5c4e1a 0%, #0a4a7a1a 100%);
  border: 1px solid rgba(13, 92, 78, 0.25);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.new-app-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  background: linear-gradient(135deg, #0d5c4e, #0a4a7a);
  color: #ffffff;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.new-app-banner p {
  font-size: 0.86rem;
  color: var(--color-text-muted);
  margin: 0;
  flex: 1;
}

.new-app-link {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
  padding: 6px 12px;
  border: 1px solid var(--color-primary);
  border-radius: 20px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.new-app-link:hover {
  background: var(--color-primary);
  color: #ffffff;
}

@media (max-width: 680px) {
  .new-app-banner {
    margin: 0 20px 16px;
  }
}

