/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ==========================================================================
   Fonts — self-hosted via the asset pipeline (no Google Fonts CDN)
   ========================================================================== */
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/cormorant-garamond-latin-400-9e10c643.woff2") format("woff2");
}

@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 300;
  font-display: swap;
  src: url("/assets/cormorant-garamond-light-italic-latin-300-fc45bb46.woff2") format("woff2");
}

/* ==========================================================================
   Base reset — remove the default 8px body margin so dark backgrounds
   bleed edge-to-edge with no white gutter around the page.
   ========================================================================== */
html,
body {
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--wt-bg);
}

/* Visually hidden but accessible to screen readers (e.g. file inputs, headings) */
.sr-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Design tokens — CSS custom properties so themes can override later
   ========================================================================== */
:root {
  --wt-bg: #15101f;
  --wt-surface: #1e1830;
  --wt-surface-alt: #271f3d;
  --wt-border: #392f54;
  --wt-text: #efeaf7;
  --wt-text-muted: #b9aed4;
  --wt-accent: #c3acff;
  --wt-accent-hover: #d9c9ff;
  --wt-accent-contrast: #1a1226;
  /* Deeper purple for buttons so white text meets WCAG AA (4.5:1).
     --wt-accent (#c3acff) stays for text highlights and borders. */
  --wt-btn-primary: #6b4faf;       /* ~6.2:1 with #fff */
  --wt-btn-primary-hover: #7c5cbf; /* ~5.1:1 with #fff */
  --wt-danger: #ff9b9b;
  --wt-danger-strong: #e25c5c;

  /* Semantic toast colours — dark-mode-friendly text on a subtle tinted fill. */
  --wt-success: #34d399;
  --wt-success-bg: rgba(16, 185, 129, 0.12);
  --wt-success-border: rgba(16, 185, 129, 0.25);
  --wt-error: #f87171;
  --wt-error-bg: rgba(239, 68, 68, 0.12);
  --wt-error-border: rgba(239, 68, 68, 0.25);

  --wt-radius: 10px;
  --wt-radius-sm: 6px;
  --wt-gap: 1rem;
  --wt-transition: 0.15s ease;
}

/* ==========================================================================
   Avatars
   ========================================================================== */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
}

.avatar[hidden] {
  display: none !important;
}

.avatar-placeholder {
  background: var(--wt-surface-alt);
  color: var(--wt-text);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: bold;
  text-transform: uppercase;
  border-radius: 50%;
}

.avatar-preview {
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   Dashboard layout
   ========================================================================== */
/* The dashboard is NOT themed: a dark branded header area wraps a fixed
   light-neutral content area (.dashboard__main scopes its own --wt-* values). */
.dashboard {
  min-height: 100dvh;
  background: #f0ebe4;
  color: var(--wt-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

.dashboard__header {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  max-width: 760px;
  margin: 0 auto;
  /* Subtle darker neutral so the header reads distinct from the content. */
  background: #e0d8ce;
  padding: 1.5rem 1.25rem;
}

/* --- Hamburger menu (brand left, menu right on all viewports) --- */
.hamburger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem;
  border: none;
  background: transparent;
  /* Inline menu icon inherits this via currentColor; --wt-header keeps it
     visible on the dark body for light-surface themes. */
  color: var(--wt-header, var(--wt-accent));
  cursor: pointer;
  border-radius: var(--wt-radius-sm);
  transition: color var(--wt-transition), background var(--wt-transition);
}

.hamburger-btn:hover,
.hamburger-btn:focus-visible {
  color: var(--wt-header-hover, var(--wt-header));
  background: rgba(255, 255, 255, 0.08);
}

/* Slide-down dropdown anchored under the hamburger */
.header-nav-mobile {
  display: none;
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 1.25rem;
  z-index: 100;
  min-width: 11rem;
  flex-direction: column;
  gap: 0;
  padding: 0.5rem;
  background: var(--wt-surface-alt);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.45);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.header-nav-mobile.is-open {
  display: flex;
}

.header-nav-mobile__link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.3rem 0.5rem;
  color: var(--wt-text);
  text-decoration: none;
  border-radius: var(--wt-radius-sm);
}

.header-nav-mobile__link:hover,
.header-nav-mobile__link:focus-visible {
  color: var(--wt-accent);
  background: rgba(255, 255, 255, 0.06);
}

.header-nav-mobile__divider {
  margin: 0.35rem 0;
  border: none;
  border-top: 1px solid var(--wt-border);
}

.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0, 0, 0, 0.5);
}

.mobile-menu-overlay.is-open {
  display: block;
}

body.menu-open {
  overflow: hidden;
}

.dashboard__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.7rem;
  font-weight: 300;
  letter-spacing: 0.01em;
  /* Brand purple, darkened to contrast against the light neutral header. */
  color: #6b4faf;
  text-decoration: none;
}

.dashboard__brand:hover,
.dashboard__brand:focus-visible {
  color: #7c5cbf;
}

/* Dashboard hamburger is brand purple too (scoped so the themed public-profile
   hamburger keeps using --wt-header). */
.dashboard__header .hamburger-btn {
  color: #6b4faf;
}

.dashboard__header .hamburger-btn:hover,
.dashboard__header .hamburger-btn:focus-visible {
  color: #7c5cbf;
}

/* Dashboard hamburger dropdown uses the fixed neutral palette (not a theme). */
.dashboard__header .header-nav-mobile {
  background: #eee8e0;
  border-color: #c0b8a8;
}

.dashboard__header .header-nav-mobile__link {
  color: #2a2a2a;
}

