/* ==========================================================================
   enhance.css
   Desktop rhythm, a single consistent title scale, and premium polish.
   Loaded after the page styles and animations, before responsive.css
   (so the mobile layer still has the final say on small screens).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Consistent section rhythm on desktop
   80px top and bottom on every section, so the page breathes evenly
   regardless of which page's stylesheet the section came from.
   -------------------------------------------------------------------------- */

@media (min-width: 1025px) {

  main > section,
  main > [class$="-section"] {
    padding-top: 80px !important;
    padding-bottom: 80px !important;
  }

  /* The hero is a full-bleed banner, not a content section. */
  main > section.hero,
  main > section.hero-banner {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  /* Marquee strips carry their own breathing room. */
  main > section.slider-section {
    padding-top: 80px !important;
    padding-bottom: 80px !important;
  }

  /* Kill the doubled-up margins that used to create the spacing, otherwise
     80px padding plus a legacy 60px margin reads as 140px. */
  main > section,
  main > [class$="-section"] {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }
}

/* --------------------------------------------------------------------------
   2. One title scale across the whole site

   The pages had drifted: section titles were mostly 36px but some were 26px,
   and .facility-title alone ranged 24 / 26 / 28 / 34px. These rules pull every
   English title onto the same scale and give them matching weight, colour,
   tracking and leading.
   -------------------------------------------------------------------------- */

/* --- Section titles (English) --- */
.title-en,
.concept-title-en,
.news-title-en,
.section-title-en {
  font-family: "Helvetica Neue", Helvetica, Arial, "Segoe UI", sans-serif;
  font-size: 36px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.04em;
  color: #333;
}

/* Footer keeps its lighter grey but matches the size. */
.site-footer .title-en {
  font-size: 36px;
  color: #555;
}

/* --- Section titles (Japanese sub-line) --- */
.title-jp,
.concept-title-jp,
.news-title-jp,
.section-title-jp {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: 0.06em;
  color: #555;
}

/* --- Page banner titles --- */
.banner-title-en {
  font-family: "Helvetica Neue", Helvetica, Arial, "Segoe UI", sans-serif;
  font-size: 42px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.04em;
}

.banner-title-jp {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* --- Large Japanese display headings --- */
.facility-title,
.about-title,
.concept-title {
  font-family: "Helvetica Neue", Helvetica, Arial, "Segoe UI", "Noto Serif JP", serif;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

/* --- Card titles --- */
.card-title,
.flow-card-title,
.facility-item-title,
.staff-name {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

/* --- The small accent square sits on the baseline of the EN title --- */
.title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.orange-square,
.square-icon {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   3. Premium motion polish

   Slower, softer easing (an expo-out curve), shorter travel, and a gentle
   shorter travel. Small distances read as expensive; large ones read as cheap.
   -------------------------------------------------------------------------- */

:root {
  --anim-dur: 1.05s;
  --anim-dur-slow: 1.5s;
  /* expo-out: fast departure, long graceful settle */
  --anim-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --anim-ease-mask: cubic-bezier(0.65, 0, 0.35, 1);
  --anim-shift: 30px;
}

/* NOTE: a blur-in was tried here and removed deliberately.
   `filter: blur()` on every revealing element has two serious problems:
   anything that fails to reveal is left permanently unreadable rather than
   merely invisible, and `filter` forces the element onto its own raster
   layer, which softens text in Chrome even at blur(0). The entrance now
   uses opacity and transform only -- both are compositor-friendly and
   degrade safely. */
.js [data-reveal]:not([data-reveal="mask"]):not([data-reveal="mask-up"]) {
  filter: none;
  transition:
    opacity var(--anim-dur) var(--anim-ease),
    transform var(--anim-dur) var(--anim-ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.js [data-reveal].is-revealed {
  filter: none;
}

/* Masked media: hold a touch longer and settle from a deeper zoom. */
.js [data-reveal="mask"] > img,
.js .reveal-media > img {
  transform: scale(1.2);
  transition: transform 2s var(--anim-ease);
}

/* Headings rise with a hair of rotation for a printed-page feel. */
.js .line-inner {
  transform: translate3d(0, 105%, 0) rotate(2deg);
  transform-origin: left bottom;
  transition: transform 1.15s var(--anim-ease-mask);
}
.js .is-revealed .line-inner,
.js .line-inner.is-revealed {
  transform: translate3d(0, 0, 0) rotate(0deg);
}

/* The accent square draws itself in rather than popping. */
.js [data-reveal] .orange-square,
.js [data-reveal] .square-icon,
.js [data-reveal] .blue-circle {
  transform: scale(0) rotate(-45deg);
  transition: transform 0.8s var(--anim-ease) 0.2s;
}
.js [data-reveal].is-revealed .orange-square,
.js [data-reveal].is-revealed .square-icon,
.js [data-reveal].is-revealed .blue-circle {
  transform: scale(1) rotate(0deg);
}

/* Buttons: a lighter, springier lift. */
.btn-pill,
.btn-pill1,
.btn-blue-reserve {
  transition:
    transform 0.4s var(--anim-ease),
    background-color 0.4s var(--anim-ease),
    box-shadow 0.4s var(--anim-ease);
}

/* Cards settle rather than jump. */
.service-card,
.concept-card,
.facility-card,
.clinic-card,
.acu-card,
.flow-card,
.director-card,
.staff-card {
  transition:
    transform 0.55s var(--anim-ease),
    box-shadow 0.55s var(--anim-ease);
}

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal],
  .js [data-reveal].is-revealed {
    filter: none !important;
  }
}

/* --------------------------------------------------------------------------
   4. Staff carousel

   Layout, arrow styling, and mobile behaviour for this now live entirely in
   assets/css/pages/homepage.css (the arrows are plain orange chevrons with
   no button chrome, matching the design), driven by buildStaffCarousel() in
   main.js. Nothing to add here.
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   5. Marquee strip (orthopedic)
   -------------------------------------------------------------------------- */

/* An infinite marquee should not animate for someone who asked for stillness. */
@media (prefers-reduced-motion: reduce) {
  .slider-track {
    animation: none !important;
  }
  .slider-section {
    overflow-x: auto;
  }
}

/* Never let the reveal system hide the marquee: it is always in motion, and a
   half-revealed strip looks broken. */
.js .slider-section[data-reveal],
.js .slider-track[data-reveal] {
  opacity: 1 !important;
  filter: none !important;
  transform: none !important;
}

/* The staff carousel always keeps its arrows visible and cycles which
   member is centred/active -- see buildStaffCarousel() in main.js. */

/* --------------------------------------------------------------------------
   Staff / doctor slider controls
   Injected by buildCarousel() in main.js. Distinct from .carousel-arrow
   above, which serves the native-scroll .carousel-wrapper carousels.
   -------------------------------------------------------------------------- */

.slider-viewport,
#sliderViewport {
  position: relative;
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y;
}
#sliderViewport.is-grabbing { cursor: grabbing; }

#sliderTrack {
  display: flex;
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
#sliderTrack.is-dragging { transition: none; }

.slider-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 32px;
}

.slider-btn {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #e2ddd2;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  transition: background 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
}
.slider-btn svg {
  width: 17px; height: 17px;
  fill: none; stroke: #f09600;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  transition: stroke 0.3s ease;
}
.slider-btn:hover:not(:disabled) {
  background: #f09600; border-color: #f09600; transform: scale(1.06);
}
.slider-btn:hover:not(:disabled) svg { stroke: #fff; }
.slider-btn:disabled { opacity: 0.32; cursor: default; }
.slider-btn:focus-visible { outline: 2px solid #3e663b; outline-offset: 3px; }

.slider-dots { display: flex; align-items: center; gap: 9px; }
.slider-dot {
  width: 8px; height: 8px; padding: 0; border: 0;
  border-radius: 50%; background: #d8d2c6; cursor: pointer;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), background 0.35s ease;
}
.slider-dot.is-active { width: 26px; border-radius: 5px; background: #f09600; }
.slider-dot:focus-visible { outline: 2px solid #3e663b; outline-offset: 3px; }

/* --------------------------------------------------------------------------
   Marquee strip
   The track is ~2770px wide and was only being clipped by the body's
   overflow-x. Clip it at the section, and feather both edges.
   -------------------------------------------------------------------------- */

.slider-section { overflow: hidden; position: relative; }
.slider-section .slider-track { width: max-content; will-change: transform; }

.slider-section::before,
.slider-section::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 12%; max-width: 160px;
  z-index: 2; pointer-events: none;
}
.slider-section::before {
  left: 0;
  background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0));
}
.slider-section::after {
  right: 0;
  background: linear-gradient(to left, #fff, rgba(255, 255, 255, 0));
}

@media (max-width: 768px) {
  .slider-controls { gap: 14px; margin-top: 22px; }
  .slider-btn { width: 42px; height: 42px; }
  .slider-section::before, .slider-section::after { width: 8%; }
}
@media (max-width: 480px) {
  .slider-section::before, .slider-section::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .slider-section .slider-track { animation: none !important; }
  #sliderTrack { transition: none !important; }
}

/* --------------------------------------------------------------------------
   Sub-page hero banner alignment

   The page stylesheets set `.hero-banner { justify-content: space-between }`
   because the banner originally held TWO children: the inline <header> at the
   top and the title block below it. Now that the header is a shared include
   and no longer sits inside the banner, only the title remains -- and
   space-between pins a lone child to the top of the box.

   Centre it vertically instead. Horizontal alignment is unchanged: the title
   still sits left inside the centred 1240px content column.
   -------------------------------------------------------------------------- */

.hero-banner {
  justify-content: center;
}

.hero-banner > .hero-content {
  padding-top: 0;
  padding-bottom: 0;
}

/* The decorative bottom curve must stay pinned to the bottom edge rather than
   joining the centred stack. */
.hero-banner > .hero-bottom-curve {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  line-height: 0;
}

/* Keep the title clear of the curve on short viewports. */
@media (max-width: 768px) {
  .hero-banner > .hero-content {
    padding-top: 0;
    padding-bottom: 24px;
  }
}

/* --------------------------------------------------------------------------
   Staff slider: card sizing

   The cards were a fixed 280px inside a ~790px column, so the third card was
   always sliced in half at the right edge. Size them off the viewport instead
   so a whole number of cards is always visible.
   -------------------------------------------------------------------------- */

#sliderTrack > * {
  flex: 0 0 calc((100% - 48px) / 3);
  min-width: 0 !important;
  width: auto !important;
  /* The page stylesheet caps these at 280px, which silently clamped the
     flex-basis and put us back to a fractional card at the right edge. */
  max-width: none !important;
}

@media (max-width: 900px) {
  #sliderTrack > * { flex: 0 0 calc((100% - 24px) / 2); }
}
@media (max-width: 560px) {
  #sliderTrack { gap: 16px !important; }
  #sliderTrack > * { flex: 0 0 100%; }
}
