/* Mahina Menu v6.47: nested page index, centered title, and art cursor. */

.paper {
  background-color: #f4f4f2;
  background-image:
    linear-gradient(rgba(244, 244, 242, 0.8), rgba(244, 244, 242, 0.8)),
    url("/assets/mahina-paper-texture-halfscale.png");
  background-repeat: no-repeat, repeat;
  background-size:
    100% 100%,
    auto var(--mahina-paper-tile-height);
}

.paper.cover-page,
.paper[data-paper-variant="0"] {
  background-position:
    0 0,
    49% 44%;
}

.paper.menu-page {
  background-position:
    0 0,
    53% 50%;
}

.paper.policy-page {
  background-position:
    0 0,
    47% 56%;
}

.paper[data-paper-variant="1"] {
  background-position:
    0 0,
    55% 49%;
}

.paper[data-paper-variant="2"] {
  background-position:
    0 0,
    45% 55%;
}

.paper[data-paper-variant="3"] {
  background-position:
    0 0,
    57% 43%;
}

.paper[data-paper-variant="4"] {
  background-position:
    0 0,
    43% 50%;
}

.paper[data-paper-variant="5"] {
  background-position:
    0 0,
    52% 58%;
}

body.mahina-page-index-open {
  overflow: hidden;
}

.mahina-page-index-overlay {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(21, 21, 21, 0.56);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: mahina-page-index-fade 0.18s ease both;
}

.mahina-page-index-panel {
  display: flex;
  flex-direction: column;
  width: min(720px, calc(100vw - 40px));
  max-height: min(760px, calc(100dvh - 40px));
  overflow: hidden;
  border: 1px solid rgba(21, 21, 21, 0.14);
  border-radius: 22px;
  background: #f8f8f6;
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.3);
  animation: mahina-page-index-rise 0.22s cubic-bezier(0.2, 0.72, 0.24, 1) both;
}

.mahina-page-index-header {
  display: flex;
  flex: none;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 26px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 248, 246, 0.96);
}

.mahina-page-index-heading {
  min-width: 0;
}

