/* =========================================================
   養徳寺 共通スタイル
   ========================================================= */

:root {
  --kinari: #f6f1e7;       /* 生成り */
  --kinari-deep: #ece4d4;
  --sumi: #2b2926;         /* 墨 */
  --sumi-deep: #161513;
  --sumi-soft: #5a5650;
  --shu: #b8422e;          /* 朱 */
  --shu-deep: #963322;
  --line: #d8cdb8;
  --paper: #fbf8f2;

  --font-mincho: "Klee One", "UD デジタル 教科書体 N-R", "UD Digi Kyokasho N-R", serif;
  --font-gothic: "Klee One", "UD デジタル 教科書体 N-R", "UD Digi Kyokasho N-R", serif;

  --header-h: 72px;
  --wrap: 1080px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--kinari);
  color: var(--sumi);
  font-family: var(--font-gothic);
  font-size: 17px;
  line-height: 1.95;
  letter-spacing: 0.04em;
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 768px) {
  body { font-size: 18px; }
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--shu-deep); text-underline-offset: 0.2em; }
a:hover { color: var(--shu); }

h1, h2, h3, h4 {
  font-family: var(--font-mincho);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.08em;
  margin: 0 0 0.8em;
}

p { margin: 0 0 1.2em; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  padding: 0 !important; border: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

/* 差し替えが必要な箇所の目印 */
.todo {
  background: #fff3b0;
  color: #6b5200;
  padding: 0 0.2em;
  border-radius: 2px;
}

/* ---------------------------------------------------------
   ヘッダー
   --------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(246, 241, 231, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  view-transition-name: site-header;
}

.site-header .wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--sumi);
}

.logo__mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--shu);
  color: #fff;
  font-family: var(--font-mincho);
  font-size: 20px;
  border-radius: 3px;
}

.logo__text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.logo__corp { font-size: 11px; color: var(--sumi-soft); letter-spacing: 0.15em; }
.logo__name { font-family: var(--font-mincho); font-size: 22px; font-weight: 600; letter-spacing: 0.2em; }

.nav ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  gap: 4px;
}

.nav a {
  display: block;
  padding: 8px 14px;
  color: var(--sumi);
  text-decoration: none;
  font-family: var(--font-mincho);
  font-size: 16px;
  letter-spacing: 0.1em;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.nav a:hover { color: var(--shu); }
.nav a[aria-current="page"] { border-bottom-color: var(--shu); }

.nav-toggle {
  display: none;
  width: 48px; height: 48px;
  border: 0; background: transparent;
  cursor: pointer;
  position: relative;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  position: absolute;
  left: 12px;
  width: 24px; height: 2px;
  background: var(--sumi);
  transition: transform 0.25s, opacity 0.25s;
  content: "";
}
.nav-toggle span { top: 23px; }
.nav-toggle span::before { top: -8px; left: 0; }
.nav-toggle span::after { top: 8px; left: 0; }

.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { transform: translateY(8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--kinari);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    display: none;
  }
  .nav.is-open { display: block; }
  .nav ul { flex-direction: column; padding: 8px 20px 20px; }
  .nav a { padding: 14px 4px; border-bottom: 1px solid var(--line); font-size: 18px; }
  .nav a[aria-current="page"] { color: var(--shu); border-bottom-color: var(--line); }
}

/* ---------------------------------------------------------
   トップ画面（ヒーロー）
   --------------------------------------------------------- */
/* 空の色（js/hero-time.js が日本時間に合わせて書き換える）。
   @property で登録して、色がゆっくり移り変わるようにする */
@property --sky-top { syntax: "<color>"; inherits: true; initial-value: #2f2c29; }
@property --sky-bottom { syntax: "<color>"; inherits: true; initial-value: #1f1d1a; }
@property --sky-glow { syntax: "<color>"; inherits: true; initial-value: rgb(255 255 255 / 0.1); }

.hero {
  position: relative;
  height: calc(100svh - var(--header-h));
  min-height: 560px;
  overflow: hidden;
  color: var(--kinari);
  background:
    radial-gradient(ellipse 75% 45% at 50% 100%, var(--sky-glow), transparent 75%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 100%);
  transition: --sky-top 3s ease, --sky-bottom 3s ease, --sky-glow 3s ease;
}

/* WebGL が使えない・動きを減らす設定のときの静止背景（和紙の質感を重ねる） */
.hero--static {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 75% 45% at 50% 100%, var(--sky-glow), transparent 75%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 100%);
}

.hero__smoke,
.hero__season {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero__smoke { opacity: 0; transition: opacity 2.5s ease; }

/* 香炉と線香 */
.incense {
  position: absolute;
  left: 76%;
  bottom: 6%;
  z-index: 1;
  width: clamp(96px, 9vw, 130px);
  transform: translateX(-50%);
  pointer-events: none;
}
/* 線香の写真（images/incense.png：30×661、軸の幅 24、先端は (14, 12)）。
   枠（120×230）の中で、先端が (60, 34) に来るように置く。軸の幅は枠の幅の 6.25% */
.incense {
  container-type: inline-size;
  aspect-ratio: 120 / 230;
}
.incense img {
  --iw: calc(6.25cqw * 30 / 24);
  position: absolute;
  width: var(--iw);
  height: auto;
  left: calc(50cqw - var(--iw) * 14 / 30);
  top: calc(100cqw * 34 / 120 - var(--iw) * 12 / 30);
}
/* 煙の出どころ：線香の先（画像の 120×230 の枠で x=60, y=34） */
.incense__tip {
  position: absolute;
  left: 50%;
  top: calc(34 / 230 * 100%);
  width: 1px;
  height: 1px;
}

@media (max-width: 600px) {
  .incense { left: 18%; bottom: 4%; width: 84px; }
}
.hero__smoke.is-ready { opacity: 1; }

.hero__inner {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 3.5vh, 36px);
  /* 墨蹟を中央より少し上に置き、下の線香と重ならないようにする */
  padding: 24px 16px 216px;
}

/* 寺号額の墨蹟から抜き出した「養徳寺」の三字（色は生成り） */
.bokuseki {
  position: relative;
  margin: 0;
  width: min(88vw, 960px, calc((100svh - var(--header-h) - 220px) * 2.025));
  aspect-ratio: 1895 / 936;
  /* 煙や夕焼けの上でも字が沈まないように、ごく薄い影 */
  filter: drop-shadow(0 0 18px rgba(0, 0, 0, 0.45));
}

.bokuseki__ink,
.bokuseki__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* 演出の準備ができるまで完成形を隠す（JS が無効・静止表示なら最初から見せる） */
.js .hero:not(.hero--static) .bokuseki:not(.is-done) .bokuseki__ink { opacity: 0; }

/* ---------------------------------------------------------
   セクション共通
   --------------------------------------------------------- */
.section { padding: clamp(64px, 10vw, 120px) 0; }
.section--paper { background: var(--paper); }
.section--deep { background: var(--kinari-deep); }

.section-title {
  text-align: center;
  margin-bottom: clamp(36px, 6vw, 64px);
}
.section-title .en {
  display: block;
  font-family: var(--font-gothic);
  font-size: 12px;
  letter-spacing: 0.4em;
  color: var(--shu);
  margin-bottom: 6px;
}
.section-title h2 {
  font-size: clamp(24px, 3.4vw, 32px);
  margin: 0;
}
.section-title h2::after {
  content: "";
  display: block;
  width: 40px; height: 2px;
  background: var(--shu);
  margin: 18px auto 0;
}

.section-title--left { text-align: left; margin-bottom: 32px; }
.section-title--left h2::after { margin-left: 0; }

/* 下層ページの見出し */
.page-head {
  position: relative;
  padding: clamp(64px, 10vw, 110px) 0 clamp(48px, 7vw, 80px);
  background:
    radial-gradient(ellipse 50% 80% at 85% 0%, rgba(184, 66, 46, 0.14), transparent 70%),
    linear-gradient(180deg, #25221e, var(--sumi-deep));
  color: var(--kinari);
  text-align: center;
  overflow: hidden;
}
.page-head .en {
  display: block;
  font-size: 12px;
  letter-spacing: 0.4em;
  color: #e3a08f;
  margin-bottom: 8px;
}
.page-head h1 { font-size: clamp(28px, 4.4vw, 42px); margin: 0; letter-spacing: 0.2em; }

.breadcrumb { font-size: 13px; padding-top: 14px; padding-bottom: 14px; color: var(--sumi-soft); }
.breadcrumb a { color: var(--sumi-soft); }

/* ご挨拶（縦書き） */
.greeting {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
}

.greeting__text {
  writing-mode: vertical-rl;
  font-family: var(--font-mincho);
  font-size: 18px;
  line-height: 2.3;
  letter-spacing: 0.14em;
  height: 460px;
  margin: 0 auto;
  padding: 32px 40px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 #fff inset, 0 20px 40px -24px rgba(0, 0, 0, 0.25);
  max-width: 100%;
  overflow-x: auto;
}
.greeting__text p { margin: 0 0 0 1.2em; }
.greeting__sign { text-align: end; margin-top: 2em; }

@media (max-width: 767px) {
  /* スマホでは縦書きをやめて読みやすさを優先 */
  .greeting__text {
    writing-mode: horizontal-tb;
    height: auto;
    padding: 28px 24px;
    font-size: 17px;
  }
  .greeting__text p { margin: 0 0 1.2em; }
}

/* カード */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--sumi);
  transition: transform 0.3s, box-shadow 0.3s;
}
a.card:hover {
  color: var(--sumi);
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -16px rgba(0, 0, 0, 0.3);
}
.card__body { padding: 24px; flex: 1; }
.card__title {
  font-family: var(--font-mincho);
  font-size: 20px;
  margin: 0 0 0.5em;
}
.card__more {
  display: inline-block;
  margin-top: 8px;
  color: var(--shu-deep);
  font-size: 15px;
}

/* 写真の仮置き */
.photo {
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.03) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.03) 50%, rgba(0, 0, 0, 0.03) 75%, transparent 75%) 0 0 / 16px 16px,
    var(--kinari-deep);
  color: var(--sumi-soft);
  font-size: 14px;
  letter-spacing: 0.1em;
  text-align: center;
  padding: 12px;
}
.photo--tall { aspect-ratio: 4 / 5; }

