/* RIVULET MILL chrome — offset ledger + aisle ribbon + river footer
   Distinct from TwentySeven top-bar and Sixty floating island / plot rail. */

.a62-mill-wrap {
  min-height: 100vh;
  position: relative;
}

.rm-stage {
  padding-top: calc(var(--ledger-h) + var(--ribbon-h) + 0.75rem);
  padding-bottom: 4rem;
  min-height: 100vh;
}

/* ── Offset ledger header ── */
.rm-ledger {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 120;
  height: var(--ledger-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0 clamp(0.85rem, 2.5vw, 1.75rem);
  background: rgba(247, 249, 250, 0.88);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  border-bottom: 1.5px solid var(--line);
  box-shadow: 0 8px 28px rgba(21, 32, 43, 0.05);
}

.rm-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  clip-path: polygon(0 0, 100% 0, 92% 100%, 0 100%);
  padding-right: 1.1rem;
}

.rm-brand-mark {
  width: 2.55rem;
  height: 2.55rem;
  display: grid;
  place-items: center;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--paper);
  background: var(--rivulet);
  border-radius: 30% 70% 60% 40% / 50% 40% 60% 50%;
  animation: rmBlob 8s var(--ease-soft) infinite alternate;
}

@keyframes rmBlob {
  from { border-radius: 30% 70% 60% 40% / 50% 40% 60% 50%; }
  to { border-radius: 58% 42% 38% 62% / 42% 58% 48% 52%; }
}

.rm-brand-word {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.rm-brand-word strong {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--muted);
}
.rm-brand-word em {
  font-family: var(--display);
  font-style: normal;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.rm-nav {
  display: none;
  justify-content: center;
  gap: 0.15rem;
}
@media (min-width: 980px) {
  .rm-nav { display: flex; }
}
.rm-nav-link {
  position: relative;
  padding: 0.55rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color 0.25s;
}
.rm-nav-link::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 0.2rem;
  height: 2px;
  background: var(--rivulet);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease-out);
}
.rm-nav-link:hover,
.rm-nav-link.is-active { color: var(--ink); }
.rm-nav-link:hover::after,
.rm-nav-link.is-active::after { transform: scaleX(1); }

.rm-tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.rm-search {
  display: none;
  align-items: center;
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
@media (min-width: 720px) {
  .rm-search { display: flex; }
}
.rm-search input {
  border: 0;
  background: transparent;
  padding: 0.55rem 0.75rem;
  width: 11rem;
  outline: none;
}
.rm-search button {
  border: 0;
  background: var(--slate);
  color: var(--paper);
  padding: 0.55rem 0.7rem;
  cursor: pointer;
}
/* Account + cart icon tools */
.a62-ico {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
}
.a62-ico svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.a62-ico-ring,
.a62-ico-head,
.a62-ico-body,
.a62-ico-pouch,
.a62-ico-handle {
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  transition: stroke 0.25s, fill 0.25s, transform 0.35s var(--ease-out);
}
.a62-ico-head {
  fill: color-mix(in srgb, currentColor 18%, transparent);
}
.a62-ico-seed {
  fill: var(--rivulet);
  stroke: none;
  transform-origin: 12px 14.2px;
  transition: transform 0.35s var(--ease-out), fill 0.25s;
}
.a62-ico-pouch {
  fill: color-mix(in srgb, currentColor 8%, transparent);
}

.rm-tool {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.45rem;
  padding: 0.4rem 0.7rem 0.4rem 0.45rem;
  border: 1.5px solid color-mix(in srgb, var(--ink) 78%, transparent);
  border-radius: 999px;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--paper) 92%, #fff), var(--paper));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 4px 14px rgba(21, 32, 43, 0.06);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  overflow: visible;
  transition:
    background 0.25s,
    color 0.25s,
    border-color 0.25s,
    transform 0.3s var(--ease-out),
    box-shadow 0.3s;
}
.rm-tool::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 1.5px solid transparent;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, border-color 0.25s;
}
.rm-tool:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.75) inset,
    0 10px 22px rgba(21, 32, 43, 0.1);
}
.rm-tool:hover::before {
  opacity: 1;
  border-color: color-mix(in srgb, var(--rivulet) 45%, transparent);
}
.rm-tool:focus-visible {
  outline: 2px solid var(--rivulet);
  outline-offset: 3px;
}
.rm-tool-label {
  line-height: 1;
  padding-right: 0.15rem;
}