.dashboard__header .header-nav-mobile__link:hover,
.dashboard__header .header-nav-mobile__link:focus-visible {
  color: #6b4faf;
}

.dashboard__header .header-nav-mobile__divider {
  border-color: #c0b8a8;
}

.dashboard__brand-name {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 300;
  /* Italics render narrower, so bump the size a touch and give it a little
     tracking for breathing room. */
  font-size: 2.1rem;
  letter-spacing: 0.01em;
}

/* Inline logo inherits the brand link color via fill:currentColor */
.dashboard__logo {
  width: auto;
  height: 2.4rem;
  flex-shrink: 0;
}

.dashboard__account {
  margin: 0;
  color: var(--wt-text-muted);
  font-size: 0.9rem;
}

.dashboard__logout {
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* Dashboard palette — fixed Bone & Shadow-inspired light neutral, independent
   of the user's profile theme. Every dashboard element reads --wt-* so these
   scoped overrides recolor the whole content area. */
.dashboard__main {
  color: var(--wt-text);
  --wt-bg: #e8e2da;
  --wt-surface: #d8d2ca;
  --wt-surface-alt: #eee8e0;
  --wt-border: #c0b8a8;
  --wt-text: #2a2a2a;
  --wt-text-muted: #6a6a6a;
  --wt-accent: #505050;
  --wt-accent-hover: #3a3a3a;
  --wt-accent-contrast: #ffffff;
  --wt-btn-primary: #4a4a4a;
  --wt-btn-primary-hover: #3a3a3a;
  background: var(--wt-surface);

  max-width: 760px;
  margin: 0 auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: var(--wt-gap);
}

/* Cards */
.card {
  position: relative;
  background: var(--wt-surface-alt);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius);
  padding: 1.25rem;
}

/* ==========================================================================
   Theme picker (profile card, top-right)
   ========================================================================== */
/* Profile theme picker — a grid of swatches with a live mini preview, shown in
   the Account tab's Branding section. */
.theme-section {
  margin-top: 1.25rem;
}

.theme-section__title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  color: var(--wt-text);
}

.theme-section__subtitle {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--wt-text-muted);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 0.5rem;
}

.theme-grid__option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem;
  background: none;
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius-sm);
  color: var(--wt-text);
  font-size: 0.7rem;
  cursor: pointer;
  transition: border-color var(--wt-transition);
}

.theme-grid__option:hover,
.theme-grid__option:focus-visible {
  border-color: var(--wt-accent);
}

.theme-grid__option--active {
  border-color: var(--wt-accent);
  box-shadow: 0 0 0 1px var(--wt-accent);
}

/* Lighter indicator for the theme currently being previewed (not yet saved).
   The solid active ring above marks the saved theme; this dashed one moves as
   the user browses. */
.theme-grid__option--previewing {
  outline: 2px dashed var(--wt-accent, #505050);
  outline-offset: 2px;
}

/* Custom swatch palette icon — grey until Custom is the saved active theme. */
.theme-grid__palette {
  color: #999;
}

.theme-grid__option--active .theme-grid__palette {
  color: #6b4faf;
}

.theme-grid__swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 36px;
  border-radius: var(--wt-radius-sm);
  border: 1px solid var(--wt-border);
}

.theme-grid__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.theme-grid__name {
  text-align: center;
  line-height: 1.15;
}

/* Live mini preview of the selected theme. */
.theme-preview {
  max-width: 300px;
  margin: 1rem auto 0;
  background: var(--wt-bg);
  padding: 25px;
}

.theme-preview__social {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  color: var(--wt-text-muted);
  margin: 0.25rem 0;
}

.theme-preview__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--wt-surface);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius);
  color: var(--wt-text);
  text-align: center;
}

.theme-preview__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--wt-surface-alt);
  border: 1px solid var(--wt-border);
}

.theme-preview__name {
  margin: 0;
  font-weight: 700;
  font-size: 0.9rem;
  /* Matches the public profile, where the display name uses the accent color. */
  color: var(--wt-accent);
}

.theme-preview__bio {
  margin: 0;
  font-size: 0.75rem;
  color: var(--wt-bio-text, var(--wt-text));
}

.theme-preview__link {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem;
  background: var(--wt-surface-alt);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius-sm);
  font-size: 0.75rem;
}

.theme-preview__pill {
  margin-top: 0.25rem;
  padding: 0.3rem 0.9rem;
  background: var(--wt-btn-primary);
  color: var(--wt-accent-contrast);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

/* Custom color pickers (premium). */
.branding-customize {
  margin-top: 1.5rem;
}

.color-pickers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
}

@media (max-width: 540px) {
  .color-pickers {
    grid-template-columns: 1fr;
  }
}

.color-picker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0;
}

.color-picker__label {
  flex: 1;
  min-width: 6rem;
  color: var(--wt-text);
  font-size: 0.9rem;
}

.color-picker__hex {
  flex-shrink: 0;
  width: 100%;
  max-width: 5.1rem;
  padding: 0.3rem 0.4rem;
  background: var(--wt-surface);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius-sm);
  color: var(--wt-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
}

/* Coloris wraps each hex input + its preview button in .clr-field; cap the
   wrapper so it hugs its content rather than stretching across the row. */
.clr-field {
  max-width: 8.5rem;
}

.color-picker__reset {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--wt-text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
}

/* Coloris popup theme overrides to match the dashboard's light-neutral palette. */
.clr-picker {
  background: #eee8e0;
  border-color: #c0b8a8;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.2);
}

