/* 家族が見るページ。
   作り手の道具（フォトスタジオ）と違い、ここは明るく、文字を大きく。
   祖父母がスマホで開くことを想定している。 */

:root {
  --bg: #faf9f7;
  --card: #fff;
  --line: #e4e1dc;
  --ink: #23201c;
  --ink-2: #6e6862;
  --accent: #b5702a;
  --jp: "Hiragino Sans", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.7 var(--jp);
  -webkit-font-smoothing: antialiased;
}

.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; }
.out { color: var(--ink-2); font-size: 13px; text-decoration: none; }

main { padding: 20px 18px 60px; max-width: 1100px; margin: 0 auto; }

h1, h2 { margin: 0 0 14px; }
h2 { font-size: 19px; }
.year { margin-bottom: 36px; }

.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.day { text-decoration: none; color: inherit; display: block; }
.cover {
  display: block; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden;
  background: #ece9e4; border: 1px solid var(--line);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.day .label { display: block; margin-top: 8px; font-weight: 600; }
.day .n, .daytitle .n { color: var(--ink-2); font-size: 13px; font-weight: 400; }
.daytitle { font-size: 22px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cell {
  position: relative; padding: 0; border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; background: #ece9e4;
  aspect-ratio: 1; cursor: pointer;
}
.cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.play {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-size: 26px; text-shadow: 0 1px 6px rgba(0,0,0,.6);
  pointer-events: none;
}

/* 拡大 */
.viewer { position: fixed; inset: 0; background: #14110f; z-index: 20; display: flex; flex-direction: column; }
.viewer[hidden] { display: none; }
.frame { flex: 1; min-height: 0; position: relative; }
.frame img, .frame video { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); object-fit: contain; }
.frame img[hidden], .frame video[hidden] { display: none; }
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  color: #efece8; font-size: 14px;
}
.bar a { color: var(--accent); text-decoration: none; font-weight: 600; }
.close, .nav {
  position: absolute; z-index: 2; background: rgba(0,0,0,.45); color: #fff;
  border: 0; border-radius: 999px; cursor: pointer;
}
.close { top: 12px; right: 12px; width: 42px; height: 42px; font-size: 18px; }
.nav { top: 50%; transform: translateY(-50%); width: 46px; height: 60px; font-size: 30px; }
.prev { left: 8px; } .next { right: 8px; }

/* ログイン */
.login {
  max-width: 340px; margin: 10vh auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 28px 24px 24px;
}
.login h1 { font-size: 22px; }
.lead { color: var(--ink-2); font-size: 14px; margin: 0 0 20px; }
.login .pw { display: block; margin-bottom: 18px; font-size: 14px; color: var(--ink-2); }

/* 名前は打たずに選ぶ。祖父母がローマ字入力で迷わないように。 */
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; }
.pick { position: relative; }
.pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.pick span {
  display: block; text-align: center; padding: 13px 8px;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; color: var(--ink); background: #fff; cursor: pointer;
}
.pick input:checked + span {
  border-color: var(--accent); background: #fdf6ee;
  color: var(--accent); font-weight: 700;
}
.pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.login input {
  display: block; width: 100%; margin-top: 6px; padding: 12px;
  font: 17px var(--jp); border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink);
}
.login button {
  width: 100%; padding: 13px; font: 600 16px var(--jp);
  background: var(--accent); color: #fff; border: 0; border-radius: 8px; cursor: pointer;
}
.err { color: #a23b2a; font-size: 14px; margin: 0 0 14px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- 見出しのナビ ---- */
.tabs { display: flex; gap: 16px; margin-right: auto; margin-left: 20px; }
.tabs a { color: var(--ink-2); text-decoration: none; font-size: 14px; }
.tabs a:hover { color: var(--accent); }

/* ---- 絞り込み ---- */
.filters { display: flex; gap: 8px; margin: 0 0 16px; }
.filter {
  padding: 9px 18px; font: 15px var(--jp); cursor: pointer;
  background: #fff; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 999px;
}
.filter.on {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600;
}
.empty-filter { color: var(--ink-2); padding: 28px 0; }
.empty-filter[hidden] { display: none; }
.cell[hidden] { display: none; }

/* ---- お気に入りの印 ---- */
/* 一覧では押せない。開いてから押す形にして、誤操作を避ける。 */
.heart {
  position: absolute; top: 6px; right: 8px;
  font-size: 19px; color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.55);
  opacity: 0; transition: opacity 140ms ease;
  pointer-events: none;
}
.cell[data-fav="on"] .heart { opacity: 1; color: #e4604f; }

.cell .when {
  position: absolute; left: 0; bottom: 0;
  font-size: 11px; color: #fff; padding: 2px 6px;
  background: rgba(0,0,0,.5);
}

/* 拡大したときのお気に入りボタン */
.fav {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; font: 15px var(--jp); cursor: pointer;
  background: transparent; color: #cfcac4;
  border: 1px solid #45403b; border-radius: 999px;
}
.fav span:first-child { font-size: 17px; }
.fav[aria-pressed="true"] {
  color: #fff; background: #c2503f; border-color: #c2503f; font-weight: 600;
}
.fav:disabled { opacity: .5; }
.who-fav { color: #a9a39c; font-size: 13px; flex: 1; }

/* ---- お気に入りの人一覧 ---- */
.who-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.who-card {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; padding: 18px 20px; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.who-name { font-size: 17px; font-weight: 600; color: var(--ink); }
.who-n { color: var(--ink-2); font-size: 14px; }
.who-card:hover { border-color: var(--accent); }
