/*
  Dropdown 04 — Nested Menu — standalone HTML/CSS/JS implementation.
  No build step, no framework, no external dependency: copy index.html,
  this file, and script.js into any project as-is.
*/

:root {
  --dropdown-accent: #39ff14;
  --dropdown-fg: oklch(0.145 0 0);
  --dropdown-muted: oklch(0.5 0 0);
  --dropdown-border: oklch(0.88 0 0);
  --dropdown-border-hover: oklch(0.72 0 0);
  --dropdown-hover: oklch(0.96 0 0);
}

.dropdown04 {
  position: relative;
  display: inline-flex;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

.dropdown04__trigger {
  border: 1px solid var(--dropdown-border);
  border-radius: 0.5rem;
  background-color: #ffffff;
  padding: 0.5rem 0.875rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--dropdown-fg);
  cursor: pointer;
  outline: none;
  transition: border-color 150ms ease-out;
}

.dropdown04__trigger:hover {
  border-color: var(--dropdown-border-hover);
}

.dropdown04__trigger:focus-visible {
  outline: 2px solid var(--dropdown-fg);
  outline-offset: 2px;
}

.dropdown04__menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  margin-top: 0.375rem;
  width: 14rem;
  max-width: calc(100vw - 1rem);
  border-radius: 0.75rem;
  border: 1px solid var(--dropdown-border);
  background-color: #ffffff;
  padding: 0.375rem;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.3);
  animation: dropdown04-in 140ms ease-out both;
}

.dropdown04__menu[data-open-upward="true"] {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: 0.375rem;
}

.dropdown04__menu[hidden] {
  display: none;
}

.dropdown04__parent {
  position: relative;
}

.dropdown04__submenu {
  position: absolute;
  top: 0;
  left: 100%;
  z-index: 30;
  margin-left: 0.75rem;
  width: 13rem;
  max-width: calc(100vw - 1rem);
  border-radius: 0.75rem;
  border: 1px solid var(--dropdown-border);
  background-color: #ffffff;
  padding: 0.375rem;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.3);
  animation: dropdown04-in 140ms ease-out both;
}

.dropdown04__submenu[data-open-side="left"] {
  left: auto;
  right: 100%;
  margin-left: 0;
  margin-right: 0.75rem;
}

/* Phone: no room for a flyout on either side, so the submenu expands
   inline beneath its parent row. */
.dropdown04__submenu[data-open-side="inline"] {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  z-index: auto;
  width: auto;
  max-width: none;
  margin: 0.125rem 0 0.125rem 1.125rem;
  border: 0;
  border-left: 1px solid var(--dropdown-border);
  border-radius: 0;
  padding: 0 0 0 0.375rem;
  box-shadow: none;
  animation-name: dropdown04-expand;
}

.dropdown04__item[data-submenu-inline="true"] .dropdown04__chevron {
  transform: rotate(90deg);
}

.dropdown04__submenu[hidden] {
  display: none;
}

@keyframes dropdown04-expand {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dropdown04-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.dropdown04__item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.625rem;
  border: 0;
  border-radius: 0.5rem;
  background: none;
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--dropdown-fg);
  text-align: left;
  cursor: pointer;
  outline: none;
}

.dropdown04__item svg:not(.dropdown04__chevron) {
  height: 1rem;
  width: 1rem;
  flex-shrink: 0;
  color: var(--dropdown-muted);
}

.dropdown04__label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown04__chevron {
  height: 0.875rem;
  width: 0.875rem;
  flex-shrink: 0;
  color: var(--dropdown-muted);
  transition: transform 150ms ease-out;
}

.dropdown04__item:hover,
.dropdown04__item:focus-visible {
  background-color: var(--dropdown-hover);
}

.dropdown04__divider {
  height: 1px;
  margin: 0.375rem 0;
  background-color: var(--dropdown-border);
}

@media (prefers-reduced-motion: reduce) {
  .dropdown04__menu,
  .dropdown04__submenu,
  .dropdown04__submenu[data-open-side="inline"] {
    animation: none;
  }
  .dropdown04__chevron {
    transition: none;
  }
}

/*
  Page layout — the canvas this resource is presented on. Adjust or drop it
  when placing the resource inside your own layout.
*/

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(to bottom, #fafafa, #f4f4f5);
}
.dropdown04-layout {
  display: flex;
  min-height: 21rem;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5rem 2.5rem 4rem;
}
/* On a phone the submenu expands inline, making the open menu taller. */
@media (max-width: 39.99rem) {
  .dropdown04-layout {
    min-height: 27rem;
  }
}
.dropdown04-layout__panel {
  display: flex;
  width: 100%;
  max-width: 42.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid oklch(0.9 0 0);
  border-radius: 1rem;
  background: #ffffff;
  padding: 1.5rem;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 16px 40px -16px rgba(0, 0, 0, 0.14);
}
.dropdown04-layout__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: oklch(0.145 0 0);
}