/* お知らせ */
.news-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.news-list li {
  display: grid;
  grid-template-columns: 8em 6em 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 18px 4px;
  border-bottom: 1px solid var(--line);
}
.news-list time { color: var(--sumi-soft); font-size: 15px; }
.tag {
  display: inline-block;
  font-size: 12px;
  text-align: center;
  padding: 2px 8px;
  border: 1px solid var(--shu);
  color: var(--shu);
  letter-spacing: 0.1em;
  line-height: 1.6;
}
@media (max-width: 600px) {
  .news-list li { grid-template-columns: auto auto 1fr; }
  .news-list li > :last-child { grid-column: 1 / -1; }
}

.center { text-align: center; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 36px;
  border: 1px solid var(--sumi);
  color: var(--sumi);
  text-decoration: none;
  font-family: var(--font-mincho);
  letter-spacing: 0.15em;
  transition: background 0.25s, color 0.25s;
}
.btn:hover { background: var(--sumi); color: var(--kinari); }
.btn--shu { border-color: var(--shu); background: var(--shu); color: #fff; }
.btn--shu:hover { background: var(--shu-deep); border-color: var(--shu-deep); color: #fff; }

/* 2 カラム */
.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
}
@media (min-width: 860px) {
  .split { grid-template-columns: 1fr 1fr; gap: 64px; }
  .split--reverse > :first-child { order: 2; }
}

/* 定義表 */
.table {
  width: 100%;
  border-collapse: collapse;
  border-top: 1px solid var(--line);
}
.table th,
.table td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.table th {
  width: 9em;
  font-family: var(--font-mincho);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.025);
  white-space: nowrap;
}
@media (max-width: 600px) {
  .table th, .table td { display: block; width: auto; }
  .table th { border-bottom: 0; padding-bottom: 4px; }
  .table td { padding-top: 4px; }
}

