/*
Theme Name: Svoboda Donate
Description: Minimal donation theme for Leyka campaigns. Matches svoboda.kik.cat editorial design.
Version: 1.0.0
Author: Svoboda Media
Text Domain: svoboda-donate
*/

/* ===================================================================
   Design tokens — mirroring main site globals.css
   =================================================================== */
:root {
  --font-serif: "IBM Plex Serif", "PT Serif", Georgia, "Times New Roman", serif;
  --font-sans: "IBM Plex Sans", "Noto Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --color-accent: #4a7c9b;
  --color-accent-hover: #3a6580;
  --color-accent-subtle: #4a7c9b1a;
  --neutral-900: #171717;
  --neutral-800: #262626;
  --neutral-700: #404040;
  --neutral-600: #525252;
  --neutral-500: #737373;
  --neutral-400: #a3a3a3;
  --neutral-300: #d4d4d4;
  --neutral-200: #e5e5e5;
  --neutral-100: #f5f5f5;
  --white: #ffffff;
  --radius-sm: 2px;
  --radius-md: 4px;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================================================
   Reset & base
   =================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.556;
  color: var(--neutral-900);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection {
  background: var(--neutral-900);
  color: var(--white);
}

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

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-hover);
}

/* Focus — matches main site */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--neutral-900);
  outline-offset: 2px;
}

/* ===================================================================
   Layout shell
   =================================================================== */
.donate-page {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.donate-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--neutral-200);
}

.donate-header__inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.donate-header__logo {
  display: block;
  height: 28px;
  width: auto;
  transition: opacity var(--transition-fast);
}

.donate-header__logo:hover {
  opacity: 0.7;
}

.donate-header__back {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--neutral-500);
  display: flex;
  align-items: center;
  gap: 0.375rem;
  transition: color var(--transition-fast);
}

.donate-header__back:hover {
  color: var(--neutral-900);
}

.donate-header__back svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.donate-main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.donate-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--neutral-200);
  text-align: center;
}

.donate-footer__text {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--neutral-400);
  letter-spacing: 0.04em;
}

.donate-footer__text a {
  color: var(--neutral-500);
  border-bottom: 1px solid var(--neutral-300);
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.donate-footer__text a:hover {
  color: var(--neutral-900);
  border-color: var(--neutral-900);
}

/* ===================================================================
   Campaign header
   =================================================================== */
.campaign-title {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
}

.campaign-excerpt {
  color: var(--neutral-600);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* Thin decorative rule between campaign info and form */
.campaign-divider {
  border: none;
  height: 1px;
  background: var(--neutral-200);
  margin: 0 0 2rem;
}

/* ===================================================================
   Leyka form — full styling
   =================================================================== */

/* Main container reset */
.leyka-pf {
  width: 100%;
}

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

/* ---- Sections ---- */
.leyka-pf .section {
  margin-bottom: 2rem;
}

.leyka-pf .section--description {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--neutral-600);
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--neutral-100);
  border-left: 3px solid var(--color-accent);
}

/* ---- Section titles ---- */
.leyka-pf .section-title-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.leyka-pf .section-title-line {
  flex: 1;
  height: 1px;
  background: var(--neutral-200);
  display: none; /* cleaner without the line in our minimal design */
}

.leyka-pf .section-title-text {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--neutral-500);
}

/* ---- Periodicity tabs (Recurring / Single) ---- */
.leyka-pf .section--periodicity {
  margin-bottom: 1.5rem;
}

.leyka-pf .periodicity {
  display: flex;
  gap: 0;
  background: var(--neutral-100);
  padding: 3px;
}

.leyka-pf .periodicity a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--neutral-500);
  text-decoration: none;
  transition: all var(--transition-fast);
  text-align: center;
}

.leyka-pf .periodicity a:hover {
  color: var(--neutral-700);
}

