.esc-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.85em 1.7em;
  border-radius: var(--esc-radius-pill);
  font-size: var(--esc-step--1);
  letter-spacing: 0.03em;
  border: 1px solid transparent;
  transition: transform 200ms ease, background-color 200ms ease, color 200ms ease;
}

.esc-btn--wine {
  background: var(--esc-wine);
  color: var(--esc-bg-panel);
}

.esc-btn--wine:hover,
.esc-btn--wine:focus-visible {
  background: color-mix(in srgb, var(--esc-wine) 85%, black);
}

.esc-btn--outline {
  border-color: var(--esc-wine);
  color: var(--esc-wine);
  background: transparent;
}

.esc-btn--outline:hover,
.esc-btn--outline:focus-visible {
  background: var(--esc-wine);
  color: var(--esc-bg-panel);
}

.esc-rule {
  display: block;
  width: 3rem;
  height: 3px;
  background: var(--esc-wine);
  border-radius: 2px;
}

.esc-rule--thin {
  width: 1.8rem;
  height: 2px;
}

.esc-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--esc-copper) 60%, transparent);
  background: var(--esc-line);
}

.esc-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  }
  
  .esc-frame__placeholder {
  width: 100%;
  height: 100%;
  min-height: 12rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--esc-space-s);
  text-align: center;
  background: repeating-linear-gradient(
    135deg,
    var(--esc-line) 0 1rem,
    color-mix(in srgb, var(--esc-copper) 22%, var(--esc-line)) 1rem 2rem
  );
  }
  
  .esc-frame__placeholder span {
  max-width: 22rem;
  font-family: var(--esc-font-body);
  font-size: var(--esc-step--1);
  line-height: 1.5;
  color: color-mix(in srgb, var(--esc-ink) 62%, transparent);
  }
  
.esc-frame--capsule {
  border-radius: 999px;
  aspect-ratio: 21 / 9;
}

.esc-frame--arc-tl {
  border-radius: 4rem 1.25rem 1.25rem 1.25rem;
  aspect-ratio: 4 / 5;
}

.esc-frame--arc-br {
  border-radius: 1.25rem 1.25rem 4rem 1.25rem;
  aspect-ratio: 4 / 5;
}

.esc-frame--half-pill {
  border-radius: 999px 999px 1.25rem 1.25rem;
  aspect-ratio: 3 / 4;
}

.esc-frame--tower {
  border-radius: 3rem 3rem 3rem 0.75rem;
  aspect-ratio: 3 / 5;
}

.esc-frame--wide-arc {
  border-radius: 2.5rem 2.5rem 0.75rem 2.5rem;
  aspect-ratio: 16 / 10;
}

.esc-frame--soft {
  border-radius: var(--esc-radius-soft);
  aspect-ratio: 5 / 4;
}

.esc-frame--tall-soft {
  border-radius: var(--esc-radius-soft);
  aspect-ratio: 3 / 4;
}

.esc-note {
  border: var(--esc-border-hair);
  background: var(--esc-bg-panel);
  border-radius: 1.5rem 1.5rem 1.5rem 0.4rem;
  padding: var(--esc-space-s);
}

.esc-note--wine {
  border-color: var(--esc-wine);
  background: color-mix(in srgb, var(--esc-wine) 8%, var(--esc-bg-panel));
}

.esc-note__title {
  font-size: var(--esc-step-0);
  margin-bottom: 0.4em;
}

.esc-note__body {
  color: color-mix(in srgb, var(--esc-ink) 78%, transparent);
  font-size: var(--esc-step--1);
}

