/* Buttons */
.btn {
  display: inline-flex;
  min-height: var(--control-height);
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  background: var(--button-bg);
  color: var(--button-fg);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  text-decoration: none;
  transition: background-color var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast), box-shadow var(--duration-normal), transform var(--duration-fast);
}
.btn:hover { background: var(--button-bg-hover); color: var(--button-fg); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn--secondary { background: var(--color-inverse-surface-hover); }
.btn--secondary:hover { background: var(--color-inverse-surface); }
.btn--outline { border-color: var(--color-border-strong); background: var(--color-surface); color: var(--color-ink-strong); }
.btn--outline:hover { border-color: var(--color-brand-border-hover); background: var(--color-brand-soft); color: var(--color-brand-hover); }
.btn--ghost { background: transparent; color: var(--color-ink-muted); }
.btn--ghost:hover { background: var(--color-surface-muted); color: var(--color-ink); box-shadow: none; }
.btn--danger { background: var(--color-danger); color: var(--color-on-brand); }
.btn--danger:hover { background: var(--color-danger-hover); }
.btn--success { background: var(--color-success); color: var(--color-on-brand); }
.btn--success:hover { background: var(--color-success-hover); color: var(--color-on-brand); }
.btn--sm { min-height: 2.75rem; padding-inline: var(--space-4); }
.btn--lg { min-height: var(--control-height-lg); padding-inline: var(--space-6); font-size: var(--text-base); }
.btn--icon { width: var(--control-height); min-width: 2.75rem; padding: 0; }
.btn--block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .48; cursor: not-allowed; pointer-events: none; box-shadow: none; }
.btn[data-loading="true"] [data-submit-label] { display: inline-flex; align-items: center; gap: var(--space-2); }
.btn[data-loading="true"] [data-submit-label]::before { width: var(--space-4); height: var(--space-4); border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; content: ""; }

/* Works on both <a> and <button> — several pages use .text-link on a plain button
   (toggle/share actions) that would otherwise render with no button-reset styling. */
.text-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border: 0;
  background: none;
  padding: 0;
  color: var(--color-brand);
  font: inherit;
  font-weight: var(--weight-semibold);
  cursor: pointer;
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
}
.text-link:hover { color: var(--color-brand-hover); text-decoration: underline; }

/* Form controls */
.field { display: grid; gap: var(--space-2); }
.field__label { color: var(--color-ink-strong); font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.field__hint, .field__error { margin: 0; font-size: var(--text-sm); }
.field__hint { color: var(--color-ink-muted); }
.field__error { color: var(--color-danger); }
.input, .textarea, .select {
  width: 100%;
  min-height: var(--control-height-lg);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  outline: 0;
  background: var(--color-surface);
  color: var(--color-ink);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast), background-color var(--duration-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--color-placeholder); opacity: 1; }
.input:hover, .textarea:hover, .select:hover { border-color: var(--color-border-strong); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--color-focus); box-shadow: var(--control-ring); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--color-danger); }
.input:disabled, .textarea:disabled, .select:disabled { background: var(--color-surface-muted); color: var(--color-ink-muted); cursor: not-allowed; }
.textarea { min-height: 7.5rem; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--color-control-indicator) 50%), linear-gradient(135deg, var(--color-control-indicator) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-repeat: no-repeat; background-size: 5px 5px, 5px 5px; padding-right: var(--space-10); }
.search-box { position: relative; }
.search-box .input { padding-inline: var(--space-12) var(--space-20); }
.search-box__icon { position: absolute; top: 50%; left: var(--space-4); color: var(--color-ink-muted); transform: translateY(-50%); pointer-events: none; }
.search-box__kbd { position: absolute; top: 50%; right: var(--space-3); padding: var(--space-1) var(--space-2); border: 1px solid var(--color-border); border-radius: .4rem; background: var(--color-surface-soft); color: var(--color-ink-muted); font-size: var(--text-xs); transform: translateY(-50%); }

