/* ───────────────────────────────────────────────────────────
   隨筆記事 — guestbook + photo album + lightbox
   ───────────────────────────────────────────────────────── */

.page-journal { background: var(--bg); min-height: 100vh; }

/* ── HERO ────────────────────────────────────────── */
.jnl-hero {
  position: relative;
  height: 100vh;
  min-height: 560px;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg) url('images/services-bg.webp') center/cover no-repeat;
}
.jnl-watercolor {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
  transform: translateZ(0);
  isolation: isolate;
}
.jnl-watercolor .wash-a {
  --wash-rotate: 6deg;
  left: -28%;
  top: -15%;
  width: 80%;
  height: 140%;
}
.jnl-watercolor .wash-b {
  --wash-rotate: -4deg;
  left: -18%;
  top: 0%;
  width: 65%;
  height: 110%;
}

.jnl-hero-grid {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-top: var(--nav-h);
}

.jnl-hero-left {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 0 var(--gutter) 0 max(var(--gutter), calc((100vw - 1320px) / 2 + var(--gutter) - var(--fs-hero)));
  width: 48%;
  pointer-events: auto;
  margin-top: calc(-1 * var(--fs-hero));
}

.jnl-eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.34em;
  color: var(--moss);
  text-transform: uppercase;
}
.jnl-eyebrow .eyebrow-rule {
  width: 48px;
  height: 1px;
  background: var(--moss);
  opacity: 0.6;
}

.jnl-title {
  position: relative;
  margin: 0;
  line-height: 0.95;
  display: inline-block;
  align-self: flex-start;
}
.jnl-title-text {
  position: relative;
  z-index: 2;
  font-family: var(--serif-zh);
  font-weight: 500;
  font-size: var(--fs-hero);
  letter-spacing: 0.22em;
  color: var(--ink);
}
.jnl-title-brush {
  position: absolute;
  z-index: 1;
  left: -20px;
  right: -40px;
  top: 6%;
  height: 96%;
  background: url('images/title-brush.webp') center/100% 100% no-repeat;
  pointer-events: none;
}

.jnl-lead, .jnl-body {
  margin: 0;
  font-family: var(--serif-zh);
  font-weight: 500;
  font-size: clamp(16px, 1.3vw, 20px);
  line-height: 2;
  letter-spacing: 0.1em;
  color: var(--ink);
}
.jnl-body { font-weight: 400; color: var(--ink-soft); }
.jnl-lead em, .jnl-body em {
  font-style: normal;
  color: var(--moss);
  font-weight: 600;
  border-bottom: 1px dotted color-mix(in oklab, var(--moss) 50%, transparent);
  padding-bottom: 1px;
}

/* ── PORTAL CARDS (留言簿 / 照片簿 buttons) ────── */
.jnl-hero-right {
  position: absolute;
  inset: 0 0 0 clamp(-80px, -8vw, -40px);
  z-index: 1;
  display: grid;
  grid-template-rows: 1fr 1fr;
  pointer-events: auto;
}
.jnl-portal {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: clamp(120px, 14vw, 200px);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  text-decoration: none;
  isolation: isolate;
  transition: filter .4s ease;
}
.jnl-portal:hover { filter: brightness(1.07) saturate(1.08); }
.jnl-portal-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(0,0,0,0.08), rgba(0,0,0,0.28));
  transition: background .35s ease;
}
.jnl-portal:hover .jnl-portal-shade {
  background: linear-gradient(160deg, rgba(0,0,0,0.04), rgba(0,0,0,0.18));
}
.jnl-portal-label {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 28px;
  background: color-mix(in oklab, var(--sage) 78%, transparent);
  border: 1px solid color-mix(in oklab, var(--sage) 55%, transparent);
  border-radius: 4px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 12px 24px -10px color-mix(in oklab, var(--moss) 45%, transparent);
  transform: scale(1.3);
  transition: background .3s ease, transform .3s ease;
}
.jnl-portal:hover .jnl-portal-label {
  background: color-mix(in oklab, var(--moss) 88%, transparent);
  transform: scale(1.35);
}
.portal-en {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.36em;
  color: rgba(250, 246, 237, 0.7);
  text-transform: uppercase;
}
.portal-zh {
  font-family: var(--serif-zh);
  font-weight: 500;
  font-size: clamp(22px, 2vw, 30px);
  letter-spacing: 0.32em;
  color: #fffdf6;
}

