:root {
    --green: #4d8b73;
    --green-dark: #3a6e59;
    --green-deep: #2d5847;
    --green-tint: #eef4f1;
    --cream: #f8f1cd;
    --gold: #c8973f;
    --gold-dark: #ad7f2f;
    --emergency: #C60000;
    --emergency-bg: #fdeceb;
    --ink: #2f3633;
    --ink-soft: #5f6b66;
    --line: #e3e7e4;
    --bg: #fff;
    --bg-soft: #f5f8f6;
    --sans: "Noto Sans JP", sans-serif;
    --mincho: "Shippori Mincho B1", serif;
    --r-lg: 18px;
    --shadow: 0 18px 44px -24px rgba(45, 88, 71, .5);
    --shadow-sm: 0 8px 22px -14px rgba(45, 88, 71, .4);
}

body {
    font-family: var(--sans);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
}

.mincho { font-family: var(--mincho); }
a { text-decoration: none; color: inherit; transition: .2s; }

/* Bootstrap overrides */
.bg-green-deep { background-color: var(--green-deep) !important; }
.bg-green { background-color: var(--green) !important; }
.bg-green-tint { background-color: var(--green-tint) !important; }
.bg-cream { background-color: var(--cream) !important; }
.text-green-deep { color: var(--green-deep) !important; }
.text-green-dark { color: var(--green-dark) !important; }
.text-gold { color: var(--gold) !important; }
.text-gold-dark { color: var(--gold-dark) !important; }