.clr-picker .clr-preview-label,
.clr-picker input.clr-color {
  color: #2a2a2a;
  background: #e0d8ce;
  border-color: #c0b8a8;
}

.clr-picker .clr-close {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  color: #fff;
  background: #505050;
  border: none;
  border-radius: 4px;
  padding: 0.4rem 1.2rem;
  cursor: pointer;
}

.clr-picker .clr-close:hover {
  background: #6a6a6a;
  color: #fff;
}

.clr-cancel {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  color: var(--wt-text-muted, #6a6a6a);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem 1rem;
}

.clr-cancel:hover {
  color: var(--wt-text, #2a2a2a);
}

.theme-custom-indicator {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--wt-text-muted);
}

.branding-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.branding-actions__primary {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin: 0.8rem 0;
}

.branding-upsell {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--wt-text-muted);
}

.card__title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

/* Profile card */
.profile-card {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.profile-card__avatar {
  flex-shrink: 0;
}

.profile-card__details {
  min-width: 0;
}

.profile-card__details > p {
  margin: 0 0 0.35rem;
}

.profile-card__name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--wt-accent);
}

/* Inline edit (click the display name to edit it in place) */
.inline-edit__display {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.inline-edit__pencil {
  display: inline-flex;
  color: var(--wt-text-muted);
  opacity: 0;
  transition: opacity var(--wt-transition);
}

.inline-edit:hover .inline-edit__pencil,
.inline-edit__display:focus-visible .inline-edit__pencil {
  opacity: 1;
}

.inline-edit__form {
  display: none;
}

.inline-edit__input {
  width: 100%;
  padding: 0.25rem 0.5rem;
  background: var(--wt-surface-alt);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius-sm);
  color: var(--wt-text);
  font-size: 1.2rem;
  font-weight: 700;
}

.inline-edit__input:focus-visible {
  outline: 2px solid var(--wt-accent);
  border-color: var(--wt-accent);
}

.inline-edit--editing .inline-edit__display {
  display: none;
}

.inline-edit--editing .inline-edit__form {
  display: block;
}

/* Username input is sized to match its smaller display text. */
.profile-card__username .inline-edit__input {
  font-size: 0.9rem;
  font-weight: 400;
}

.inline-edit__textarea {
  width: 100%;
  min-height: 4.5rem;
  padding: 0.4rem 0.5rem;
  background: var(--wt-surface-alt);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius-sm);
  color: var(--wt-text);
  font: inherit;
  resize: vertical;
}

.inline-edit__textarea:focus-visible {
  outline: 2px solid var(--wt-accent);
  border-color: var(--wt-accent);
}

.inline-edit__save {
  margin-top: 0.4rem;
}

.inline-edit__warning {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--wt-danger);
}

.inline-edit__cooldown {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--wt-text-muted);
}

.inline-edit__placeholder {
  color: var(--wt-text-muted);
  font-style: italic;
}

.profile-card__username,
.profile-card__url {
  color: var(--wt-text-muted);
  font-size: 0.9rem;
}

.profile-card__url-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--wt-accent);
  text-decoration: none;
}

.profile-card__url-link:hover,
.profile-card__url-link:focus-visible {
  color: var(--wt-accent);
  text-decoration: underline;
}

.profile-card__bio {
  color: var(--wt-text);
}

.profile-card__details .btn {
  margin-top: 0.5rem;
}

/* ==========================================================================
   Public profile page (the standalone /:username link-in-bio view)
   ========================================================================== */
.public-profile {
  box-sizing: border-box;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 3rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--wt-surface);
  border: 1px solid var(--wt-border);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Slim floating hamburger for signed-in viewers — top-right, out of the way. */
.public-profile__nav {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
}

/* The hamburger icon follows the theme (via --wt-header), but its dropdown uses
   the fixed neutral palette so menu text is always legible regardless of theme. */
.public-profile__nav .header-nav-mobile {
  background: #eee8e0;
  border-color: #c0b8a8;
}

.public-profile__nav .header-nav-mobile__link {
  color: #2a2a2a;
}

.public-profile__nav .header-nav-mobile__link:hover,
.public-profile__nav .header-nav-mobile__link:focus-visible {
  color: #505050;
}

.public-profile__nav .header-nav-mobile__divider {
  border-color: #c0b8a8;
}

.public-profile__avatar {
  margin-bottom: 1.25rem;
}

.public-profile__name {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--wt-accent);
  overflow-wrap: break-word;
}

.public-profile__username {
  margin: 0.25rem 0 0;
  color: var(--wt-text-muted);
  font-size: 0.95rem;
}

.public-profile__bio {
  margin: 1rem 0 0;
  color: var(--wt-bio-text, var(--wt-text));
  line-height: 1.5;
  overflow-wrap: break-word;
}

.public-profile__socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.public-profile__social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  color: var(--wt-text-muted);
  transition: color var(--wt-transition);
}

.public-profile__social:hover,
.public-profile__social:focus-visible {
  color: var(--wt-accent);
}

.social-icon {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
}

.public-profile__links {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 2rem;
}

.public-profile__link {
  /* Balanced 3-column grid: visual | title | empty spacer. The spacer mirrors
     the visual column so the centered title is always centered in the full
     button, with or without an icon/thumbnail. */
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 56px;
  padding: 0.5rem 0.75rem;
  background: var(--wt-surface-alt);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius);
  color: var(--wt-text);
  text-decoration: none;
  font-weight: 400;
  transition: border-color var(--wt-transition);
}

.public-profile__link:hover,
.public-profile__link:focus-visible {
  border-color: var(--wt-accent);
}

