/* =========================================================
   Kurashi Log — Dark theme (black base + orange accent)
   ========================================================= */

:root {
  --base: #0a0a0b;
  --panel: #121214;
  --panel2: #18181b;
  --edge: rgba(255, 255, 255, 0.10);
  --edge2: rgba(255, 255, 255, 0.06);
  --ink: #f5f5f7;
  --sub: #a1a1aa;
  --mute: #71717a;
  --brand: #f97316;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--base);
}

body {
  background: var(--base);
  color: var(--ink);
  letter-spacing: 0.01em;
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Hiragino Sans',
    'Helvetica Neue', sans-serif;
}

/* ---------------- 数字は等幅で桁を揃える ----------------
   金額・基準価額・距離など、縦に並んだときに桁がずれないようにする */
.font-mono,
time,
table td,
table th {
  font-family: 'Roboto Mono', SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}
.tabular-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

::selection {
  background: rgba(249, 115, 22, 0.35);
  color: #fff;
}

/* ---------------- scroll reveal ----------------
   読み物向けに演出は最小限（スクロールを邂らない） */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s ease-out, transform 0.45s ease-out;
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------------- hero intro ---------------- */
.hero-line {
  opacity: 0;
  transform: translateY(22px);
  animation: heroUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.hero-line:nth-child(2) {
  animation-delay: 0.08s;
}
.hero-line:nth-child(3) {
  animation-delay: 0.16s;
}
.hero-line:nth-child(4) {
  animation-delay: 0.24s;
}
@keyframes heroUp {
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-media {
  animation: heroZoom 1.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes heroZoom {
  from {
    transform: scale(1.08);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal,
  .hero-line,
  .hero-media {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
}

/* ---------------- horizontal snap carousel ---------------- */
.snap-row {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  scrollbar-width: none;
}
.snap-row::-webkit-scrollbar {
  display: none;
}
.snap-row > * {
  scroll-snap-align: start;
  flex: 0 0 auto;
}

/* ---------------- article body (light text on dark) ---------------- */
.post-body {
  font-size: 15.5px;
  line-height: 1.95;
  color: #e4e4e7;
  letter-spacing: 0.012em;
  /* 日本語の可読幅（1行45文字前後）に抑える。写真ギャラリーは枠外なので影響しない */
  /* 日本語の可読幅（1行50文字前後）に抑える。写真ギャラリーは枠外なので影響しない */
  max-width: 50em;
}
@media (min-width: 640px) {
  .post-body {
    font-size: 17.5px;
    line-height: 1.95;
  }
}
.post-body > * + * {
  margin-top: 1.3em;
}
/* 本文中の数字だけ等幅にする（見出しの数字も含む） */
.post-body table td,
.post-body table th {
  font-family: 'Roboto Mono', SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.86em;
}
.post-body p {
  color: #d4d4d8;
  /* 日本語を文節単位で折り返す。英数字・記号の途中では切らない */
  word-break: auto-phrase;
  line-break: strict;
  text-wrap: pretty;
}
.post-body h2 {
  margin-top: 2em;
  margin-bottom: 0.55em;
  font-size: 1.28em;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--edge2);
}
.post-body h3 {
  margin-top: 1.75em;
  margin-bottom: 0.35em;
  font-size: 1.1em;
  font-weight: 700;
  color: var(--ink);
}
.post-body h4 {
  margin-top: 1.45em;
  font-size: 1em;
  font-weight: 700;
  color: var(--ink);
}
.post-body a {
  color: #fdba74;
  text-decoration: none;
  border-bottom: 1px solid rgba(253, 186, 116, 0.4);
}
.post-body a:hover {
  color: var(--brand);
  border-bottom-color: var(--brand);
}
.post-body strong {
  color: #fff;
  font-weight: 700;
}
.post-body em {
  color: #fff;
}
.post-body ul,
.post-body ol {
  padding-left: 1.35em;
  color: #d4d4d8;
}
.post-body ul {
  list-style: disc;
}
.post-body ol {
  list-style: decimal;
}
.post-body li + li {
  margin-top: 0.5em;
}
.post-body li::marker {
  color: var(--mute);
}
.post-body blockquote {
  border-left: 3px solid var(--brand);
  background: rgba(249, 115, 22, 0.07);
  padding: 0.9em 1.2em;
  border-radius: 0 12px 12px 0;
  color: var(--sub);
  font-size: 0.96em;
}
.post-body blockquote p {
  color: var(--sub);
}
.post-body code {
  background: rgba(255, 255, 255, 0.08);
  color: #fdba74;
  border-radius: 6px;
  padding: 0.15em 0.42em;
  font-size: 0.88em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.post-body pre {
  background: #08080a;
  border: 1px solid var(--edge2);
  color: #e4e4e7;
  border-radius: 14px;
  padding: 18px 20px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.7;
}
.post-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.post-body img {
  border-radius: 18px;
  width: 100%;
  border: 1px solid var(--edge2);
}
/* インラインstyleの無い画像だけ、縦に伸びすぎないよう上限をつける */
.post-body img:not([style]) {
  width: auto;
  max-width: 100%;
  max-height: 72vh;
}
.post-body hr {
  border: 0;
  border-top: 1px solid var(--edge2);
  margin: 2.4em 0;
}
.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
  display: block;
  overflow-x: auto;
}
.post-body th,
.post-body td {
  border: 1px solid var(--edge2);
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}
.post-body th {
  background: var(--panel2);
  color: var(--ink);
  font-weight: 700;
}
.post-body td {
  color: #d4d4d8;
}

/* ---------------- Leaflet (dark) ---------------- */
.leaflet-container {
  background: #0e0e10;
  font-family: inherit;
}
.leaflet-container a {
  color: #fdba74;
}
.leaflet-control-attribution {
  background: rgba(10, 10, 11, 0.75) !important;
  color: var(--mute) !important;
  font-size: 10px !important;
  border-radius: 6px 0 0 0;
}
.leaflet-control-attribution a {
  color: var(--sub) !important;
}
.leaflet-bar,
.leaflet-control-zoom {
  border: 1px solid var(--edge) !important;
  border-radius: 10px !important;
  overflow: hidden;
  box-shadow: none !important;
}
.leaflet-bar a,
.leaflet-control-zoom a {
  background: var(--panel) !important;
  color: var(--ink) !important;
  border-bottom: 1px solid var(--edge2) !important;
}
.leaflet-bar a:hover,
.leaflet-control-zoom a:hover {
  background: var(--panel2) !important;
  color: var(--brand) !important;
}
.leaflet-popup-content-wrapper {
  background: var(--panel) !important;
  color: var(--ink) !important;
  border: 1px solid var(--edge) !important;
  border-radius: 14px !important;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6) !important;
}
.leaflet-popup-content {
  margin: 12px 14px !important;
  font-size: 13px;
  line-height: 1.6;
}
.leaflet-popup-tip {
  background: var(--panel) !important;
  border: 1px solid var(--edge) !important;
}
.leaflet-popup-close-button {
  color: var(--mute) !important;
}
.leaflet-popup-close-button:hover {
  color: var(--ink) !important;
}

/* map pin */
.map-pin {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

/* ---------------- Admin (dark) ---------------- */
.admin-body h1,
.admin-body h2,
.admin-body h3,
.admin-body h4,
.admin-body strong {
  letter-spacing: -0.01em;
}
.admin-body .nav-btn.active {
  background: var(--brand);
  color: #fff;
}
.admin-input {
  width: 100%;
  background: var(--base);
  border: 1px solid var(--edge2);
  border-radius: 12px;
  padding: 10px 13px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.admin-input::placeholder {
  color: var(--mute);
}
.admin-input:focus {
  border-color: rgba(249, 115, 22, 0.65);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16);
}
.admin-input:disabled {
  opacity: 0.55;
}
select.admin-input {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%),
    linear-gradient(135deg, var(--mute) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
textarea.admin-input {
  line-height: 1.7;
  resize: vertical;
}
.admin-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 6px;
}

/* markdown preview inside admin */
.md-preview {
  font-size: 14px;
  line-height: 1.85;
  color: #d4d4d8;
}
.md-preview > * + * {
  margin-top: 1em;
}
.md-preview h2 {
  font-size: 1.25em;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 1px solid var(--edge2);
  padding-bottom: 0.3em;
  margin-top: 1.6em;
}
.md-preview h3 {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--ink);
  margin-top: 1.3em;
}
.md-preview a {
  color: #fdba74;
}
.md-preview ul {
  list-style: disc;
  padding-left: 1.3em;
}
.md-preview ol {
  list-style: decimal;
  padding-left: 1.3em;
}
.md-preview code {
  background: rgba(255, 255, 255, 0.08);
  color: #fdba74;
  border-radius: 5px;
  padding: 0.1em 0.35em;
  font-size: 0.88em;
}
.md-preview pre {
  background: #08080a;
  border: 1px solid var(--edge2);
  color: #e4e4e7;
  border-radius: 12px;
  padding: 14px;
  overflow-x: auto;
}
.md-preview pre code {
  background: none;
  color: inherit;
  padding: 0;
}
.md-preview blockquote {
  border-left: 3px solid var(--brand);
  background: rgba(249, 115, 22, 0.07);
  padding: 0.7em 1em;
  color: var(--sub);
  border-radius: 0 10px 10px 0;
}
.md-preview img {
  border-radius: 12px;
  width: 100%;
}
.md-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}
.md-preview th,
.md-preview td {
  border: 1px solid var(--edge2);
  padding: 7px 9px;
}
.md-preview th {
  background: var(--panel2);
  color: var(--ink);
}

/* ---------------- scrollbar ---------------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--base);
}
::-webkit-scrollbar-thumb {
  background: #3f3f46;
  border-radius: 8px;
  border: 2px solid var(--base);
}
::-webkit-scrollbar-thumb:hover {
  background: #52525b;
}

/* ---------------- misc ---------------- */
input[type='date'].admin-input::-webkit-calendar-picker-indicator,
input[type='time'].admin-input::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.55);
  cursor: pointer;
}
.no-scroll {
  overflow: hidden;
}

