/* モバイルホーム（東京臨海西ロータリークラブ） */

:root {
  --rotary-navy: #1a3568;
  --rotary-navy-dark: #142a54;
  --rotary-gold: #f7a81b;
  --rotary-gold-dark: #e09410;
  --rotary-purple: #7b4fa8;
  --rotary-purple-dark: #6a4392;
  --rotary-surface: #ffffff;
  --rotary-muted: #6b7280;
  --rotary-border: #e5e7eb;
  --rotary-tab-active: #2563eb;
  --rotary-tab-inactive: #9ca3af;
}

.page-home {
  background: var(--rotary-surface);
  color: #111827;
  min-height: 100dvh;
  padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

.page-home:not(.page-home--ready) {
  visibility: hidden;
}

.page-home .shell-header,
.page-home .shell-main {
  display: none;
}

/* ----- トップバー ----- */

.home-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(env(safe-area-inset-top, 0px) + 0.65rem) 1rem 0.5rem;
  max-width: 28rem;
  margin: 0 auto;
}

.home-topbar__left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
  min-width: 0;
}

.home-mark {
  flex-shrink: 0;
  display: block;
  width: 3.5rem;
  height: 3.5rem;
  line-height: 0;
}

.home-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.home-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--rotary-purple);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(123, 79, 168, 0.28);
  transition: background 0.15s ease;
  white-space: nowrap;
}

.home-logout:hover {
  background: var(--rotary-purple-dark);
  color: #fff;
}

.home-topbar__auth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: var(--rotary-navy);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.home-topbar__auth:hover {
  background: var(--rotary-navy-dark);
  color: #fff;
}

.home-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  min-width: 5.5rem;
  max-width: 7rem;
  text-align: center;
}

#home-user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.home-user__avatar {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 50%;
  object-fit: cover;
  background: #e5e7eb;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--rotary-border);
}

.home-user__avatar--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
}

.home-user__avatar--fallback svg {
  width: 2.8rem;
  height: 2.8rem;
}

.home-user__name {
  display: block;
  width: 100%;
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
  text-align: center;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----- メイン ----- */

.home-main {
  max-width: 28rem;
  margin: 0 auto;
  padding: 0.25rem 1.25rem 1.5rem;
  text-align: center;
}

.home-welcome {
  margin: 0 0 1rem;
  padding: 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.55;
  color: #111827;
}

/* ----- 直近イベント ----- */

.home-events {
  margin: 0 0 1.35rem;
  text-align: left;
}

.home-events__title {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--rotary-muted);
  text-align: center;
}

.home-events__legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem 0.85rem;
  margin: 0 0 0.85rem;
  padding: 0;
  list-style: none;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
}

.home-events__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.home-events__dot {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.home-events__dot--attending {
  background: #22c55e;
}

.home-events__dot--none {
  background: #ef4444;
}

.home-events__dot--absent {
  background: #eab308;
}

.home-events__list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.home-events__loading,
.home-events__empty {
  margin: 0;
  padding: 1rem 0.85rem;
  border: 1px dashed var(--rotary-border);
  border-radius: 0.75rem;
  background: #f9fafb;
  color: var(--rotary-muted);
  font-size: 0.92rem;
  text-align: center;
}

.home-event-card {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--rotary-border);
  border-radius: 0.75rem;
  background: #fff;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(17, 24, 39, 0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.home-event-card:hover {
  border-color: #c4cad4;
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.1);
  color: inherit;
  transform: translateY(-1px);
}

.home-event-card__status {
  flex-shrink: 0;
  width: 0.82rem;
  height: 0.82rem;
  margin-top: 0.28rem;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(17, 24, 39, 0.06);
}

.home-event-card__body {
  flex: 1;
  min-width: 0;
}

