/* Base rules, design tokens, accessibility, typography, and foundational utilities. */

/* ========================================================================== */
/* DAFY.SITE                                   */
/* ========================================================================== */

/* -------------------------------------------------------------------------- */
/* DESIGN TOKENS                                                              */
/* -------------------------------------------------------------------------- */

:root {
  --dafy-surface-0: #111111;
  --dafy-surface-1: #1a1a1a;
  --dafy-surface-2: #1f1f1f;
  --dafy-surface-3: #202020;
  --dafy-surface-4: #222222;
  --dafy-surface-5: #2a2a2a;
  --dafy-surface-hover: #303030;

  --dafy-border: #333333;
  --dafy-border-strong: #444444;
  --dafy-border-soft: rgba(255, 255, 255, 0.07);

  --dafy-text: #f5f5f5;
  --dafy-text-secondary: #d7d7dd;
  --dafy-text-muted: #cccccc;
  --dafy-text-soft: #bbbbbb;
  --dafy-text-dark: #111111;

  --dafy-orange: #ff6600;
  --dafy-orange-hover: #ff8534;
  --dafy-yellow: #fcec07;
  --dafy-yellow-deep: #d4af37;
  --dafy-danger: #e85a33;

  /* Semantic button tokens. Components can keep their own base style,
     while the final interaction layer uses one shared hover/focus contract. */
  --dafy-button-bg: var(--dafy-orange);
  --dafy-button-border: rgba(255, 102, 0, 0.95);
  --dafy-button-text: var(--dafy-text-dark);
  --dafy-button-hover-bg: var(--dafy-yellow);
  --dafy-button-hover-border: var(--dafy-yellow);
  --dafy-button-hover-text: var(--dafy-text-dark);
  --dafy-button-shadow: var(--dafy-shadow-orange);
  --dafy-button-hover-shadow: var(--dafy-shadow-yellow);

  --dafy-orange-06: rgba(255, 102, 0, 0.06);
  --dafy-orange-10: rgba(255, 102, 0, 0.10);
  --dafy-orange-16: rgba(255, 102, 0, 0.16);
  --dafy-orange-24: rgba(255, 102, 0, 0.24);
  --dafy-orange-38: rgba(255, 102, 0, 0.38);
  --dafy-yellow-12: rgba(252, 236, 7, 0.12);
  --dafy-yellow-22: rgba(252, 236, 7, 0.22);
  --dafy-yellow-32: rgba(252, 236, 7, 0.32);

  --dafy-radius-xs: 6px;
  --dafy-radius-sm: 8px;
  --dafy-radius-md: 12px;
  --dafy-radius-lg: 16px;
  --dafy-radius-xl: 20px;
  --dafy-radius-card: 22px;
  --dafy-radius-pill: 999px;

  /* Compact shadows retain depth while reducing large repainted areas. */
  --dafy-shadow-xs: 0 3px 10px rgba(0, 0, 0, 0.20);
  --dafy-shadow-sm: 0 6px 16px rgba(0, 0, 0, 0.24);
  --dafy-shadow-md: 0 10px 24px rgba(0, 0, 0, 0.30);
  --dafy-shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.36);
  --dafy-shadow-orange: 0 10px 24px rgba(255, 102, 0, 0.18);
  --dafy-shadow-yellow: 0 10px 24px rgba(252, 236, 7, 0.18);
  --dafy-shadow-header: 0 8px 24px rgba(0, 0, 0, 0.32);

  --dafy-content-surface: #151515;
  --dafy-content-surface-deep: #101010;
  --dafy-content-surface-hover: #1b1b1b;
  --dafy-content-surface-border: rgba(255, 255, 255, 0.10);
  --dafy-content-surface-border-strong: rgba(255, 255, 255, 0.15);
  --dafy-content-surface-shadow: var(--dafy-shadow-md);

  --dafy-duration-fast: 180ms;
  --dafy-duration-base: 280ms;
  --dafy-ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --dafy-content-width: 900px;
  --dafy-archive-width: 1240px;
  --dafy-control-height: 46px;
  --dafy-list-gap: 8px;
  --dafy-list-padding-y: 12px;
  --dafy-button-radius: var(--dafy-radius-md);
  --dafy-sheen-duration: 6.4s;

  /* Backward compatibility with the previous variable names. */
  --surface-1: var(--dafy-surface-3);
  --surface-2: var(--dafy-surface-1);
  --surface-3: var(--dafy-surface-2);
  --surface-4: var(--dafy-surface-4);
  --surface-5: var(--dafy-surface-5);
  --border-color: var(--dafy-border);
  --border-strong: var(--dafy-border-strong);
  --text-primary: var(--dafy-text);
  --text-secondary: var(--dafy-text-secondary);
  --text-muted: var(--dafy-text-muted);
  --text-soft: var(--dafy-text-soft);
  --accent-primary: var(--dafy-orange);
  --accent-primary-hover: var(--dafy-orange-hover);
  --accent-secondary: var(--dafy-yellow);
  --accent-secondary-deep: var(--dafy-yellow-deep);
  --accent-danger: var(--dafy-danger);
  --radius-sm: var(--dafy-radius-sm);
  --radius-md: var(--dafy-radius-md);
  --radius-lg: var(--dafy-radius-lg);
  --radius-xl: var(--dafy-radius-xl);
  --shadow-sm: var(--dafy-shadow-sm);
  --shadow-md: var(--dafy-shadow-md);
  --shadow-lg: var(--dafy-shadow-lg);
  --transition-fast: var(--dafy-duration-fast) var(--dafy-ease);
  --transition-base: var(--dafy-duration-base) var(--dafy-ease);
  --content-max-width: var(--dafy-content-width);
}