/* ---------------- 地図タイル（OpenStreetMap標準）をダークテーマに寄せる ----------------
   CARTOのダークタイルがAPIキー必須になったため、キー不要のOSM標準タイルを
   CSSフィルタで暗転させて使う。キー管理が不要になる。 */
.leaflet-container {
  background: var(--panel2);
}
.map-dark img.leaflet-tile {
  filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88) saturate(0.6);
}
/* 帰属表示はダーク背景に合わせる */
.leaflet-control-attribution {
  background: rgba(10, 10, 11, 0.72) !important;
  color: var(--mute) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a {
  color: var(--sub) !important;
}
/* 画像の拡大表示（ライトボックス） */
.lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.92);
  opacity: 0;
  transition: opacity 0.18s ease;
  cursor: zoom-out;
}
.lb-overlay.is-open {
  opacity: 1;
}
.lb-overlay img {
  max-width: 100%;
  max-height: 92vh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.lb-close {
  position: absolute;
  top: 14px;
  right: 18px;
  border: 0;
  background: none;
  color: #fff;
  font-size: 30px;
  line-height: 1;
  opacity: 0.75;
  cursor: pointer;
}
.lb-close:hover {
  opacity: 1;
}
.post-body a[href^="/media/"] {
  border-bottom: 0;
  cursor: zoom-in;
}
