/* DESIGN ROLL: garden-bed rows · utility bar + main bar · olive and blush (#4F5D3A / #E8B4A8)
   · soil-strata gradient · seed-packet notched brand tag · Caveat script + Nunito Sans
   · vine line draws in on hover/active · hide on scroll down / show on scroll up · bottom tab bar + full-screen category sheet
   Signature: active furrow “irrigation” fill climbs the ledge; cart badge plants a seed dot that sprouts on count bump */

.tr-root {
  position: relative;
  top: auto;
  --tr-olive: #4f5d3a;
  --tr-olive-deep: #364228;
  --tr-blush: #e8b4a8;
  --tr-blush-deep: #c98f82;
  --tr-cream: #f7efe6;
  --tr-ink: #1e2418;
  --tr-soil: #5c4a3a;
  --tr-lime: #a8c45a;
  --tr-line: rgba(30, 36, 24, 0.14);
  --tr-ease: cubic-bezier(0.33, 1, 0.45, 1);
  --tr-dur: 220ms;
  --tr-tab-h: 62px;
  z-index: 900;
}

.tr-root.is-hidden .tr-shell {
  transform: translateY(calc(-100% - 2px));
}

.tr-util {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--a117-space-2);
  padding: 6px clamp(12px, 3vw, 20px);
  background: var(--tr-olive-deep);
  color: var(--tr-cream);
  font-size: var(--a117-type-xs);
}

.tr-util-msg {
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tr-util-track {
  color: var(--tr-blush);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.tr-util-track:hover {
  text-decoration: underline;
}

.tr-util-track:focus-visible {
  outline: 2px solid var(--tr-lime);
  outline-offset: 2px;
}

.tr-shell {
  background:
    linear-gradient(180deg, #d9c4a8 0%, #c4a88a 12%, #8f7358 24%, var(--tr-cream) 24%),
    var(--tr-cream);
  border-bottom: 2px solid var(--tr-olive);
  transition: transform var(--tr-dur) var(--tr-ease);
  will-change: transform;
}

.tr-main {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr minmax(220px, 340px);
  gap: 12px 16px;
  align-items: end;
  padding: 12px 0 14px;
}

.tr-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--tr-ink);
  padding: 10px 12px 10px 14px;
  background: var(--tr-cream);
  border: 2px solid var(--tr-olive);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
  box-shadow: 3px 3px 0 var(--tr-blush-deep);
  min-height: 44px;
}

.tr-brand:focus-visible {
  outline: 2px solid var(--tr-lime);
  outline-offset: 3px;
}

.tr-mark {
  color: var(--tr-olive);
  flex-shrink: 0;
}

.tr-brand-script {
  display: block;
  font-family: "Caveat", cursive;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--tr-soil);
  font-style: normal;
}

.tr-brand-sans {
  display: block;
  font-family: "Nunito Sans", var(--a117-font-body);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tr-olive-deep);
}

.tr-ridges {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px 10px;
  padding-bottom: 4px;
}

.tr-ridge {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 44px;
  padding: 8px 12px 10px;
  text-decoration: none;
  color: var(--tr-ink);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--tr-line);
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  transition: transform var(--tr-dur) var(--tr-ease), border-color var(--tr-dur) var(--tr-ease);
}

.tr-ridge--step-1 { margin-bottom: 0; }
.tr-ridge--step-2 { margin-bottom: 6px; }
.tr-ridge--step-3 { margin-bottom: 12px; }
.tr-ridge--step-4 { margin-bottom: 18px; }

.tr-ridge-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: linear-gradient(0deg, rgba(79, 93, 58, 0.35), rgba(168, 196, 90, 0.25));
  transition: height 280ms var(--tr-ease);
}

.tr-ridge.is-on .tr-ridge-fill,
.tr-ridge:hover .tr-ridge-fill,
.tr-ridge:focus-visible .tr-ridge-fill {
  height: 100%;
}

.tr-ridge-label {
  position: relative;
  z-index: 1;
  font-family: "Nunito Sans", var(--a117-font-body);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tr-vine {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 4px;
  height: 2px;
  background: var(--tr-olive);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--tr-dur) var(--tr-ease);
  border-radius: 2px;
}

.tr-ridge:hover .tr-vine,
.tr-ridge:focus-visible .tr-vine,
.tr-ridge.is-on .tr-vine {
  transform: scaleX(1);
}

.tr-ridge.is-on {
  border-color: var(--tr-olive);
  box-shadow: inset 0 -3px 0 var(--tr-lime);
}

.tr-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.tr-search {
  display: flex;
  flex: 1 1 180px;
  min-width: 0;
  align-items: stretch;
  border: 2px solid var(--tr-olive);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
  min-height: 44px;
}

.tr-search-ico {
  display: flex;
  align-items: center;
  padding: 0 8px 0 10px;
  color: var(--tr-olive);
}

.tr-search input {
  flex: 1;
  border: 0;
  min-width: 0;
  padding: 8px 6px;
  font: inherit;
  color: var(--tr-ink);
  background: transparent;
}

.tr-search input:focus {
  outline: none;
}

.tr-search:focus-within {
  box-shadow: 0 0 0 3px rgba(168, 196, 90, 0.45);
}

.tr-search-go {
  border: 0;
  background: var(--tr-olive);
  color: var(--tr-cream);
  font-family: "Nunito Sans", var(--a117-font-body);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 14px;
  cursor: pointer;
  min-height: 44px;
}

.tr-search-go:hover {
  background: var(--tr-olive-deep);
}