.mahina-page-index-caption {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.35;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.mahina-page-index-heading h2 {
  margin: 5px 0 0;
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.mahina-page-index-title-button {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: start;
}

.mahina-page-index-title-button > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mahina-page-index-title-button:hover > span:first-child {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.mahina-page-index-title-button:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

.mahina-page-index-chevron {
  display: block;
  flex: none;
  width: 18px;
  height: 18px;
  align-self: center;
  object-fit: contain;
  opacity: 0.72;
}

.mahina-page-index-panel[data-view="menus"] .mahina-page-index-heading h2 {
  max-width: 560px;
  font-size: clamp(18px, 3vw, 26px);
  line-height: 1.18;
}

.mahina-page-index-close {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
}

.mahina-page-index-close:hover,
.mahina-page-index-close:focus-visible {
  border-color: var(--ink);
  outline: none;
}

.mahina-page-index-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.mahina-page-index-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 12px;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 11px 14px;
  border: 1px solid #dedbd4;
  border-radius: 12px;
  background: #fff;
  text-align: start;
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.mahina-page-index-item:hover {
  border-color: #8f8b83;
  transform: translateY(-1px);
}

.mahina-page-index-item:focus-visible {
  border-color: var(--ink);
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.mahina-page-index-item[aria-current="page"] {
  border-color: #aaa69e;
  background: var(--soft);
  color: var(--ink);
}

.mahina-page-index-menu-item[aria-selected="true"] {
  border-color: #aaa69e;
  background: var(--soft);
  color: var(--ink);
}

.mahina-page-index-number {
  color: var(--muted);
  font-family: var(--font-geist-mono), ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.mahina-page-index-item[aria-current="page"] .mahina-page-index-number {
  color: var(--muted);
}

.mahina-page-index-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.mahina-page-index-title {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.mahina-page-index-secondary {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.35;
}

.mahina-page-index-current {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
}

.mahina-page-index-item[aria-current="page"] .mahina-page-index-current {
  background: var(--ink);
}

.mahina-page-index-menu-item[aria-selected="true"] .mahina-page-index-current {
  background: var(--ink);
}

.mahina-page-index-menu-item {
  grid-template-columns: minmax(0, 1fr) 12px;
}

html[data-menu-rtl="true"] .mahina-page-index-heading,
html[data-menu-rtl="true"] .mahina-page-index-item {
  text-align: right;
}

/* The current menu, page number, and current page are deliberately separated. */
.pager {
  width: min(calc(100vw - 18px), 620px) !important;
  grid-template-columns: 60px minmax(0, 1fr) 60px !important;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(249, 248, 245, 0.98) 52%,
    rgba(241, 239, 233, 0.98) 100%
  ) !important;
}

.page-indicator {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(14px, 3.4vw, 34px);
  padding-inline: clamp(14px, 3vw, 26px) !important;
}

.page-indicator-mode,
.page-indicator-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #5f5c57;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-indicator-mode {
  text-align: end;
}

.page-indicator-title {
  text-align: start;
}

.page-indicator-count {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
}

.page-indicator-count strong {
  font-size: 14px;
}

.page-indicator-count > span {
  color: var(--muted);
  font-size: 10px;
}

/* The center brand line is pinned to the viewport, independent of side controls. */
.topbar {
  isolation: isolate;
}

.topbar > .brand,
.topbar > .topbar-actions {
  position: relative;
  z-index: 1;
}

.topbar-menu-title {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 0;
  display: inline-flex;
  max-width: min(42vw, 360px);
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px 4px;
  color: #3f3d39;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  text-overflow: ellipsis;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center;
  transition:
    color 0.22s ease,
    opacity 0.22s ease,
    transform 0.22s cubic-bezier(0.2, 0.72, 0.24, 1);
  white-space: nowrap;
}

.topbar-menu-title:hover,
.topbar-menu-title:focus-visible {
  color: #151515;
  opacity: 0.82;
  text-decoration: none;
  transform: translate(-50%, -50%) scale(1.035);
}

.topbar-menu-title:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.menu-button .mahina-menu-button-label {
  display: none;
  width: auto;
  height: auto;
  background: transparent;
}

@media (min-width: 721px) {
  .menu-button {
    position: relative;
    width: auto;
    min-width: 74px;
    border-radius: 999px;
    padding: 0 13px 0 34px;
  }

  .menu-button > span:not(.mahina-menu-button-label) {
    position: absolute;
    left: 13px;
  }

  .menu-button > span:first-child {
    top: 12px;
  }

  .menu-button > span:nth-child(2) {
    bottom: 12px;
  }

  .menu-button .mahina-menu-button-label {
    display: inline-flex;
    align-items: center;
    color: var(--ink);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: -0.01em;
    line-height: 1;
    white-space: nowrap;
  }
}

.art-cursor-arrow,
.art-cursor-lens {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 400;
  contain: paint;
  overflow: hidden;
  border: 0;
  outline: 0;
  pointer-events: none;
  will-change: transform;
}

.art-cursor-arrow {
  width: 27px;
  height: 27px;
  opacity: 0;
  background: linear-gradient(
    315deg,
    #fff 0%,
    rgba(224, 228, 235, 0.72) 30%,
    rgba(133, 140, 154, 0.28) 68%,
    rgba(82, 86, 96, 0) 100%
  );
  -webkit-backdrop-filter: blur(5px) saturate(112%);
  backdrop-filter: blur(5px) saturate(112%);
  box-shadow:
    1px 2px 4px rgba(0, 0, 0, 0.18),
    0 0 5px rgba(255, 255, 255, 0.16);
  clip-path: polygon(0 0, 100% 38%, 38% 100%);
  transform-origin: 0 0;
  transition: opacity 0.22s;
}

.art-cursor-arrow.is-visible {
  opacity: 1;
}

.art-cursor-arrow.is-interactive {
  opacity: 0;
}

.art-cursor-lens {
  contain: layout style;
  width: 30px;
  height: 20px;
  overflow: visible;
  border-radius: 64% 36% 58% 42% / 55% 62% 38% 45%;
  opacity: 0;
  background: linear-gradient(
    315deg,
    rgba(242, 247, 255, 0.36) 0%,
    rgba(165, 190, 222, 0.17) 44%,
    rgba(255, 255, 255, 0) 100%
  );
  -webkit-backdrop-filter: blur(5px) saturate(108%);
  backdrop-filter: blur(5px) saturate(108%);
  box-shadow:
    0 0 10px rgba(91, 124, 168, 0.16),
    0 0 18px rgba(255, 255, 255, 0.2);
  filter: blur(2.6px);
  transition:
    opacity 0.28s,
    width 0.24s,
    height 0.24s,
    filter 0.24s;
}

.art-cursor-arrow::before,
.art-cursor-lens::before {
  position: absolute;
  content: "";
  pointer-events: none;
}

.art-cursor-arrow::before {
  inset: -18% -28%;
  background: linear-gradient(
    315deg,
    rgba(255, 255, 255, 0.7) 0%,
    rgba(255, 255, 255, 0.24) 34%,
    rgba(255, 255, 255, 0) 72%
  );
  animation: cursor-directional-flow 9.6s cubic-bezier(0.42, 0, 0.2, 1)
    infinite;
}

.art-cursor-lens::before {
  inset: -35%;
  border-radius: inherit;
  background: linear-gradient(
    325deg,
    rgba(255, 255, 255, 0.26) 0%,
    rgba(166, 193, 226, 0.11) 52%,
    rgba(255, 255, 255, 0) 100%
  );
  filter: blur(4px);
  animation: cursor-fog-drift 8.8s ease-in-out infinite alternate;
}

.art-cursor-lens.is-positioned.is-interactive {
  opacity: 0.74;
  box-shadow:
    0 0 0 0.6px rgba(47, 54, 65, 0.2),
    0 0 10px rgba(91, 124, 168, 0.16),
    0 0 18px rgba(255, 255, 255, 0.2);
}

.art-cursor-lens.is-pressed {
  width: 15px;
  height: 10px;
  opacity: 0.62;
  filter: blur(2px) brightness(1.06);
}

.art-cursor-lens.is-native {
  opacity: 0;
}

@keyframes cursor-directional-flow {
  0% {
    opacity: 0.18;
    transform: translate(-14%, -14%) scale(1.04);
  }

  24% {
    opacity: 0.66;
  }

  76% {
    opacity: 0.42;
  }

  100% {
    opacity: 0.08;
    transform: translate(22%, 22%) scale(1.04);
  }
}

@keyframes cursor-fog-drift {
  0% {
    opacity: 0.36;
    transform: translate(-8%, -5%) scale(0.96);
  }

  100% {
    opacity: 0.16;
    transform: translate(9%, 6%) scale(1.08);
  }
}

html.has-art-cursor,
html.has-art-cursor body,
html.has-art-cursor a,
html.has-art-cursor button {
  cursor: none;
}

html.has-art-cursor input,
html.has-art-cursor textarea {
  cursor: text;
}

html.has-art-cursor select {
  cursor: default;
}

@keyframes mahina-page-index-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes mahina-page-index-rise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 720px) {
  .mahina-page-index-overlay {
    place-items: end stretch;
    padding: 0;
  }

  .mahina-page-index-panel {
    width: 100%;
    max-height: min(82dvh, 720px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mahina-page-index-header {
    padding: 20px 18px 16px;
  }

  .mahina-page-index-heading h2 {
    font-size: 25px;
  }

  .mahina-page-index-panel[data-view="menus"] .mahina-page-index-heading h2 {
    font-size: 19px;
  }

  .mahina-page-index-close {
    width: 40px;
    height: 40px;
  }

  .mahina-page-index-list {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 10px 10px 14px;
    scrollbar-gutter: auto;
  }

  .mahina-page-index-item {
    grid-template-columns: 38px minmax(0, 1fr) 10px;
    min-height: 60px;
    padding: 10px 13px;
  }

  .mahina-page-index-menu-item {
    grid-template-columns: minmax(0, 1fr) 10px;
  }

  .pager {
    grid-template-columns: 48px minmax(0, 1fr) 48px !important;
  }

  .page-indicator {
    gap: 12px;
    padding-inline: 9px !important;
  }

  .page-indicator-mode,
  .page-indicator-title {
    font-size: 9px;
  }

  .topbar-menu-title {
    max-width: 40vw;
    padding-inline: 2px;
    font-size: 9px;
  }
}

@media (max-width: 390px) {
  .pager {
    grid-template-columns: 44px minmax(0, 1fr) 44px !important;
  }

  .page-indicator {
    gap: 8px;
    padding-inline: 7px !important;
  }

  .page-indicator-mode,
  .page-indicator-title {
    font-size: 8px;
  }

  .topbar-menu-title {
    max-width: 36vw;
    font-size: 7.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mahina-page-index-overlay,
  .mahina-page-index-panel {
    animation: none;
  }

  .mahina-page-index-item {
    transition: none;
  }

  .topbar-menu-title {
    transition: none;
  }

  .topbar-menu-title:hover,
  .topbar-menu-title:focus-visible {
    transform: translate(-50%, -50%) scale(1);
  }
}