.public-profile__link-title {
  text-align: center;
}

.public-profile__link-visual {
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--wt-radius-sm);
  overflow: hidden;
  /* Icons inherit the link text color so they always match the title. */
  color: var(--wt-text);
}

.public-profile__link-visual img {
  width: 40px;
  height: 40px;
  object-fit: cover;
}

.public-profile__link-visual svg {
  width: 24px;
  height: 24px;
  color: var(--wt-text);
}


.public-profile__footer {
  margin-top: auto;
  padding-top: 2.5rem;
}

.public-profile__cta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.5rem;
  background: var(--wt-btn-primary);
  border: 1px solid transparent;
  color: var(--wt-accent-contrast);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--wt-transition);
}

.public-profile__cta-pill:hover,
.public-profile__cta-pill:focus-visible {
  background: var(--wt-btn-primary-hover);
}

.public-profile__cta-pill svg {
  width: 1rem;
  height: 1rem;
}

/* ==========================================================================
   Auth pages (Devise: login, signup, password reset, confirmations, unlocks)
   Centered card on the dark background — no site chrome.
   ========================================================================== */
body.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.auth-card {
  box-sizing: border-box;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}

.auth-card__logo {
  display: inline-block;
  margin-bottom: 1.25rem;
  color: var(--wt-accent);
}

.auth-card__logo svg {
  width: 6rem;
  height: 6rem;
}

.auth-card__heading {
  margin: 0 0 1.5rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 2rem;
  font-weight: 400;
  font-style: italic;
  color: var(--wt-accent);
}

.auth-card__form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
}

.auth-card__form input[type="text"],
.auth-card__form input[type="email"],
.auth-card__form input[type="password"] {
  box-sizing: border-box;
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--wt-surface-alt);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius);
  color: var(--wt-text);
  text-align: center;
  font-size: 1rem;
}

.auth-card__form input::placeholder {
  color: var(--wt-text-muted);
}

.auth-card__form input[type="text"]:focus,
.auth-card__form input[type="email"]:focus,
.auth-card__form input[type="password"]:focus {
  outline: 2px solid var(--wt-accent);
  outline-offset: 1px;
  border-color: var(--wt-accent);
}

.auth-card__form input[type="submit"] {
  box-sizing: border-box;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.8rem 1rem;
  background: var(--wt-btn-primary);
  color: #fff;
  border: none;
  border-radius: var(--wt-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--wt-transition);
}

.auth-card__form input[type="submit"]:hover,
.auth-card__form input[type="submit"]:focus-visible {
  background: var(--wt-btn-primary-hover);
}

.auth-card__links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.auth-card__links a {
  color: var(--wt-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color var(--wt-transition);
}

.auth-card__links a:hover,
.auth-card__links a:focus-visible {
  color: var(--wt-accent);
}

/* ==========================================================================
   Links list + rows (each row is a <turbo-frame>)
   ========================================================================== */
.links-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--wt-surface-alt);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius-sm);
  padding: 0.65rem 0.85rem;
}

.link-row--hidden {
  opacity: 0.55;
}

.link-row__drag-handle {
  display: flex;
  align-items: center;
  padding: 0.25rem;
  color: var(--wt-text-muted);
  cursor: grab;
  touch-action: none;
}

.link-row__drag-handle:active {
  cursor: grabbing;
}

.link-row--ghost {
  opacity: 0.4;
  background: var(--wt-surface-alt);
}

.link-row__visual {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wt-text-muted);
}

.link-row__visual img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: var(--wt-radius-sm);
}

.thumbnail-preview {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.thumbnail-preview__img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--wt-radius-sm);
}

.thumbnail-preview__remove {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--wt-text-muted);
}

.link-row__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.link-row__title {
  font-weight: 600;
}

.link-row__url {
  color: var(--wt-text-muted);
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-row__url:hover,
.link-row__url:focus-visible {
  color: var(--wt-accent);
  text-decoration: underline;
}

.link-row__actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* button_to wraps the button in a form — keep it inline with no spacing */
.icon-btn__form {
  display: inline;
  margin: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: var(--wt-radius-sm);
  background: transparent;
  color: var(--wt-text-muted);
  cursor: pointer;
  transition: color var(--wt-transition), background var(--wt-transition);
}

.icon-btn:hover,
.icon-btn:focus-visible {
  color: var(--wt-accent);
  background: rgba(195, 172, 255, 0.12);
}

.icon-btn--danger:hover,
.icon-btn--danger:focus-visible {
  color: var(--wt-danger);
  background: rgba(255, 155, 155, 0.12);
}

.icon {
  display: block;
}

/* ==========================================================================
   Forms (add link + inline edit)
   ========================================================================== */
.link-row--editing {
  display: block;
}

.link-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 600px;
  margin: 0 auto;
}

.link-edit-form .field__input {
  width: 100%;
}

/* Visual icon picker */
.icon-picker__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.icon-picker__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--wt-surface-alt);
  border: 2px solid transparent;
  border-radius: var(--wt-radius-sm);
  color: var(--wt-text-muted);
  cursor: pointer;
}

.icon-picker__btn:hover {
  border-color: var(--wt-border);
  color: var(--wt-text);
}

.icon-picker__btn--active {
  border-color: var(--wt-accent);
  color: var(--wt-accent);
}

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

.field__label {
  font-size: 0.85rem;
  color: var(--wt-text);
}

.field__optional {
  font-size: 0.75rem;
  font-style: italic;
  font-weight: 400;
  color: var(--wt-text-muted);
}

