/* Photo calendar — 和風 / 侘び寂び base styles.
   Off-white paper background, sumi text, deep crimson accent.
   All theme-able knobs are CSS custom properties on :root so the
   Tweaks panel can override them via inline style on the app shell. */

:root {
  --paper: #f4ecdb;          /* warm off-white, like washi */
  --paper-2: #ece2cc;        /* slight darker for cards / mats */
  --ink: #1a1612;            /* sumi black, slightly warm */
  --ink-2: #4a4238;          /* secondary text */
  --ink-3: #8a7f6e;          /* tertiary / numerals on empty cells */
  --rule: rgba(26, 22, 18, 0.18);
  --rule-soft: rgba(26, 22, 18, 0.08);
  --accent: #9c2a2a;         /* 朱 — deep crimson */
  --serif-jp: "Shippori Mincho", "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --serif-en: "Cormorant Garamond", "EB Garamond", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", "SFMono-Regular", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif-jp);
  font-feature-settings: "palt";
  min-height: 100vh;
  /* Subtle paper grain — radial gradient + tiny noise via SVG inline */
  background-image:
    radial-gradient(ellipse at top left, rgba(255,255,255,0.4), transparent 60%),
    radial-gradient(ellipse at bottom right, rgba(120, 90, 50, 0.06), transparent 60%);
}

button { font-family: inherit; color: inherit; }

/* ── App shell ────────────────────────────────────────────────────────── */

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 56px 64px 96px;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 18px;
  margin-bottom: 48px;
  border-bottom: 0.5px solid var(--rule);
}
.topbar-title {
  font-family: var(--serif-en);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 0.04em;
  margin: 0;
}
.topbar-title em {
  font-family: var(--serif-jp);
  font-style: normal;
  font-size: 16px;
  letter-spacing: 0.3em;
  margin-left: 14px;
  color: var(--ink-2);
}
.topbar-meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-btn {
  appearance: none;
  background: transparent;
  border: 0.5px solid currentColor;
  padding: 3px 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--ink-3);
  opacity: 0.4;
  transition: opacity 0.2s;
}
.admin-btn:hover { opacity: 0.9; }
.admin-btn.is-admin { color: var(--accent); opacity: 0.85; }

/* ── Hero (today) ─────────────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 56px;
  margin-bottom: 80px;
  align-items: center;
}

.hero-meta { position: relative; padding-top: 8px; }

.hero-date-en {
  display: flex;
  align-items: baseline;
  gap: 18px;
  font-family: var(--serif-en);
}
.hero-month-en {
  font-style: italic;
  font-size: 38px;
  font-weight: 400;
  letter-spacing: 0.01em;
}
.hero-day-en {
  font-size: 96px;
  font-weight: 400;
  line-height: 0.9;
  font-feature-settings: "lnum";
}

.hero-rule {
  width: 64px;
  height: 1px;
  background: var(--accent);
  margin: 22px 0 24px;
}

.hero-vert {
  position: absolute;
  top: 14px;
  right: 0;
  writing-mode: vertical-rl;
  text-orientation: upright;
  display: flex;
  flex-direction: column-reverse;
  gap: 14px;
}
.hero-vert-jp {
  font-size: 22px;
  letter-spacing: 0.4em;
  color: var(--ink);
}
.hero-vert-en {
  writing-mode: horizontal-tb;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  text-transform: uppercase;
  align-self: flex-end;
  white-space: nowrap;
  transform: translateX(2px);
}

.hero-text { max-width: 460px; padding-right: 20px; }

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.hero-subject {
  font-family: var(--serif-en);
  font-style: italic;
  font-weight: 400;
  font-size: 32px;
  letter-spacing: 0.005em;
  line-height: 1.2;
  margin: 0 0 14px;
}
.hero-loc {
  font-family: var(--serif-en);
  font-size: 15px;
  color: var(--ink-2);
  margin-bottom: 22px;
  letter-spacing: 0.02em;
}
.hero-note {
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink);
  margin: 0 0 32px;
  text-wrap: pretty;
}
.hero-cta {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 0.5px solid var(--ink);
  padding: 6px 0;
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: gap 0.2s ease, color 0.2s ease;
}
.hero-cta:hover { gap: 18px; color: var(--accent); border-bottom-color: var(--accent); }
.hero-cta-arr { font-family: var(--serif-jp); }

/* hero image */
.hero-img-col { position: relative; }
.hero-empty {
  aspect-ratio: 3 / 2;
  background: var(--paper-2);
  border: 0.5px dashed var(--rule);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.hero-empty-num {
  font-family: var(--serif-en);
  font-size: 140px;
  color: var(--ink-3);
  line-height: 1;
  font-feature-settings: "lnum";
}
.hero-empty-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.hero-img-cap {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  text-transform: uppercase;
}

/* ── Placeholder image (the striped SVG) ─────────────────────────────── */

.ph-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--paper-2);
}
.ph-wrap svg {
  display: block;
  width: 100%;
  height: 100%;
}
.ph-label {
  position: absolute;
  bottom: 10px;
  left: 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  background: rgba(244, 236, 219, 0.86);
  padding: 3px 8px;
  border-radius: 1px;
  letter-spacing: 0.06em;
}