/* 年中行事 */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5.2em; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--line);
}
.timeline li {
  display: grid;
  grid-template-columns: 4.4em 1fr;
  gap: 2em;
  padding: 18px 0;
  position: relative;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: calc(5.2em - 5px); top: 30px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--shu);
  box-shadow: 0 0 0 4px var(--kinari);
}
.timeline .month {
  font-family: var(--font-mincho);
  font-size: 22px;
  color: var(--shu-deep);
  text-align: right;
}
.timeline h3 { font-size: 20px; margin: 0 0 4px; }
.timeline p { margin: 0; color: var(--sumi-soft); }
.timeline .date { font-size: 14px; color: var(--sumi-soft); margin-left: 0.6em; font-family: var(--font-gothic); font-weight: 400; }

/* 注意書き */
.note {
  padding: 24px 28px;
  background: var(--paper);
  border-left: 4px solid var(--shu);
}
.note p:last-child { margin-bottom: 0; }

/* 連絡先ボックス */
.contact-box {
  text-align: center;
  padding: clamp(32px, 5vw, 56px) 24px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.contact-box .tel {
  display: inline-block;
  font-family: var(--font-mincho);
  font-size: clamp(28px, 5vw, 40px);
  letter-spacing: 0.1em;
  color: var(--sumi);
  text-decoration: none;
  margin: 8px 0;
}
.contact-box small { display: block; color: var(--sumi-soft); }

.map {
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 0;
  background: var(--kinari-deep);
}

/* ---------------------------------------------------------
   フッター
   --------------------------------------------------------- */
.site-footer {
  background: var(--sumi-deep);
  color: #cfc8ba;
  padding: 56px 0 28px;
  font-size: 15px;
}
.site-footer a { color: #cfc8ba; }
.site-footer a:hover { color: #fff; }

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 1.4fr 1fr; }
}

.footer-name {
  font-family: var(--font-mincho);
  font-size: 22px;
  color: var(--kinari);
  letter-spacing: 0.2em;
  margin-bottom: 8px;
}
.footer-name small { display: block; font-size: 12px; letter-spacing: 0.15em; color: #9d968a; }
/* 寺名の右に、少し空けて住職名 */
.footer-name__priest { margin-left: 1.6em; font-size: 16px; letter-spacing: 0.14em; color: #cfc8ba; white-space: nowrap; }
.site-footer address { font-style: normal; }

.footer-nav ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }

.footer-bottom {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: #8b857a;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

/* ---------------------------------------------------------
   スクロール連動のフェードイン（対応ブラウザのみ）
   --------------------------------------------------------- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal {
      animation: reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 28%;
    }
  }
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(32px); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}

/* ---------------------------------------------------------
   ページ切り替え（襖が開くような演出）
   --------------------------------------------------------- */
@view-transition { navigation: auto; }

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: 0.45s ease both fusuma-out; }
  ::view-transition-new(root) { animation: 0.55s ease both fusuma-in; }
}

@keyframes fusuma-out {
  to { opacity: 0; }
}
@keyframes fusuma-in {
  from { opacity: 0; clip-path: inset(0 50% 0 50%); }
  to { opacity: 1; clip-path: inset(0 0 0 0); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* カードが 1 枚だけのとき */
.cards--single { grid-template-columns: minmax(0, 420px); justify-content: center; }

/* ---------------------------------------------------------
   お問い合わせフォーム
   --------------------------------------------------------- */
.contact-form .field { margin-bottom: 24px; }
.contact-form label {
  display: block;
  font-family: var(--font-mincho);
  font-weight: 600;
  margin-bottom: 6px;
}
.contact-form .req {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  font-size: 12px;
  line-height: 1.7;
  color: #fff;
  background: var(--shu);
  border-radius: 2px;
  vertical-align: 2px;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--sumi);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
  line-height: 1.6;
}
.contact-form textarea { resize: vertical; min-height: 10em; }
.contact-form input:focus,
.contact-form textarea:focus {
  outline: 2px solid var(--shu);
  outline-offset: 1px;
  border-color: transparent;
}
.contact-form .btn { font-size: 17px; cursor: pointer; }
.contact-form .btn:disabled { opacity: 0.6; cursor: wait; }
.form-error { color: var(--shu-deep); min-height: 1.5em; margin: 0 0 8px; }
.btn-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; }

.confirm-list {
  margin: 0 0 32px;
  border-top: 1px solid var(--line);
}
.confirm-list dt {
  font-family: var(--font-mincho);
  font-weight: 600;
  padding: 16px 4px 4px;
}
.confirm-list dd {
  margin: 0;
  padding: 0 4px 16px;
  border-bottom: 1px solid var(--line);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