.esc-feature {
  border: var(--esc-border-hair);
  border-radius: 0.9rem;
  padding: var(--esc-space-s);
  background: var(--esc-bg-panel);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.esc-feature__title {
  font-size: var(--esc-step-0);
}

.esc-feature__body {
  color: color-mix(in srgb, var(--esc-ink) 78%, transparent);
  font-size: var(--esc-step--1);
}

.esc-panel {
  border: 1.5px solid var(--esc-copper);
  border-radius: 2.5rem 0.75rem 2.5rem 0.75rem;
  padding: var(--esc-space-m);
  background: var(--esc-bg-panel);
}

.esc-panel--alt {
  border-radius: 0.75rem 2.5rem 0.75rem 2.5rem;
}

.esc-panel__index {
  display: block;
  color: var(--esc-copper);
  font-size: var(--esc-step--1);
  letter-spacing: 0.1em;
  margin-bottom: var(--esc-space-xs);
}

.esc-overlap {
  position: relative;
}

.esc-overlap__card {
  position: absolute;
  background: var(--esc-bg-panel);
  border: var(--esc-border-hair);
  border-radius: 1.75rem 1.75rem 1.75rem 0.4rem;
  padding: var(--esc-space-s) var(--esc-space-m);
  max-width: 20rem;
}

.esc-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.esc-field label {
  font-size: var(--esc-step--1);
  letter-spacing: 0.02em;
}

.esc-field input,
.esc-field textarea {
  border: 1px solid var(--esc-copper);
  border-radius: 0.7rem;
  padding: 0.85em 1em;
  background: var(--esc-bg-panel);
  color: var(--esc-ink);
  min-height: 3.1rem;
}

.esc-field textarea {
  min-height: 8rem;
  resize: vertical;
}

.esc-field input:invalid[data-touched="true"],
.esc-field textarea:invalid[data-touched="true"] {
  border-color: var(--esc-brick);
}

.esc-field__error {
  color: var(--esc-brick);
  font-size: var(--esc-step--1);
  min-height: 1.1em;
}

.esc-checkline {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.esc-checkline input {
  margin-top: 0.3rem;
  width: 1.15rem;
  height: 1.15rem;
  min-height: 0;
  accent-color: var(--esc-wine);
}

.esc-checkline a {
  text-decoration: underline;
}

.esc-form-status {
  font-size: var(--esc-step--1);
  color: var(--esc-wine);
}

.esc-consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: none;
  padding: var(--esc-space-s);
  background: color-mix(in srgb, var(--esc-footer) 96%, transparent);
  border-top: 1px solid var(--esc-copper);
}

.esc-consent[data-visible="true"] {
  display: block;
}

.esc-consent__row {
  max-width: var(--esc-content-max);
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--esc-space-s);
  color: var(--esc-footer-ink);
}

.esc-consent__text {
  max-width: 42rem;
  font-size: var(--esc-step--1);
}

.esc-consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.esc-consent__actions .esc-btn--outline {
  border-color: var(--esc-copper);
  color: var(--esc-footer-ink);
}

.esc-consent__actions .esc-btn--outline:hover {
  background: var(--esc-copper);
  color: var(--esc-footer);
}

.esc-consent-dialog {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--esc-space-s);
}

.esc-consent-dialog[data-visible="true"] {
  display: flex;
}

.esc-consent-dialog__scrim {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--esc-footer) 60%, transparent);
}

.esc-consent-dialog__panel {
  position: relative;
  z-index: 1;
  width: min(32rem, 100%);
  background: var(--esc-bg-panel);
  border: var(--esc-border-hair);
  border-radius: 1.5rem;
  padding: var(--esc-space-m);
  max-height: 85vh;
  overflow-y: auto;
}

.esc-consent-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--esc-space-s);
  padding-block: var(--esc-space-xs);
  border-top: 1px solid var(--esc-line);
}

.esc-consent-toggle:first-of-type {
  border-top: none;
}

.esc-consent-toggle__label strong {
  display: block;
  font-size: var(--esc-step-0);
  margin-bottom: 0.2em;
}

.esc-consent-toggle__label p {
  color: color-mix(in srgb, var(--esc-ink) 78%, transparent);
  font-size: var(--esc-step--1);
}

.esc-consent-dialog__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: var(--esc-space-m);
}

.esc-switch {
  position: relative;
  display: inline-flex;
  width: 3rem;
  height: 1.7rem;
  border-radius: var(--esc-radius-pill);
  background: var(--esc-line);
  border: none;
  padding: 0;
  flex-shrink: 0;
}

.esc-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: var(--esc-bg-panel);
  transition: transform 200ms ease;
}

.esc-switch[aria-checked="true"] {
  background: var(--esc-wine);
}

.esc-switch[aria-checked="true"]::after {
  transform: translateX(1.28rem);
}

.esc-switch[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

[data-esc-reveal] {
  opacity: 0;
  transform: translateY(var(--esc-motion-distance));
  transition: opacity var(--esc-motion-duration) ease, transform var(--esc-motion-duration) ease;
}

[data-esc-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  [data-esc-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ==========================================================================
   Header Search Widget
   ========================================================================== */
.esc-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  max-width: 250px;
  min-width: 140px;
}

.esc-search__box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  border-radius: var(--esc-radius-pill);
  border: 1px solid var(--esc-copper);
  background: var(--esc-bg-panel);
  padding: 0.2rem 0.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

.esc-search__box:focus-within {
  border-color: var(--esc-wine);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--esc-wine) 25%, transparent);
}

.esc-search__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--esc-copper);
  margin-left: 0.35rem;
  margin-right: 0.35rem;
  flex-shrink: 0;
}

.esc-search__icon svg {
  width: 15px;
  height: 15px;
  display: block;
}

.esc-search__input {
  width: 100%;
  min-height: 2.1rem;
  border: none;
  background: transparent;
  padding: 0.2rem 0.3rem;
  font-family: var(--esc-font-body);
  font-size: var(--esc-step--1);
  color: var(--esc-ink);
  outline: none;
}

.esc-search__input::placeholder {
  color: color-mix(in srgb, var(--esc-ink) 50%, transparent);
  font-size: 0.86rem;
}