.choice { display: inline-flex; min-height: 2.75rem; align-items: center; gap: var(--space-3); cursor: pointer; }
.choice input { width: 1.125rem; height: 1.125rem; margin: 0; accent-color: var(--color-brand); }
.switch { position: relative; display: inline-flex; min-height: 2.75rem; align-items: center; gap: var(--space-3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track { position: relative; width: 2.75rem; height: 1.55rem; border: 1px solid var(--color-border-strong); border-radius: var(--radius-pill); background: var(--color-border); transition: background var(--duration-fast), border-color var(--duration-fast); }
.switch__track::after { position: absolute; top: 2px; left: 2px; width: 1.15rem; height: 1.15rem; border-radius: 50%; background: var(--color-surface); box-shadow: var(--shadow-xs); content: ""; transition: transform var(--duration-normal) var(--ease-standard); }
.switch input:checked + .switch__track { border-color: var(--color-brand); background: var(--color-brand); }
.switch input:checked + .switch__track::after { transform: translateX(1.18rem); }
.switch input:focus-visible + .switch__track { box-shadow: var(--control-ring); }

/* Badges, avatars, cards */
.badge { display: inline-flex; min-height: 1.5rem; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); background: var(--color-brand); color: var(--color-on-brand); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.badge--soft { background: var(--color-brand-soft); color: var(--color-brand-hover); }
.badge--success { background: var(--color-success-soft); color: var(--color-success); }
.badge--warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge--danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge--outline { border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-ink-muted); }
.badge--info { background: var(--color-info-soft); color: var(--color-info); }
.badge--mastery {
  gap: var(--space-2);
  padding-inline: var(--space-3);
  background: var(--gradient-mastery);
  color: var(--color-mastery-text);
  box-shadow: var(--shadow-mastery);
}
.badge--mastery .icon { width: 0.9rem; height: 0.9rem; color: var(--color-mastery-text); }
.badge--founding {
  gap: var(--space-2);
  padding-inline: var(--space-3);
  background: var(--gradient-founding);
  color: var(--color-founding-text);
  box-shadow: var(--shadow-founding);
}
.badge--founding .icon { width: 0.9rem; height: 0.9rem; color: var(--color-founding-text); }

/* Accessible tooltip: shows on hover AND keyboard focus (unlike the native title="" attribute,
   which never appears on touch devices at all), so a badge's meaning is always reachable. */
.tooltip { position: relative; display: inline-flex; }
.tooltip__trigger { cursor: help; border: none; background: none; padding: 0; font: inherit; }
.tooltip__bubble {
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 50%;
  z-index: 20;
  width: max-content;
  max-width: 16rem;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-ink-strong);
  color: var(--color-inverse-text);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  text-align: left;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard);
}
.tooltip__bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  border: 6px solid transparent;
  border-top-color: var(--color-ink-strong);
  transform: translateX(-50%);
}
.tooltip:hover .tooltip__bubble,
.tooltip:focus-within .tooltip__bubble {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
@media (prefers-reduced-motion: reduce) {
  .tooltip__bubble { transition: none; }
}

.avatar { display: inline-grid; width: 3rem; height: 3rem; place-items: center; overflow: hidden; border: 3px solid var(--color-surface); border-radius: 50%; background: var(--color-brand-subtle); color: var(--color-brand-hover); box-shadow: 0 0 0 1px var(--color-border); font-weight: var(--weight-bold); }
.avatar--sm { width: 2rem; height: 2rem; border-width: 2px; font-size: var(--text-xs); }
.avatar--lg { width: 4rem; height: 4rem; }
.avatar--xl { width: 5.5rem; height: 5.5rem; font-size: var(--text-xl); }
.avatar-group { display: flex; }
.avatar-group .avatar + .avatar { margin-left: -.75rem; }

.card { display: flex; min-width: 0; flex-direction: column; gap: var(--space-4); padding: var(--card-padding); border: 1px solid var(--card-border); border-radius: var(--card-radius); background: var(--card-bg); box-shadow: var(--card-shadow); }
.card--interactive { color: inherit; text-decoration: none; transition: border-color var(--duration-normal), box-shadow var(--duration-normal), transform var(--duration-normal); }
.card--interactive:hover { border-color: var(--color-brand-border); color: inherit; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
.card__title { margin-bottom: var(--space-1); font-size: var(--text-lg); }
.card__description { margin: 0; color: var(--color-ink-muted); font-size: var(--text-sm); }
.card__footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-top: auto; padding-top: var(--space-3); border-top: 1px solid var(--color-border); }
.card__icon { display: grid; width: 3rem; height: 3rem; place-items: center; border-radius: var(--radius-md); background: var(--color-brand-soft); color: var(--color-brand); }
.responsive-media { display: block; width: 100%; height: auto; object-fit: cover; }
.card__icon .responsive-media { width: 2rem; height: 2rem; border-radius: .5rem; }
.stat-card__value { color: var(--color-ink-strong); font-size: var(--text-3xl); font-weight: var(--weight-bold); letter-spacing: -.04em; }
.stat-card__label { color: var(--color-ink-muted); font-size: var(--text-sm); }
.category-card { align-items: flex-start; }
.craftsman-card__identity { display: flex; align-items: center; gap: var(--space-3); }
.craftsman-card__meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); color: var(--color-ink-muted); font-size: var(--text-sm); }

