/* Final layout overrides for public dialogs. */
dialog { overflow-x: hidden; }
.dialog-head > div { min-width: 0; max-width: 100%; width: 100%; }
.dialog-head h2 { min-width: 0; max-width: 100%; overflow: hidden; }
.appointment-window-note { max-width: 100%; overflow: hidden; text-overflow: clip; }

/* Keep the institution lockup centered while giving the motto its own line above it. */
.hero-brand-lockup {
  --hero-motto-space: clamp(58px, 4.1vw, 82px);
  --hero-brand-lift: clamp(14px, 1vw, 18px);
  top: calc(2px + var(--hero-motto-space) - var(--hero-brand-lift));
}

.hero-brand-motto {
  position: absolute;
  top: calc(-1 * var(--hero-motto-space) + 2px + var(--hero-brand-lift));
  left: calc(50% + 10px);
  z-index: 5;
  display: block;
  width: max-content;
  max-width: min(92vw, 780px);
  box-sizing: border-box;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  overflow: visible;
  transform: translateX(-50%);
  text-decoration: none;
  pointer-events: auto;
}

.hero-brand-motto-image {
  display: block;
  width: clamp(300px, 26vw, 520px);
  max-width: calc(100vw - 24px);
  height: auto;
  object-fit: contain;
}

