/* Trellis Rail — Lathhouse Nursery nav (relative / contrast / mobile) */
.tr-rail {
  position: relative;
  top: 0;
  z-index: 80;
  background: var(--a104-night);
  color: var(--a104-on-night);
  border-bottom: 4px solid var(--a104-primary);
  isolation: isolate;
}

.tr-bed {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px 12px;
  align-items: center;
  width: min(100% - 24px, var(--a104-max));
  margin-inline: auto;
  min-height: var(--a104-nav-h);
  padding: 10px 0;
}

.tr-post--brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--a104-on-night);
  padding: 6px 10px;
  border: 2px solid var(--a104-sun);
  background: linear-gradient(145deg, #163526, #0f1f16);
  box-shadow: 3px 3px 0 var(--a104-secondary);
  transition: transform 180ms ease, color 180ms ease;
  max-width: 11.5rem;
  min-width: 0;
}
.tr-post--brand:hover,
.tr-post--brand:focus-visible {
  transform: translate(-1px, -1px);
  color: var(--a104-sun);
  outline: none;
}
.tr-post--brand:focus-visible {
  outline: 3px solid var(--a104-sun);
  outline-offset: 2px;
}
.tr-leaf-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  background: var(--a104-primary);
  clip-path: polygon(50% 0%, 90% 35%, 75% 100%, 25% 100%, 10% 35%);
}
.tr-brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  min-width: 0;
}
.tr-brand-copy small {
  font-family: var(--a104-font-display);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--a104-night-mute);
  font-weight: 800;
}
.tr-brand-copy strong {
  font-family: var(--a104-font-display);
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 800;
  color: var(--a104-sun);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tr-wire-wrap {
  position: relative;
  min-width: 0;
  padding: 10px 2px 6px;
}
.tr-wire {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 20px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--a104-lath), transparent);
  opacity: 0.55;
  pointer-events: none;
}
.tr-leaves {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  position: relative;
  z-index: 1;
  min-width: 0;
}
.tr-leaf {
  flex: 1 1 0;
  min-width: 0;
  text-decoration: none;
  font-family: var(--a104-font-display);
  font-weight: 800;
  font-size: clamp(0.68rem, 1.05vw, 0.78rem);
  line-height: 1.15;
  text-align: center;
  padding: 11px 5px 9px;
  border: 2px solid var(--a104-ink);
  color: var(--a104-ink);
  transform: translateY(calc(var(--tr-i, 0) * 2px));
  transition: transform 200ms cubic-bezier(.2,.8,.2,1), box-shadow 200ms ease, filter 200ms ease;
  animation: trLeafIn 420ms ease both;
  animation-delay: calc(var(--tr-i, 0) * 35ms);
}
@keyframes trLeafIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(calc(var(--tr-i, 0) * 2px)); }
}
.tr-leaf-blade {
  display: block;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  hyphens: auto;
  word-break: break-word;
}
.tr-leaf--leaf { background: var(--a104-primary); color: #fff; }
.tr-leaf--clay { background: var(--a104-secondary); color: #fff; }
.tr-leaf--sun { background: var(--a104-sun); color: var(--a104-sun-ink); }
.tr-leaf--bloom { background: var(--a104-accent); color: #fff; }
.tr-leaf:hover,
.tr-leaf:focus-visible,
.tr-leaf.is-active {
  transform: translateY(-5px);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
  z-index: 2;
  filter: brightness(1.05);
  outline: none;
}
.tr-leaf:focus-visible {
  outline: 3px solid var(--a104-sun);
  outline-offset: 2px;
}
.tr-leaf.is-active {
  box-shadow: 3px 3px 0 var(--a104-sun);
}

.tr-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.tr-tool,
.tr-cart {
  appearance: none;
  border: 2px solid var(--a104-sun);
  background: transparent;
  color: var(--a104-sun);
  font-family: var(--a104-font-display);
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 10px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1.1;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
  white-space: nowrap;
}
.tr-tool:hover,
.tr-tool:focus-visible,
.tr-cart:hover,
.tr-cart:focus-visible,
.tr-cart.is-active,
.tr-tool[aria-expanded="true"] {
  background: var(--a104-sun);
  color: var(--a104-sun-ink);
  transform: translateY(-2px);
  outline: none;
}
.tr-tool:focus-visible,
.tr-cart:focus-visible {
  outline: 3px solid var(--a104-accent);
  outline-offset: 2px;
}
.tr-tool--unfurl {
  display: none;
}
.tr-cart {
  position: relative;
  padding-inline: 12px;
}
.tr-cart-count {
  font-style: normal;
  background: var(--a104-accent);
  color: #fff;
  min-width: 1.35em;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 0.68rem;
  line-height: 1.35;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.tr-search,
.tr-more {
  position: relative;
  z-index: 82;
  background: var(--a104-field-warm);
  border-bottom: 3px solid var(--a104-primary);
  color: var(--a104-ink);
  padding: 14px 0;
  box-shadow: 0 8px 24px rgba(15, 31, 22, 0.18);
}
.tr-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.tr-search-form input {
  border: 2px solid var(--a104-ink);
  padding: 12px 14px;
  background: #fff;
  color: var(--a104-ink);
  font-family: var(--a104-font-body);
  min-width: 0;
  min-height: 48px;
}
.tr-search-form input:focus {
  outline: 3px solid var(--a104-sun);
  outline-offset: 1px;
}
.tr-search-form button {
  border: 2px solid var(--a104-ink);
  background: var(--a104-primary);
  color: #fff;
  font-family: var(--a104-font-display);
  font-weight: 800;
  padding: 0 18px;
  min-height: 48px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--a104-ink);
}
.tr-search-form button:hover,
.tr-search-form button:focus-visible {
  background: var(--a104-primary-deep);
  outline: none;
}
.tr-search-form button:focus-visible {
  outline: 3px solid var(--a104-sun);
  outline-offset: 2px;
}

.tr-more-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--a104-font-display);
  font-weight: 800;
}
.tr-more-nav a {
  text-decoration: none;
  color: var(--a104-ink);
  background: #fff;
  border: 2px solid var(--a104-ink);
  padding: 8px 12px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  box-shadow: 2px 2px 0 var(--a104-primary);
  transition: transform 140ms ease, background 140ms ease;
}
.tr-more-nav a:hover,
.tr-more-nav a:focus-visible,
.tr-more-nav a[aria-current="page"] {
  background: var(--a104-sun);
  color: var(--a104-sun-ink);
  transform: translate(-1px, -1px);
  outline: none;
}
.tr-more-nav a:focus-visible {
  outline: 3px solid var(--a104-primary);
  outline-offset: 2px;
}

.tr-scrim {
  position: fixed;
  inset: 0;
  top: 0;
  background: rgba(15, 31, 22, 0.5);
  z-index: 70;
}

/* Mid widths: keep leaves usable before full mobile sheet */
@media (max-width: 1100px) {
  .tr-leaf { font-size: 0.66rem; padding: 10px 4px 8px; }
  .tr-tool,
  .tr-cart { font-size: 0.64rem; padding: 8px; }
}

@media (max-width: 860px) {
  .tr-bed {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .tr-wire-wrap { display: none; }
  .tr-post--brand { max-width: none; }
  .tr-tools { gap: 5px; }
  .tr-tool--unfurl { display: inline-flex !important; }
  .tr-rail.is-unfurled .tr-wire-wrap {
    display: block;
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(var(--a104-nav-h) + 10px);
    z-index: 85;
    background: var(--a104-night);
    padding: 14px;
    border: 2px solid var(--a104-sun);
    box-shadow: var(--a104-shadow-hard);
    max-height: min(70vh, 420px);
    overflow: auto;
  }
  .tr-rail.is-unfurled .tr-wire { display: none; }
  .tr-leaves {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .tr-leaf {
    transform: none !important;
    animation: none;
    opacity: 1;
    font-size: 0.92rem;
    padding: 14px 12px;
    text-align: left;
  }
  .tr-leaf-blade {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
    white-space: normal;
  }
  .tr-leaf:hover,
  .tr-leaf:focus-visible,
  .tr-leaf.is-active {
    transform: translateX(4px) !important;
  }
  .tr-search-form { grid-template-columns: 1fr; }
  .tr-search-form button { width: 100%; }
}

@media (max-width: 420px) {
  .tr-brand-copy small { display: none; }
  .tr-bed { width: min(100% - 16px, var(--a104-max)); }
  .tr-tool,
  .tr-cart { padding: 8px 7px; font-size: 0.62rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tr-leaf,
  .tr-tool,
  .tr-cart,
  .tr-post--brand,
  .tr-more-nav a { transition: none; animation: none; }
  .tr-leaf { opacity: 1; transform: none; }
}

/* Explicit nav leaf/cart colors (after tokens link fix) */
body.a104-body a.tr-leaf--leaf,
body.a104-body a.tr-leaf--clay,
body.a104-body a.tr-leaf--bloom { color: #fff; }
body.a104-body a.tr-leaf--sun { color: var(--a104-sun-ink); }
body.a104-body a.tr-leaf--leaf:hover,
body.a104-body a.tr-leaf--leaf:focus-visible,
body.a104-body a.tr-leaf--clay:hover,
body.a104-body a.tr-leaf--clay:focus-visible,
body.a104-body a.tr-leaf--bloom:hover,
body.a104-body a.tr-leaf--bloom:focus-visible { color: #fff; }
body.a104-body a.tr-leaf--sun:hover,
body.a104-body a.tr-leaf--sun:focus-visible { color: var(--a104-sun-ink); }
body.a104-body a.tr-cart { color: var(--a104-sun); }
body.a104-body a.tr-cart:hover,
body.a104-body a.tr-cart:focus-visible,
body.a104-body a.tr-cart.is-active { color: var(--a104-sun-ink); }
body.a104-body a.tr-post--brand { color: var(--a104-on-night); }
body.a104-body a.tr-post--brand:hover,
body.a104-body a.tr-post--brand:focus-visible { color: var(--a104-sun); }
body.a104-body .tr-more-nav a { color: var(--a104-ink); }
body.a104-body .tr-more-nav a:hover,
body.a104-body .tr-more-nav a:focus-visible,
body.a104-body .tr-more-nav a[aria-current="page"] { color: var(--a104-sun-ink); }