/* Feedback */
.alert { display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--color-info-border); border-radius: var(--radius-md); background: var(--color-brand-soft); color: var(--color-info-strong); }
.alert--success { border-color: var(--color-success-border); background: var(--color-success-soft); color: var(--color-success); }
.alert--warning { border-color: var(--color-warning-border); background: var(--color-warning-soft); color: var(--color-warning); }
.alert--danger { border-color: var(--color-danger-border); background: var(--color-danger-soft); color: var(--color-danger); }
.alert__title { margin: 0 0 var(--space-1); color: currentColor; font-size: var(--text-base); }
.alert p { margin: 0; color: var(--color-ink-muted); font-size: var(--text-sm); }

.spinner { width: 2rem; height: 2rem; border: 3px solid var(--color-brand-subtle); border-top-color: var(--color-brand); border-radius: 50%; animation: spin .8s linear infinite; }

.upload-control {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-subtle);
}

.upload-control label { color: var(--color-ink-strong); font-weight: var(--weight-semibold); }
.upload-control input[type="file"] { min-height: var(--control-height); max-width: 100%; color: var(--color-ink); }
.upload-control input[type="file"]::file-selector-button { min-height: var(--control-height); margin-inline-end: var(--space-3); padding-inline: var(--space-4); border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-ink-strong); cursor: pointer; font: inherit; font-weight: var(--weight-semibold); }
.upload-file-name { overflow-wrap: anywhere; color: var(--color-ink-muted); font-size: var(--text-sm); }
.upload-feedback { min-height: 1.25rem; color: var(--color-danger); font-size: var(--text-sm); }
.upload-preview { width: 100%; max-height: 14rem; border-radius: var(--radius-md); object-fit: cover; }
.field-validation-error { display: block; color: var(--color-danger); font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.field-validation-valid:empty { display: none; }
.submit-status { min-height: 1.5rem; margin: 0; color: var(--color-ink-muted); font-size: var(--text-sm); }
.loading { display: inline-flex; align-items: center; gap: var(--space-3); color: var(--color-ink-muted); }
.empty-state, .error-state { display: grid; justify-items: center; gap: var(--space-4); padding: var(--space-10); text-align: center; }
.empty-state--compact, .error-state--compact { padding: var(--space-6); }
.empty-state h1, .empty-state h2, .empty-state p, .error-state h1, .error-state h2, .error-state p { margin-bottom: 0; }
.error-state { border-color: var(--color-danger-border); background: var(--color-danger-soft); }
.filter-chip-list { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-8); padding: 0; list-style: none; }
.filter-chip { display: inline-flex; min-height: var(--control-height); align-items: center; gap: var(--space-2); padding-inline: var(--space-4); border: 1px solid var(--color-brand-border); border-radius: var(--radius-pill); background: var(--color-brand-soft); color: var(--color-brand-hover); font-size: var(--text-sm); font-weight: var(--weight-semibold); text-decoration: none; transition: border-color var(--duration-normal) var(--ease-standard), background-color var(--duration-normal) var(--ease-standard), box-shadow var(--duration-normal) var(--ease-standard), transform var(--duration-normal) var(--ease-standard); }
.filter-chip:hover { border-color: var(--color-brand); background: var(--color-surface); color: var(--color-brand-hover); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.contact-actions { display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
.contact-actions .btn { min-height: 2.75rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { position: relative; overflow: hidden; border-radius: var(--radius-sm); background: var(--color-surface-muted); }
.skeleton::after { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--color-shimmer), transparent); content: ""; transform: translateX(-100%); animation: shimmer 1.6s infinite; }
.skeleton--avatar { width: 3rem; height: 3rem; border-radius: 50%; }
.skeleton--line { width: 100%; height: .85rem; }
.skeleton--line-short { width: 62%; }
.skeleton-lines { flex: 1; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* Navigation and disclosure */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; padding: 0; list-style: none; font-size: var(--text-sm); }
.breadcrumb li { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--color-ink-muted); }
.breadcrumb li:not(:last-child)::after { color: var(--color-placeholder); content: "/"; }
.breadcrumb a { display: inline-flex; min-width: 2.75rem; min-height: 2.75rem; align-items: center; color: var(--color-ink-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--color-brand); }