/* ── Month navigation ────────────────────────────────────────────────── */

.month-nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 0.5px solid var(--rule);
}
.month-nav-title {
  display: flex;
  align-items: baseline;
  gap: 20px;
  font-family: var(--serif-en);
}
.month-nav-month {
  font-size: 44px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.005em;
}
.month-nav-jp {
  font-family: var(--serif-jp);
  font-size: 16px;
  letter-spacing: 0.3em;
  color: var(--ink-2);
}
.month-nav-count {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.month-nav-arrows { display: flex; gap: 4px; }
.month-nav-arr {
  appearance: none;
  background: transparent;
  border: 0.5px solid var(--rule);
  width: 38px;
  height: 38px;
  border-radius: 0;
  font-family: var(--serif-jp);
  font-size: 16px;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.month-nav-arr:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ── Grid: squares ───────────────────────────────────────────────────── */

.grid-squares {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}

.cell {
  position: relative;
  appearance: none;
  border: 0;
  padding: 0;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  background: var(--paper-2);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.cell:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(26,22,18,0.12); }
.cell-empty {
  background: transparent;
  border: 0.5px solid var(--rule-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cell-empty:hover {
  background: var(--paper-2);
  border-color: var(--rule);
  transform: translateY(-2px);
}
.cell-num {
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-family: var(--serif-en);
  font-size: 12px;
  color: var(--paper);
  font-feature-settings: "lnum";
  text-shadow: 0 1px 4px rgba(0,0,0,0.35);
  letter-spacing: 0.02em;
}
.cell-num-empty {
  position: static;
  font-size: 22px;
  color: var(--ink-3);
  text-shadow: none;
  font-style: italic;
  letter-spacing: 0;
}
.cell.is-today {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.cell.is-today::after {
  content: "TODAY";
  position: absolute;
  top: 6px;
  left: 6px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--paper);
  background: var(--accent);
  padding: 2px 5px;
}
.cell-empty.is-today .cell-num-empty { color: var(--accent); }
.cell-pad { background: transparent; pointer-events: none; }

/* ── Grid: calendar ─────────────────────────────────────────────────── */

.grid-cal-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--ink-3);
  text-align: center;
}
.grid-cal-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

/* ── Grid: list ─────────────────────────────────────────────────────── */

.grid-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.row {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 0.5px solid var(--rule-soft);
  display: grid;
  grid-template-columns: 56px 64px 1fr 28px;
  align-items: center;
  gap: 22px;
  padding: 14px 4px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}
.row:hover { background: var(--paper-2); }
.row.is-today { border-bottom-color: var(--accent); }
.row-num {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 28px;
  color: var(--ink);
  font-feature-settings: "lnum";
}
.row.row-empty .row-num { color: var(--ink-3); }
.row-thumb { width: 64px; height: 64px; }
.row-thumb-empty {
  display: block;
  width: 64px;
  height: 64px;
  border: 0.5px dashed var(--rule);
}
.row-text { display: flex; flex-direction: column; gap: 4px; }
.row-subject {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 16px;
}
.row.row-empty .row-subject { color: var(--ink-3); }
.row-loc {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.row-arr {
  font-family: var(--serif-jp);
  color: var(--ink-3);
  font-size: 16px;
  text-align: right;
}
.row.is-today .row-arr { color: var(--accent); }

/* ── Lightbox ───────────────────────────────────────────────────────── */

.lb-back {
  position: fixed; inset: 0;
  background: rgba(20, 17, 13, 0.78);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px;
  animation: fade .22s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.lb-x {
  position: absolute;
  top: 24px;
  right: 28px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 0.5px solid rgba(244, 236, 219, 0.4);
  color: var(--paper);
  font-size: 20px;
  cursor: pointer;
  z-index: 1;
}
.lb-x:hover { background: rgba(244, 236, 219, 0.08); }
.lb-stage {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 720px;
  width: 100%;
  background: var(--paper);
  padding: 32px;
  animation: rise .3s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.lb-img { max-height: 60vh; overflow: hidden; }
.lb-img .ph-wrap { height: 100%; }
.lb-caption { padding-top: 28px; }
.lb-date {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 12px;
}
.lb-date-en {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 28px;
}
.lb-date-jp {
  font-family: var(--serif-jp);
  font-size: 14px;
  letter-spacing: 0.2em;
  color: var(--ink-2);
}
.lb-rule {
  width: 48px;
  height: 1px;
  background: var(--accent);
  margin-bottom: 16px;
}
.lb-subject {
  font-family: var(--serif-en);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  margin: 0 0 6px;
}
.lb-loc {
  font-family: var(--serif-en);
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 14px;
}
.lb-taken {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.lb-note {
  font-size: 13px;
  line-height: 1.85;
  margin: 0;
  color: var(--ink);
}

/* ── Upload dialog ─────────────────────────────────────────────────── */

.up-card {
  position: relative;
  background: var(--paper);
  width: 100%;
  max-width: 520px;
  padding: 36px 36px 28px;
  animation: rise .3s cubic-bezier(.2,.8,.2,1);
}
.up-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
}
.up-date-en {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 28px;
}
.up-date-jp {
  font-family: var(--serif-jp);
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--ink-2);
}
.up-rule {
  width: 40px;
  height: 1px;
  background: var(--accent);
  margin: 14px 0 22px;
}
.up-body { display: flex; flex-direction: column; gap: 14px; }
.up-drop {
  border: 0.5px dashed var(--rule);
  background: var(--paper-2);
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.up-drop:hover { background: rgba(0,0,0,0.04); border-color: var(--ink-3); }
.up-drop-mark {
  font-family: var(--serif-jp);
  font-size: 28px;
  color: var(--ink-3);
}
.up-drop-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.up-drop-text strong {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 15px;
  font-weight: 400;
}
.up-drop-text span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.up-preview { display: flex; align-items: center; gap: 14px; }
.up-preview img { width: 80px; height: 80px; object-fit: cover; }
.up-preview span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
}
.up-field { display: flex; flex-direction: column; gap: 4px; }
.up-field span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.up-field input,
.up-field textarea {
  border: 0;
  border-bottom: 0.5px solid var(--rule);
  background: transparent;
  padding: 6px 0;
  font-family: var(--serif-en);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  resize: vertical;
}
.up-field input:focus,
.up-field textarea:focus { border-bottom-color: var(--accent); }
.up-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
}
.up-btn {
  appearance: none;
  border: 0.5px solid var(--rule);
  background: transparent;
  padding: 9px 18px;
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.up-btn-ghost:hover { background: var(--paper-2); }
.up-btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.up-btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.up-btn-primary:disabled,
.up-btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }
.up-btn-danger {
  background: #7a1a1a;
  color: #f5ebe4;
  border-color: #7a1a1a;
}
.up-btn-danger:hover { background: #9c2a2a; border-color: #9c2a2a; }

/* 管理者用：ライトボックス内の編集・削除エリア */
.lb-admin-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 0.5px solid var(--rule-soft);
}
.lb-btn-delete { color: var(--accent); border-color: var(--accent); opacity: 0.7; }
.lb-btn-delete:hover { opacity: 1; background: rgba(156, 42, 42, 0.06); }
.lb-delete-confirm {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-2);
}

/* ── Footer ─────────────────────────────────────────────────────────── */

.foot {
  margin-top: 64px;
  padding-top: 18px;
  border-top: 0.5px solid var(--rule);
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  text-transform: uppercase;
}

/* ── Variant: minimal tone ─────────────────────────────────────────── */
.app[data-tone="minimal"] {
  --paper: #fafaf7;
  --paper-2: #f0eee8;
  --ink: #1c1c1a;
  --ink-2: #5a5a55;
  --ink-3: #9c9c95;
  --rule: rgba(28, 28, 26, 0.14);
  --rule-soft: rgba(28, 28, 26, 0.06);
}
.app[data-tone="minimal"] .hero-vert-jp { letter-spacing: 0.2em; opacity: 0.7; }

/* ── Variant: editorial tone ─────────────────────────────────────── */
.app[data-tone="editorial"] {
  --paper: #1a1815;
  --paper-2: #25221d;
  --ink: #f3ecdc;
  --ink-2: #c2b89e;
  --ink-3: #7a7058;
  --rule: rgba(243, 236, 220, 0.2);
  --rule-soft: rgba(243, 236, 220, 0.08);
}
.app[data-tone="editorial"] body,
.app[data-tone="editorial"] { color: var(--ink); }
.app[data-tone="editorial"] .ph-label { background: rgba(26, 24, 21, 0.8); color: var(--ink) !important; }

/* ── Responsive: tablet (〜960px) ────────────────────────────────────── */
@media (max-width: 960px) {
  .app { padding: 36px 36px 80px; }

  .hero {
    grid-template-columns: 1fr 1.6fr;
    gap: 36px;
  }

  .hero-day-en { font-size: 72px; }
  .hero-month-en { font-size: 30px; }
  .hero-subject { font-size: 26px; }

  .grid-squares { grid-template-columns: repeat(7, 1fr); }
}

/* ── Responsive: スマホ (〜680px) ───────────────────────────────────── */
@media (max-width: 680px) {
  .app { padding: 20px 18px 64px; }

  /* ヘッダー */
  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 28px;
  }
  .topbar-title { font-size: 17px; }
  .topbar-title em { font-size: 13px; margin-left: 10px; }
  .topbar-meta { gap: 10px; }

  /* ヒーロー：1カラムに変更・写真を上に */
  .hero {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 48px;
  }
  .hero-img-col { order: -1; }

  /* 絶対配置の縦書きテキストを非表示（スマホでは重なるため） */
  .hero-vert { display: none; }

  .hero-date-en { gap: 10px; }
  .hero-day-en { font-size: 60px; }
  .hero-month-en { font-size: 24px; }
  .hero-rule { width: 40px; margin: 14px 0 18px; }
  .hero-subject { font-size: 22px; margin-bottom: 10px; }
  .hero-text { max-width: 100%; padding-right: 0; }
  .hero-note { margin-bottom: 20px; }

  /* 月ナビ */
  .month-nav { flex-wrap: wrap; gap: 8px; padding-bottom: 10px; margin-bottom: 18px; }
  .month-nav-title { order: 0; }
  .month-nav-arrows { order: 1; }
  .month-nav-count { order: 2; width: 100%; }
  .month-nav-month { font-size: 34px; }

  /* グリッド */
  .grid-squares { grid-template-columns: repeat(5, 1fr); gap: 5px; }

  /* リスト */
  .row { grid-template-columns: 40px 52px 1fr 24px; gap: 12px; padding: 12px 4px; }
  .row-num { font-size: 22px; }
  .row-thumb { width: 52px; height: 52px; }
  .row-thumb-empty { width: 52px; height: 52px; }
  .row-subject { font-size: 14px; }

  /* ライトボックス */
  .lb-back { padding: 16px; }
  .lb-stage { padding: 20px; }
  .lb-date-en { font-size: 22px; }
  .lb-subject { font-size: 18px; }

  /* アップロードダイアログ */
  .up-card { padding: 24px 20px 20px; }
  .up-date-en { font-size: 22px; }

  /* フッター */
  .foot { flex-direction: column; gap: 4px; margin-top: 40px; }
}
