/*
 * Rudy Deelen – Main CSS
 * Design system on top of theme.json custom properties
 * ─────────────────────────────────────────────────────
 */

/* ═══════════════════════════════════════════════════════
   1. CSS Custom Properties (light mode defaults)
   ═══════════════════════════════════════════════════ */
:root {
  --rd-header-height: 64px;
  --rd-transition:    150ms cubic-bezier(0.4, 0, 0.2, 1);
  --rd-transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Map theme.json vars to short aliases */
  --rd-color-primary:      var(--wp--preset--color--primary);
  --rd-color-primary-dark: var(--wp--preset--color--primary-dark);
  --rd-color-text:         var(--wp--preset--color--text);
  --rd-color-muted:        var(--wp--preset--color--text-muted);
  --rd-color-border:       var(--wp--preset--color--border);
  --rd-color-bg:           var(--wp--preset--color--base);
  --rd-color-surface:      var(--wp--preset--color--surface);
}

/* ═══════════════════════════════════════════════════════
   2. Dark Mode
   ═══════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
  :root {
    --wp--preset--color--base:      #0F172A;
    --wp--preset--color--surface:   #1E293B;
    --wp--preset--color--text:      #F1F5F9;
    --wp--preset--color--text-muted:#94A3B8;
    --wp--preset--color--border:    #334155;
    --wp--preset--color--code-bg:   #0F172A;
    --wp--preset--color--primary:   #3B82F6;
  }
}

/* ═══════════════════════════════════════════════════════
   3. Global Base
   ═══════════════════════════════════════════════════ */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  min-height: 100svh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--wp--preset--color--base);
}

img, video { max-width: 100%; height: auto; }

/* Focus visible only */
:focus:not(:focus-visible) { outline: none; }
:focus-visible {
  outline: 2px solid var(--rd-color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════
   4. Header
   ═══════════════════════════════════════════════════ */
.rd-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(248,250,252,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rd-color-border);
  transition: box-shadow var(--rd-transition);
}

@media (prefers-color-scheme: dark) {
  .rd-header {
    background-color: rgba(15,23,42,0.85);
  }
}

.rd-header.is-scrolled {
  box-shadow: 0 1px 20px rgba(15,23,42,0.08);
}

.rd-header__inner {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--wp--preset--spacing--6);
}

.rd-header__tagline {
  display: none;
}
@media (min-width: 640px) {
  .rd-header__tagline {
    display: block;
    margin: 0 !important;
    padding-left: var(--wp--preset--spacing--3);
    border-left: 1px solid var(--rd-color-border);
  }
}

/* Mobile nav overlay */
.wp-block-navigation__responsive-container.is-menu-open {
  background-color: var(--wp--preset--color--base);
}

/* ═══════════════════════════════════════════════════════
   5. Hero Section
   ═══════════════════════════════════════════════════ */
.rd-hero {
  position: relative;
  overflow: hidden;
}

.rd-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 20%, rgba(37,99,235,0.06) 0%, transparent 60%),
    radial-gradient(circle at 20% 80%, rgba(30,58,138,0.04) 0%, transparent 50%);
  pointer-events: none;
}

.rd-hero__label {
  margin-bottom: var(--wp--preset--spacing--3) !important;
}

.rd-hero__title {
  max-width: 18ch;
}

.rd-hero__terminal {
  margin-top: var(--wp--preset--spacing--12);
  max-width: 480px;
}

@media (min-width: 1024px) {
  .rd-hero > .wp-block-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--wp--preset--spacing--16);
    align-items: center;
  }
  .rd-hero__title { max-width: none; }
  .rd-hero__terminal { margin-top: 0; }
}

/* ─── Terminal Widget ──────────────────────────────── */
.rd-terminal {
  background: #1E293B;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #334155;
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.8125rem;
  box-shadow: 0 20px 60px rgba(15,23,42,0.2), 0 4px 16px rgba(15,23,42,0.1);
}

.rd-terminal__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: #0F172A;
  border-bottom: 1px solid #334155;
}

