/*
 * 東京都 白内障手術クリニックガイド
 * Drop-in replacement stylesheet
 * Existing class names, IDs and HTML structure are preserved.
 */

:root {
  --color-primary: #155f73;
  --color-primary-dark: #0c3e4b;
  --color-primary-soft: #e7f2f4;
  --color-accent: #bd8750;
  --color-accent-soft: #fbf3e9;
  --color-bg: #f4f7f6;
  --color-card: #ffffff;
  --color-text: #17313a;
  --color-text-muted: #53676e;
  --color-border: #d6e0df;
  --color-border-strong: #b8c9c7;
  --color-yes: #176b4b;
  --color-yes-bg: #e5f3eb;
  --color-no: #6e6262;
  --color-no-bg: #f1eeee;
  --radius: 14px;
  --radius-small: 9px;
  --shadow: 0 8px 28px rgba(18, 54, 61, 0.07);
  --shadow-hover: 0 12px 32px rgba(18, 54, 61, 0.11);
  --max-width: 1160px;
  --focus-ring: 0 0 0 4px rgba(21, 95, 115, 0.2);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 0%, rgba(222, 239, 240, 0.72), transparent 30rem),
    var(--color-bg);
  color: var(--color-text);
  font-family: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.8;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

.container {
  width: min(100% - 40px, var(--max-width));
  margin-inline: auto;
  padding: 0;
}

/* Header */
header.site-header {
  position: relative;
  z-index: 50;
  padding: 0;
  background: rgba(255, 255, 255, 0.96);
  color: var(--color-text);
  border-top: 5px solid var(--color-primary);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 3px 16px rgba(17, 50, 58, 0.05);
}

header.site-header .container {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-title {
  position: relative;
  padding-left: 18px;
  color: var(--color-primary-dark);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 750;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.site-title::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: 99px;
  background: var(--color-accent);
}

.site-title small {
  display: block;
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

nav.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
}

nav.site-nav a {
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

nav.site-nav a:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  text-decoration: none;
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(56px, 8vw, 96px) 0 clamp(52px, 7vw, 84px);
  text-align: center;
  background:
    linear-gradient(135deg, rgba(232, 244, 244, 0.72), rgba(255, 255, 255, 0.86)),
    repeating-linear-gradient(90deg, transparent 0 79px, rgba(21, 95, 115, 0.025) 80px);
  border-bottom: 1px solid var(--color-border);
}

.hero::after {
  content: "";
  position: absolute;
  width: 340px;
  height: 340px;
  right: -150px;
  bottom: -230px;
  border: 58px solid rgba(189, 135, 80, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero h1 {
  max-width: 850px;
  margin: 0 auto 18px;
  color: var(--color-primary-dark);
  font-size: clamp(1.75rem, 4.2vw, 2.75rem);
  font-weight: 750;
  line-height: 1.45;
  letter-spacing: 0.015em;
}

.hero p {
  max-width: 740px;
  margin: 0 auto 30px;
  color: var(--color-text-muted);
  font-size: clamp(1rem, 1.8vw, 1.08rem);
  line-height: 1.9;
}

.search-box {
  max-width: 680px;
  margin: 0 auto;
  padding: 7px;
  display: flex;
  gap: 8px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 15px;
  box-shadow: 0 14px 38px rgba(17, 57, 65, 0.13);
}

.search-box:focus-within {
  border-color: var(--color-primary);
  box-shadow: var(--shadow), var(--focus-ring);
}

.search-box input {
  min-width: 0;
  flex: 1;
  min-height: 50px;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font-size: 1rem;
  outline: 0;
}

.search-box input::placeholder {
  color: #718288;
}

.search-box button {
  min-height: 50px;
  padding: 10px 24px;
  border: 1px solid var(--color-primary);
  border-radius: 10px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.98rem;
  font-weight: 700;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.search-box button:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-1px);
}

/* Sections and information cards */
section {
  padding: clamp(36px, 6vw, 64px) 0;
}

section.container + section.container {
  padding-top: 12px;
}

.section-title,
.page-content h2 {
  position: relative;
  margin: 0 0 26px;
  padding: 0 0 13px;
  border: 0;
  color: var(--color-primary-dark);
  font-size: clamp(1.35rem, 2.8vw, 1.75rem);
  font-weight: 750;
  line-height: 1.5;
  letter-spacing: 0.015em;
}

.section-title::after,
.page-content h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 64px;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--color-primary) 0 72%, var(--color-accent) 72%);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.info-card {
  position: relative;
  min-height: 175px;
  overflow: hidden;
  padding: 26px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.info-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--color-primary);
}