.field__input {
  width: 100%;
  box-sizing: border-box; /* keep width:100% inside the card, level with link rows */
  padding: 0.55rem 0.7rem;
  background: var(--wt-surface-alt);
  color: var(--wt-text);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius-sm);
  font-size: 0.95rem;
}

.field__input:focus-visible {
  outline: 2px solid var(--wt-accent);
  outline-offset: 1px;
  border-color: var(--wt-accent);
}

.link-edit-form__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.add-link {
  border-top: 1px solid var(--wt-border);
  padding-top: 1.25rem;
}

.add-link__title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.empty-state {
  color: var(--wt-text-muted);
  font-style: italic;
}

/* ==========================================================================
   Collapsible dashboard sections (Social Links / Links)
   ========================================================================== */
.collapsible__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.collapsible__title {
  margin: 0;
  font-size: 1.1rem;
  color: var(--wt-text);
}

.collapsible__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: none;
  border: none;
  color: var(--wt-text-muted);
  cursor: pointer;
}

.collapsible__toggle:hover,
.collapsible__toggle:focus-visible {
  color: var(--wt-accent);
}

.collapsible__chevron {
  display: inline-flex;
  color: var(--wt-text);
  transition: transform 0.2s ease;
}

.collapsible__chevron--rotated {
  transform: rotate(180deg);
}

.collapsible__content {
  margin-top: 1rem;
}

.collapsible__content--hidden {
  display: none;
}

/* Social links: compact list + add form */
.social-links-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.social-links-list__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--wt-surface-alt);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius-sm);
}

.social-links-list__platform {
  font-weight: 600;
  color: var(--wt-text);
}

.social-links-list__handle {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--wt-text-muted);
  font-size: 0.9rem;
}

.social-links-list__actions {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

.social-link-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  border-top: 1px solid var(--wt-border);
  padding-top: 1.25rem;
}

.social-link-form .field {
  flex: 1;
  min-width: 8rem;
  margin: 0;
}

/* ==========================================================================
   Analytics summary + QR code
   ========================================================================== */
.analytics-summary {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.analytics-summary__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.analytics-summary__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 7rem;
  padding: 0.9rem 1rem;
  background: var(--wt-surface-alt);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius-sm);
  transition: border-color var(--wt-transition);
}

/* Premium stat boxes are buttons that switch the chart metric. */
button.analytics-summary__stat {
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: center;
}

.analytics-summary__stat--active {
  border-color: var(--wt-accent);
}

.analytics-summary__count {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--wt-accent);
}

.analytics-summary__label {
  font-size: 0.85rem;
  color: var(--wt-text-muted);
}

.analytics-summary__delta {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: var(--wt-text-muted);
}

.analytics-chart__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.analytics-summary__breakdown-title {
  margin: 0;
  font-size: 0.95rem;
  color: var(--wt-text);
}

.analytics-summary__breakdown-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.analytics-summary__breakdown-list li {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--wt-text-muted);
}

.analytics-summary__upsell {
  margin: 0;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--wt-text-muted);
}

.analytics-chart {
  position: relative;
}

.analytics-chart__toggles {
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
}

.analytics-chart__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: none;
  border: none;
  color: var(--wt-text-muted);
  cursor: pointer;
  border-radius: var(--wt-radius-sm);
}

.analytics-chart__toggle--active {
  color: var(--wt-accent);
}

.analytics-chart canvas {
  width: 100%;
  max-height: 200px;
}

.analytics-chart__ranges {
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.analytics-chart__range {
  padding: 0.25rem 0.6rem;
  background: none;
  border: 1px solid var(--wt-border);
  border-radius: 999px;
  color: var(--wt-text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: color var(--wt-transition), border-color var(--wt-transition);
}

.analytics-chart__range--active {
  color: var(--wt-accent);
  border-color: var(--wt-accent);
}

.analytics-top-links {
  margin-top: 1.25rem;
}

.analytics-top-links__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--wt-border);
}

.analytics-top-links__title {
  color: var(--wt-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-top-links__clicks {
  color: var(--wt-text-muted);
  font-weight: 700;
  white-space: nowrap;
}

.analytics-monthly {
  margin-top: 1.25rem;
}

.analytics-monthly__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.analytics-monthly__table th,
.analytics-monthly__table td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--wt-border);
  color: var(--wt-text);
}

.analytics-monthly__table th {
  color: var(--wt-text-muted);
  font-weight: 600;
}

.analytics-export {
  margin-top: 1.25rem;
}

.link-row__clicks {
  font-size: 0.8rem;
  color: var(--wt-text-muted);
  white-space: nowrap;
}

.qr-code-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.qr-code-card__svg {
  align-self: stretch;
}

.qr-code-card__svg svg {
  display: block;
  width: 200px;
  height: 200px;
  margin: 0 auto;
}

.qr-code-card__svg svg path {
  fill: var(--wt-text);
}

.qr-code-card__caption {
  margin: 0;
  font-size: 0.9rem;
  color: var(--wt-text-muted);
}

/* ==========================================================================
   Dashboard tabs (Analytics / Links / Account)
   ========================================================================== */
.dashboard-tabs {
  width: 100%;
}

.dashboard-tabs__bar {
  display: flex;
  gap: 0.5rem;
  /* Tab bar sits on the dark body — use --wt-header so the divider and labels
     stay visible on light-surface themes. Falls back to accent. */
  border-bottom: 1px solid var(--wt-header, var(--wt-accent));
}