.home-event-card--attending {
  background: linear-gradient(135deg, #f0fdf4 0%, #fff 55%);
  border-color: #bbf7d0;
}

.home-event-card--attending .home-event-card__status {
  background: #22c55e;
}

.home-event-card--none {
  background: linear-gradient(135deg, #fef2f2 0%, #fff 55%);
  border-color: #fecaca;
}

.home-event-card--none .home-event-card__status {
  background: #ef4444;
}

.home-event-card--absent {
  background: linear-gradient(135deg, #fefce8 0%, #fff 55%);
  border-color: #fde68a;
}

.home-event-card--absent .home-event-card__status {
  background: #eab308;
}

.home-event-card__date {
  margin: 0 0 0.2rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--rotary-muted);
}

.home-event-card__name {
  margin: 0 0 0.4rem;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.35;
  color: #111827;
}

.home-event-card__meta {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: #4b5563;
}

.home-event-card__intent {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.home-event-card--attending .home-event-card__intent {
  color: #15803d;
}

.home-event-card--none .home-event-card__intent {
  color: #b91c1c;
}

.home-event-card--absent .home-event-card__intent {
  color: #a16207;
}

/* ----- アクションボタン ----- */

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.35rem;
}

.home-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.85rem 1rem;
  border-radius: 0.65rem;
  background: var(--rotary-navy);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(26, 53, 104, 0.22);
  transition: background 0.15s ease, transform 0.12s ease;
}

.home-action-btn:hover {
  background: var(--rotary-navy-dark);
  color: #fff;
  transform: translateY(-1px);
}

.home-action-btn:active {
  transform: translateY(0);
}

.home-action-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.home-action-btn--disabled {
  opacity: 0.55;
  pointer-events: none;
  box-shadow: none;
}

/* ----- リンク ----- */

.home-links {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem 1rem;
  background: #f3f4f6;
  border-radius: 0.65rem;
  text-align: left;
}

.home-links__title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
}

.home-links__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.home-links__hp {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #111827;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
}

.home-links__fb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  background: transparent;
  text-decoration: none;
  line-height: 0;
}

.home-links__fb-badge {
  display: block;
  width: auto;
  height: 3.75rem;
  max-width: 14rem;
  object-fit: contain;
}

/* ----- アカウント設定 ----- */

.home-settings {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 1rem;
  border-radius: 0.65rem;
  background: #f3f4f6;
  color: #374151;
  font-size: 0.98rem;
  font-weight: 600;
  text-decoration: none;
}

.home-settings:hover {
  background: #e5e7eb;
  color: #111827;
}

.home-settings svg {
  width: 1.15rem;
  height: 1.15rem;
}

.home-admin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3rem;
  margin-top: 0.65rem;
  padding: 0.75rem 1rem;
  border-radius: 0.65rem;
  background: #f3f4f6;
  color: #374151;
  font-size: 0.98rem;
  font-weight: 600;
  text-decoration: none;
}

.home-admin:hover {
  background: #e5e7eb;
  color: #111827;
}

.home-version {
  margin: 0.85rem 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: #374151;
}

/* ----- ボトムタブ ----- */

.home-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  max-width: 28rem;
  margin: 0 auto;
  padding: 0.35rem 0.5rem calc(env(safe-area-inset-bottom, 0px) + 0.35rem);
  background: #fff;
  border-top: 1px solid var(--rotary-border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
}

.home-tabbar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 3rem;
  padding: 0.25rem 0.15rem;
  color: var(--rotary-tab-inactive);
  font-size: 0.68rem;
  font-weight: 600;
  text-decoration: none;
}

.home-tabbar__item svg {
  width: 1.35rem;
  height: 1.35rem;
}

.home-tabbar__item--active {
  color: var(--rotary-tab-active);
}

.home-tabbar__item:hover {
  color: var(--rotary-tab-active);
}

/* デスクトップ: モバイル幅を中央に固定 */
@media (min-width: 30rem) {
  .page-home {
    background: #f3f4f6;
  }

  .page-home::before {
    content: "";
    position: fixed;
    inset: 0;
    background: #f3f4f6;
    z-index: -1;
  }

  .home-topbar,
  .home-main,
  .home-tabbar {
    background: var(--rotary-surface);
  }

  .home-tabbar {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(100%, 28rem);
    border-left: 1px solid var(--rotary-border);
    border-right: 1px solid var(--rotary-border);
  }
}
