:root {
  color-scheme: dark;

  --bg: #071b17;
  --bg-deep: #04100d;
  --panel: rgba(10, 35, 29, 0.94);
  --panel-soft: rgba(15, 47, 39, 0.88);

  --gold: #c9a96a;
  --gold-soft: rgba(201, 169, 106, 0.42);
  --ivory: #eee4cf;
  --turquoise: #4f9f98;

  --text: #eee8dc;
  --muted: #b9b2a4;
  --danger: #c9867c;

  --shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;

  color: var(--text);

  font-family:
    "Yu Mincho",
    "Hiragino Mincho ProN",
    "Noto Serif JP",
    serif;

  background:
    radial-gradient(circle at top right, rgba(79, 159, 152, 0.08), transparent 28rem),
    linear-gradient(180deg, #0a211c 0%, var(--bg) 42%, var(--bg-deep) 100%);
}

/*
  小さく控えめな幾何学文様。
  大柄の星を廃止し、写真の邪魔をしない濃度にする。
*/
body::before {
  content: "";

  position: fixed;
  inset: 0;
  z-index: -1;

  pointer-events: none;

  opacity: 0.16;

  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23c9a96a' stroke-width='0.8'%3E%3Cpath d='M48 10 58 28 78 38 60 48 78 58 58 68 48 86 38 68 18 58 36 48 18 38 38 28Z'/%3E%3Ccircle cx='48' cy='48' r='12'/%3E%3Cpath d='M48 36 60 48 48 60 36 48Z'/%3E%3C/g%3E%3C/svg%3E");

  background-size: 96px 96px;
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
select,
input,
dialog {
  color: var(--text);
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--turquoise);
  outline-offset: 3px;
}

/* ヘッダー */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;

  background: rgba(5, 19, 15, 0.94);
  backdrop-filter: blur(14px);

  border-bottom: 1px solid rgba(201, 169, 106, 0.30);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.site-header::after {
  content: "";

  display: block;
  height: 1px;

  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(79, 159, 152, 0.55),
      rgba(201, 169, 106, 0.70),
      rgba(79, 159, 152, 0.55),
      transparent
    );
}

.header-inner,
.page-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
}

.header-inner {
  min-height: 88px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 5px;

  color: var(--turquoise);
  font-family: Georgia, serif;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;

  color: var(--ivory);
  font-size: clamp(1.5rem, 3vw, 2.15rem);
  font-weight: 500;
  letter-spacing: 0.12em;
}

/* ボタン */
.header-button,
.quiet-button,
.viewer-actions button,
.dialog-buttons button,
.bookmark-list-header button,
.bookmark-footer button {
  border: 1px solid rgba(201, 169, 106, 0.52);
  background: rgba(11, 40, 33, 0.88);
  color: var(--ivory);

  border-radius: 4px;
  padding: 9px 16px;
}

.header-button:hover,
.quiet-button:hover,
.viewer-actions button:hover,
.dialog-buttons button:hover,
.bookmark-list-header button:hover,
.bookmark-footer button:hover {
  border-color: var(--gold);
  background: rgba(18, 56, 46, 0.94);
}

.header-button span {
  margin-left: 8px;
  color: var(--gold);
}

.page-shell {
  padding: 32px 0 80px;
}

/* 絞り込み */
.filter-panel {
  position: relative;

  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;

  padding: 18px 20px;
  margin-bottom: 34px;

  border: 1px solid rgba(201, 169, 106, 0.28);
  background: rgba(8, 31, 25, 0.82);

  box-shadow: var(--shadow);
}

.filter-panel label {
  display: grid;
  gap: 7px;
  min-width: 150px;

  color: var(--muted);
  font-size: 0.9rem;
}

.filter-panel select {
  width: 100%;

  border: 1px solid rgba(79, 159, 152, 0.38);
  background: #081d18;
  color: var(--text);

  padding: 10px 34px 10px 12px;
}

/* 日付 */
.diary-day {
  margin-bottom: 48px;
  scroll-margin-top: 120px;
}

.date-heading {
  position: relative;

  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;

  padding-bottom: 12px;
  margin-bottom: 18px;

  border-bottom: 1px solid rgba(201, 169, 106, 0.30);
}

.date-heading::after {
  content: "";

  position: absolute;
  left: 0;
  bottom: -1px;

  width: 88px;
  height: 1px;

  background:
    linear-gradient(
      90deg,
      var(--gold),
      var(--turquoise),
      transparent
    );
}

.date-year {
  margin: 0 0 2px;

  color: var(--turquoise);
  font-family: Georgia, serif;
  font-size: 0.76rem;
  letter-spacing: 0.18em;
}

.date-heading h2 {
  margin: 0;

  color: var(--ivory);
  font-size: clamp(1.3rem, 2.5vw, 1.9rem);
  font-weight: 500;
  letter-spacing: 0.10em;
}

.count-badge {
  color: var(--muted);
  font-size: 0.86rem;
}

/* 200pxサムネイル */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 200px);
  justify-content: start;
  gap: 18px;
}

.photo-card {
  position: relative;
  overflow: hidden;

  width: 200px;

  border: 1px solid rgba(201, 169, 106, 0.34);
  background: #081b16;

  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

/* 派手な帯をやめ、細い内枠だけ */
.photo-card::before {
  content: "";

  position: absolute;
  inset: 5px;
  z-index: 2;

  border: 1px solid rgba(79, 159, 152, 0.18);

  pointer-events: none;
}

.photo-button {
  display: block;

  width: 200px;
  height: 200px;
  padding: 0;

  border: 0;
  background: #06110e;

  overflow: hidden;
}

.photo-button img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;

  transition:
    transform 0.28s ease,
    opacity 0.28s ease;
}