.dashboard-tabs__tab {
  padding: 0.6rem 0.9rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--wt-header, var(--wt-accent));
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.dashboard-tabs__tab:hover,
.dashboard-tabs__tab:focus-visible {
  color: var(--wt-header-hover, var(--wt-header, var(--wt-accent)));
}

.dashboard-tabs__tab--active {
  color: var(--wt-header, var(--wt-accent));
  border-bottom-color: var(--wt-header, var(--wt-accent));
}

.dashboard-tabs__panel {
  display: flex;
  flex-direction: column;
  gap: var(--wt-gap);
  padding-top: 1.25rem;
}

.dashboard-tabs__panel[hidden] {
  display: none;
}

/* Account tab sections */
.account-section {
  margin-bottom: 1.75rem;
}

.account-section:last-child {
  margin-bottom: 0;
}

.account-section__heading {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--wt-text);
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 500px;
  margin-inline: auto;
}

.account-form__note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--wt-text-muted);
}

/* Settings row: label text on the left, a themed toggle switch on the right. */
.toggle-field {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 1rem auto 0;
  cursor: pointer;
  color: var(--wt-text);
}

/* Quiet "admin setting" branding checkbox at the bottom of the Settings tab.
   The real checkbox is hidden; .settings-toggle__check is the custom visual. */
.settings-toggle {
  text-align: center;
  padding: 1.5rem 0;
}

.settings-toggle__label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--wt-text-muted, #6a6a6a);
  cursor: pointer;
  user-select: none;
}

.settings-toggle__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.settings-toggle__check {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--wt-border, #c0b8a8);
  border-radius: 3px;
  background: var(--wt-surface, #e8e0d8);
  transition: background 0.15s, border-color 0.15s;
  position: relative;
  flex-shrink: 0;
}

.settings-toggle__input:checked + .settings-toggle__check {
  background: #908478;
  border-color: #908478;
}

.settings-toggle__input:checked + .settings-toggle__check::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.settings-toggle__input:focus-visible + .settings-toggle__check {
  outline: 2px solid var(--wt-accent, #505050);
  outline-offset: 2px;
}

.toggle {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
}

/* The real checkbox sits invisibly over the track for clicks + keyboard focus. */
.toggle__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.toggle__track {
  display: inline-flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 2px;
  background: var(--wt-border);
  border-radius: 999px;
  transition: background var(--wt-transition);
}

.toggle__thumb {
  width: 20px;
  height: 20px;
  background: var(--wt-surface);
  border-radius: 50%;
  transition: transform var(--wt-transition);
}

.toggle__input:checked + .toggle__track {
  background: var(--wt-accent);
}

.toggle__input:checked + .toggle__track .toggle__thumb {
  transform: translateX(20px);
}

.toggle__input:focus-visible + .toggle__track {
  outline: 2px solid var(--wt-accent);
  outline-offset: 2px;
}

/* Form validation errors */
.form-errors {
  background: #3a1620;
  border: 1px solid #6a2533;
  border-radius: var(--wt-radius-sm);
  padding: 0.6rem 0.85rem;
  color: var(--wt-danger);
}

.form-errors__title {
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.form-errors__list {
  margin: 0;
  padding-left: 1.1rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--wt-radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--wt-transition), color var(--wt-transition), border-color var(--wt-transition);
}

.btn--primary {
  background: var(--wt-btn-primary);
  color: var(--wt-accent-contrast);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--wt-btn-primary-hover);
}

.btn--secondary {
  background: transparent;
  color: var(--wt-accent);
  border-color: var(--wt-border);
}

.btn--secondary:hover,
.btn--secondary:focus-visible {
  border-color: var(--wt-accent);
}

/* Disabled Undo/Redo (and any secondary button): dimmed, no hover affordance. */
.btn--secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn--secondary:disabled:hover,
.btn--secondary:disabled:focus-visible {
  border-color: var(--wt-border);
}

.btn--ghost {
  background: transparent;
  color: var(--wt-text-muted);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  color: var(--wt-text);
}

.btn--outline {
  background: transparent;
  color: var(--wt-accent);
  border-color: var(--wt-border);
}

.btn--outline:hover,
.btn--outline:focus-visible {
  border-color: var(--wt-accent);
}

/* Quiet, de-emphasized action (Reset All) — text only so it doesn't compete
   with Apply/Cancel. */
.btn--muted {
  background: transparent;
  border-color: transparent;
  color: var(--wt-text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
}

.btn--muted:hover,
.btn--muted:focus-visible {
  color: var(--wt-text);
}

.btn--sm {
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
}

/* ==========================================================================
   Focus + motion accessibility
   ========================================================================== */
.dashboard a:focus-visible,
.dashboard .btn:focus-visible,
.dashboard .icon-btn:focus-visible {
  outline: 2px solid var(--wt-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 600px) {
  .profile-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .link-row {
    flex-wrap: wrap;
  }

  /* Left-justify the action icons in a horizontal row */
  .link-row__actions {
    width: 100%;
    justify-content: flex-start;
    gap: 0.5rem;
  }

  /* Larger touch targets on mobile (WCAG 44x44) */
  .icon-btn {
    width: 44px;
    height: 44px;
  }
}

/* ==========================================================================
   Avatar sizing + edit trigger (hover/focus overlay)
   ========================================================================== */
.avatar--lg {
  width: 96px;
  height: 96px;
  font-size: 2.4rem;
}

.avatar-trigger {
  position: relative;
  display: block;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
}

.avatar-trigger .avatar {
  display: block;
}

.avatar-trigger__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  opacity: 0;
  transition: opacity var(--wt-transition);
}

.avatar-trigger:hover .avatar-trigger__overlay,
.avatar-trigger:focus-visible .avatar-trigger__overlay {
  opacity: 1;
}

.avatar-trigger:focus-visible {
  outline: 2px solid var(--wt-accent);
  outline-offset: 2px;
}

/* ==========================================================================
   Modal dialog
   ========================================================================== */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.6);
}

