/* ---------- Design tokens ---------- */
:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f5f5f7;
  --color-bg-dark: #000000;
  --color-bg-blue: #e8f4fc;
  --color-text: #1d1d1f;
  --color-text-muted: #6e6e73;
  --color-text-on-dark: #f5f5f7;
  --color-text-on-dark-muted: #a1a1a6;
  --color-accent: #0071e3;
  --color-accent-hover: #0077ed;
  --color-border: #d2d2d7;

  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Hiragino Sans", "Yu Gothic", "Segoe UI", sans-serif;
  --max-width: 980px;
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #000000;
    --color-bg-alt: #111113;
    --color-bg-blue: #0d2233;
    --color-text: #f5f5f7;
    --color-text-muted: #a1a1a6;
    --color-border: #2a2a2c;
    --color-accent: #2997ff;
    --color-accent-hover: #52aeff;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* [hidden]属性は、他のクラスがdisplayを指定していても常に優先する */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container.narrow { max-width: 640px; }

a { color: var(--color-accent); text-decoration: none; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

.site.hidden { display: none; }

/* ---------- Lock screen ---------- */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: 24px;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.lock-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.lock-card {
  background: var(--color-bg-alt);
  border-radius: var(--radius);
  padding: 48px 36px;
  text-align: center;
  max-width: 340px;
  width: 100%;
}

.lock-icon { font-size: 2rem; margin: 0 0 8px; }

.lock-card h1 {
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.lock-sub {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: 0 0 24px;
}

#lockForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#lockInput {
  padding: 13px 18px;
  border-radius: 980px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
  text-align: center;
  outline: none;
}

#lockInput:focus { border-color: var(--color-accent); }

#lockForm button {
  padding: 13px 18px;
  border-radius: 980px;
  border: none;
  background: var(--color-accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 400;
  cursor: pointer;
}

#lockForm button:hover { background: var(--color-accent-hover); }

.lock-error {
  color: #ff453a;
  font-size: 0.85rem;
  margin: 14px 0 0;
  display: none;
}

.lock-error.show { display: block; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 48px;
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 60%, transparent);
}

/* blur lives on a pseudo-element (not the header itself) so that
   backdrop-filter doesn't turn .site-header into the containing block
   for the fixed-position mobile nav overlay */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--color-bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  position: relative;
  z-index: 51;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.site-nav { display: flex; gap: 28px; }

.site-nav a {
  color: var(--color-text);
  font-size: 0.78rem;
  opacity: 0.85;
}

.site-nav a:hover { opacity: 1; }

.nav-toggle {
  display: none;
  position: relative;
  z-index: 51;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--color-text);
  border-radius: 2px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  min-height: 56svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 24px;
}

.hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to bottom,
    var(--color-bg) 0%,
    color-mix(in srgb, var(--color-bg) 85%, transparent) 22%,
    color-mix(in srgb, var(--color-bg) 68%, transparent) 48%,
    color-mix(in srgb, var(--color-bg) 45%, transparent) 68%,
    var(--color-bg) 100%
  );
}

.hero-inner { position: relative; z-index: 2; max-width: 680px; }

.eyebrow {
  color: var(--color-accent);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin: 0 0 16px;
}

.eyebrow.center { text-align: center; }

.hero h1 {
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  letter-spacing: -0.02em;
}

.accent { color: var(--color-accent); }

.hero-lead {
  margin: 20px auto 0;
  max-width: 40ch;
  color: var(--color-text-muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.hero-actions {
  margin-top: 32px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 13px 26px;
  border-radius: 980px;
  font-weight: 400;
  font-size: 0.98rem;
  transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-hover); }

.btn-outline {
  border: 1px solid var(--color-border);
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-bg) 70%, transparent);
  backdrop-filter: blur(6px);
}

.btn-outline:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* ---------- Sections ---------- */
.section-light { padding: 96px 0; background: var(--color-bg); color: var(--color-text); border-top: 1px solid var(--color-border); }
.section-dark { padding: 96px 0; background: var(--color-bg-dark); color: var(--color-text-on-dark); }
.section-blue {
  padding: 96px 0;
  color: var(--color-text);
  border-top: 1px solid var(--color-border);
  background:
    radial-gradient(ellipse 70% 55% at 50% 15%, color-mix(in srgb, var(--color-accent) 22%, transparent), transparent 70%),
    linear-gradient(to bottom, var(--color-bg) 0%, var(--color-bg-blue) 45%, var(--color-bg) 100%);
}

.section-dark p,
.section-dark .trip-dates { color: var(--color-text-on-dark-muted); }
.section-dark .eyebrow { color: var(--color-accent); }

.statement {
  text-align: center;
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  letter-spacing: -0.02em;
}

.statement-sub {
  text-align: center;
  max-width: 48ch;
  margin: 16px auto 0;
  color: var(--color-text-muted);
}

/* ---------- Next trip ---------- */
.next-trip-media {
  margin-top: 48px;
  max-width: 1120px;
  margin-inline: auto;
  padding: 0 24px;
}

.next-trip-media img {
  width: 100%;
  height: min(56vw, 480px);
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  display: block;
}

.next-trip-body {
  margin-top: 40px;
  text-align: center;
}

.next-trip-body h3 { font-size: 1.5rem; margin: 6px 0 28px; }
.next-trip-body p { color: var(--color-text-muted); margin: 0 0 28px; }

/* ---------- Trip map ---------- */
.trip-map {
  margin: 48px auto 0;
  max-width: 560px;
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  overflow: hidden;
  background: var(--color-bg-alt);
}