.info-card h3 {
  margin: 0 0 12px;
  color: var(--color-primary-dark);
  font-size: 1.08rem;
  font-weight: 750;
}

.info-card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  line-height: 1.8;
}

/* info-card is also used as a link (top page quick links) */
a.info-card {
  display: block;
  text-decoration: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

a.info-card:hover,
a.info-card:focus-visible {
  text-decoration: none;
  border-color: #b9cecd;
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.disclaimer {
  position: relative;
  padding: 18px 20px 18px 50px;
  background: var(--color-accent-soft);
  border: 1px solid #e8d6bd;
  border-radius: 12px;
  color: #5f513f;
  font-size: 0.91rem;
  line-height: 1.8;
}

.disclaimer::before {
  content: "i";
  position: absolute;
  top: 19px;
  left: 18px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid #9d774f;
  border-radius: 50%;
  color: #795a3d;
  font-family: Georgia, serif;
  font-weight: 700;
  line-height: 1;
}

/* Filters */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 16px;
  margin-bottom: 26px;
  padding: 22px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-top: 4px solid var(--color-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.filter-bar label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.4;
}

.filter-bar select,
.filter-bar input[type="text"],
.ward-toggle-btn {
  min-height: 44px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-small);
  color: var(--color-text);
  font-size: 0.91rem;
  font-weight: 500;
  line-height: 1.4;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.filter-bar input[type="text"] {
  width: min(240px, 100%);
}

.filter-bar select:hover,
.filter-bar input[type="text"]:hover,
.ward-toggle-btn:hover {
  border-color: var(--color-primary);
}

.filter-bar select:focus,
.filter-bar input[type="text"]:focus,
.ward-toggle-btn:focus {
  border-color: var(--color-primary);
  outline: 0;
  box-shadow: var(--focus-ring);
}

.result-count {
  margin-left: auto;
  padding: 9px 12px;
  color: var(--color-primary-dark);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.ward-multiselect {
  position: relative;
}

.ward-toggle-btn {
  white-space: nowrap;
}

.ward-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  width: min(320px, calc(100vw - 40px));
  max-height: 390px;
  overflow-y: auto;
  padding: 12px;
  background: var(--color-card);
  border: 1px solid var(--color-border-strong);
  border-radius: 12px;
  box-shadow: 0 18px 45px rgba(16, 46, 54, 0.18);
}

.ward-panel[hidden] {
  display: none;
}

.ward-panel-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 9px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

.ward-panel-actions button {
  min-height: 36px;
  padding: 6px 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 7px;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.ward-panel-actions button:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
}

.ward-checkbox-list label {
  min-height: 40px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 7px;
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.ward-checkbox-list label:hover {
  background: var(--color-primary-soft);
}

.ward-checkbox-list input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

/* Clinic cards */
.clinic-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.clinic-card {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  overflow: hidden;
  padding: 23px 24px 23px 28px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 5px 20px rgba(18, 54, 61, 0.055);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.clinic-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--color-primary);
}

.clinic-card:hover {
  border-color: #b9cecd;
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.clinic-main {
  min-width: 240px;
  flex: 1 1 430px;
}

.clinic-name {
  margin: 0 0 8px;
  color: var(--color-primary-dark);
  font-size: clamp(1.05rem, 2vw, 1.18rem);
  font-weight: 750;
  line-height: 1.55;
}

.clinic-meta {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.clinic-note {
  margin-top: 7px;
  color: var(--color-text-muted);
  font-size: 0.83rem;
  line-height: 1.65;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin: 2px 3px 2px 0;
  padding: 4px 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.badge-yes {
  background: var(--color-yes-bg);
  border-color: #bfddcd;
  color: var(--color-yes);
}

.badge-no {
  background: var(--color-no-bg);
  border-color: #ddd4d4;
  color: var(--color-no);
}

.badge-rating {
  background: #f4f6f6;
  border-color: var(--color-border);
  color: #4b5f66;
  font-weight: 600;
}

.clinic-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 9px;
  align-items: center;
}

.btn-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 15px;
  background: #fff;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-small);
  color: var(--color-primary);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.btn-link:hover {
  background: var(--color-primary);
  color: #fff;
  text-decoration: none;
}

/* Pagination (clinic list) */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 28px 0 8px;
}

.pagination button {
  min-height: 42px;
  padding: 8px 18px;
  background: #fff;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-small);
  color: var(--color-primary);
  font-size: 0.88rem;
  font-weight: 700;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.pagination button:hover:not(:disabled) {
  background: var(--color-primary);
  color: #fff;
}

.pagination button:disabled {
  border-color: var(--color-border);
  color: var(--color-text-muted);
  opacity: 0.5;
  cursor: default;
}

.pagination-info {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

/* Content pages and FAQ */
.page-content {
  max-width: 840px;
}

.page-content h2 {
  margin-top: 48px;
}

.page-content h3 {
  margin: 30px 0 10px;
  color: var(--color-primary-dark);
  font-size: 1.15rem;
  line-height: 1.6;
}

.page-content p,
.page-content li {
  line-height: 1.9;
}

.page-content ul {
  padding-left: 1.4em;
}

.faq-item {
  margin-bottom: 15px;
  padding: 21px 22px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 18px rgba(18, 54, 61, 0.05);
}

.faq-item .q {
  position: relative;
  margin-bottom: 9px;
  padding-left: 32px;
  color: var(--color-primary-dark);
  font-weight: 750;
}

.faq-item .q::before {
  content: "Q";
  position: absolute;
  top: 0.05em;
  left: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  background: var(--color-primary-soft);
  border-radius: 50%;
  color: var(--color-primary);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1;
}

/* Footer */
footer {
  margin-top: 54px;
  padding: 38px 0;
  background: #14343d;
  border-top: 5px solid var(--color-accent);
  color: #d1dddf;
  font-size: 0.84rem;
  line-height: 1.8;
  text-align: center;
}

footer p {
  margin: 5px 0;
}

footer a {
  color: #fff;
}

/* Tablet */
@media (max-width: 900px) {
  header.site-header .container {
    min-height: auto;
    padding-block: 16px;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  nav.site-nav {
    justify-content: flex-start;
    margin-left: -8px;
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-bar {
    align-items: stretch;
  }

  .result-count {
    width: 100%;
    margin-left: 0;
    padding-left: 0;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .container {
    width: min(100% - 28px, var(--max-width));
  }

  header.site-header {
    border-top-width: 4px;
  }

  header.site-header .container {
    padding-block: 14px;
  }

  .site-title {
    padding-left: 14px;
    font-size: 1.03rem;
  }

  nav.site-nav {
    display: none;
  }

  .hero {
    padding: 48px 0 52px;
  }

  .hero h1 {
    font-size: 1.75rem;
    line-height: 1.5;
  }

  .hero p {
    margin-bottom: 24px;
    text-align: left;
  }

  .search-box {
    padding: 8px;
    flex-direction: column;
    border-radius: 13px;
  }

  .search-box input,
  .search-box button {
    width: 100%;
    min-height: 50px;
  }

  .search-box input {
    padding-inline: 10px;
  }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .info-card {
    min-height: 0;
    padding: 22px;
  }

  .disclaimer {
    padding: 16px 16px 16px 46px;
    font-size: 0.88rem;
  }

  .disclaimer::before {
    top: 17px;
    left: 15px;
  }

  .filter-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px;
  }

  .filter-bar label,
  .filter-bar select,
  .filter-bar input[type="text"],
  .ward-multiselect,
  .ward-toggle-btn {
    width: 100%;
  }

  .ward-toggle-btn {
    text-align: left;
  }

  .ward-panel {
    position: fixed;
    inset: auto 14px 14px;
    width: auto;
    max-height: min(70vh, 520px);
  }

  .clinic-card {
    padding: 21px 18px 21px 22px;
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .clinic-card:hover {
    transform: none;
  }

  .clinic-main {
    width: 100%;
    min-width: 0;
  }

  .clinic-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .btn-link {
    flex: 1 1 130px;
    min-height: 46px;
  }

  footer {
    margin-top: 42px;
    padding: 30px 0;
    text-align: left;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --color-text-muted: #344950;
    --color-border: #9baead;
    --color-border-strong: #718886;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  header.site-header,
  .filter-bar,
  .clinic-actions,
  footer {
    display: none;
  }

  .clinic-card,
  .info-card,
  .faq-item {
    break-inside: avoid;
    box-shadow: none;
  }
}