.modal-backdrop.is-open {
  display: flex;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 28rem;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--wt-surface);
  color: var(--wt-text);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.5);
}

.modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--wt-text-muted);
  border-radius: var(--wt-radius-sm);
  cursor: pointer;
  transition: color var(--wt-transition), background var(--wt-transition);
}

.modal__close:hover,
.modal__close:focus-visible {
  color: var(--wt-text);
  background: rgba(255, 255, 255, 0.08);
}

.modal__title {
  margin: 0 0 1.25rem;
  font-size: 1.25rem;
  text-align: center;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-form__actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Avatar uploader inside the modal */
.avatar-uploader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.avatar-uploader__label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.avatar-uploader__preview {
  position: relative;
  display: block;
  width: 96px;
  height: 96px;
}

.avatar-uploader__preview img.avatar:not([hidden]) {
  display: block;
}

.avatar-uploader__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  opacity: 0;
  transition: opacity var(--wt-transition);
}

.avatar-uploader__label:hover .avatar-uploader__overlay,
.avatar-uploader__label:focus-within .avatar-uploader__overlay {
  opacity: 1;
}

.avatar-uploader__label:focus-within .avatar-uploader__preview {
  outline: 2px solid var(--wt-accent);
  outline-offset: 2px;
  border-radius: 50%;
}

.avatar-uploader__text {
  font-size: 0.85rem;
  color: var(--wt-text-muted);
}

.avatar-uploader__label:focus-within .avatar-uploader__text {
  color: var(--wt-text);
}

@media (max-width: 600px) {
  .modal__close {
    width: 44px;
    height: 44px;
  }

  .modal-form__actions {
    flex-direction: column;
  }

  .modal-form__actions .btn {
    width: 100%;
    min-height: 44px;
  }
}

/* ==========================================================================
   Marketing site pages (home, about, pricing, contact)
   Uses the Wytchtree brand palette; Cormorant Garamond for headings.
   ========================================================================== */
.site {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--wt-bg);
  /* Body text across all site pages is muted; headings are the accent purple. */
  color: var(--wt-text-muted);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
}

.site h1,
.site h2,
.site h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 400;
  line-height: 1.15;
}

.site h1,
.site h2 {
  color: var(--wt-accent);
}

/* --- Site header --- */
.site-header {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem 1.5rem;
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  box-sizing: border-box;
}

/* Brand left, nav centered (auto column), auth right. */
.site-header__brand {
  justify-self: start;
}

.site-header__auth {
  justify-self: end;
}

/* Homepage hides the redundant header brand; keep the nav to the right. */
.site-header--no-brand .site-header__brand {
  visibility: hidden;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
}

.site-nav__link {
  color: var(--wt-text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.35rem 0;
  transition: color var(--wt-transition);
}

.site-nav__link:hover,
.site-nav__link:focus-visible {
  color: var(--wt-accent);
}

.site-nav__link--active {
  color: var(--wt-accent);
}

/* Auth buttons (desktop, logged-out only) */
.site-header__auth {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* On marketing pages the hamburger is mobile-only (shown below 640px). */
.site-header .hamburger-btn {
  display: none;
}

/* --- Main content area --- */
.site-main {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 1.5rem;
  box-sizing: border-box;
}

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 3rem 1rem 4rem;
}

.hero__logo {
  color: var(--wt-accent);
  margin: 0 auto 1rem;
}

.hero__logo .dashboard__logo {
  height: clamp(160px, 32vw, 240px);
}

.hero__title {
  margin: 0;
  font-size: clamp(2.75rem, 8vw, 4.5rem);
  font-style: italic;
  font-weight: 300;
  color: var(--wt-accent);
}

.hero__tagline {
  margin: 0.5rem auto 0;
  max-width: 32rem;
  font-size: 1.15rem;
  color: var(--wt-text-muted);
}

.hero__cta {
  margin-top: 2rem;
}

.hero__cta-note {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  color: var(--wt-text-muted);
}

/* --- Value propositions --- */
.value-props {
  padding: 2rem 0 3rem;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  margin: 0 0 1.25rem;
  color: var(--wt-text);
}

.value-props .section-title {
  text-align: center;
}

.value-props__list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.value-prop {
  background: var(--wt-surface);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius);
  padding: 1.5rem;
}

.value-prop__title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  color: var(--wt-accent);
}

.value-prop p {
  margin: 0;
  color: var(--wt-text-muted);
}

/* --- Generic content page (about, pricing, contact) --- */
.page {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
}

.page__title {
  font-size: clamp(2.25rem, 6vw, 3.25rem);
  margin: 0 0 0.75rem;
  color: var(--wt-accent);
  font-style: italic;
  font-weight: 300;
  text-align: center;
}

.page__lead {
  font-size: 1.15rem;
  color: var(--wt-text-muted);
  margin: 0 0 2rem;
}

/* Decorative heading: branch dividers flanking the title text. */
.branch-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 0 0 1.5rem;
  color: var(--wt-accent);
}

.branch-heading__text {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
  color: var(--wt-accent);
}