.leyka-pf .periodicity a.active {
  background: var(--white);
  color: var(--neutral-900);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ---- Currency tabs ---- */
.leyka-pf .section--currencies {
  margin-bottom: 1.5rem;
}

.leyka-pf .currencies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.leyka-pf .currencies a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 3rem;
  height: 2.5rem;
  padding: 0 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--neutral-600);
  background: var(--white);
  border: 1px solid var(--neutral-300);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.leyka-pf .currencies a:hover {
  border-color: var(--neutral-900);
  color: var(--neutral-900);
}

.leyka-pf .currencies a.active {
  background: var(--neutral-900);
  border-color: var(--neutral-900);
  color: var(--white);
}

/* ---- Amount swiper / grid ---- */
.leyka-pf .amount__figure {
  position: relative;
}

/* Hide swiper arrows — we use a flat grid */
.leyka-pf .star-swiper .swiper-arrow,
.leyka-pf .star-swiper .arrow-gradient {
  display: none !important;
}

.leyka-pf .full-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.leyka-pf .swiper-item {
  flex: 0 0 auto;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.leyka-pf .swiper-item .swiper-item-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 5rem;
  height: 3rem;
  padding: 0 1rem;
  border: 1px solid var(--neutral-300);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  color: var(--neutral-700);
  background: var(--white);
  transition: all var(--transition-fast);
}

.leyka-pf .swiper-item:hover .swiper-item-inner {
  border-color: var(--neutral-900);
  color: var(--neutral-900);
}

.leyka-pf .swiper-item.selected .swiper-item-inner {
  background: var(--neutral-900);
  border-color: var(--neutral-900);
  color: var(--white);
}

.leyka-pf .swiper-item .amount {
  font-variant-numeric: tabular-nums;
}

.leyka-pf .swiper-item .currency {
  font-size: 0.8125rem;
  opacity: 0.7;
}

/* Flex (custom) amount input */
.leyka-pf .flex-amount-item {
  flex: 1 1 100%;
  margin-top: 0.25rem;
}

.leyka-pf .flex-amount-item .swiper-item-inner {
  width: 100%;
  min-width: unset;
  padding: 0;
  border: none !important;
  background: transparent !important;
  flex-direction: column;
  align-items: stretch;
  height: auto;
  gap: 0.375rem;
  color: var(--neutral-700) !important;
}

/* Prevent selected state from applying dark bg to flex-amount wrapper */
.leyka-pf .flex-amount-item.selected .swiper-item-inner {
  background: transparent !important;
  color: var(--neutral-700) !important;
}

.leyka-pf .flex-amount-item .textfield-label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--neutral-500);
  letter-spacing: 0.02em;
}

.leyka-pf .flex-amount-item input[type="number"] {
  width: 100%;
  height: 3rem;
  padding: 0 1rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  color: var(--neutral-900);
  background: var(--white);
  border: 1px solid var(--neutral-300);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  -moz-appearance: textfield;
  appearance: textfield;
}

.leyka-pf .flex-amount-item input[type="number"]::-webkit-inner-spin-button,
.leyka-pf .flex-amount-item input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.leyka-pf .flex-amount-item input[type="number"]:focus {
  outline: none;
  border-color: var(--neutral-900);
  box-shadow: 0 0 0 1px var(--neutral-900);
}

/* Active state: accent border instead of dark fill */
.leyka-pf .flex-amount-item.selected input[type="number"] {
  border-color: var(--neutral-900);
  box-shadow: 0 0 0 1px var(--neutral-900);
}

/* Amount descriptions (hidden by Leyka, keep hidden) */
.leyka-pf .amount-description {
  display: none !important;
}

/* ---- Payment method cards ---- */
.leyka-pf .section--cards {
  margin-bottom: 1.5rem;
}

.leyka-pf .payments-grid .full-list {
  gap: 0.5rem;
}

.leyka-pf .payment-opt {
  cursor: pointer;
}

.leyka-pf .payment-opt .swiper-item-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.625rem;
  min-width: unset;
  width: 100%;
  height: auto;
  padding: 1rem 1.25rem;
  border: 1px solid var(--neutral-300);
  transition: all var(--transition-fast);
}

