/*
 * Brand menu overlay (template-parts/oba-menu.php)
 *
 * Figma: Menu_Obataimu (white) / Menu_Yogataimu (black).
 * Desktop frame 1440 wide, mobile 393 wide. --mu is one design pixel.
 */

.oba-menu {
  --mu: calc(100vw / 1440);
  --oba-menu-bg: var(--oba-white);
  --oba-menu-fg: var(--oba-black);

  position: fixed;
  inset: 0;
  /* Above the site header (z-index 9990), below the search overlay (9999). */
  z-index: 9995;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--oba-menu-bg);
  color: var(--oba-menu-fg);
  font-weight: 400;
  text-transform: none;
  -webkit-font-smoothing: antialiased;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.oba-menu[hidden] {
  display: none;
}

.oba-menu[data-theme='dark'] {
  --oba-menu-bg: var(--oba-black);
  --oba-menu-fg: var(--oba-white);
}

.oba-menu.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s;
}

/* Logged-in editors: stay clear of the WordPress admin bar. */
body.admin-bar .oba-menu,
body.admin-bar .oba-menu__bar {
  top: 32px;
}

@media screen and (max-width: 782px) {
  body.admin-bar .oba-menu,
  body.admin-bar .oba-menu__bar {
    top: 46px;
  }
}

.oba-menu__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Top bar: home, search, close ---------- */

.oba-menu__bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 56px 64px 0 56px;
  pointer-events: none;
}

.oba-menu__actions {
  display: flex;
  align-items: center;
  gap: 28px;
}

/* Icons are the supplied SVG files, tinted with the theme colour. */
.oba-menu .oba-menu__icon {
  all: unset;
  display: block;
  box-sizing: border-box;
  flex: 0 0 auto;
  background-color: var(--oba-menu-fg);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 0.2s ease;
}

.oba-menu .oba-menu__icon:hover {
  opacity: 0.6;
}

.oba-menu .oba-menu__icon--home {
  width: 50px;
  height: 52px;
}

.oba-menu .oba-menu__icon--search {
  width: 45px;
  height: 41px;
}

.oba-menu .oba-menu__icon--close {
  width: 32px;
  height: 32px;
}

.oba-menu .oba-menu__icon:focus-visible,
.oba-menu .oba-menu__link:focus-visible,
.oba-menu .oba-menu__sublink:focus-visible {
  outline: 2px solid var(--oba-menu-fg);
  outline-offset: 6px;
}

/* ---------- Slanted list ---------- */

.oba-menu__nav {
  display: flex;
  justify-content: center;
  /* The list is rotated around its centre, so it needs room above and below. */
  padding: calc(240 * var(--mu)) 0 calc(260 * var(--mu));
}

.oba-menu .oba-menu__list,
.oba-menu .oba-menu__sub {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.oba-menu .oba-menu__list {
  gap: calc(40 * var(--mu));
  transform: translateX(calc(31 * var(--mu))) rotate(-15deg);
}

.oba-menu .oba-menu__item,
.oba-menu .oba-menu__subitem {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 0;
}

.oba-menu .oba-menu__link,
.oba-menu .oba-menu__link:visited,
.oba-menu .oba-menu__sublink,
.oba-menu .oba-menu__sublink:visited {
  all: unset;
  display: block;
  box-sizing: border-box;
  color: var(--oba-menu-fg);
  font-family: var(--oba-font-title);
  font-weight: 900;
  line-height: 0.9;
  text-align: center;
  text-decoration: none;
  /* Menu names are stored in lowercase: the design sets them in Title Case. */
  text-transform: capitalize;
  /* Long names wrap inside the width of the Figma text column. */
  max-width: calc(998 * var(--mu));
  cursor: pointer;
}

/* Menu 1st: Helvetica Black 110 / 90% / -5% */
.oba-menu .oba-menu__link,
.oba-menu .oba-menu__link:visited {
  font-size: calc(110 * var(--mu));
  letter-spacing: -0.05em;
}

/* Menu 2nd: Helvetica Black 36 / 90% / -2% */
.oba-menu .oba-menu__sublink,
.oba-menu .oba-menu__sublink:visited {
  font-size: calc(36 * var(--mu));
  letter-spacing: -0.02em;
}

.oba-menu .oba-menu__sub {
  gap: calc(12 * var(--mu));
  margin-top: calc(40 * var(--mu));
}

.oba-menu .oba-menu__sub[hidden] {
  display: none;
}

/*
 * Opening / closing a sub menu: js/oba.js sets the start and end height,
 * margins and opacity inline; this class supplies the motion. Keep the
 * duration in step with SUB_DURATION there.
 */
.oba-menu .oba-menu__sub.is-animating {
  overflow: hidden;
  transition: height 0.45s cubic-bezier(0.4, 0, 0.2, 1), margin 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
  will-change: height;
}

/* Sub menu rows never squash while the list is sliding: they are clipped. */
.oba-menu .oba-menu__subitem {
  flex-shrink: 0;
}

.oba-menu .oba-menu__sub--nested {
  margin: calc(12 * var(--mu)) 0;
}

.oba-menu .oba-menu__sub--nested .oba-menu__sublink {
  font-size: calc(28 * var(--mu));
}

/* Open menus slide their items in, one after the other. */
.oba-menu .oba-menu__item {
  opacity: 0;
  transform: translateY(calc(24 * var(--mu)));
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--i, 0) * 35ms);
}