.rm-tool-account .a62-ico {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--rivulet) 12%, var(--paper));
  color: var(--rivulet-deep);
}
.rm-tool-account:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.rm-tool-account:hover .a62-ico {
  background: color-mix(in srgb, var(--rivulet) 35%, transparent);
  color: var(--paper);
}
.rm-tool-account:hover .a62-ico-head {
  fill: color-mix(in srgb, var(--paper) 35%, transparent);
}
.rm-tool-account.is-signed .a62-ico {
  background: var(--rivulet);
  color: var(--paper);
}
.rm-tool-account.is-signed .a62-ico-head {
  fill: color-mix(in srgb, var(--paper) 28%, transparent);
}
.rm-tool-account.is-signed::after {
  content: "";
  position: absolute;
  top: 0.28rem;
  right: 0.28rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--oat);
  border: 1.5px solid var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
}

.rm-tool-bag {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--oat-soft) 80%, #fff), var(--oat-soft));
  border-color: var(--oat-deep);
  padding-right: 0.85rem;
}
.rm-tool-bag .a62-ico {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 12px 12px 10px 10px;
  background: color-mix(in srgb, var(--oat) 22%, var(--paper));
  color: var(--ink);
}
.rm-tool-bag:hover {
  background: var(--rivulet);
  color: var(--paper);
  border-color: var(--rivulet-deep);
}
.rm-tool-bag:hover .a62-ico {
  background: color-mix(in srgb, var(--paper) 18%, transparent);
  color: var(--paper);
}
.rm-tool-bag:hover .a62-ico-seed {
  fill: var(--oat);
  transform: scale(1.18);
}
.rm-tool-bag:hover .a62-ico-pouch {
  fill: color-mix(in srgb, var(--paper) 12%, transparent);
}
.rm-tool-bag.has-items .a62-ico-seed {
  animation: a62SeedPulse 1.8s var(--ease-soft) infinite;
}

.rm-tool-bag em,
.rm-tray-tab em,
[data-cart-badge] {
  display: inline-grid;
  place-items: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: var(--rivulet);
  color: var(--paper);
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--paper);
}
[data-cart-badge][hidden],
em[data-cart-badge][hidden] {
  display: none !important;
}
.rm-tool-bag em,
.rm-tool-bag [data-cart-badge] {
  position: absolute;
  top: -0.28rem;
  right: -0.18rem;
  background: var(--ink);
  color: var(--paper);
  animation: a62BadgePop 0.45s var(--ease-out) both;
}
.rm-tool-bag:hover em,
.rm-tool-bag:hover [data-cart-badge] {
  background: var(--oat);
  color: var(--ink);
}

@keyframes a62SeedPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.22); }
}
@keyframes a62BadgePop {
  0% { transform: scale(0.7); }
  70% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .rm-tool-bag em,
  .rm-tool-bag [data-cart-badge],
  .rm-tool-bag.has-items .a62-ico-seed {
    animation: none !important;
  }
}

@media (max-width: 720px) {
  .rm-tool-label { display: none; }
  .rm-tool {
    width: 2.55rem;
    height: 2.55rem;
    min-height: 0;
    padding: 0;
    justify-content: center;
    border-radius: 14px;
  }
  .rm-tool-account.is-signed::after {
    top: 0.2rem;
    right: 0.2rem;
  }
}