.tabs__list { display: flex; gap: var(--space-1); padding: var(--space-1); border-radius: var(--radius-md); background: var(--color-surface-muted); overflow-x: auto; }
.tabs__tab { min-height: 2.75rem; flex: 1 0 auto; padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); background: transparent; color: var(--color-ink-muted); cursor: pointer; font-weight: var(--weight-semibold); }
.tabs__tab[aria-selected="true"] { background: var(--color-surface); color: var(--color-ink-strong); box-shadow: var(--shadow-xs); }
.tabs__panel { padding-top: var(--space-5); }

.accordion { overflow: hidden; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.accordion details + details { border-top: 1px solid var(--color-border); }
.accordion summary { display: flex; min-height: 3.5rem; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-4); cursor: pointer; font-weight: var(--weight-semibold); list-style: none; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { color: var(--color-brand); content: "+"; font-size: var(--text-xl); }
.accordion details[open] summary::after { content: "−"; }
.accordion__content { padding: 0 var(--space-4) var(--space-4); color: var(--color-ink-muted); }
.accordion__content p { margin: 0; }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-2); margin-top: var(--space-8); }
.pagination__item, .pagination a { display: inline-grid; min-width: 2.75rem; height: 2.75rem; place-items: center; border: 1px solid var(--color-border); border-radius: var(--control-radius); background: var(--color-surface); color: var(--color-ink-muted); text-decoration: none; }
.pagination__item:hover, .pagination__item[aria-current="page"], .pagination a:hover, .pagination .is-current { border-color: var(--color-brand); background: var(--color-brand); color: var(--color-on-brand); }

.dropdown { position: relative; display: inline-block; }
.dropdown__menu { position: absolute; top: calc(100% + var(--space-2)); right: 0; z-index: var(--z-dropdown); width: 14rem; padding: var(--space-2); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-md); }
.dropdown__item { display: flex; width: 100%; min-height: 2.75rem; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: transparent; color: var(--color-ink); cursor: pointer; text-align: left; text-decoration: none; }
.dropdown__item:hover { background: var(--color-brand-soft); color: var(--color-brand-hover); }

.tooltip { position: relative; display: inline-flex; }
.tooltip__content { position: absolute; left: 50%; bottom: calc(100% + var(--space-2)); z-index: var(--z-tooltip); width: max-content; max-width: 15rem; padding: var(--space-2) var(--space-3); border-radius: .5rem; background: var(--color-inverse-surface); color: var(--color-inverse-text); font-size: var(--text-xs); opacity: 0; pointer-events: none; transform: translate(-50%, .25rem); transition: opacity var(--duration-fast), transform var(--duration-fast); }
.tooltip:hover .tooltip__content, .tooltip:focus-within .tooltip__content { opacity: 1; transform: translate(-50%, 0); }

/* Modal, drawer, toast */
.dialog { width: min(calc(100% - var(--space-8)), 34rem); max-height: calc(100dvh - var(--space-8)); padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius-xl); background: var(--color-surface); color: var(--color-ink); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
.dialog__header, .dialog__body, .dialog__footer { padding: var(--space-5); }
.dialog__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); border-bottom: 1px solid var(--color-border); }
.dialog__header h2 { margin: 0; font-size: var(--text-xl); }
.dialog__body p { margin: 0; color: var(--color-ink-muted); }
.dialog__footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-3); border-top: 1px solid var(--color-border); }

.drawer { position: fixed; inset: 0; z-index: var(--z-drawer); visibility: hidden; }
.drawer[aria-hidden="false"] { visibility: visible; }
.drawer__scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity var(--duration-normal); }
.drawer__panel { position: absolute; top: 0; right: 0; width: min(90vw, 25rem); height: 100%; overflow-y: auto; padding: max(var(--space-6), var(--safe-area-top)) max(var(--space-6), var(--safe-area-right)) max(var(--space-6), var(--safe-area-bottom)) max(var(--space-6), var(--safe-area-left)); background: var(--color-surface); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform var(--duration-slow) var(--ease-standard); }
.drawer[aria-hidden="false"] .drawer__scrim { opacity: 1; }
.drawer[aria-hidden="false"] .drawer__panel { transform: translateX(0); }
.drawer__header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); }

