/* Hallmark · macrostructure: existing Nagaminekai pages; tone: familiar; anchor hue: original blue. */
@import url('../tokens.css');

/* The original desktop styles and original media remain authoritative. */
@media (max-width: 991px) {
  html { font-size: var(--mobile-font); overflow-x: clip; -webkit-text-size-adjust: 100%; }
  body { font-size: var(--mobile-font); line-height: var(--mobile-line); color: var(--mobile-text); overflow-x: clip; -webkit-text-size-adjust: 100%; }
  a, h1, h2, h3, h4, p, li { overflow-wrap: anywhere; }
  a { transition-property: color, background-color, border-color, opacity; }
  a:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--mobile-accent); outline-offset: 4px; }
  main, #container, .container, .row > * { min-width: 0; }
  main { padding: 0; }
  main > section, main > article { padding: var(--mobile-section) var(--mobile-gutter); }
  main > section > .container { padding-inline: 0; }
  main h2 { font-size: var(--mobile-title); line-height: 1.5; letter-spacing: .03em; margin-bottom: 24px; }
  main h2 span { font-size: var(--mobile-font); line-height: 1.7; letter-spacing: .03em; color: var(--mobile-text); }
  main h3 { font-size: var(--mobile-subtitle); line-height: 1.65; padding: 12px; margin-bottom: 16px; }
  main p { margin: 0 0 24px; line-height: var(--mobile-line); }
  main p + p { margin-top: 0; }
  main ol { padding-left: 1.5em; }
  main .pl-4 { padding-left: 0 !important; }
  main .col-md-10, .page-letter main .col-md-8 { flex: 0 0 100%; max-width: 100%; }

  /* Four original destinations, with the full original labels. */
  #header-menu { padding: 16px var(--mobile-gutter); }
  #header-menu ul { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 0; font-size: var(--mobile-font); }
  #header-menu ul li, .home #header-menu ul li:nth-child(2) { margin: 0; text-align: left; min-width: 0; }
  #header-menu ul li a { display: flex; align-items: center; gap: 14px; height: auto; min-height: 72px; padding: 12px 16px; font-size: var(--mobile-font); line-height: 1.65; color: var(--mobile-text); background: var(--mobile-surface); border: 1px solid var(--mobile-border); border-left-width: 5px; overflow: visible; }
  #header-menu ul li:nth-child(n) a { color: var(--mobile-text); border-bottom: 1px solid var(--mobile-border); }
  #header-menu ul li:nth-child(1) a { border-left-color: var(--mobile-link-mail); }
  #header-menu ul li:nth-child(2) a { border-left-color: var(--mobile-link-chat); }
  #header-menu ul li:nth-child(3) a { border-left-color: var(--mobile-link-band); }
  #header-menu ul li:nth-child(4) a { border-left-color: var(--mobile-link-letter); }
  #header-menu ul li a i { flex: 0 0 28px; margin: 0; font-size: var(--mobile-icon); text-align: center; }
  #header-menu .menu-label { flex: 1; min-width: 0; }
  #header-top-menu { padding: 12px var(--mobile-gutter) 0; }
  #header-top-menu ul { display: grid; grid-template-columns: minmax(0, 1fr); margin: 0; gap: 8px; }
  #header-top-menu ul li { margin: 0; }
  #header-top-menu ul li a { height: auto; min-height: 48px; padding: 12px 0; font-size: var(--mobile-font); line-height: 1.65; color: var(--mobile-text); overflow: visible; }
  .page-donation header #logo, .page-letter header #logo, .page-community header #logo, .page-news header #logo { padding: 20px 76px 20px 16px; }
  .page-donation header #logo img, .page-letter header #logo img, .page-community header #logo img, .page-news header #logo img { width: 100%; height: auto; }

  .page-home > header { display: flex; flex-direction: column; padding-bottom: 12px; background: var(--mobile-surface); }
  .page-home header #logo { order: 2; display: block !important; position: relative; left: auto; bottom: auto; width: 104px; margin: 12px auto 0; border: 4px solid var(--mobile-surface); background: var(--mobile-accent); opacity: 1; }
  .page-home #mobileVideo { order: 1; width: 100%; height: auto; }
  .page-home #mainimg { height: min(50svh, 24rem); }
  .page-home #project > h2 { margin-top: 0 !important; }
  .page-home .project, .page-home .mt3 { margin-top: 0; }
  .page-home #anniversary { padding: 0; }
  .page-home #anniversary > li { margin-bottom: 28px; }
  .page-home #anniversary ul { padding-left: 1.25em; }
  .page-home .list-container { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .page-home .list-square { width: 100%; max-width: 100%; margin: 0; }
  .page-home .list-square figure { margin: 0; }
  .page-home .list-square .text { position: static; padding: 10px 0 0; color: var(--mobile-text); background: none; }
  .page-home .list-square .text p { display: block; margin: 0; font-size: var(--mobile-small); line-height: 1.7; }
  .page-home .blur { opacity: 1; filter: none; transform: none; animation: none; }
  .page-home .greeting .col-md-2 { flex: 0 0 100%; max-width: 100%; margin-bottom: 24px; text-align: center; }
  .page-home .greeting .col-md-2 img { width: 180px; height: auto; }
  .page-home .daihyokanzi, .page-home .soshikizu, .page-home .sche img { width: 100%; height: auto; }
  .page-home .yakuin { min-height: 52px; font-size: var(--mobile-font); color: var(--mobile-text); padding: 14px 12px; }
  .page-home .yakuin.clicked { padding-left: 40px; }

  /* Original hamburger menu, enlarged and usable with keyboard and touch. */
  #menubar_hdr, body:not(.home) #menubar_hdr { top: 12px; left: auto; right: 12px; width: 56px; height: 56px; padding: 14px 0; transform: none; background: var(--mobile-nav-background); }
  #menubar_hdr div { width: 28px; height: 28px; }
  #menubar_hdr span { border-width: 2px; }
  #menubar_hdr.ham span:nth-of-type(1), #menubar_hdr.ham span:nth-of-type(3) { width: 36px; }
  #menubar_hdr.ham span:nth-of-type(1) { transform: rotate(45deg) translate(5px, 7px); }
  #menubar_hdr.ham span:nth-of-type(3) { transform: rotate(-45deg) translate(5px, -7px); }
  #menubar_hdr p { display: none !important; }
  #menubar { width: 100%; height: 100dvh; padding: 84px 24px 32px; font-size: var(--mobile-font); overscroll-behavior: contain; }
  #menubar a { display: block; min-height: 48px; padding: 12px 4px; line-height: 1.6; }
  #menubar .btn a { background: var(--mobile-nav-background); color: var(--mobile-surface); }
  body.mobile-menu-open { overflow-y: hidden; }
  .pagetop { right: 12px; bottom: 12px; width: 48px; line-height: 48px; }

  .navbar.fixed-top { position: sticky; top: 0; }
  .navbar { padding: 12px 16px; background: var(--mobile-nav-background) !important; }
  .navbar .navbar-brand { max-width: calc(100% - 60px); padding: 0; margin: 0; white-space: normal; font-size: var(--mobile-small); line-height: 1.6; }
  .navbar-toggler { min-width: 44px; min-height: 44px; padding: 8px; }
  .navbar .nav-link { min-height: 44px; padding-block: 10px; font-size: var(--mobile-font); line-height: 1.6; }
  .navbar-collapse { max-height: calc(100dvh - 96px); overflow-y: auto; }

  .page-letter main { padding: 32px var(--mobile-gutter) !important; margin-top: 0 !important; }
  .page-letter main > .container { padding: 0; }
  .page-letter .profile-pic { display: block; width: 180px; max-width: 60%; height: auto; margin: 0 auto 24px; }
  .page-letter .profile-title { font-size: var(--mobile-font); line-height: 1.7; }
  .page-letter .greeting-text h2 { margin-top: 32px; font-size: var(--mobile-letter-title); }
  .page-donation .progress-container { width: 100%; margin-bottom: 48px !important; }
  .page-donation .current-amount-label { position: static; display: block; transform: none; padding: 8px 0 0; text-align: center; font-size: var(--mobile-font); }
  .page-donation .progress-label { color: var(--mobile-text); font-size: var(--mobile-small); }
  .page-donation .box26 { padding: 16px; }
  .page-donation .box26 .box-title { position: static; display: block; margin-bottom: 12px; font-size: var(--mobile-subtitle); }
  .page-donation .box26 p { padding: 0; }

  /* Mobile gallery: swipe at your pace, tap to open the original photo. */
  .page-gallery #gallery { padding: 32px 0 !important; margin: 0 !important; }
  .page-gallery .wrapper { width: 100%; margin: 0; }
  .page-gallery .gallerytitle, .page-gallery .yearselect { position: static; margin: 0 16px 24px; text-align: center; }
  .page-gallery .gallerymaintitle { margin: 0; font-size: var(--mobile-title); }
  .page-gallery .dropdown.yearselect button { max-width: 100%; min-height: 48px; margin: 0; padding: 12px 16px; white-space: normal; font-size: var(--mobile-font); background-color: var(--mobile-nav-background) !important; color: var(--mobile-surface); }
  .page-gallery .dropdown-item { min-height: 44px; padding: 10px 16px; font-size: var(--mobile-font); }
  .page-gallery .gallerycontents, .page-gallery .galleryphoto { width: 100%; margin: 0; top: 0; }
  .page-gallery [class^='d-demo__wrap-'] { width: 100%; max-width: 100%; overflow-x: auto; overflow-y: hidden; margin-bottom: 16px; scroll-snap-type: x proximity; overscroll-behavior-inline: contain; }
  .page-gallery .d-demo__list { animation: none !important; transform: none; gap: 8px; margin: 0; padding: 0 16px 8px; }
  .page-gallery .d-demo__list + .d-demo__list { display: none; }
  .page-gallery .d-demo__item { width: auto; scroll-snap-align: start; }
  .page-gallery .d-demo__item > a { padding: 0; }
  .page-gallery .d-demo__item img { width: auto; max-width: none; height: 180px; }

  .page-band header { height: auto; }
  .page-band header .inner { height: 260px; background-size: cover; }
  .page-band header #logo { top: auto; bottom: 16px; left: 16px; right: auto; width: 180px; }
  .page-band header #logo img { width: 100%; height: auto; }
  .page-band #contents { padding: 24px 20px; margin: 0; border-radius: 0; box-shadow: none; }
  .page-band #main { float: none; width: 100%; padding: 0; }
  .page-band #main section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 0; }
  .page-band #main section > :not(.list2) { grid-column: 1 / -1; }
  .page-band #main .list2 { float: none; width: auto; margin: 0; font-size: var(--mobile-small); }
  .page-band #main .list2 h4 { height: auto; }
  .page-band #main h2, .page-band #main h3 { margin: 24px 0 0; padding: 8px 0; }
  .page-band #main p { padding: 0; }
  .page-community main, .page-news main { padding: 32px 20px; }
  .page-community main section, .page-news main section { padding-inline: 0; }
  footer, footer small { font-size: var(--mobile-small); line-height: 1.8; }
  footer { padding: 24px var(--mobile-gutter); overflow-wrap: anywhere; }
  footer a { color: var(--mobile-contact); }
  footer.footermenu p, #footermenu { font-size: var(--mobile-font); line-height: var(--mobile-line); }
  footer a[href^='tel:'] { display: inline-block; min-height: 44px; padding-block: 8px; }
}

@media (min-width: 600px) and (max-width: 991px) {
  #header-menu ul, .page-home .list-container { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-band #main section { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .page-gallery .d-demo__list { animation: none !important; }
}