.rm-menu {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0.45rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--paper);
  cursor: pointer;
}
@media (min-width: 980px) {
  .rm-menu { display: none; }
}
.rm-menu span:not(.visually-hidden) {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

/* ── Aisle ribbon ── */
.rm-aisle-ribbon {
  position: fixed;
  top: var(--ledger-h);
  left: 0;
  right: 0;
  z-index: 110;
  height: var(--ribbon-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 clamp(0.85rem, 2.5vw, 1.75rem);
  background: var(--rivulet-deep);
  color: var(--paper);
  overflow: hidden;
}
.rm-aisle-label {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.7;
}
.rm-aisle-track {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent);
}
.rm-aisle-track::-webkit-scrollbar { display: none; }
.rm-aisle-chip {
  flex-shrink: 0;
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(247, 249, 250, 0.28);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0;
  animation: rmChipIn 0.5s var(--ease-out) forwards;
  animation-delay: calc(var(--ai, 0) * 0.05s);
  transition: background 0.2s, border-color 0.2s;
}
.rm-aisle-chip:hover,
.rm-aisle-chip.is-active {
  background: var(--paper);
  color: var(--rivulet-deep);
  border-color: var(--paper);
}
@keyframes rmChipIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ── Drawer ── */
.rm-drawer[hidden] { display: none !important; }
.rm-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
}
.rm-drawer-scrim {
  position: absolute;
  inset: 0;
  background: rgba(21, 32, 43, 0.45);
}
.rm-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(340px, 92vw);
  height: 100%;
  background: var(--paper);
  border-left: 1.5px solid var(--line);
  padding: 1.25rem;
  overflow-y: auto;
  animation: rmSlide 0.35s var(--ease-out);
}
@keyframes rmSlide {
  from { transform: translateX(12%); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}
.rm-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.rm-drawer-head strong {
  font-family: var(--display);
  font-size: 1.2rem;
}
.rm-drawer-head button {
  border: 1px solid var(--line);
  background: var(--mist);
  width: 2.2rem;
  height: 2.2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.2rem;
}
.rm-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.rm-drawer-nav a {
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius);
  font-weight: 600;
  background: var(--mist);
}
.rm-drawer-aisles {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.rm-drawer-aisles p {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.35rem;
}
.rm-drawer-aisles a {
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.92rem;
}
.rm-drawer-desk {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── River footer ── */
.rm-river {
  margin-top: var(--space-section);
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(26, 107, 99, 0.14), transparent 55%),
    var(--slate);
  color: var(--paper);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
}
.rm-river-bend {
  display: grid;
  grid-template-columns: 1.15fr 1.4fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  padding: clamp(2.5rem, 5vw, 4rem) clamp(1.1rem, 3vw, 2rem);
}
@media (max-width: 860px) {
  .rm-river-bend { grid-template-columns: 1fr; }
}
.rm-river-mark {
  display: inline-grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.75rem;
  border-radius: 40% 60% 55% 45% / 55% 45% 55% 45%;
  background: var(--rivulet);
  font-weight: 700;
  font-size: 0.8rem;
}
.rm-river-brand h2 {
  font-family: var(--display);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  margin: 0 0 0.65rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.rm-river-brand p {
  margin: 0 0 1rem;
  color: rgba(247, 249, 250, 0.72);
  max-width: 34ch;
  font-size: 0.95rem;
}
.rm-river-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.rm-river-facts li {
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(247, 249, 250, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.rm-river-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 640px) {
  .rm-river-cols { grid-template-columns: 1fr 1fr; }
}
.rm-river-col {
  transform: translateY(calc(var(--ci, 0) * 0.85rem));
}
.rm-river-col h4 {
  margin: 0 0 0.75rem;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--oat);
}
.rm-river-col a,
.rm-river-col p {
  display: block;
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  color: rgba(247, 249, 250, 0.82);
}
.rm-river-col a:hover { color: #fff; }
.rm-river-hours { opacity: 0.65; font-size: 0.8rem !important; }
.rm-river-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 1rem clamp(1.1rem, 3vw, 2rem);
  border-top: 1px solid rgba(247, 249, 250, 0.12);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(247, 249, 250, 0.55);
}

/* ── Mobile tray ── */
.rm-tray {
  position: fixed;
  bottom: 0.65rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 130;
  width: min(420px, calc(100% - 1.2rem));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.15rem;
  padding: 0.4rem;
  background: rgba(247, 249, 250, 0.94);
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}
@media (min-width: 980px) {
  .rm-tray { display: none; }
  .rm-stage { padding-bottom: 2rem; }
}
.rm-tray-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.45rem 0.2rem;
  border-radius: 12px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  position: relative;
}
.rm-tray-tab.is-active {
  background: var(--rivulet-soft);
  color: var(--rivulet-deep);
}
.rm-tray-tab em {
  position: absolute;
  top: 0.15rem;
  right: 0.35rem;
}

/* Legacy class hooks so older page sheets don't break */
.a62-prism-wrap { min-height: 100vh; }
.a62-prism-stage { min-height: 50vh; }
.a62-island, .a62-spine, .a62-tape, .a62-mob-dock, .fd-chrome { display: none !important; }