.drawer--sheet .drawer__panel { top: auto; right: 0; bottom: 0; left: 0; width: 100%; height: auto; max-height: 82vh; padding: var(--space-3) max(var(--space-5), var(--safe-area-right)) max(var(--space-5), var(--safe-area-bottom)) max(var(--space-5), var(--safe-area-left)); border-top-left-radius: var(--radius-lg); border-top-right-radius: var(--radius-lg); transform: translateY(100%); }
.drawer--sheet[aria-hidden="false"] .drawer__panel { transform: translateY(0); }
.drawer__handle { display: block; width: 2.5rem; height: .3rem; margin: 0 auto var(--space-4); border-radius: var(--radius-pill); background: var(--color-border); }
.drawer__sheet-body { display: grid; gap: var(--space-3); overflow-y: auto; max-height: calc(82vh - 6rem); }
.craftsman-grid--sheet { display: grid; gap: var(--space-3); grid-template-columns: 1fr; }

.toast-region { position: fixed; right: max(var(--space-4), var(--safe-area-right)); bottom: max(var(--space-4), var(--safe-area-bottom)); z-index: var(--z-toast); display: grid; width: min(calc(100% - var(--space-8)), 23rem); gap: var(--space-3); pointer-events: none; }
.toast { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-md); pointer-events: auto; animation: toast-in var(--duration-slow) var(--ease-standard); }
.toast[hidden] { display: none; }
.toast__title { margin: 0; font-size: var(--text-sm); }
.toast p { margin: 0; color: var(--color-ink-muted); font-size: var(--text-xs); }
@keyframes toast-in { from { opacity: 0; transform: translateY(1rem); } }

/* Header and footer */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: calc(var(--header-height) + var(--safe-area-top));
  padding-top: var(--safe-area-top);
  border-bottom: 1px solid transparent;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--duration-normal), box-shadow var(--duration-normal);
}
.site-header.is-scrolled { border-color: var(--color-border); }
.navbar { display: flex; height: 100%; align-items: center; justify-content: space-between; gap: var(--space-4); }
.brand { display: inline-flex; min-height: 2.75rem; flex: 0 0 auto; align-items: center; text-decoration: none; }
.brand__logo { display: block; width: 16.5rem; height: 4.95rem; object-fit: cover; object-position: center; }

.navbar__brand-group { display: flex; flex: 0 0 auto; align-items: center; gap: var(--space-4); }
/* The header is shorter than the logo's own natural size now (~80px vs. the wordmark's 4.95rem),
   so it gets its own scaled-down copy here — the footer (and the base .brand__logo rule above,
   which several contract tests pin to 16.5rem/4.95rem) keep the original larger size untouched. */
.navbar .brand { min-height: 2.85rem; }
.navbar .brand__logo { width: 9.5rem; height: 2.85rem; }

/* Compact "Konumum" location chip next to the logo. Value text is populated client-side from the
   same remembered-location / resolve-location endpoints the discovery maps already use (see
   header-location.js) — never a hardcoded place name. */
.navbar__location {
  display: none;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
  color: var(--color-ink-strong);
  font-family: inherit;
  line-height: 1.15;
  cursor: pointer;
}
.navbar__location:hover { border-color: var(--color-brand-border-hover); background: var(--color-brand-soft); }
.navbar__location[aria-busy="true"] { opacity: .65; pointer-events: none; }
.navbar__location-pin { color: var(--color-brand); }
.navbar__location-chevron { color: var(--color-ink-muted); }
.navbar__location-text { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; }
.navbar__location-label { color: var(--color-ink-muted); font-size: var(--text-xs); font-weight: var(--weight-medium); line-height: 1; }
.navbar__location-value { max-width: 8rem; overflow: hidden; color: var(--color-ink-strong); font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1; text-overflow: ellipsis; white-space: nowrap; }

.navbar__links, .navbar__actions { display: none; align-items: center; gap: var(--space-1); flex-wrap: nowrap; }
.navbar__actions { gap: var(--space-3); flex: 0 0 auto; }
.navbar__link {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  gap: var(--space-1);
  padding-inline: var(--space-3);
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--color-ink-muted);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