.oba-menu.is-open .oba-menu__item {
  opacity: 1;
  transform: none;
}

@media (hover: hover) {
  .oba-menu .oba-menu__link,
  .oba-menu .oba-menu__sublink {
    transition: opacity 0.2s ease;
  }

  .oba-menu .oba-menu__list:hover .oba-menu__link:not(:hover):not([aria-expanded='true']) {
    opacity: 0.35;
  }

  .oba-menu .oba-menu__sub:hover .oba-menu__sublink:not(:hover) {
    opacity: 0.35;
  }
}

/* ---------- Mobile (393 frame) ---------- */

@media (max-width: 767px) {
  .oba-menu {
    --mu: calc(100vw / 393);
  }

  .oba-menu__bar {
    padding: 42px 20px 0;
  }

  .oba-menu__actions {
    gap: 22px;
  }

  .oba-menu .oba-menu__icon--home {
    width: 30px;
    height: 30px;
    margin-top: 2px;
  }

  .oba-menu .oba-menu__icon--search {
    width: 28px;
    height: 25px;
  }

  .oba-menu .oba-menu__icon--close {
    width: 23px;
    height: 23px;
  }

  .oba-menu__nav {
    padding: calc(183 * var(--mu)) 0 calc(170 * var(--mu));
  }

  .oba-menu .oba-menu__list {
    gap: calc(15 * var(--mu));
    transform: rotate(-15deg);
  }

  /* mobile/Menu 1st: 40 / 90% / -3% */
  .oba-menu .oba-menu__link,
  .oba-menu .oba-menu__link:visited {
    max-width: calc(340 * var(--mu));
    font-size: calc(40 * var(--mu));
    letter-spacing: -0.03em;
  }

  .oba-menu .oba-menu__sublink,
  .oba-menu .oba-menu__sublink:visited {
    max-width: calc(300 * var(--mu));
  }

  /* mobile/Menu 2nd: 20 / 90% / -2% */
  .oba-menu .oba-menu__sublink,
  .oba-menu .oba-menu__sublink:visited {
    font-size: calc(20 * var(--mu));
  }

  .oba-menu .oba-menu__sub {
    gap: calc(8 * var(--mu));
    margin-top: calc(15 * var(--mu));
  }

  .oba-menu .oba-menu__sub--nested {
    margin: calc(8 * var(--mu)) 0;
  }

  .oba-menu .oba-menu__sub--nested .oba-menu__sublink {
    font-size: calc(17 * var(--mu));
  }
}

@media (prefers-reduced-motion: reduce) {
  .oba-menu,
  .oba-menu .oba-menu__item {
    transition-duration: 0.01s;
    transition-delay: 0s;
    transform: none;
  }
}

body.oba-menu-open {
  overflow: hidden;
}

/* ---------- Page headings set in the menu font ---------- */

/*
 * The heading of the fabrics page ("obataimu fabrics",
 * stroke-our-fabrics-template.php), like the listing and product headings in
 * css/oba-brand.css. Here because this stylesheet is on every page. The
 * wording, its case, the size and the spacing around it stay as they were.
 */
.stroke-our-fabrics-heading {
  font-family: var(--oba-font-title, 'Helvetica Black', 'Helvetica Neue', Helvetica, Arial, sans-serif) !important;
  font-weight: 900 !important;
  letter-spacing: -0.03em !important;
}

/*
 * Helvetica Black is wider than the old heading font: in the old 40% box the
 * two words no longer fit on one line. From tablet up the box is as wide as
 * the heading needs, up to 14 letters-heights; longer headings still wrap.
 */
@media (min-width: 768px) {
  .stroke-our-fabrics-heading {
    width: auto;
    max-width: 14em;
  }
}