.hero-brand-motto:hover,
.hero-brand-motto:focus-visible { color: #fff; text-decoration: none; filter: brightness(1.08); }

/* Align both utility groups with the motto's upper line, not with the central logo. */
.hero-top-info { top: calc(-1 * var(--hero-motto-space) + 2px + var(--hero-brand-lift)); }

/* The request buttons now occupy the former motto position on the right. */
.hero-top-info-right {
  right: clamp(34px, 2.9vw, 56px);
  transform: none;
  justify-content: flex-start;
  align-items: flex-start;
  gap: clamp(6px, .8vw, 12px);
}

.hero-top-info-right .hero-top-action-stack,
.hero-top-info-right .hero-top-support-stack {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  max-width: clamp(190px, 13.6vw, 270px);
  margin: 0;
  transform: none;
}

.hero-top-info-right .hero-top-team-request,
.hero-top-info-right .hero-top-appointment,
.hero-top-info-right .hero-top-support-button {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.hero-top-info-right .hero-top-team-request span,
.hero-top-info-right .hero-top-appointment span,
.hero-top-info-right .hero-top-support-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Long RTL headings stay inside the dialog instead of creating a horizontal scrollbar. */
body.public-portal dialog { box-sizing: border-box; overflow-x: hidden; }
body.public-portal dialog > * { box-sizing: border-box; min-width: 0; max-width: 100%; }
body.public-portal .dialog-head { min-width: 0; box-sizing: border-box; }
body.public-portal .dialog-head > div { flex: 1 1 auto; min-width: 0; max-width: 100%; overflow: hidden; }
body.public-portal .dialog-head h2 { min-width: 0; max-width: 100%; overflow: hidden; }
body.public-portal .dialog-head .dialog-close { flex: 0 0 auto; }
body.public-portal .appointment-window-note {
  display: block;
  width: 100%;
  max-width: 100%;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  transform: none;
  letter-spacing: -.02em;
}

@media (max-width: 720px) {
  .hero-brand-lockup { --hero-brand-lift: 8px; }

  .hero-brand-motto {
    max-width: calc(100vw - 24px);
  }

  .hero-brand-motto-image { width: min(84vw, 420px); }
}

/* Date/time is intentionally stacked: date, red digital time, then a compact analogue clock. */
.hero-datetime {
  align-self: start;
  grid-template-rows: auto auto auto;
  gap: 3px;
  height: auto;
  min-height: 80px;
  padding-top: 1px;
}

.hero-datetime > span:first-child { order: 1; }

.hero-datetime time {
  order: 2;
  margin-top: 2px;
  color: #ff3e55 !important;
  font-weight: 900;
  letter-spacing: .02em;
  text-shadow: 0 2px 10px rgba(83, 0, 9, .62);
}

.hero-analog-clock {
  --hero-analog-hour: 0deg;
  --hero-analog-minute: 0deg;
  --hero-analog-second: 0deg;
  position: relative;
  order: 3;
  display: block;
  width: clamp(78px, 6.2vw, 100px);
  height: clamp(78px, 6.2vw, 100px);
  margin: 3px auto 0;
  border: 2px solid rgba(255, 255, 255, .92);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fdfefe 0 7%, transparent 8%),
    conic-gradient(from -1deg, rgba(255,255,255,.86) 0 2deg, transparent 2deg 28deg, rgba(255,255,255,.86) 28deg 30deg, transparent 30deg 58deg, rgba(255,255,255,.86) 58deg 60deg, transparent 60deg 88deg, rgba(255,255,255,.86) 88deg 90deg, transparent 90deg 118deg, rgba(255,255,255,.86) 118deg 120deg, transparent 120deg 148deg, rgba(255,255,255,.86) 148deg 150deg, transparent 150deg 178deg, rgba(255,255,255,.86) 178deg 180deg, transparent 180deg 208deg, rgba(255,255,255,.86) 208deg 210deg, transparent 210deg 238deg, rgba(255,255,255,.86) 238deg 240deg, transparent 240deg 268deg, rgba(255,255,255,.86) 268deg 270deg, transparent 270deg 298deg, rgba(255,255,255,.86) 298deg 300deg, transparent 300deg 328deg, rgba(255,255,255,.86) 328deg 330deg, transparent 330deg 358deg, rgba(255,255,255,.86) 358deg 360deg),
    rgba(4, 79, 81, .44);
  box-shadow: 0 3px 12px rgba(0, 17, 19, .38), inset 0 1px 4px rgba(255,255,255,.55);
}

.hero-analog-clock::before {
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: inherit;
  content: "";
}

.hero-analog-clock .hero-analog-hand {
  position: absolute;
  z-index: 1;
  bottom: 50%;
  left: calc(50% - 1px);
  display: block;
  width: 2px;
  border-radius: 99px;
  transform-origin: 50% 100%;
  transition: transform .3s linear;
}

.hero-analog-hand-hour { width:4px !important; height: 24%; background: #fff; transform: rotate(var(--hero-analog-hour)); }
.hero-analog-hand-minute { width:3px !important; height: 34%; background: #e5fffb; transform: rotate(var(--hero-analog-minute)); }
.hero-analog-hand-second { width: 2px !important; height: 38%; background: #ff4056; transform: rotate(var(--hero-analog-second)); }
.hero-analog-clock b { position: absolute; z-index: 2; top: calc(50% - 6px); left: calc(50% - 6px); width: 12px; height: 12px; border: 2px solid #fff; border-radius: 50%; background: #ff4056; }

/* Equipment impact gallery: cards are ready to receive real photographs and funding amounts. */
.equipment-impact {
  position: relative;
  z-index: 4;
  margin: -3px auto 0;
  padding: clamp(23px, 3vw, 39px);
  border: 1px solid rgba(255,255,255,.92);
  border-radius: 0 0 27px 27px;
  background: rgba(252, 255, 254, .94);
  box-shadow: 0 16px 30px rgba(10,84,78,.08);
}

.equipment-impact-heading { max-width: 800px; }
.equipment-impact-heading h2 { margin: 7px 0 0; color: var(--portal-deep); font-size: clamp(1.22rem, 2.25vw, 1.9rem); line-height: 1.45; }
.equipment-impact-heading p { max-width: 760px; margin: 8px 0 0; color: #537674; font-size: .82rem; line-height: 1.9; }
.equipment-feature-grid,.equipment-more-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin-top:20px; }
.equipment-more-grid { padding-top:15px; border-top:1px dashed #c6dfd9; }
.equipment-card { display:grid; grid-template-columns:112px minmax(0,1fr); gap:12px; align-items:center; min-width:0; padding:12px; border:1px solid #d4e8e3; border-radius:17px; background:linear-gradient(135deg,#fff,#f3fbf8); box-shadow:0 9px 21px rgba(8,85,77,.06); }
.equipment-card-featured { border-color:#9bcfc3; background:linear-gradient(135deg,#f8fffd,#e7f7f1); }
.equipment-image-placeholder { position:relative; display:grid; place-items:center; min-height:96px; margin:0; overflow:hidden; border:1px dashed #7fbfb1; border-radius:13px; background:linear-gradient(135deg,rgba(1,116,113,.13),rgba(172,223,149,.26)); color:#3e7771; font-size:.66rem; font-weight:800; text-align:center; }
.equipment-image-placeholder::before { display:grid; place-items:center; width:35px; height:35px; margin-bottom:16px; border-radius:50%; background:rgba(255,255,255,.66); color:#087574; content:"✚"; font-size:1.4rem; }
.equipment-image-placeholder span { position:absolute; right:7px; bottom:7px; left:7px; }
.equipment-image-eye { background:linear-gradient(135deg,rgba(5,107,113,.2),rgba(166,224,208,.47)); }
.equipment-image-dental { background:linear-gradient(135deg,rgba(245,190,95,.25),rgba(233,246,199,.57)); }
.equipment-image-diagnostic { background:linear-gradient(135deg,rgba(81,155,207,.22),rgba(207,237,249,.62)); }
.equipment-card-type { color:#12776f; font-size:.65rem; font-weight:900; }
.equipment-card h3 { margin:3px 0 0; color:var(--portal-deep); font-size:.9rem; line-height:1.65; }
.equipment-card p { margin:4px 0 0; color:#567774; font-size:.72rem; }
.equipment-card p b { color:#bd5960; }
.equipment-more-toggle { display:flex; align-items:center; justify-content:center; gap:7px; width:max-content; min-width:190px; margin:18px auto 0; padding:10px 15px; border:1px solid #91c8bd; border-radius:999px; background:#effaf7; color:#076b68; font:800 .78rem var(--tabib-font,Dana,Tahoma,Arial,sans-serif); cursor:pointer; }
.equipment-more-toggle:hover,.equipment-more-toggle:focus-visible { background:#dff3ed; outline:none; }
.story-title-row { display:flex; align-items:center; flex-wrap:wrap; gap:12px 16px; }
.story-title-row h2 { margin-inline-end:0; }
.story-gallery-link { display:inline-flex; align-items:center; gap:6px; padding:8px 11px; border:1px solid #9ccdc3; border-radius:999px; color:#087370; background:#f3fbf8; font-size:.72rem; font-weight:900; text-decoration:none; white-space:nowrap; }
.story-gallery-link:hover,.story-gallery-link:focus-visible { color:#fff; background:#087370; outline:none; }
.hero-support-submenu { min-width:215px; }
.hero-units-submenu { min-width:310px !important; }
.hero-units-submenu a:first-child { color:#d60000 !important; font-weight:900; text-shadow:0 1px 7px rgba(214,0,0,.34); }
.hero-units-submenu a:first-child:hover,.hero-units-submenu a:first-child:focus-visible { color:#a40000 !important; background:#fff0f0; }
.hero-split-menu .hero-submenu a.hero-support-development { color:#ff1744; font-weight:900; text-shadow:0 1px 8px rgba(255,0,38,.38); }
.hero-split-menu .hero-submenu a.hero-support-development:hover,.hero-split-menu .hero-submenu a.hero-support-development:focus-visible { color:#9c001b; background:#fff0f2; }

/* A single RTL rule for every navigation submenu. */
.hero-split-menu .hero-submenu {
  direction: rtl;
  text-align: right;
  font-size: clamp(.82rem, .94vw, .96rem);
  line-height: 1.55;
  width: max-content;
  min-width: 280px;
  max-width: calc(100vw - 24px);
}

.hero-split-menu > .hero-split-menu-side > .hero-menu-dropdown > .hero-submenu {
  right: 0;
  left: auto;
  min-width: 280px;
  padding: 9px;
  transform: translateY(-5px);
}

.hero-split-menu > .hero-split-menu-side > .hero-menu-dropdown:hover > .hero-submenu,
.hero-split-menu > .hero-split-menu-side > .hero-menu-dropdown:focus-within > .hero-submenu {
  transform: translateY(0);
}

.hero-split-menu .hero-submenu a,
.hero-split-menu .hero-submenu span,
.hero-split-menu .hero-submenu-link,
.hero-split-menu .hero-submenu-action {
  box-sizing: border-box;
  width: 100%;
  min-height: 35px;
  padding: 7px 11px;
  direction: rtl;
  text-align: right;
  font-size: inherit !important;
  line-height: 1.55;
  white-space: nowrap;
}

.hero-split-menu .hero-submenu a,
.hero-split-menu .hero-submenu span { justify-content: flex-start; }
.hero-split-menu .hero-submenu span { display:block; color:rgba(255,255,255,.93); }

/* Fixed-entry medical history and companion list.  Only saved rows carry edit/delete actions. */
#appointment-form .history-editor { display:grid; gap:11px; margin-top:10px; padding:13px; border:1px solid #cde5de; border-radius:15px; background:linear-gradient(135deg,#fbfffd,#effaf7); }
#appointment-form .medical-entry-grid { display:grid; grid-template-columns:minmax(150px,.8fr) minmax(190px,1.2fr); gap:10px; align-items:end; }
#appointment-form .medical-disease-name { max-width:230px; font-size:.78rem; }
#appointment-form .medical-medicine-editor { padding-top:10px; border-top:1px solid #d8ebe6; }
#appointment-form .medical-medicine-grid { display:grid; grid-template-columns:minmax(145px,.8fr) minmax(195px,1.2fr) auto; gap:10px; align-items:end; }
#appointment-form .medical-medicine-grid .upload-label { min-width:0; }
#appointment-form .history-editor-actions,.companion-editor-actions { display:flex; align-items:center; justify-content:flex-start; gap:8px; flex-wrap:wrap; }
#appointment-form .draft-entry-list { display:grid; gap:7px; margin-top:10px; }
#appointment-form .draft-entry-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 10px; border:1px solid #d4e8e3; border-radius:10px; background:rgba(255,255,255,.8); color:#285f5a; font-size:.76rem; }
#appointment-form .draft-entry-row span { color:#5d817b; font-size:.7rem; }
#appointment-form .history-list,.companion-entry-list { display:grid; gap:9px; margin-top:11px; }
#appointment-form .history-record,.companion-record { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:11px; border:1px solid #cde5de; border-radius:13px; background:#fcfffe; }
#appointment-form .history-record-summary,.companion-record-summary { display:grid; min-width:0; gap:3px; }
#appointment-form .history-record-summary strong,.companion-record-summary strong { color:#074d4d; font-size:.84rem; }
#appointment-form .history-record-summary span,.companion-record-summary span { color:#5b7a76; font-size:.71rem; line-height:1.7; }
#appointment-form .history-record-actions,.companion-record-actions { display:flex; flex:0 0 auto; gap:7px; flex-wrap:wrap; }
#appointment-form .empty-history-message { margin:0; padding:9px 11px; border:1px dashed #b9d9d2; border-radius:10px; color:#63837e; background:rgba(255,255,255,.6); font-size:.74rem; }
#appointment-form .surgery-entry-grid { display:grid; grid-template-columns:minmax(170px,1fr) minmax(145px,.82fr) minmax(140px,.72fr); gap:10px; align-items:end; }
#appointment-form .companion-entry-list { padding-top:4px; }
#appointment-form .appointment-form-actions { position:sticky; bottom:0; z-index:12; margin:14px -2px -2px; padding:12px 2px calc(12px + env(safe-area-inset-bottom)); border-top:1px solid #cfe5df; background:linear-gradient(180deg,rgba(252,255,254,.8),#fbfffd 25%); box-shadow:0 -9px 20px rgba(5,71,66,.07); }

/* The volunteer profile changes its details after a membership type is selected. */
#volunteer-membership-form .volunteer-membership-context { padding:13px; border:1px solid #cde5de; border-radius:15px; background:linear-gradient(135deg,#fbfffd,#effaf7); }
#volunteer-membership-form .volunteer-membership-context .field-help { margin:0 0 10px; }
#volunteer-membership-form .volunteer-membership-context-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
#volunteer-membership-form .volunteer-membership-context-grid .full { grid-column:1 / -1; }

@media (max-width: 980px) {
  .equipment-feature-grid,.equipment-more-grid { grid-template-columns:1fr; }
  .equipment-card { grid-template-columns:128px minmax(0,1fr); }
}

@media (max-width: 720px) {
  .hero-datetime { min-height:75px; }
  .equipment-impact { margin:0; border-radius:0 0 22px 22px; padding:21px 16px; }
  .equipment-card { grid-template-columns:96px minmax(0,1fr); }
  #appointment-form .medical-entry-grid,#appointment-form .medical-medicine-grid,#appointment-form .surgery-entry-grid { grid-template-columns:1fr; }
  #appointment-form .medical-disease-name { max-width:none; }
  #appointment-form .history-record,#appointment-form .companion-record { align-items:stretch; flex-direction:column; }
  #appointment-form .history-record-actions,#appointment-form .companion-record-actions { width:100%; }
  #appointment-form .history-record-actions button,#appointment-form .companion-record-actions button { flex:1; }
  #volunteer-membership-form .volunteer-membership-context-grid { grid-template-columns:1fr; }
  #volunteer-membership-form .volunteer-membership-context-grid .full { grid-column:auto; }
}