/* -------------------------------------------------------------------------- */
/* BASE AND ACCESSIBILITY                                                      */
/* -------------------------------------------------------------------------- */

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

:where(img, svg, video, canvas, iframe) {
  max-width: 100%;
}

:where(.ct-media-container img, figure.wp-block-image img, figure.ct-featured-image img, .entry-content img) {
  display: block;
  height: auto;
}

:where(a, button, input, select, textarea, summary, [tabindex]) {
  -webkit-tap-highlight-color: transparent;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--dafy-yellow);
  outline-offset: 3px;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* -------------------------------------------------------------------------- */
/* TYPOGRAPHY AND CONTENT RHYTHM                                               */
/* -------------------------------------------------------------------------- */

.entry-content p {
  margin-block: 0 1.5em;
  line-height: 1.7;
}

.single .entry-content h2,
.page:not(.home) .entry-content h2 {
  margin-top: 80px;
  margin-bottom: 0.65em;
  margin-block: clamp(52px, 6vw, 80px) 0.65em;
  scroll-margin-top: 24px;
}

.single .entry-content h3,
.page:not(.home) .entry-content h3 {
  margin-block: 35px 0.55em;
}

.single .entry-content h2 + h3,
.page:not(.home) .entry-content h2 + h3 {
  margin-top: 45px;
}

.single .entry-content :where(.wp-block-blocksy-query, .custom-faq-item) h2,
.single .entry-content :where(.wp-block-blocksy-query, .custom-faq-item) h3,
.page:not(.home) .entry-content :where(.wp-block-blocksy-query, .custom-faq-item) h2,
.page:not(.home) .entry-content :where(.wp-block-blocksy-query, .custom-faq-item) h3,
.no-heading-spacing :where(h2, h3) {
  margin-top: 0 !important;
}

.no-spacing {
  margin-block: 0 !important;
}

/* Editorial list spacing is defined in section 11. */

/* Text links inside articles and pages.
   Button links are excluded from link typography so link hover states
   cannot change button text color. */