/* The redesigned desktop nav trades the old hover/active pill for a slim underline — a single
   `.navbar__link` component still backs the mobile drawer, where the pill highlight makes more
   sense on full-width rows, so the underline treatment is scoped to the header's own nav list. */
.navbar__links .navbar__link { position: relative; height: 100%; }
.navbar__links .navbar__link:hover { color: var(--color-ink-strong); }
.navbar__links .navbar__link[aria-current="page"] { color: var(--color-brand); font-weight: var(--weight-semibold); }
.navbar__links .navbar__link[aria-current="page"]::after {
  position: absolute;
  right: var(--space-3);
  bottom: .65rem;
  left: var(--space-3);
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--color-brand);
  content: "";
}
.navbar__more .dropdown__menu { right: auto; left: 0; }
.dropdown__item[aria-current="page"] { background: var(--color-brand-soft); color: var(--color-brand-hover); }

.navbar__cta-outline { border-color: var(--color-brand); background: var(--color-surface); color: var(--color-brand); }
.navbar__cta-outline:hover { background: var(--color-brand-soft); color: var(--color-brand-hover); box-shadow: none; }
.navbar__cta-outline[aria-current="page"] { background: var(--color-brand-soft); }

.navbar__cta-primary { box-shadow: 0 8px 20px var(--color-brand-shadow); }
.navbar__cta-primary:hover { box-shadow: 0 10px 24px var(--color-brand-shadow); }

.navbar__account-trigger {
  display: inline-flex;
  min-height: var(--control-height);
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  background: var(--color-surface-muted);
  color: var(--color-ink-strong);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
}
.navbar__account-trigger:hover { background: var(--color-border); }
.navbar__logout-item.dropdown__item { width: 100%; border: none; background: transparent; font: inherit; text-align: left; }

.navbar__actions .btn[aria-current="page"] { background: var(--color-brand-soft); color: var(--color-brand-hover); box-shadow: none; }
.navbar__toggle { display: inline-flex; }

.mobile-menu__nav { display: grid; gap: var(--space-2); }
.mobile-menu__nav .navbar__link { min-height: 3rem; padding-inline: var(--space-4); border-radius: var(--radius-sm); font-size: var(--text-base); }
.mobile-menu__nav .navbar__link:hover, .mobile-menu__nav .navbar__link[aria-current="page"] { background: var(--color-brand-soft); color: var(--color-brand-hover); }
.mobile-menu__actions { display: grid; gap: var(--space-3); margin-top: var(--space-8); padding-top: var(--space-6); border-top: 1px solid var(--color-border); }

.site-footer { padding-block: var(--space-12) max(var(--space-6), var(--safe-area-bottom)); border-top: 1px solid var(--color-border); background: var(--color-inverse-surface); color: var(--color-footer-text); }
.footer-grid { display: grid; gap: var(--space-8); }
.footer-brand p { margin: var(--space-4) 0 0; color: var(--color-footer-muted); font-size: var(--text-sm); }
.site-footer .brand__logo { filter: brightness(0) invert(1); }
.footer-column h2 { margin-bottom: var(--space-4); color: var(--color-inverse-text); font-size: var(--text-sm); letter-spacing: 0; }
.footer-links { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.footer-links a { display: inline-flex; min-width: 2.75rem; min-height: 2.75rem; align-items: center; color: var(--color-footer-text); font-size: var(--text-sm); text-decoration: none; }
.footer-links a:hover { color: var(--color-inverse-text); }
.footer-bottom { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-10); padding-top: var(--space-5); border-top: 1px solid var(--color-footer-border); color: var(--color-footer-muted); font-size: var(--text-sm); }
.footer-powered { color: var(--color-inverse-text); font-weight: var(--weight-semibold); }

/* Cookie consent / install-prompt banner stack */
.site-banner-stack { position: fixed; right: max(var(--space-3), var(--safe-area-right)); bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + var(--space-3)); left: max(var(--space-3), var(--safe-area-left)); z-index: var(--z-overlay); display: flex; flex-direction: column-reverse; gap: var(--space-3); pointer-events: none; }
.site-banner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); width: min(100%, 28rem); margin-inline: auto; padding: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-lg); pointer-events: auto; }
.site-banner[hidden] { display: none; }
.site-banner p { margin: 0; color: var(--color-ink-muted); font-size: var(--text-sm); }
.site-banner p strong { color: var(--color-ink); }
.site-banner a { color: var(--color-brand); }
.site-banner__icon { display: grid; width: 2.5rem; height: 2.5rem; flex: 0 0 auto; place-items: center; border-radius: var(--radius-sm); background: var(--color-brand-soft); color: var(--color-brand); }
.site-banner__icon svg { width: 1.5rem; height: 1.5rem; }
.site-banner__body { flex: 1 1 12rem; display: grid; gap: var(--space-1); }
.site-banner__actions { display: flex; flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); }

