/* Reusable components. */

/* ---------- Scroll progress ---------- */
.scroll-progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 120; pointer-events: none; }
.scroll-progress span {
  display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--emerald-500), var(--saffron-500));
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 100; height: var(--header-h);
  transition: background var(--t-med) var(--ease-out), box-shadow var(--t-med), backdrop-filter var(--t-med);
}
.site-header.is-scrolled {
  background: rgba(250, 248, 241, 0.86);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: 0 1px 0 var(--line), 0 10px 30px -20px rgba(15, 51, 36, 0.35);
}
.header-inner { height: 100%; display: flex; align-items: center; gap: var(--s-5); }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--forest-800); }
.brand-mark { color: var(--forest-800); display: inline-flex; }
.brand-word { font-family: var(--font-display); font-size: 1.45rem; font-weight: 600; letter-spacing: -0.02em; color: var(--forest-800); }
.brand-word span { color: var(--emerald-500); font-style: italic; font-weight: 500; }
.brand-word.light { color: #fff; }
.brand-word.light span { color: var(--emerald-300); }

.primary-nav { margin-left: auto; }
.nav-list { list-style: none; display: flex; align-items: center; gap: 2px; }
.nav-link {
  position: relative; display: inline-flex; align-items: center; gap: 4px;
  padding: 10px 14px; border-radius: var(--r-pill); border: 0; background: none;
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-link:hover { background: rgba(18, 61, 43, 0.06); color: var(--forest-800); }
.nav-link.is-active { color: var(--forest-800); }
.nav-link.is-active::after {
  content: ""; position: absolute; left: 50%; bottom: 3px; width: 5px; height: 5px; margin-left: -2.5px;
  border-radius: 50%; background: var(--emerald-500);
}
.nav-link .lucide { width: 15px; height: 15px; transition: transform var(--t-fast); }
.dropdown-toggle[aria-expanded="true"] .lucide { transform: rotate(180deg); }

.has-dropdown { position: relative; }
.dropdown {
  position: absolute; top: calc(100% + 10px); left: 50%; width: 300px;
  padding: 8px; border-radius: var(--r-md); background: var(--white);
  border: 1px solid var(--line); box-shadow: var(--sh-3);
  opacity: 0; visibility: hidden; transform: translate(-50%, -6px);
  transition: opacity var(--t-fast), transform var(--t-fast) var(--ease-out), visibility var(--t-fast);
}
.has-dropdown.is-open .dropdown { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.dropdown-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm);
  text-decoration: none; color: var(--ink);
}
.dropdown-item .lucide { margin-top: 2px; color: var(--green-700); width: 20px; height: 20px; }
.dropdown-item strong { display: block; font-size: var(--fs-sm); }
.dropdown-item small { color: var(--muted); font-size: var(--fs-xs); }
.dropdown-item:hover, .dropdown-item:focus-visible { background: var(--mint-50); color: var(--ink); }

.header-actions { display: flex; align-items: center; gap: var(--s-3); }
.link-quiet { font-size: var(--fs-sm); font-weight: 700; color: var(--forest-800); text-decoration: none; padding: 8px 10px; border-radius: var(--r-sm); }
.link-quiet:hover { background: rgba(18, 61, 43, 0.06); }

.nav-burger, .icon-btn {
  display: none; width: 44px; height: 44px; align-items: center; justify-content: center;
  border-radius: 12px; border: 1px solid var(--line); background: var(--white); color: var(--forest-800);
}
.icon-btn { display: inline-flex; }
.nav-burger .lucide, .icon-btn .lucide { width: 22px; height: 22px; }

/* ---------- Mobile drawer ---------- */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 140; background: rgba(11, 37, 25, 0.45);
  opacity: 0; transition: opacity var(--t-med);
}
.drawer-scrim.is-visible { opacity: 1; }
.mobile-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 150; width: min(360px, 88vw);
  display: flex; flex-direction: column; background: var(--ivory); box-shadow: var(--sh-3);
  transform: translateX(105%); visibility: hidden;
  transition: transform var(--t-med) var(--ease-out), visibility var(--t-med);
}
.mobile-drawer.is-open { transform: none; visibility: visible; transition: transform var(--t-med) var(--ease-out), visibility 0s; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.mobile-drawer nav { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; }
.mobile-drawer nav a {
  padding: 13px 12px; border-radius: var(--r-sm); text-decoration: none;
  color: var(--ink); font-weight: 600; font-size: 1.05rem;
}
.mobile-drawer nav a:hover, .mobile-drawer nav a:focus-visible { background: var(--mint-50); }
.drawer-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800; color: var(--muted); padding: 16px 12px 4px; }
.drawer-foot { padding: 16px 20px 24px; display: grid; gap: 10px; border-top: 1px solid var(--line); }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--white); --btn-fg: var(--forest-800); --btn-bd: var(--line-strong);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: var(--r-pill);
  background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bd);
  font-weight: 700; font-size: var(--fs-sm); letter-spacing: 0.01em; text-decoration: none; white-space: nowrap;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast), background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.btn:hover { transform: translateY(-1px); color: var(--btn-fg); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn .lucide { width: 18px; height: 18px; transition: transform var(--t-fast) var(--ease-out); }
.btn:hover .lucide-arrow-right { transform: translateX(3px); }
.btn-sm { min-height: 38px; padding: 0 16px; }
.btn-lg { min-height: 54px; padding: 0 28px; font-size: var(--fs-md); }
.btn-block { width: 100%; }
.btn-primary {
  --btn-bg: var(--green-700); --btn-fg: #fff; --btn-bd: transparent;
  background: linear-gradient(180deg, var(--green-600), var(--green-700));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 20px -8px rgba(23, 107, 69, 0.65);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--green-700), var(--forest-800)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 14px 28px -10px rgba(23, 107, 69, 0.7); }