.photo-button:hover img {
  transform: scale(1.025);
  opacity: 0.95;
}

.bookmark-button {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 3;

  border: 1px solid rgba(201, 169, 106, 0.68);
  background: rgba(4, 16, 13, 0.88);
  color: var(--gold);

  border-radius: 3px;
  padding: 6px 10px;

  font-size: 0.8rem;
}

.bookmark-button:hover {
  background: rgba(19, 55, 45, 0.94);
}

.bookmark-button.is-bookmarked {
  background: var(--gold);
  color: #12231b;
}

/* 添付ファイル */
.attachments {
  margin-top: 16px;
  padding: 15px 17px;

  border-left: 2px solid var(--gold);
  background: rgba(10, 34, 28, 0.72);
}

.attachments-title {
  margin-bottom: 9px;

  color: var(--muted);
  font-size: 0.88rem;
}

.attachments ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;

  margin: 0;
  padding: 0;

  list-style: none;
}

.file-type {
  display: inline-block;
  min-width: 48px;
  margin-right: 7px;

  color: var(--turquoise);
  font-family: Georgia, serif;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

.empty-message {
  padding: 60px 20px;

  color: var(--muted);
  text-align: center;
}

/* ダイアログ */
dialog {
  color: var(--text);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.84);
  backdrop-filter: blur(4px);
}

.viewer-dialog {
  width: min(96vw, 1500px);
  height: min(94vh, 1000px);
  padding: 0;

  border: 1px solid rgba(201, 169, 106, 0.42);
  background: #030907;

  box-shadow: var(--shadow);
}

.viewer-toolbar {
  min-height: 62px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 12px 16px;

  border-bottom: 1px solid rgba(201, 169, 106, 0.26);
  background: rgba(8, 30, 24, 0.98);
}

.viewer-date {
  color: var(--gold);
  letter-spacing: 0.08em;
}

.viewer-actions {
  display: flex;
  gap: 10px;
}

.viewer-canvas {
  position: relative;
  overflow: hidden;

  height: calc(100% - 62px);

  touch-action: none;

  background:
    radial-gradient(circle at center, rgba(39, 101, 84, 0.22), transparent 60%),
    #010403;
}

.viewer-canvas img {
  position: absolute;
  top: 50%;
  left: 50%;

  max-width: 92%;
  max-height: 92%;

  transform-origin: center;
  user-select: none;
  -webkit-user-drag: none;
}



/* 栞ダイアログ */
.small-dialog,
.bookmark-dialog {
  border: 1px solid rgba(201, 169, 106, 0.40);
  background: #0a2a21;

  box-shadow: var(--shadow);
}

.small-dialog {
  width: min(92vw, 470px);
  padding: 24px;
}

.small-dialog h2,
.bookmark-list-header h2 {
  color: var(--ivory);
  font-weight: 500;
}

.small-dialog label {
  display: grid;
  gap: 8px;

  color: var(--muted);
}

.small-dialog input {
  width: 100%;

  border: 1px solid rgba(79, 159, 152, 0.42);
  background: #061711;
  color: var(--text);

  padding: 12px;
}

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;

  margin-top: 20px;
}

.bookmark-dialog {
  width: min(94vw, 960px);
  max-height: 88vh;
  padding: 24px;
}

.bookmark-list-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;

  padding-bottom: 14px;

  border-bottom: 1px solid rgba(201, 169, 106, 0.28);
}

.bookmark-list-header h2 {
  margin-bottom: 0;
}

.bookmark-list {
  display: grid;
  gap: 12px;

  margin: 18px 0;
}

.bookmark-row {
  display: grid;
  grid-template-columns: auto 92px 1fr;
  align-items: center;
  gap: 14px;

  padding: 10px;

  border: 1px solid rgba(201, 169, 106, 0.22);
  background: rgba(7, 26, 21, 0.82);
}

.bookmark-row img {
  width: 92px;
  height: 72px;

  object-fit: cover;

  border: 1px solid rgba(79, 159, 152, 0.30);
}

.bookmark-row strong {
  display: block;
  margin-bottom: 5px;

  color: var(--gold);
  font-weight: 500;
}

.bookmark-row small {
  color: var(--muted);
}

.bookmark-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;

  padding-top: 15px;

  border-top: 1px solid rgba(201, 169, 106, 0.28);
}

.danger-button {
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

@media (max-width: 700px) {
  .header-inner,
  .page-shell {
    width: min(100% - 20px, 1480px);
  }

  .site-header {
    position: static;
  }

  .header-inner {
    min-height: 76px;
  }

  .eyebrow {
    display: none;
  }

  .header-button {
    padding: 8px 12px;
    white-space: nowrap;
  }

  .page-shell {
    padding-top: 20px;
  }

  .filter-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;

    padding: 16px;
  }

  .filter-panel label {
    min-width: 0;
  }

  .quiet-button {
    grid-column: 1 / -1;
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .photo-card,
  .photo-button {
    width: 100%;
  }

  .photo-button {
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .bookmark-button {
    top: 7px;
    right: 7px;

    padding: 5px 8px;
  }

  .viewer-toolbar {
    align-items: start;
  }

  .viewer-actions button {
    padding: 8px 10px;
  }

  .viewer-help {
    padding: 0 10px;
    text-align: center;
  }

  .bookmark-row {
    grid-template-columns: auto 68px 1fr;
    gap: 10px;
  }

  .bookmark-row img {
    width: 68px;
    height: 58px;
  }
}