.entry-content a:not(:is(
  [role="button"],
  [class*="button"],
  [class*="btn"],
  .wp-block-button__link,
  .wp-element-button,
  .ct-button,
  .ct-button-outline,
  .cta-link-button,
  .entry-button,
  .game-buy-box__button,
  .ct-load-more,
  .ct-cookies-accept-button,
  .ct-cookies-decline-button,
  .dark-button,
  .dark-outline-button,
  .gog-button,
  .gmg-button,
  .dg-button,
  .dg-hero__nav a,
  .dg-card__link,
  .dg-game__button,
  .dafy-support-card__button
)) {
  transition: color var(--dafy-duration-fast) var(--dafy-ease);
}

.entry-content a:not(:is(
  [role="button"],
  [class*="button"],
  [class*="btn"],
  .wp-block-button__link,
  .wp-element-button,
  .ct-button,
  .ct-button-outline,
  .cta-link-button,
  .entry-button,
  .game-buy-box__button,
  .ct-load-more,
  .ct-cookies-accept-button,
  .ct-cookies-decline-button,
  .dark-button,
  .dark-outline-button,
  .gog-button,
  .gmg-button,
  .dg-button,
  .dg-hero__nav a,
  .dg-card__link,
  .dg-game__button,
  .dafy-support-card__button
)):hover,
.entry-content a:not(:is(
  [role="button"],
  [class*="button"],
  [class*="btn"],
  .wp-block-button__link,
  .wp-element-button,
  .ct-button,
  .ct-button-outline,
  .cta-link-button,
  .entry-button,
  .game-buy-box__button,
  .ct-load-more,
  .ct-cookies-accept-button,
  .ct-cookies-decline-button,
  .dark-button,
  .dark-outline-button,
  .gog-button,
  .gmg-button,
  .dg-button,
  .dg-hero__nav a,
  .dg-card__link,
  .dg-game__button,
  .dafy-support-card__button
)):focus-visible {
  color: var(--dafy-yellow) !important;
}

/* -------------------------------------------------------------------------- */
/* DECORATIVE PAGE HEADINGS                                                    */
/* -------------------------------------------------------------------------- */

:where(.ct-advanced-heading[title], .blog .page-title[title], .page .page-title[title]) {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

:where(.ct-advanced-heading[title], .blog .page-title[title], .page .page-title[title])::after {
  content: attr(title);
  position: absolute;
  inset: -7% 0 0;
  z-index: -1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--theme-palette-color-7, rgba(255, 255, 255, 0.05));
  font-size: clamp(50px, 15vw, 200px);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  text-shadow:
    -1px 0 rgba(255, 255, 255, 0.1),
    0 1px rgba(255, 255, 255, 0.1),
    1px 0 rgba(255, 255, 255, 0.1),
    0 -1px rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.ct-advanced-heading[title]::after {
  font-size: clamp(70px, 10vw, 140px);
}

@media (min-width: 690px) {
  .ct-advanced-heading[title]::after {
    justify-content: flex-start;
  }
}

/* -------------------------------------------------------------------------- */
/* MOTION UTILITIES                                                            */
/* -------------------------------------------------------------------------- */

@keyframes dafy-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.hover-zoom {
  transition: transform var(--dafy-duration-base) var(--dafy-ease);
}

.hover-zoom:hover {
  transform: scale(1.06);
}

.pulse-image {
  animation: dafy-pulse 3s infinite;
  transition: transform var(--dafy-duration-base) var(--dafy-ease);
}

.pulse-image:hover {
  animation: none;
  transform: scale(1.1);
}

.entry-content img:not(.author-image) {
  border-radius: var(--dafy-radius-xl);
}

:where(.wp-block-image-donation img, .ad-banner) {
  border-radius: 0 !important;
}

.wp-block-donation-link img {
  border-radius: var(--dafy-radius-xl);
}

/* -------------------------------------------------------------------------- */