.esc-search__input::-webkit-search-decoration,
.esc-search__input::-webkit-search-cancel-button,
.esc-search__input::-webkit-search-results-button,
.esc-search__input::-webkit-search-results-decoration {
  display: none;
}

.esc-search__clear {
  border: none;
  background: transparent;
  color: color-mix(in srgb, var(--esc-ink) 60%, transparent);
  font-size: 1.15rem;
  line-height: 1;
  padding: 0 0.35rem;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.esc-search__clear:hover {
  color: var(--esc-wine);
}

.esc-search__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 320px;
  max-width: 440px;
  width: max-content;
  background: var(--esc-bg-panel);
  border: 1px solid var(--esc-line);
  border-radius: var(--esc-radius-soft);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16);
  z-index: 120;
  max-height: 380px;
  overflow-y: auto;
  padding: 0.45rem;
}

@media (max-width: 640px) {
  .esc-search {
    max-width: 165px;
  }
  .esc-search__dropdown {
    left: auto;
    right: -50px;
    min-width: 290px;
    max-width: 90vw;
  }
}

.esc-search__empty {
  padding: 1.1rem 0.85rem;
  text-align: center;
  font-size: var(--esc-step--1);
  color: color-mix(in srgb, var(--esc-ink) 70%, transparent);
}

.esc-search__item {
  display: block;
  text-decoration: none;
  padding: 0.55rem 0.75rem;
  border-radius: 0.6rem;
  color: var(--esc-ink);
  transition: background-color 0.15s ease, transform 0.1s ease;
  margin-bottom: 0.15rem;
}

.esc-search__item:hover,
.esc-search__item.is-selected {
  background: color-mix(in srgb, var(--esc-wine) 12%, transparent);
}

.esc-search__item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.esc-search__item-title {
  font-weight: 650;
  font-size: 0.92rem;
  color: var(--esc-ink);
}

.esc-search__item-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: var(--esc-radius-pill);
  background: color-mix(in srgb, var(--esc-copper) 25%, transparent);
  color: var(--esc-ink);
  font-weight: 600;
  white-space: nowrap;
}

.esc-search__item-desc {
  font-size: 0.8rem;
  color: color-mix(in srgb, var(--esc-ink) 75%, transparent);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.esc-search__highlight {
  background: color-mix(in srgb, var(--esc-copper) 35%, transparent);
  font-weight: 700;
  border-radius: 2px;
  padding: 0 1px;
}

/* ==========================================================================
   Floating Theme Toggle Widget (NOT in Header)
   ========================================================================== */
.esc-theme-toggle {
  position: fixed;
  bottom: 1.75rem;
  left: 1.75rem;
  z-index: 995;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 50%;
  border: 1px solid var(--esc-copper);
  background: var(--esc-bg-panel);
  color: var(--esc-ink);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, background-color 0.3s ease, border-color 0.3s ease;
  user-select: none;
}

.esc-theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  border-color: var(--esc-wine);
}

.esc-theme-toggle:active {
  transform: scale(0.94);
}

.esc-theme-toggle svg {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}

.esc-theme-toggle .esc-icon-sun {
  display: none;
}

.esc-theme-toggle .esc-icon-moon {
  display: block;
}

[data-theme="dark"] .esc-theme-toggle .esc-icon-sun {
  display: block;
}

[data-theme="dark"] .esc-theme-toggle .esc-icon-moon {
  display: none;
}

.esc-theme-toggle__tooltip {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  background: var(--esc-footer);
  color: var(--esc-footer-ink);
  padding: 0.35rem 0.65rem;
  border-radius: 0.4rem;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.22);
}

.esc-theme-toggle:hover .esc-theme-toggle__tooltip,
.esc-theme-toggle:focus-visible .esc-theme-toggle__tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@media (max-width: 480px) {
  .esc-theme-toggle {
    bottom: 1.25rem;
    left: 1.25rem;
    width: 2.75rem;
    height: 2.75rem;
  }
}

/* ==========================================================================
   Advanced Form Validation Styles
   ========================================================================== */
.esc-field input.is-invalid,
.esc-field textarea.is-invalid {
  border-color: var(--esc-brick) !important;
  background-color: color-mix(in srgb, var(--esc-brick) 8%, transparent) !important;
}

.esc-field input.is-valid,
.esc-field textarea.is-valid {
  border-color: #2e7d32 !important;
}

.esc-char-counter {
  font-size: 0.78rem;
  color: color-mix(in srgb, var(--esc-ink) 65%, transparent);
  text-align: right;
  margin-top: 0.25rem;
}

.esc-field__error {
  min-height: 1.25rem;
  font-size: 0.82rem;
  color: var(--esc-brick);
  font-weight: 500;
  transition: all 0.2s ease;
}

@keyframes escShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.esc-form-shake {
  animation: escShake 0.4s ease;
}