/* ── SECTIONS ────────────────────────────────────── */
.jnl-section {
  padding: clamp(80px, 12vh, 140px) var(--gutter) clamp(60px, 10vh, 120px);
  background: var(--bg);
}
.jnl-section-album { background: var(--bg-soft); }

.jnl-section-head {
  max-width: 1400px;
  margin: 0 auto clamp(40px, 6vh, 64px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.jnl-section-title {
  position: relative;
  margin: 0;
  line-height: 0.95;
  display: inline-block;
  align-self: flex-start;
}
.jnl-section-title .jnl-title-text {
  font-size: var(--fs-section);
}
.jnl-section-sub {
  margin: 0;
  font-family: var(--serif-zh);
  font-size: clamp(13px, 1vw, 16px);
  letter-spacing: 0.18em;
  color: var(--ink-mute);
}

/* ── GRID ────────────────────────────────────────── */
.jnl-grid {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 2.2vw, 36px);
}

/* ── TEXT CARDS (留言簿) ─────────────────────────── */
.jnl-card-text {
  position: relative;
  padding: clamp(22px, 2vw, 32px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 18px 28px -18px rgba(46, 33, 23, 0.3);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 180px;
  transition: transform .3s ease, box-shadow .3s ease;
}
.jnl-card-text:hover {
  transform: translateY(-3px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 26px 36px -16px rgba(46, 33, 23, 0.35);
}
.jnl-card-date {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--moss);
}
.jnl-card-body {
  margin: 0;
  flex: 1;
  font-family: var(--serif-zh);
  font-size: clamp(14px, 1.1vw, 16px);
  line-height: 1.9;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.jnl-card-sig {
  align-self: flex-end;
  font-family: var(--serif-zh);
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--ink-mute);
}

/* ── ALBUM CARDS (照片簿 — polaroid w/ illustration) ── */
.jnl-card-album {
  appearance: none;
  border: 0;
  padding: 12px 12px 36px;
  background: var(--paper);
  border-radius: 3px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 22px 36px -22px rgba(46, 33, 23, 0.4),
    0 8px 14px -8px rgba(46, 33, 23, 0.18);
  cursor: pointer;
  transition: transform .35s ease, box-shadow .35s ease;
  position: relative;
}
.jnl-card-album:hover {
  transform: translateY(-4px) rotate(-0.4deg);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 30px 44px -18px rgba(46, 33, 23, 0.45),
    0 10px 18px -8px rgba(46, 33, 23, 0.22);
}

/* SOON placeholder — matches services green style */
.placeholder-art {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 2px;
  overflow: hidden;
  background:
    linear-gradient(160deg,
      color-mix(in oklab, var(--sage) 75%, transparent) 0%,
      color-mix(in oklab, var(--moss) 80%, transparent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(250, 246, 237, 0.55);
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 22px;
  letter-spacing: 0.4em;
}
.placeholder-art::after {
  content: "soon";
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid rgba(250, 246, 237, 0.4);
  border-radius: 999px;
}
.ph-cloud { display: none; }

/* ── LIGHTBOX ────────────────────────────────────── */
.jnl-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(20, 14, 8, 0.78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.jnl-lightbox[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}
.lightbox-content {
  position: relative;
  width: min(1200px, 92vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.lightbox-frame {
  background: var(--paper);
  padding: 16px 16px 44px;
  border-radius: 3px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 36px 60px -24px rgba(0, 0, 0, 0.5);
  transform: scale(0.94);
  transition: transform .35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow: hidden;
}
.jnl-lightbox[aria-hidden="false"] .lightbox-frame { transform: scale(1); }
.lightbox-art {
  width: 100%;
  flex: 1;
  min-height: 0;
  /* aspect-ratio removed — image determines its own ratio */
}

/* ── Zoom wrapper ─────────────────────────────────── */
.lightbox-zoom-wrap {
  width: 100%;
  height: 100%;
  min-height: 200px;
  overflow: hidden;
  cursor: zoom-in;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
}
.lightbox-zoom-wrap img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 100px);
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox-zoom-wrap.is-zoomed {
  overflow: auto;
  cursor: zoom-out;
  align-items: flex-start;
  justify-content: flex-start;
}
.lightbox-zoom-wrap.is-zoomed img {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
}
.lightbox-caption {
  display: block;
  margin-top: 18px;
  text-align: center;
  font-family: var(--serif-zh);
  font-size: 14px;
  letter-spacing: 0.22em;
  color: var(--ink-soft);
}
.lightbox-caption em {
  font-family: var(--serif-en);
  font-style: italic;
  color: var(--moss);
  margin: 0 4px;
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  border: 1px solid rgba(250, 246, 237, 0.3);
  background: rgba(250, 246, 237, 0.1);
  color: #faf6ed;
  font-size: 22px;
  font-family: var(--serif-en);
  border-radius: 50%;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease;
  z-index: 2;
}
.lightbox-close { top: 36px; right: 36px; transform: none; }
.lightbox-prev  { left: clamp(16px, 4vw, 56px); }
.lightbox-next  { right: clamp(16px, 4vw, 56px); }
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(250, 246, 237, 0.22);
  transform: translateY(-50%) scale(1.06);
}
.lightbox-close:hover { transform: scale(1.06); }

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 768px) {
  /* 單一背景，保持 100vh */
  .jnl-hero {
    height: 100vh;
    min-height: 560px;
  }

  /* 手機：水墨換成半透明遮罩 */
  .jnl-watercolor .wash { display: none; }
  .jnl-watercolor { background: linear-gradient(to bottom, transparent 70%, rgba(246, 239, 228, 1) 100%), url('images/mobile-wash-overlay.webp') center/cover no-repeat; }

  /* Grid 僅佔 portals 以上的空間 */
  .jnl-hero-grid {
    height: 100vh;
    align-items: center;
    padding-bottom: calc(2 * var(--fs-hero));
  }

  .jnl-hero-left {
    width: 100%;
    margin: 0;
    padding: 0 var(--gutter);
    align-items: flex-start;
    color: #111;
  }
  .jnl-lead, .jnl-body { padding-left: 5vw; }
  /* 眉標 */
  .jnl-eyebrow { color: #111; }
  .jnl-eyebrow .eyebrow-rule { background: #111; }
  /* 大標題置中 */
  .jnl-title { align-self: center; text-align: center; }
  /* 其他文字 */
  .jnl-lead, .jnl-body { color: var(--ink); }
  .jnl-lead em, .jnl-body em { color: var(--moss); }

  /* Portals：固定在 hero 底部，橫排並列，z-index 高於水墨 */
  .jnl-hero-right {
    inset: auto 0 0 0;
    z-index: 4;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
    height: 150px;
  }

  /* Portal：手機版隱藏各自背景圖，只顯示單一 hero 背景 */
  .jnl-portal {
    justify-content: center;
    padding-right: 0;
    background-image: none !important;
  }
  .jnl-portal-shade { display: none; }
  .jnl-portal-label {
    transform: scale(1);
    padding: 10px 20px;
  }
  .jnl-portal:hover .jnl-portal-label { transform: scale(1.05); }

  .jnl-title-text { font-size: clamp(28px, 16vw, 72px); }
  .jnl-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .jnl-hero-grid { height: calc(100vh - 130px); }
  .jnl-hero-right { height: 130px; }
  .jnl-title-text { font-size: clamp(28px, 16vw, 52px); }
  .jnl-grid { grid-template-columns: 1fr; }
}