.trip-map .leaflet-popup-content a { font-weight: 600; }

.trip-map .leaflet-control-attribution {
  font-size: 9px;
  padding: 1px 4px;
  line-height: 1.4;
}

.trip-map .map-home-control a {
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Trips ---------- */
.trip-dates {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: 0 0 4px;
}

.trip-emoji { font-size: 1.7rem; }

/* ---------- Trip detail page ---------- */
.trip-detail-body {
  margin-top: 40px;
  padding-bottom: 8px;
}

.back-link { margin-top: 32px; }

.trip-day {
  border-top: 1px solid var(--color-border);
  padding: 16px 0;
}

.trip-day > summary {
  cursor: pointer;
  font-weight: 500;
  list-style: none;
}

.trip-day > summary::-webkit-details-marker { display: none; }

.trip-day > summary::before {
  content: "＋ ";
  color: var(--color-accent);
}

.trip-day[open] > summary::before { content: "－ "; }

.trip-day ul {
  margin: 16px 0 0;
  padding: 0 0 0 1.2em;
  color: var(--color-text-muted);
}

.trip-day li { margin-bottom: 6px; }

.trip-subitem summary {
  cursor: pointer;
  list-style: none;
  color: var(--color-text-muted);
}

.trip-subitem summary::-webkit-details-marker { display: none; }

.trip-subitem summary::after {
  content: " +";
  color: var(--color-accent);
  font-weight: 600;
}

.trip-subitem[open] summary::after { content: " −"; }

.trip-subitem p {
  margin: 6px 0 0;
  font-size: 0.9em;
}

.trip-travel-time {
  list-style: none;
  font-size: 0.85em;
}

.trip-travel-time .trip-subitem {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 6px;
}

.trip-travel-time .trip-subitem p {
  margin: 0;
}

.trip-memo {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

/* ---------- Photos ---------- */
.photo-toolbar {
  margin-top: 40px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.photo-toolbar .btn { padding: 8px 18px; font-size: 0.85rem; }

.photo-toolbar-selecting {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px 12px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.btn-danger { border: none; background: #e0393e; color: #fff; }
.btn-danger:hover { background: #c22e33; }
.btn-danger:disabled { opacity: 0.5; cursor: default; }

button.btn { cursor: pointer; font: inherit; }

.photo-year-filter {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.year-tab {
  padding: 6px 16px;
  border-radius: 980px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 0.8rem;
  cursor: pointer;
}

.year-tab.active { border-color: var(--color-accent); background: var(--color-accent); color: #fff; }
.year-tab:hover:not(.active) { border-color: var(--color-accent); color: var(--color-accent); }

.photo-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
}

.memories-cta {
  margin-top: 24px;
  text-align: center;
}

.photo {
  position: relative;
  aspect-ratio: 1;
  border-radius: 2px;
  border: none;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease;
}

.photo:hover { transform: scale(1.03); }

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo.selected { outline: 3px solid var(--color-accent); outline-offset: -3px; }

.photo.selected::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-empty {
  margin-top: 24px;
  text-align: center;
}

.hint {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ---------- 写真アップロード ---------- */
.upload-status {
  margin-top: 12px;
  text-align: right;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  min-height: 1.2em;
}

.upload-status.error { color: #e0393e; }

/* ---------- Lightbox(iPhone写真アプリ風の全画面ビューア) ---------- */
/* 写真は常に画面いっぱい(フルブリード)に表示し、閉じるボタン/日時/ゴミ箱は
   その上に浮かせたオーバーレイにする(iPhoneの写真アプリと同じ構造)。
   これにより写真が上下左右とも画面中央に来る(ヘッダー分のレイアウト幅を食わない)。 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  background: #fff;
  touch-action: none;
  overscroll-behavior: none;
}

.lightbox.open { display: block; }

.lightbox-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

.lightbox-track {
  display: flex;
  height: 100%;
  gap: 12px;
}

.lightbox-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
}

.lightbox-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 8px;
  padding: max(16px, env(safe-area-inset-top, 16px)) 16px 16px;
  pointer-events: none;
}

.lightbox-close {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #f2f2f2;
  color: #1d1d1f;
  font-size: 1.7rem;
  line-height: 1;
  padding-bottom: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-datetime {
  pointer-events: auto;
  justify-self: center;
  padding: 9px 18px;
  border-radius: 980px;
  background: #f2f2f2;
  color: #1d1d1f;
  font-size: 0.85rem;
  text-align: center;
  white-space: nowrap;
}

/* ゴミ箱と削除確認ボタンは画面右下、同じ位置に重ねて表示(切り替え式) */
.lightbox-trash,
.lightbox-delete-confirm {
  position: absolute;
  right: 16px;
  bottom: max(20px, env(safe-area-inset-bottom, 20px));
  z-index: 2;
  border: none;
  cursor: pointer;
}

.lightbox-trash {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(242, 242, 242, 0.95);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  color: #1d1d1f;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-delete-confirm {
  padding: 14px 22px;
  border-radius: 14px;
  background: rgba(142, 142, 147, 0.92);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  color: #ff453a;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 32px 0;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  background: var(--color-bg-alt);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .nav-toggle { display: flex; }

  .site-nav {
    position: fixed;
    inset: 0;
    z-index: 49;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  }

  .site-nav.open { opacity: 1; visibility: visible; transform: translateY(0); }

  .site-nav a { font-size: 1.5rem; opacity: 1; }

  .hero { padding: 88px 20px 56px; }
  .section-light, .section-dark { padding: 64px 0; }
  .next-trip-media img { height: 240px; }
}