.btn-gold { background-color: var(--gold); color: #fff; border: none; font-weight: 700; }
.btn-gold:hover { background-color: var(--gold-dark); color: #fff; }
.btn-outline-green { border: 2px solid var(--green); color: var(--green-dark); font-weight: 700; border-radius: 26px; }
.btn-outline-green:hover { background-color: var(--green); color: #fff; }

/* Topbar */
.topbar { font-size: 0.8rem; color: #dbeae3; }
.topbar b { color: #fff; }

/* Header */
.header { position: sticky; top: 0; z-index: 1020; background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand-name { font-family: var(--mincho); font-size: 1.25rem; font-weight: 700; color: var(--green-deep); line-height: 1.2; }
.brand-sub { font-size: 0.66rem; color: var(--ink-soft); display: block; }

/* Gnav */
.gnav-link { font-weight: 500; font-size: 0.94rem; padding: 1rem 1.25rem; position: relative; }
.gnav-link:hover { color: var(--green-dark); }
.gnav-link::after { content: ""; position: absolute; left: 1.25rem; right: 1.25rem; bottom: 0; height: 3px; background: var(--gold); transform: scaleX(0); transition: 0.2s; }
.gnav-link:hover::after { transform: scaleX(1); }

/* Footer */
.footer { background-color: var(--green-deep); color: #cfe2d9; padding: 4rem 0 2rem; position: relative; }
.footer-bg { position: absolute; inset: 0; opacity: 0.1; object-fit: cover; width: 100%; height: 100%; }
.footer h4 { color: #fff; font-size: 1rem; margin-bottom: 1.25rem; }
.footer-nav a:hover { color: #fff; text-decoration: underline; }

@media (max-width: 991.98px) {
    .header { position: relative; }
}

/* --- Page specific styles --- */

/* Index */
.carousel-item { height: min(60vh, 480px); min-height: 340px; background: var(--green-deep); }
.carousel-item img { width: 100%; height: 100%; object-fit: cover; }
.carousel-overlay { position: absolute; inset: 0; background: linear-gradient(92deg, rgba(45, 88, 71, 0.72), rgba(45, 88, 71, 0.2) 58%, transparent); z-index: 1; }
.carousel-caption-custom { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; color: #fff; }
.hero-eyebrow { display: inline-block; border: 1px solid rgba(255, 255, 255, 0.5); font-size: 0.78rem; letter-spacing: 0.18em; padding: 6px 16px; border-radius: 24px; margin-bottom: 1.25rem; }
.hero-title { font-family: var(--mincho); font-weight: 800; font-size: clamp(1.7rem, 4vw, 2.9rem); line-height: 1.4; letter-spacing: 0.04em; text-shadow: 0 2px 20px rgba(0,0,0,0.35); }
.hero-em { color: #f1d49a; }

.infobar { margin-top: -64px; position: relative; z-index: 10; }
.infobar-card { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow); border-top: 4px solid var(--gold); overflow: hidden; }
.infobar-item { padding: 1.5rem; border-right: 1px solid var(--line); }
.infobar-item:last-child { border-right: none; }
.infobar-label { font-family: var(--mincho); font-weight: 700; color: var(--green-dark); display: flex; align-items: center; gap: 8px; margin-bottom: 0.5rem; }
.infobar-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--green-tint); display: flex; align-items: center; justify-content: center; color: var(--green); }
.infobar-value { font-family: var(--mincho); font-size: 1.5rem; font-weight: 700; }
.infobar-value-group { line-height: 1.3; }
.infobar-value-sub { font-family: var(--mincho); font-size: 1.15rem; font-weight: 700; margin-bottom: 2px; }
.infobar-tel { color: var(--gold-dark); font-family: var(--mincho); font-weight: 700; font-size: 1.4rem; }

.tile-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.5rem 1rem; text-align: center; transition: 0.25s; box-shadow: var(--shadow-sm); height: 100%; display: block; }
.tile-card:hover { transform: translateY(-6px); border-color: var(--green); box-shadow: var(--shadow); color: inherit; }
.tile-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--green-tint); display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; color: var(--green); transition: 0.25s; }
.tile-card:hover .tile-icon { background: var(--green); color: #fff; }
.tile-title { font-family: var(--mincho); font-size: 0.98rem; font-weight: 700; margin-bottom: 4px; }
.tile-en { font-size: 0.62rem; color: var(--gold-dark); letter-spacing: 0.08em; font-weight: 700; display: block; }

section { padding: 4rem 0; }
.dept-section { background-color: var(--green); color: #fff; }
.dept-card-wrap { background: #fff; border-radius: 14px; padding: 1rem 2rem; box-shadow: var(--shadow); }
.dept-link { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 500; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.dept-link:hover { color: var(--green-dark); }
.dept-link::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

@media (max-width: 991.98px) {
    .infobar { margin-top: 2rem; }
    .infobar-item { border-right: none; border-bottom: 1px solid var(--line); }
    .infobar-item:last-child { border-bottom: none; }
    .carousel-item { height: 300px; }
    .carousel-caption-custom { position: static; background: var(--green-deep); padding: 2rem 0; color: #fff; }
    .carousel-overlay { display: none; }
}

/* About / Common Page Header */
.page-header { background: var(--green-deep); color: #fff; padding: 4rem 0; position: relative; overflow: hidden; }
.page-header::after { content: ""; position: absolute; inset: 0; background: url('https://www.sasayama.hyo-med.ac.jp/common/css/img/bg_footer.jpg') center/cover; opacity: 0.15; }
.page-header .container { position: relative; z-index: 2; }
.page-header h1 { font-family: var(--mincho); font-size: 2.5rem; font-weight: 800; margin-bottom: 0.5rem; }
.page-header .breadcrumb { font-size: 0.85rem; color: rgba(255,255,255,0.8); }
.page-header .breadcrumb a { color: #fff; }

.content-area { padding: 5rem 0; }
.content-section { margin-bottom: 5rem; }
.content-section:last-child { margin-bottom: 0; }
.content-title { font-family: var(--mincho); font-size: 2rem; font-weight: 700; color: var(--green-deep); margin-bottom: 2rem; border-bottom: 2px solid var(--green); padding-bottom: 0.5rem; display: inline-block; }

.table-custom th { background-color: var(--green-tint); color: var(--green-deep); font-weight: 700; width: 25%; }

/* Access Styles */
.access-map { border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.access-info-card { height: 100%; border-radius: 14px; border: 1px solid var(--line); padding: 2rem; background: #fff; }
/* Dept Table */
.dept-table th { background-color: var(--green-tint); color: var(--green-deep); font-weight: 700; width: 30%; }

@media (max-width: 991.98px) {
  .dept-table th { width: 40%; }
}

/* Outpatient Styles */
.reception-box { background: var(--cream); border-radius: 14px; padding: 2rem; border: 1px solid var(--gold); }
.flow-step { position: relative; padding-left: 3rem; margin-bottom: 2rem; }
.flow-step::before { content: attr(data-step); position: absolute; left: 0; top: 0; width: 2rem; height: 2rem; background: var(--green); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.flow-step::after { content: ""; position: absolute; left: 1rem; top: 2.5rem; bottom: -1.5rem; width: 2px; background: var(--line); }
.flow-step:last-child::after { display: none; }
