*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.62;
  color: var(--ink-900);
  background-color: var(--parchment);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-main {
  flex: 1 0 auto;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-inline: 24px;
}

/* Typography */
.font-display,
h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: -0.015em;
  line-height: 1.18;
  margin: 0;
}

p {
  margin: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-600);
}

.eyebrow--light {
  color: var(--gold-400);
}

.section-heading {
  font-size: clamp(1.75rem, 2.8vw, 2.45rem);
  color: var(--emerald-950);
  font-weight: 700;
}

.section-lead {
  color: var(--ink-700);
  font-size: 1.02rem;
  max-width: 66ch;
}

/* Ornamental Gold Divider */
.ornament-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
}

.ornament-divider::before,
.ornament-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--gold-500), transparent);
}

.ornament-divider__gem {
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--gold-500);
  transform: rotate(45deg);
  flex-shrink: 0;
}

/* Framed Logo */
.logo-frame {
  background: #ffffff;
  border: 1.5px solid var(--gold-500);
  border-radius: var(--radius-sm);
  padding: 4px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-frame--header {
  width: 44px;
  height: 44px;
}

.logo-frame--hero {
  width: 144px;
  height: 144px;
  border-radius: var(--radius-md);
  padding: 10px;
  border-width: 2px;
  box-shadow: var(--shadow-gold);
}

.logo-frame--about {
  width: 164px;
  height: 164px;
  border-radius: var(--radius-md);
  padding: 12px;
  border-width: 2px;
  box-shadow: var(--shadow-md);
}

.logo-frame--footer {
  width: 54px;
  height: 54px;
  padding: 5px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.93rem;
  line-height: 1.2;
  border: 1px solid transparent;
  transition: transform var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn--ruby {
  background: var(--ruby-600);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(124, 29, 38, 0.25);
}

.btn--ruby:hover:not(:disabled) {
  background: var(--ruby-700);
}

.btn--emerald {
  background: var(--emerald-900);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(13, 59, 36, 0.2);
}

.btn--emerald:hover:not(:disabled) {
  background: var(--emerald-800);
}

.btn--gold-outline {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(212, 175, 55, 0.65);
}

.btn--gold-outline:hover:not(:disabled) {
  background: rgba(212, 175, 55, 0.16);
  border-color: var(--gold-400);
}

.btn--surface {
  background: var(--surface);
  color: var(--emerald-900);
  border-color: var(--border-subtle);
}

.btn--surface:hover:not(:disabled) {
  background: var(--emerald-50);
  border-color: rgba(13, 59, 36, 0.24);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-700);
  border-color: transparent;
}

.btn--ghost:hover:not(:disabled) {
  background: rgba(13, 59, 36, 0.06);
  color: var(--emerald-900);
}

.btn--danger-ghost {
  background: var(--ruby-50);
  color: var(--ruby-600);
  border-color: rgba(124, 29, 38, 0.2);
}

.btn--danger-ghost:hover:not(:disabled) {
  background: var(--ruby-600);
  color: #ffffff;
}

.btn--sm {
  padding: 7px 13px;
  font-size: 0.82rem;
  border-radius: var(--radius-xs);
}

.btn--lg {
  padding: 14px 26px;
  font-size: 0.98rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.25;
}

.badge--emerald {
  background: var(--emerald-50);
  color: var(--emerald-900);
  border: 1px solid rgba(13, 59, 36, 0.14);
}

.badge--gold {
  background: var(--gold-100);
  color: #6b5012;
  border: 1px solid var(--border-gold);
}

.badge--ruby {
  background: var(--ruby-600);
  color: #ffffff;
}

.badge--ruby-soft {
  background: var(--ruby-50);
  color: var(--ruby-600);
  border: 1px solid rgba(124, 29, 38, 0.22);
}

.badge--live-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.28);
  animation: livePulse 1.8s infinite;
}

@keyframes livePulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.85);
  }
}

/* Progress Bar */
.progress-track {
  width: 100%;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--parchment-deep);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--emerald-800), var(--gold-500));
  transition: width 360ms ease;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--emerald-950);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--ink-500);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(13, 59, 36, 0.18);
  background: var(--surface);
  color: var(--ink-900);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--emerald-800);
  box-shadow: 0 0 0 3px rgba(13, 59, 36, 0.11);
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* Modal System */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(7, 34, 21, 0.68);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  animation: fadeIn 160ms ease-out;
}

.modal-dialog {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slideUp 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-dialog--wide {
  max-width: 700px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, var(--parchment) 0%, #ffffff 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.38rem;
  color: var(--emerald-950);
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  color: var(--ink-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.modal-close:hover {
  background: var(--ruby-50);
  color: var(--ruby-600);
}

.modal-body {
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-error {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--ruby-50);
  border: 1px solid rgba(124, 29, 38, 0.25);
  color: var(--ruby-700);
  font-size: 0.88rem;
  font-weight: 500;
}

.modal-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--parchment);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.modal-tab {
  padding: 9px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-xs);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-700);
  transition: background-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.modal-tab.is-active {
  background: var(--surface);
  color: var(--emerald-900);
  box-shadow: var(--shadow-sm);
}

/* Toasts */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 40px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--emerald-950);
  color: #ffffff;
  border: 1px solid var(--gold-500);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideUp 200ms ease-out;
}

.toast--error {
  background: var(--ruby-700);
  border-color: rgba(255, 255, 255, 0.25);
}

.toast--success {
  background: var(--emerald-900);
  border-color: var(--gold-500);
}

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(90deg, var(--parchment-deep) 25%, #f8f4ea 50%, var(--parchment-deep) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