.tr-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border: 2px solid var(--tr-blush-deep);
  border-radius: 6px;
  background: var(--tr-blush);
  color: var(--tr-ink);
  font-family: "Nunito Sans", var(--a117-font-body);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.tr-cat-btn[aria-expanded="true"] {
  background: var(--tr-olive);
  color: var(--tr-cream);
  border-color: var(--tr-olive-deep);
}

.tr-tool {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 2px solid var(--tr-line);
  background: #fff;
  color: var(--tr-ink);
  text-decoration: none;
}

.tr-tool.is-on {
  border-color: var(--tr-olive);
  background: rgba(168, 196, 90, 0.2);
}

.tr-tool:focus-visible,
.tr-cat-btn:focus-visible {
  outline: 2px solid var(--tr-lime);
  outline-offset: 2px;
}

.tr-cart-badge.is-empty,
.tr-tab-badge.is-empty {
  display: none;
}

.tr-cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--tr-soil);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  font-style: normal;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 200ms var(--tr-ease);
}

.tr-tool--cart.is-bump .tr-cart-badge {
  animation: tr-badge-bump 280ms var(--tr-ease);
}

@keyframes tr-badge-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.tr-seed-pop {
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--tr-lime);
  opacity: 0;
  transform: translateY(4px) scale(0.4);
  pointer-events: none;
}

.tr-tool--cart.is-bump .tr-seed-pop {
  animation: tr-seed-sprout 420ms var(--tr-ease) forwards;
}

@keyframes tr-seed-sprout {
  0% { opacity: 0; transform: translateY(6px) scale(0.3); }
  35% { opacity: 1; transform: translateY(0) scale(1); }
  70% { opacity: 1; transform: translateY(-8px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-14px) scale(0.6); }
}

.tr-cat-sheet[hidden],
.tr-search-sheet[hidden] {
  display: none !important;
}

.tr-cat-sheet,
.tr-search-sheet {
  position: fixed;
  inset: 0;
  z-index: 960;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.tr-cat-scrim {
  position: absolute;
  inset: 0;
  background: rgba(30, 36, 24, 0.55);
}

.tr-cat-panel,
.tr-search-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  margin: auto;
  max-height: min(88vh, 640px);
  overflow: auto;
  background: var(--tr-cream);
  border: 3px solid var(--tr-olive);
  border-radius: 12px;
  padding: 16px 18px 20px;
  box-shadow: 0 20px 50px rgba(30, 36, 24, 0.25);
}

.tr-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.tr-cat-head h2 {
  margin: 0;
  font-family: "Nunito Sans", var(--a117-font-body);
  font-size: var(--a117-type-lg);
  color: var(--tr-olive-deep);
}

.tr-cat-close {
  width: 44px;
  height: 44px;
  border: 2px solid var(--tr-line);
  border-radius: 8px;
  background: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.tr-cat-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.tr-cat-grid a {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--tr-line);
  border-radius: 6px;
  text-decoration: none;
  color: var(--tr-ink);
  font-weight: 600;
  background: #fff;
  min-height: 44px;
}

.tr-cat-grid a:hover {
  border-color: var(--tr-olive);
  background: rgba(232, 180, 168, 0.25);
}

.tr-search-panel h2 {
  margin: 0 0 12px;
  font-size: var(--a117-type-lg);
  color: var(--tr-olive-deep);
}

.tr-search-panel form {
  display: grid;
  gap: 10px;
}

.tr-search-panel input {
  min-height: 44px;
  padding: 10px 12px;
  border: 2px solid var(--tr-olive);
  border-radius: 6px;
  font: inherit;
}

.tr-search-cancel {
  min-height: 44px;
  border: 2px solid var(--tr-line);
  border-radius: 6px;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

.tr-tabs {
  display: none;
}

@media (max-width: 899px) {
  .tr-main {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
  }

  .tr-brand {
    grid-column: 1;
  }

  .tr-tools {
    grid-column: 2;
    grid-row: 1;
  }

  .tr-ridges {
    display: none;
  }

  .tr-search,
  .tr-cat-btn {
    display: none;
  }

  .tr-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 880;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--tr-olive-deep);
    border-top: 3px solid var(--tr-lime);
  }

  .tr-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 44px;
    padding: 4px 2px;
    border: 0;
    background: transparent;
    color: rgba(247, 239, 230, 0.85);
    font-family: "Nunito Sans", var(--a117-font-body);
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
  }

  .tr-tab.is-on {
    color: var(--tr-lime);
  }

  .tr-tab.is-on svg {
    transform: translateY(-2px);
  }

  .tr-tab svg {
    transition: transform var(--tr-dur) var(--tr-ease);
  }

  .tr-tab-badge {
    position: absolute;
    top: 2px;
    margin-left: 28px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    border-radius: 999px;
    background: var(--tr-blush);
    color: var(--tr-ink);
    font-size: 0.6rem;
    font-style: normal;
    font-weight: 800;
  }

  .tr-tab--cart {
    position: relative;
  }

  body.chromatic-loom {
    padding-bottom: var(--tr-tab-h);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tr-shell,
  .tr-ridge-fill,
  .tr-vine,
  .tr-cart-badge,
  .tr-tab svg {
    transition: none;
  }
  .tr-tool--cart.is-bump .tr-cart-badge,
  .tr-tool--cart.is-bump .tr-seed-pop {
    animation: none;
  }
  .tr-root.is-hidden .tr-shell {
    transform: none;
  }
}