.branch-heading__branch {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

/* Branch SVGs use fill:currentColor, so they inherit the accent purple. */
.branch-svg {
  display: block;
  width: auto;
  height: 36px;
}

@media (max-width: 600px) {
  .branch-heading {
    gap: 0.6rem;
  }

  .branch-svg {
    height: 28px;
  }
}

/* Drop the branches on very narrow screens, leaving just the title. */
@media (max-width: 380px) {
  .branch-heading__branch {
    display: none;
  }
}

.page__section {
  margin-top: 2.5rem;
}

.page__section p {
  margin: 0 0 1rem;
}

.page__figure {
  margin: 2rem 0 0;
}

.page__image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--wt-radius);
}

/* Roomier on mobile, ~75% and centered on desktop. */
@media (min-width: 600px) {
  .page__image {
    width: 75%;
    margin-inline: auto;
  }
}

.page__caption {
  margin-top: 0.6rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--wt-text-muted);
}

/* --- Pricing --- */
/* Pricing page is wider so the three tiers sit in a row on desktop. */
.page--pricing {
  max-width: 60rem;
}

.pricing {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  margin: 2rem 0 1rem;
}

.pricing-tier {
  background: var(--wt-surface);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
}

.pricing-tier--featured {
  border-color: var(--wt-accent);
}

.pricing-tier__badge {
  align-self: flex-start;
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--wt-accent-contrast);
  background: var(--wt-accent);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
}

.pricing-tier__name {
  margin: 0;
  font-size: 2rem;
  color: var(--wt-text);
}

.pricing-tier__price {
  margin: 0.25rem 0 1rem;
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--wt-accent);
}

.pricing-tier__period {
  font-size: 1rem;
  font-weight: 400;
  color: var(--wt-text-muted);
}

.pricing-tier__currency {
  margin-left: 0.35em;
  font-size: 0.35em;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wt-text-muted);
  vertical-align: baseline;
}

.pricing-tier__bonus {
  margin: -0.5rem 0 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--wt-accent);
}

/* --- Monthly / Annual toggle --- */
.billing-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 0 0 2rem;
}

.billing-toggle__option {
  font-size: 0.95rem;
  color: var(--wt-text-muted);
  transition: color var(--wt-transition);
}

/* Annual is the default active option; flips when .is-monthly is set. */
.billing-toggle__option--annual {
  color: var(--wt-accent);
}

.page--pricing.is-monthly .billing-toggle__option--annual {
  color: var(--wt-text-muted);
}

.page--pricing.is-monthly .billing-toggle__option--monthly {
  color: var(--wt-accent);
}

.billing-toggle__switch {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--wt-border);
  border-radius: 999px;
  background: var(--wt-accent);
  cursor: pointer;
  transition: background var(--wt-transition);
}

.page--pricing.is-monthly .billing-toggle__switch {
  background: var(--wt-surface-alt);
}

.billing-toggle__switch:focus-visible {
  outline: 2px solid var(--wt-accent);
  outline-offset: 2px;
}

.billing-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  transform: translateX(24px);
  transition: transform var(--wt-transition);
}

.page--pricing.is-monthly .billing-toggle__thumb {
  transform: translateX(0);
}

/* Show one period's prices at a time; annual is the default. */
.page--pricing [data-period="monthly"] {
  display: none;
}

.page--pricing.is-monthly [data-period="monthly"] {
  display: block;
}

.page--pricing.is-monthly [data-period="annual"] {
  display: none;
}

/* Commerce tier zero-commission positioning */
.pricing-tier__callout {
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--wt-accent);
}

.pricing-tier__features {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

/* Pin the CTA to the bottom so cards align, leaving the callout directly
   beneath the bullets rather than floating in a gap. */
.pricing-tier .btn {
  margin-top: auto;
}

.pricing-tier__features li {
  padding: 0.35rem 0 0.35rem 1.5rem;
  position: relative;
  color: var(--wt-text-muted);
}

.pricing-tier__features li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--wt-accent);
}

/* Commerce review footnote (matches the * on the Commerce card) */
.pricing__footnote {
  max-width: 40rem;
  margin: 0.75rem auto 0;
  text-align: center;
  color: var(--wt-text-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

/* --- Contact --- */
.contact__email {
  font-size: 1.1rem;
}

.contact__email-link {
  color: var(--wt-accent);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 32rem;
  margin: 0 auto;
}

/* Contact page is centered: lead, section heading, and the form block. */
.page--contact .page__lead,
.page--contact .section-title {
  text-align: center;
}

/* Pricing subtitle is centered too. */
.page--pricing .page__lead {
  text-align: center;
}

.contact-form__note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--wt-text-muted);
}

/* --- Disabled placeholder buttons (registration/forms not wired up) --- */
.btn--disabled {
  cursor: not-allowed;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--wt-border);
  margin-top: 2rem;
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
  max-width: 1040px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0.5rem;
}

.site-footer__nav a {
  color: var(--wt-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.site-footer__nav a:hover,
.site-footer__nav a:focus-visible {
  color: var(--wt-accent);
}

.site-footer__copy {
  text-align: center;
  color: var(--wt-text-muted);
  font-size: 0.85rem;
  padding: 0 1.5rem 1.5rem;
  margin: 0.5rem 0 0;
}

@media (max-width: 640px) {
  /* Mobile: grid isn't needed for just logo + hamburger — use a simple flex row. */
  .site-header {
    display: flex;
    justify-content: space-between;
  }

  /* Mobile: desktop nav links and auth buttons collapse into the hamburger. */
  .site-nav,
  .site-header__auth {
    display: none;
  }

  .site-header .hamburger-btn {
    display: flex;
  }
}