.rd-terminal__dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rd-terminal__dot--red    { background: #EF4444; }
.rd-terminal__dot--yellow { background: #F59E0B; }
.rd-terminal__dot--green  { background: #10B981; }

.rd-terminal__title {
  margin-left: auto;
  color: #475569;
  font-size: 0.75rem;
}

.rd-terminal__body {
  padding: 20px 24px;
  line-height: 1.8;
}

.rd-terminal__body p {
  margin: 0;
  color: #94A3B8;
}

.rd-terminal__prompt {
  color: #10B981;
  user-select: none;
}

.rd-terminal__cmd {
  color: #E2E8F0;
  margin-left: 8px;
}

.rd-terminal__out {
  color: #64748B;
  padding-left: 20px;
}

.rd-terminal__cursor {
  animation: blink 1.2s step-end infinite;
  color: #3B82F6;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ═══════════════════════════════════════════════════════
   6. Stats Bar
   ═══════════════════════════════════════════════════ */
.rd-stats .wp-block-columns {
  gap: 0;
}

.rd-stat {
  text-align: center;
  padding: var(--wp--preset--spacing--4);
  border-right: 1px solid var(--rd-color-border);
}

.rd-stat:last-child { border-right: none; }

.rd-stat__num {
  margin: 0 !important;
  line-height: 1 !important;
}

/* ═══════════════════════════════════════════════════════
   7. Cards
   ═══════════════════════════════════════════════════ */
.rd-card {
  transition:
    transform var(--rd-transition-slow),
    box-shadow var(--rd-transition-slow);
}

.rd-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(15,23,42,0.1);
}

.rd-card .wp-block-post-featured-image img {
  transition: transform var(--rd-transition-slow);
}

.rd-card:hover .wp-block-post-featured-image img {
  transform: scale(1.02);
}

.rd-card .wp-block-post-featured-image {
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════
   8. Blog List (home.html)
   ═══════════════════════════════════════════════════ */
.rd-list-item:last-child {
  border-bottom: none !important;
}

/* ═══════════════════════════════════════════════════════
   9. Single Post
   ═══════════════════════════════════════════════════ */
.rd-single-content {
  /* Long-form reading typography */
  --content-font-size: clamp(1rem, 1.5vw, 1.125rem);
}

.rd-single-content .wp-block-post-content {
  font-size: var(--content-font-size);
  line-height: 1.75;
}

.rd-single-content .wp-block-post-content > * + * {
  margin-top: 1.5em;
}

.rd-single-content .wp-block-post-content h2,
.rd-single-content .wp-block-post-content h3 {
  margin-top: 2.5em;
  margin-bottom: 0.75em;
}

/* Inline code */
.rd-single-content .wp-block-post-content code:not(pre code) {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.875em;
  background: var(--wp--preset--color--primary-light);
  color: var(--wp--preset--color--primary-dark);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  border: 1px solid rgba(37,99,235,0.15);
}

@media (prefers-color-scheme: dark) {
  .rd-single-content .wp-block-post-content code:not(pre code) {
    background: rgba(59,130,246,0.1);
    color: #93C5FD;
    border-color: rgba(59,130,246,0.2);
  }
}

/* Author box */
.rd-author-box .wp-block-post-author {
  display: flex;
  gap: var(--wp--preset--spacing--5);
  align-items: flex-start;
}

/* ═══════════════════════════════════════════════════════
   10. CTA Section
   ═══════════════════════════════════════════════════ */
.rd-cta {
  position: relative;
  overflow: hidden;
}

.rd-cta::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(37,99,235,0.12) 0%, transparent 70%);
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════
   11. Pagination
   ═══════════════════════════════════════════════════ */
.rd-pagination .wp-block-query-pagination {
  display: flex;
  justify-content: center;
  gap: var(--wp--preset--spacing--2);
  margin-top: var(--wp--preset--spacing--12);
}

.rd-pagination .wp-block-query-pagination-numbers a,
.rd-pagination .wp-block-query-pagination-previous,
.rd-pagination .wp-block-query-pagination-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding-inline: var(--wp--preset--spacing--3);
  border-radius: var(--wp--custom--border-radius--md);
  border: 1px solid var(--rd-color-border);
  font-size: var(--wp--preset--font-size--sm);
  font-weight: 500;
  color: var(--rd-color-text);
  text-decoration: none;
  transition: all var(--rd-transition);
  background: var(--wp--preset--color--surface);
}

.rd-pagination .wp-block-query-pagination-numbers .current,
.rd-pagination .wp-block-query-pagination-numbers a:hover,
.rd-pagination .wp-block-query-pagination-previous:hover,
.rd-pagination .wp-block-query-pagination-next:hover {
  background: var(--rd-color-primary);
  border-color: var(--rd-color-primary);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════
   12. Footer
   ═══════════════════════════════════════════════════ */
.rd-footer .rd-footer__nav .wp-block-navigation__container {
  flex-direction: column;
  gap: var(--wp--preset--spacing--3);
}

.rd-footer .wp-block-navigation-item__content {
  color: #94A3B8 !important;
  font-size: var(--wp--preset--font-size--sm);
  text-decoration: none;
  transition: color var(--rd-transition);
}

.rd-footer .wp-block-navigation-item__content:hover {
  color: #ffffff !important;
}

/* ═══════════════════════════════════════════════════════
   13. Buttons
   ═══════════════════════════════════════════════════ */
.wp-element-button {
  cursor: pointer;
  transition:
    background-color var(--rd-transition),
    border-color var(--rd-transition),
    transform var(--rd-transition),
    box-shadow var(--rd-transition);
}

.wp-element-button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(37,99,235,0.3);
}

.wp-element-button:active {
  transform: translateY(0);
}

.rd-btn-join .wp-element-button {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ═══════════════════════════════════════════════════════
   14. Utilities
   ═══════════════════════════════════════════════════ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* Skip to content */
.skip-link {
  position: absolute;
  left: var(--wp--preset--spacing--4);
  top: var(--wp--preset--spacing--4);
  background: var(--rd-color-primary);
  color: #fff;
  padding: var(--wp--preset--spacing--2) var(--wp--preset--spacing--5);
  border-radius: var(--wp--custom--border-radius--md);
  font-weight: 600;
  z-index: 9999;
  text-decoration: none;
  transform: translateY(-100px);
  transition: transform var(--rd-transition);
}
.skip-link:focus { transform: translateY(0); }

/* ═══════════════════════════════════════════════════════
   15. wp-block resets
   ═══════════════════════════════════════════════════ */
.wp-block-site-title a {
  text-decoration: none;
  color: inherit;
}

/* Remove WP block default margins */
.wp-block-query { margin: 0; }
