@font-face { font-family: 'Cormorant Garamond'; font-weight: 500; font-display: swap; src: url(/vendor/fonts/cormorant-garamond-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 600; font-display: swap; src: url(/vendor/fonts/cormorant-garamond-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 500; font-style: italic; font-display: swap; src: url(/vendor/fonts/cormorant-garamond-latin-500-italic.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url(/vendor/fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url(/vendor/fonts/inter-latin-500-normal.woff2) format('woff2'); }

:root {
  --paper: #f6f3ee;
  --paper-2: #ece7df;
  --ink: #1f1c18;
  --ink-2: #5e574d;
  --muted: #8f877b;
  --line: #ddd6cb;
  --accent: #8a5a3c;
  --gap: 6px;
  --edge: clamp(16px, 4vw, 56px);
  --serif: 'Cormorant Garamond', 'Noto Serif TC', 'Songti TC', 'PMingLiU', Georgia, serif;
  --sans: 'Inter', 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.label { font-size: 13px; color: var(--ink-2); letter-spacing: .01em; }

/* ---- loading / messages ---- */
.loading, .message { min-height: 100svh; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 24px; text-align: center; }
.spinner { width: 26px; height: 26px; border: 1.5px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin 1s linear infinite; }
.loading-text { margin: 0; color: var(--muted); font-size: 13px; }
.message h1 { margin: 0; font: 500 34px/1.15 var(--serif); }
.message p { margin: 0; color: var(--ink-2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- password gate ---- */
.gate { min-height: 100svh; display: grid; place-items: center; padding: 40px 20px; }
.gate-box { width: min(400px, 100%); text-align: center; }
.gate-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; margin: 0 auto 32px; background: var(--paper-2); box-shadow: 0 1px 2px rgba(31, 28, 24, .08), 0 12px 32px -12px rgba(31, 28, 24, .25); }
.gate-title { margin: 0 0 6px; font: 500 34px/1.15 var(--serif); overflow-wrap: anywhere; }
.gate-sub { margin: 0 0 30px; }
.gate-hint { margin: 0 0 14px; font-size: 13px; color: var(--ink-2); }
.gate-field { display: flex; align-items: center; border-bottom: 1px solid var(--ink); }
.gate-input { flex: 1; min-width: 0; padding: 12px 2px; border: 0; background: transparent; font-size: 16px; letter-spacing: .08em; }
.gate-input:focus { outline: none; }
.gate-input::placeholder { color: var(--muted); letter-spacing: 0; }
.gate-field:focus-within { border-bottom-color: var(--accent); }
.gate-btn { display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: none; cursor: pointer; color: var(--ink); }
.gate-btn svg { width: 22px; height: 22px; transition: transform .2s; }
.gate-btn:hover svg { transform: translateX(3px); }
.gate-btn:disabled { opacity: .4; cursor: default; }
.gate-error { min-height: 20px; margin: 10px 0 0; font-size: 13px; color: #a3402a; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---- cover ---- */
.cover { padding: 28px var(--edge) 0; }
.cover-top { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.cover-site { margin: 0; font: 500 18px/1.2 var(--serif); }
.cover-meta { margin: 0; text-align: right; }
.cover-title { margin: clamp(28px, 6vh, 64px) 0 clamp(24px, 4vh, 40px); max-width: 18ch; font: 500 clamp(38px, 6.4vw, 84px)/1.04 var(--serif); letter-spacing: -.01em; overflow-wrap: anywhere; }
.cover-media { position: relative; height: min(72svh, 56vw); min-height: 260px; background: var(--paper-2); overflow: hidden; }
.cover-media img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.02); transition: opacity 1s, transform 1.6s cubic-bezier(.2, .7, .2, 1); }
.cover-media img.loaded { opacity: 1; transform: none; }
.cover-cta { display: inline-flex; align-items: center; gap: 10px; margin: 22px 0 8px; padding: 0; border: 0; background: none; cursor: pointer; font-size: 14px; font-weight: 500; }
.cover-cta svg { width: 18px; height: 18px; transition: transform .2s; }
.cover-cta:hover svg { transform: translateY(3px); }

@media (max-width: 699px) {
  .cover { padding-top: 18px; }
  .cover-top { flex-direction: column; gap: 2px; }
  .cover-meta { text-align: left; }
  .cover-media { height: 62svh; margin: 0 calc(var(--edge) * -1); }
}

/* ---- sticky bar ---- */
.bar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 58px; padding: 0 var(--edge); margin-top: 28px;
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.bar.stuck { border-bottom-color: var(--line); }
.bar-title { margin: 0; min-width: 0; font: 500 21px/1.2 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .25s; }
.bar.stuck .bar-title { opacity: 1; }
.bar-actions { display: flex; gap: 2px; flex-shrink: 0; margin-left: auto; }
.text-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border: 0; border-radius: 18px; background: none; cursor: pointer; font-size: 13px; font-weight: 500; text-decoration: none; color: var(--ink); }
.text-btn:hover { background: var(--paper-2); }
.text-btn svg { width: 17px; height: 17px; }
@media (max-width: 699px) { .text-btn span { display: none; } .text-btn { width: 38px; padding: 0; justify-content: center; } }

/* ---- grid: justified rows ---- */
.grid { padding: 0 var(--edge); display: flex; flex-direction: column; gap: var(--gap); overflow: hidden; }
.row { display: flex; gap: var(--gap); }
.tile { flex: 0 0 auto; display: block; position: relative; background: var(--paper-2); overflow: hidden; cursor: zoom-in; border-radius: 2px; }
.tile img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s, filter .3s; }
.tile img.loaded { opacity: 1; }
.tile:hover img { filter: brightness(.9); }
@media (max-width: 699px) { .grid { padding: 0 var(--gap); } }

.footer { padding: 72px var(--edge) 80px; text-align: center; }
.footer p { margin: 0; font: italic 500 20px/1.3 var(--serif); color: var(--ink-2); }

/* ---- album index ---- */
.index-head { padding: 56px var(--edge) 36px; border-bottom: 1px solid var(--line); margin-bottom: 40px; }
.index-head h1 { margin: 0; font: 500 clamp(38px, 6vw, 72px)/1.05 var(--serif); }
.index-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 44px 28px; padding: 0 var(--edge) 72px; }
.index-card { text-decoration: none; }
.index-card .media { aspect-ratio: 4 / 3; background: var(--paper-2); overflow: hidden; }
.index-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.index-card:hover img { transform: scale(1.03); }
.index-card h2 { margin: 16px 0 2px; font: 500 26px/1.15 var(--serif); }
.index-card p { margin: 0; }

/* ---- toast ---- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 20px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 100001; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- lightbox (dark) ---- */
.pswp {
  --pswp-bg: #141311;
  --pswp-placeholder-bg: #24221f;
  --pswp-icon-color: #ece7df;
  --pswp-icon-color-secondary: #141311;
  --pswp-icon-stroke-color: #141311;
  --pswp-icon-stroke-width: 0px;
  --pswp-error-text-color: #ece7df;
  font-family: var(--sans);
}
.pswp__counter { color: #b8b0a3; text-shadow: none; font-size: 13px; opacity: 1; }
.pswp__custom-btn { display: grid; place-items: center; text-decoration: none; }
.pswp__custom-btn svg { width: 22px; height: 22px; color: #ece7df; stroke-width: 2; }
.pswp__caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 16px 14px; text-align: center;
  display: flex; flex-direction: column; gap: 2px; align-items: center;
  pointer-events: none; transition: opacity .3s; opacity: 0;
}
.pswp__caption-when { color: #ddd6cb; font-size: 13px; }
.pswp__caption-when:empty, .pswp__caption-settings:empty { display: none; }
.pswp__caption-settings { display: flex; gap: 14px; color: #b8b0a3; font-size: 12px; font-variant-numeric: tabular-nums; }
.pswp__caption-file { color: #8f877b; font-size: 11px; }
.pswp--ui-visible .pswp__caption { opacity: 1; }

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