.leyka-pf .payment-opt:hover .swiper-item-inner {
  border-color: var(--neutral-900);
}

.leyka-pf .payment-opt.selected .swiper-item-inner {
  border-color: var(--neutral-900);
  background: var(--neutral-100);
}

.leyka-pf .payment-opt__button {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.leyka-pf .payment-opt__radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.leyka-pf .payment-opt__icon {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.leyka-pf .payment-opt__icon img {
  height: 24px;
  width: auto;
}

.leyka-pf .payment-opt__label {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--neutral-600);
}

.leyka-pf .payment-opt__label b {
  font-weight: 500;
  color: var(--neutral-500);
}

/* ---- Donor fields ---- */
.leyka-pf .section--person {
  margin-bottom: 1.5rem;
}

.leyka-pf .donor {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.leyka-pf .donor__textfield {
  width: 100%;
}

.leyka-pf .leyka-star-field-frame {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.leyka-pf .donor__textfield-label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--neutral-500);
  letter-spacing: 0.02em;
}

.leyka-pf .donor__textfield input[type="text"] {
  width: 100%;
  height: 3rem;
  padding: 0 1rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--neutral-900);
  background: var(--white);
  border: 1px solid var(--neutral-300);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.leyka-pf .donor__textfield input[type="text"]::placeholder {
  color: var(--neutral-400);
}

.leyka-pf .donor__textfield input[type="text"]:focus {
  outline: none;
  border-color: var(--neutral-900);
  box-shadow: 0 0 0 1px var(--neutral-900);
}

/* Error state */
.leyka-pf .leyka-star-field-error-frame {
  margin-top: 0.25rem;
}

.leyka-pf .donor__textfield-error {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: #dc2626;
  display: none;
}

.leyka-pf .donor__textfield.has-error input[type="text"] {
  border-color: #dc2626;
}

.leyka-pf .donor__textfield.has-error .donor__textfield-error {
  display: block;
}

/* ---- Checkboxes (oferta, personal data) ---- */
.leyka-pf .donor__oferta {
  margin-top: 0.5rem;
}

.leyka-pf .donor__oferta > span {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.leyka-pf .donor__oferta input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.leyka-pf .donor__oferta label {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--neutral-600);
  cursor: pointer;
  padding-left: 1.875rem;
  position: relative;
}

/* Custom checkbox */
.leyka-pf .donor__oferta label::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  width: 1.125rem;
  height: 1.125rem;
  border: 1.5px solid var(--neutral-300);
  background: var(--white);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.leyka-pf .donor__oferta input[type="checkbox"]:checked + label::before {
  background: var(--neutral-900);
  border-color: var(--neutral-900);
}

.leyka-pf .donor__oferta input[type="checkbox"]:checked + label::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 5px;
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--white);
  border-bottom: 2px solid var(--white);
  transform: rotate(-45deg);
}

.leyka-pf .donor__oferta input[type="checkbox"]:focus-visible + label::before {
  outline: 2px solid var(--neutral-900);
  outline-offset: 2px;
}

/* Hide Leyka's SVG checkbox icon */
.leyka-pf .donor__oferta .svg-icon {
  display: none;
}

.leyka-pf .donor__oferta a {
  color: var(--color-accent);
  border-bottom: 1px solid var(--color-accent);
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.leyka-pf .donor__oferta a:hover {
  color: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

/* ---- Submit button ---- */
.leyka-pf .donor__submit {
  margin-top: 1.5rem;
}

.leyka-pf .donor__submit input[type="submit"] {
  display: block;
  width: 100%;
  height: 3.5rem;
  padding: 0 2rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--neutral-900);
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast), opacity var(--transition-fast);
}

.leyka-pf .donor__submit input[type="submit"]:hover:not(:disabled) {
  background: var(--neutral-800);
}