@media (min-width: 64rem) {
  .site-banner-stack { bottom: max(var(--space-4), var(--safe-area-bottom)); }
}

/* App-shell bottom navigation (mobile only) */
.app-bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: var(--z-sticky); display: flex; align-items: flex-end; justify-content: space-around; height: calc(var(--bottom-nav-height) + var(--safe-area-bottom)); padding: var(--space-1) var(--space-2) max(var(--space-1), var(--safe-area-bottom)); border-top: 1px solid var(--color-border); background: var(--color-surface); box-shadow: var(--shadow-sm); }
.app-bottom-nav__link { display: flex; flex: 1 1 0; min-height: 44px; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1); border: none; background: none; color: var(--color-ink-muted); font-family: inherit; font-size: var(--text-xs); text-decoration: none; }
.app-bottom-nav__link.is-active, .app-bottom-nav__link[aria-current="page"] { color: var(--color-brand); }
.app-bottom-nav__icon { width: 1.5rem; height: 1.5rem; }
.app-bottom-nav__link--center { position: relative; flex: 0 0 auto; width: 3.5rem; margin-top: -1.75rem; }
.app-bottom-nav__center-icon { display: grid; width: 3.5rem; height: 3.5rem; place-items: center; border-radius: var(--radius-pill); background: var(--gradient-brand); color: var(--color-on-brand); box-shadow: 0 8px 16px var(--color-brand-shadow); transition: transform var(--duration-fast) var(--ease-standard); }
.app-bottom-nav__center-icon svg { width: 1.75rem; height: 1.75rem; }
.app-bottom-nav__link--center:active .app-bottom-nav__center-icon { transform: scale(.94); }
.app-bottom-nav__link--center[aria-busy="true"] .app-bottom-nav__center-icon { animation: app-bottom-nav-pulse 1s var(--ease-standard) infinite; }
.nearby-status { position: fixed; right: max(var(--space-4), var(--safe-area-right)); left: max(var(--space-4), var(--safe-area-left)); bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + var(--space-2)); z-index: var(--z-toast); margin: 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-md); font-size: var(--text-sm); text-align: center; }
.nearby-status[hidden] { display: none; }
@media (min-width: 64rem) {
  .nearby-status { position: static; margin-top: var(--space-3); box-shadow: none; }
}
@keyframes app-bottom-nav-pulse { 0%, 100% { box-shadow: 0 8px 16px var(--color-brand-shadow); } 50% { box-shadow: 0 8px 16px var(--color-brand-shadow), 0 0 0 6px var(--color-brand-soft); } }

@media (min-width: 48rem) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
  .footer-bottom { flex-direction: row; align-items: center; justify-content: space-between; }
}

@media (min-width: 64rem) {
  .navbar__links, .navbar__actions, .navbar__location { display: flex; }
  .navbar__links { flex: 1 1 auto; justify-content: center; }
  .navbar__toggle { display: none; }
  .app-bottom-nav { display: none; }
}

/* Between the nav appearing (64rem) and the roomier breakpoint below, keep every element as
   tight as possible — logo, location chip, five nav items, and three actions all share one row
   here, and none of them may wrap to a second line. */
@media (min-width: 64rem) and (max-width: 79.9375rem) {
  .navbar__location-value { max-width: 5.5rem; }
  .navbar__brand-group { gap: var(--space-2); }
}

@media (min-width: 90rem) {
  .navbar__links { gap: var(--space-2); }
  .navbar__actions { gap: var(--space-4); }
  .navbar__link { padding-inline: var(--space-4); }
  .navbar__location-value { max-width: 10rem; }
}

@media (prefers-reduced-motion: reduce) {
  .btn[data-loading="true"] [data-submit-label]::before { animation: none; }
  .filter-chip:hover, .card--interactive:hover { transform: none; }
  .app-bottom-nav__link--center[aria-busy="true"] .app-bottom-nav__center-icon { animation: none; }
  .app-bottom-nav__link--center:active .app-bottom-nav__center-icon { transform: none; }
}