.btn-ghost { --btn-bg: rgba(255, 255, 255, 0.7); }
.btn-ghost:hover { --btn-bg: var(--white); border-color: var(--green-700); }
.btn-light { --btn-bg: var(--mint-100); --btn-fg: var(--forest-900); --btn-bd: transparent; }
.btn-light:hover { --btn-bg: #fff; }
.btn-outline-light { --btn-bg: transparent; --btn-fg: #fff; --btn-bd: rgba(255, 255, 255, 0.4); }
.btn-outline-light:hover { --btn-bg: rgba(255, 255, 255, 0.08); --btn-bd: #fff; }

/* ---------- Segmented controls / tabs ---------- */
.seg-tabs, .seg {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 5px; border-radius: var(--r-pill);
  background: var(--ivory-2); border: 1px solid var(--line);
}
.seg-tabs [role="tab"], .seg button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink-2);
  font-weight: 700; font-size: var(--fs-sm);
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.seg-tabs [role="tab"]:hover, .seg button:hover { color: var(--forest-800); background: rgba(255, 255, 255, 0.6); }
.seg-tabs [role="tab"][aria-selected="true"], .seg button[aria-pressed="true"] {
  background: var(--white); color: var(--forest-800); box-shadow: var(--sh-1), 0 0 0 1px var(--line);
}
.seg-tabs [role="tab"][aria-selected="true"] .lucide { color: var(--emerald-500); }
.seg-sm button { min-height: 32px; padding: 0 12px; font-size: var(--fs-xs); }
.seg-xs { padding: 3px; }
.seg-xs button { min-height: 26px; padding: 0 10px; font-size: 0.7rem; }

/* ---------- Pills, tags ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: var(--r-pill);
  font-size: 0.7rem; font-weight: 800; font-style: normal; letter-spacing: 0.02em;
  background: var(--ivory-2); color: var(--ink-2);
}
.pill-ok { background: var(--mint-100); color: var(--green-700); }
.pill-warm { background: var(--saffron-100); color: #8a5310; }
.pill-danger { background: #FDE8E5; color: var(--danger); }

.proto-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-weight: 700; color: var(--muted);
  background: rgba(255, 255, 255, 0.82); border: 1px solid var(--line);
  padding: 5px 10px; border-radius: var(--r-pill); backdrop-filter: blur(6px);
}
.proto-tag .lucide { width: 13px; height: 13px; }
.proto-tag-dark { background: rgba(11, 37, 25, 0.6); color: rgba(255, 255, 255, 0.85); border-color: rgba(255, 255, 255, 0.15); }

/* ---------- Floating cards ---------- */
.float-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px 12px 12px;
  background: rgba(255, 255, 255, 0.94); border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--r-md); box-shadow: var(--sh-float); backdrop-filter: blur(10px);
}
.float-card small { display: block; font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.float-card strong { display: block; font-size: 0.95rem; color: var(--forest-800); }
.fc-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--mint-100); color: var(--green-700);
}
.fc-icon .lucide { width: 20px; height: 20px; }
.fc-icon-ok { background: var(--green-700); color: #fff; }
.fc-icon-warm { background: var(--saffron-100); color: #9a5b0f; }

/* ---------- Check list ---------- */
.check-list { list-style: none; display: grid; gap: 10px; }
.check-list li { display: flex; gap: 12px; align-items: flex-start; font-weight: 600; color: var(--ink-2); }
.check-list .ic {
  width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--mint-100); color: var(--green-700);
}
.check-list .ic .lucide { width: 17px; height: 17px; }
.check-list li span:last-child { padding-top: 5px; }

/* ---------- Form fields ---------- */
.field { display: grid; gap: 4px; }
.field label { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
select, input[type="search"], input[type="email"], input:not([type]) {
  min-height: 40px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--white); color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
select { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23176B45' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
select:hover, input:hover { border-color: var(--green-700); }
select:focus-visible, input:focus-visible { outline: none; border-color: var(--emerald-500); box-shadow: 0 0 0 4px rgba(32, 165, 107, 0.2); }

.search-field {
  position: relative; display: flex; align-items: center; width: min(360px, 100%);
}
.search-field .lucide { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.search-field input { width: 100%; min-height: 48px; padding-left: 42px; border-radius: var(--r-pill); }

/* ---------- Spinner ---------- */
.spinner {
  width: 18px; height: 18px; border-radius: 50%; display: inline-block;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

/* ---------- Toast ---------- */
.toast-region { position: fixed; left: 50%; bottom: 24px; z-index: 180; transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: var(--r-pill);
  background: var(--forest-900); color: #fff; font-weight: 600; font-size: var(--fs-sm); box-shadow: var(--sh-3);
  animation: toast-in var(--t-med) var(--ease-out);
}
.toast .lucide { color: var(--emerald-300); }
.toast.is-leaving { animation: toast-out var(--t-med) var(--ease-out) forwards; }

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 90; width: 48px; height: 48px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--white); color: var(--forest-800);
  display: grid; place-items: center; box-shadow: var(--sh-2);
  transition: transform var(--t-fast), opacity var(--t-med);
}
.back-to-top:hover { transform: translateY(-3px); }
.back-to-top[hidden] { display: none; }

/* ---------- Accordion ---------- */
.accordion { display: grid; gap: 12px; }
.acc-item { border-radius: var(--r-md); background: var(--white); border: 1px solid var(--line); transition: box-shadow var(--t-med), border-color var(--t-med); }
.acc-item.is-open { box-shadow: var(--sh-2); border-color: transparent; }
.acc-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 22px; border: 0; background: none; text-align: left;
  font-weight: 700; font-size: 1.05rem; color: var(--forest-800); border-radius: var(--r-md);
}
.acc-icon {
  width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--mint-50); color: var(--green-700); transition: transform var(--t-med) var(--ease-out), background var(--t-med);
}
.acc-item.is-open .acc-icon { transform: rotate(45deg); background: var(--green-700); color: #fff; }
.acc-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--t-med) var(--ease-out); }
.acc-item.is-open .acc-panel { grid-template-rows: 1fr; }
.acc-panel > div { overflow: hidden; }
.acc-panel p { padding: 0 22px 20px; color: var(--ink-2); max-width: 62ch; }
.acc-panel a { font-weight: 700; }

/* Dropdowns near the right edge of the header open right-aligned so they never leave the viewport. */
.dropdown.dropdown-right { left: auto; right: 0; transform: translateY(-6px); }
.has-dropdown.is-open .dropdown.dropdown-right { transform: translateY(0); }