.leyka-pf .donor__submit input[type="submit"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.leyka-pf .donor__submit input[type="submit"]:focus-visible {
  outline: 2px solid var(--neutral-900);
  outline-offset: 2px;
}

/* Single PM icon row below submit — payment logos */
.leyka-pf .single-pm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
  opacity: 0.4;
}

.leyka-pf .single-pm-icon img {
  height: 20px;
  width: auto;
}

/* ---- Leyka signature ---- */
.leyka-pf .section--signature {
  margin-top: 2.5rem;
  text-align: center;
}

#leyka-platform-signature {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  color: var(--neutral-400);
  letter-spacing: 0.02em;
}

#leyka-platform-signature a {
  color: var(--neutral-500);
  border-bottom: 1px solid transparent;
  transition: all var(--transition-fast);
}

#leyka-platform-signature a:hover {
  color: var(--neutral-900);
  border-bottom-color: var(--neutral-900);
}

#leyka-signature-icon {
  display: none;
}

/* ---- Agreement overlay (oferta, PD) ---- */
.leyka-pf__overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  backdrop-filter: blur(2px);
}

.leyka-pf__agreement {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  padding: 1.5rem;
  overflow-y: auto;
  background: var(--white);
}

.leyka-pf__agreement .agreement__frame {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.leyka-pf__agreement .agreement__flow {
  font-family: var(--font-serif);
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--neutral-700);
}

.leyka-pf__agreement .agreement__flow p {
  margin-bottom: 0.75rem;
}

.leyka-pf__agreement .agreement__close {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 3.5rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--neutral-900);
  text-decoration: none;
  transition: background var(--transition-fast);
}

.leyka-pf__agreement .agreement__close:hover {
  background: var(--neutral-800);
  color: var(--white);
}

/* ---- Redirect / loading overlay ---- */
.leyka-pf__redirect {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1001;
  background: var(--white);
}

.leyka-pf__redirect .waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.leyka-pf__redirect .waiting__card {
  text-align: center;
  padding: 2rem;
}

.leyka-pf__redirect .waiting__card-text {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--neutral-600);
  margin-top: 1rem;
}

/* Spinner */
.leyka-spinner-border {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--neutral-200);
  border-top-color: var(--neutral-900);
  border-radius: 50%;
  animation: leyka-spin 0.75s linear infinite;
}

@keyframes leyka-spin {
  to { transform: rotate(360deg); }
}

/* ---- Submit errors ---- */
#leyka-submit-errors {
  margin-top: 1rem;
  padding: 0.875rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #dc2626;
  background: #fef2f2;
  border-left: 3px solid #dc2626;
}

/* ---- Hidden currency tabs ---- */
.leyka-pf .leyka-hidden {
  display: none !important;
}

/* ===================================================================
   Campaign archive / listing
   =================================================================== */
.campaign-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.campaign-card {
  display: block;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--neutral-200);
  transition: border-color var(--transition-fast);
}

.campaign-card:hover {
  border-color: var(--neutral-900);
}

.campaign-card__title {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--neutral-900);
  margin-bottom: 0.25rem;
}

.campaign-card__meta {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--neutral-500);
  letter-spacing: 0.04em;
}

/* ===================================================================
   Responsive
   =================================================================== */
@media (min-width: 640px) {
  .donate-header {
    padding: 1.5rem 2rem;
  }

  .donate-main {
    padding: 3rem 2rem 5rem;
  }

  .leyka-pf .periodicity a {
    font-size: 0.875rem;
    padding: 0.75rem 1.25rem;
  }

  .leyka-pf .swiper-item .swiper-item-inner {
    min-width: 5.5rem;
    height: 3.25rem;
    font-size: 1.0625rem;
  }
}

/* ===================================================================
   Print — hide chrome, show form cleanly
   =================================================================== */
@media print {
  .donate-header,
  .donate-footer,
  .leyka-pf .donor__submit,
  .leyka-pf .section--signature {
    display: none;
  }
}

/* ===================================================================
   Reduced motion
   =================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
