/* ═══════════════════════════════════════════════════════════════════════
   UDM GLOBAL DESIGN SYSTEM
   Foundation for every page. Tokens + typography + grid texture + components.
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── 1. Color tokens ─────────────────────────────────────────────────── */
:root {
    /* Backgrounds */
    --udm-bg-primary:    #090D0A;
    --udm-bg-section:    #0D1410;
    --udm-bg-card:       #111A14;
    --udm-bg-card-hover: #162119;
    --udm-bg-input:      #0F1712;

    /* Green palette */
    --udm-green:         #22C55E;
    --udm-green-bright:  #4ADE80;
    --udm-green-dim:     #166534;
    --udm-green-deep:    #052E16;
    --udm-green-glow:    rgba(34, 197, 94, 0.08);

    /* Text */
    --udm-text-primary:  #F0FDF4;
    --udm-text-secondary:rgba(240, 253, 244, 0.60);
    --udm-text-muted:    rgba(240, 253, 244, 0.35);
    --udm-text-code:     #86EFAC;

    /* Borders */
    --udm-border:        rgba(34, 197, 94, 0.15);
    --udm-border-bright: rgba(34, 197, 94, 0.35);
    --udm-border-card:   rgba(34, 197, 94, 0.12);

    /* Grid texture */
    --udm-grid-line:     rgba(34, 197, 94, 0.11);
    --udm-grid-size:     38px;

    /* Shadows */
    --udm-shadow-card:   0 4px 24px rgba(0, 0, 0, 0.40);
    --udm-shadow-glow:   0 0 40px rgba(34, 197, 94, 0.20);
    --udm-shadow-btn:    0 0 28px rgba(34, 197, 94, 0.30);

    /* Spacing & radius */
    --udm-section-py:    100px;
    --udm-section-py-sm: 60px;
    --udm-max-width:     1100px;
    --udm-radius:        10px;
    --udm-radius-sm:     6px;
    --udm-radius-pill:   100px;
}

/* ─── 2. Base / typography ────────────────────────────────────────────── */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--udm-bg-primary);
    color: var(--udm-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
    overflow-x: hidden;
}

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

a {
    color: var(--udm-green);
    text-decoration: none;
    transition: color 0.2s ease;
}
a:hover { color: var(--udm-green-bright); }

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 0.5em 0;
    font-weight: 700;
    color: var(--udm-text-primary);
    letter-spacing: -0.02em;
}

p { margin: 0 0 1em 0; }

/* Type scale */
.udm-display    { font-size: clamp(40px, 5vw, 64px); font-weight: 800; line-height: 1.08; letter-spacing: -0.03em; }
.udm-h1         { font-size: clamp(32px, 4vw, 52px);  font-weight: 800; line-height: 1.12; letter-spacing: -0.025em; }
.udm-h2         { font-size: clamp(26px, 3vw, 40px);  font-weight: 700; line-height: 1.18; letter-spacing: -0.02em; }
.udm-h3         { font-size: clamp(18px, 2vw, 24px);  font-weight: 600; line-height: 1.3; }
.udm-body-lg    { font-size: 18px; line-height: 1.72; font-weight: 400; }
.udm-body       { font-size: 16px; line-height: 1.68; font-weight: 400; }
.udm-body-sm    { font-size: 14px; line-height: 1.6;  font-weight: 400; }
.udm-label      { font-size: 12px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; }
.udm-mono       { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 13px; }

/* ─── 3. Grid texture (signature visual) ──────────────────────────────── */
.udm-grid-bg {
    background-color: var(--udm-bg-primary);
    background-image:
        linear-gradient(to right, var(--udm-grid-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--udm-grid-line) 1px, transparent 1px);
    background-size: var(--udm-grid-size) var(--udm-grid-size);
}

.udm-grid-bg--alt {
    background-color: var(--udm-bg-section);
    background-image:
        linear-gradient(to right, rgba(34,197,94,0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(34,197,94,0.08) 1px, transparent 1px);
    background-size: var(--udm-grid-size) var(--udm-grid-size);
}

.udm-grid-bg--glow {
    position: relative;
}
.udm-grid-bg--glow::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 900px 600px at 50% 0%, rgba(34,197,94,0.10) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.udm-grid-bg--glow > * { position: relative; z-index: 1; }

/* ─── 4. Container / section helpers ──────────────────────────────────── */
.udm-container {
    max-width: var(--udm-max-width);
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}
.udm-section {
    padding: var(--udm-section-py) 0;
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .udm-section { padding: var(--udm-section-py-sm) 0; }
    .udm-container { padding: 0 16px; }
}

.udm-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.udm-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.udm-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

@media (max-width: 768px) {
    .udm-grid-2, .udm-grid-3, .udm-grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) and (min-width: 769px) {
    .udm-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .udm-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ─── 5. Section header (centered) ────────────────────────────────────── */
.udm-section-header {
    text-align: center;
    max-width: 680px;
    margin: 0 auto 64px;
}
.udm-section-header .udm-badge { margin-bottom: 20px; }
.udm-section-header h2 { color: var(--udm-text-primary); margin-bottom: 16px; }
.udm-section-header p { color: var(--udm-text-secondary); font-size: 17px; line-height: 1.7; }

/* ─── 6. Buttons ──────────────────────────────────────────────────────── */
.udm-btn-primary {
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    background: var(--udm-green); color: #090D0A;
    font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 700;
    padding: 14px 28px; border-radius: var(--udm-radius-sm);
    border: none; cursor: pointer; text-decoration: none;
    box-shadow: var(--udm-shadow-btn);
    transition: all 0.2s ease;
    line-height: 1.2;
}
.udm-btn-primary:hover {
    background: var(--udm-green-bright);
    box-shadow: 0 0 48px rgba(34,197,94,0.40);
    transform: translateY(-1px);
    color: #090D0A;
}
.udm-btn-primary:active { transform: translateY(0); }
.udm-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.udm-btn-secondary {
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    background: transparent; color: var(--udm-green);
    font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 600;
    padding: 13px 26px; border-radius: var(--udm-radius-sm);
    border: 1.5px solid var(--udm-border-bright);
    cursor: pointer; text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1.2;
}
.udm-btn-secondary:hover {
    background: rgba(34,197,94,0.08);
    border-color: var(--udm-green);
    transform: translateY(-1px);
    color: var(--udm-green-bright);
}

.udm-btn-ghost {
    display: inline-flex; align-items: center; gap: 6px; justify-content: center;
    background: transparent; color: var(--udm-text-secondary);
    font-size: 14px; font-weight: 500;
    padding: 10px 16px; border-radius: var(--udm-radius-sm);
    border: 1px solid transparent; text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1.2;
}
.udm-btn-ghost:hover { color: var(--udm-text-primary); border-color: var(--udm-border); }

.udm-btn-block { display: flex; width: 100%; }
.udm-btn-lg    { padding: 18px 36px; font-size: 17px; }
.udm-btn-sm    { padding: 9px 16px; font-size: 13px; }

/* Pulse animation (CTA button) */
.udm-btn-pulse {
    animation: udm-btn-pulse-anim 4s ease-in-out infinite;
}
@keyframes udm-btn-pulse-anim {
    0%, 100% { box-shadow: var(--udm-shadow-btn); }
    50% { box-shadow: 0 0 48px rgba(34,197,94,0.45), var(--udm-shadow-btn); }
}

/* ─── 7. Cards ────────────────────────────────────────────────────────── */
.udm-card {
    background: var(--udm-bg-card);
    border: 1px solid var(--udm-border-card);
    border-radius: var(--udm-radius);
    padding: 28px;
    transition: all 0.25s ease;
}
.udm-card:hover {
    background: var(--udm-bg-card-hover);
    border-color: var(--udm-border-bright);
    box-shadow: var(--udm-shadow-glow);
    transform: translateY(-3px);
}

.udm-card--featured {
    background: linear-gradient(135deg, #0F2218 0%, #111A14 100%);
    border: 1.5px solid var(--udm-green);
    box-shadow: 0 0 60px rgba(34,197,94,0.15), var(--udm-shadow-card);
}

.udm-card--flat:hover {
    transform: none;
    box-shadow: none;
}

/* ─── 8. Badge / pill label ───────────────────────────────────────────── */
.udm-badge {
    display: inline-flex; align-items: center; gap: 7px;
    background: rgba(34,197,94,0.10);
    border: 1px solid rgba(34,197,94,0.25);
    border-radius: var(--udm-radius-pill);
    padding: 5px 14px;
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--udm-green);
}
.udm-badge__dot {
    width: 6px; height: 6px;
    border-radius: 50%; background: var(--udm-green);
    animation: udm-pulse 2s ease infinite;
}
@keyframes udm-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ─── 9. Code block / shortcode display ───────────────────────────────── */
.udm-code-block {
    background: #060A07;
    border: 1px solid rgba(34,197,94,0.20);
    border-radius: var(--udm-radius-sm);
    padding: 14px 18px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--udm-text-code);
    display: flex; align-items: center; gap: 10px;
    position: relative; overflow: hidden;
}
.udm-code-block::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: var(--udm-green);
}
.udm-code-block code {
    font-family: inherit;
    color: inherit;
    background: transparent;
    padding: 0;
}

/* ─── 10. Inputs ──────────────────────────────────────────────────────── */
.udm-input {
    width: 100%;
    background: var(--udm-bg-input);
    border: 1px solid var(--udm-border);
    border-radius: var(--udm-radius-sm);
    padding: 12px 16px;
    font-family: 'Inter', sans-serif; font-size: 15px;
    color: var(--udm-text-primary);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.udm-input:focus { border-color: var(--udm-green); box-shadow: 0 0 0 3px rgba(34,197,94,0.10); }
.udm-input::placeholder { color: var(--udm-text-muted); }
.udm-input:disabled { opacity: 0.5; cursor: not-allowed; }

textarea.udm-input { min-height: 120px; resize: vertical; }
select.udm-input { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%2322C55E' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

.udm-label-field {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--udm-text-secondary); margin-bottom: 7px;
}

.udm-field-group { margin-bottom: 18px; }

/* ─── 11. Animation tokens ────────────────────────────────────────────── */
.udm-animate {
    opacity: 0; transform: translateY(24px);
    transition: opacity 0.55s ease, transform 0.55s ease;
    transition-delay: var(--delay, 0s);
}
.udm-animate.is-visible {
    opacity: 1; transform: translateY(0);
}

.udm-count-up { display: inline-block; }

/* ─── 12. Toast (notifications) ───────────────────────────────────────── */
.udm-toast {
    position: fixed; top: 100px; right: 24px;
    background: var(--udm-bg-card);
    border: 1px solid var(--udm-border-bright);
    border-radius: var(--udm-radius-sm);
    padding: 14px 20px;
    color: var(--udm-text-primary);
    font-size: 14px;
    box-shadow: var(--udm-shadow-card);
    z-index: 9999;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}
.udm-toast.is-visible { transform: translateX(0); }
.udm-toast--success { border-color: var(--udm-green); }
.udm-toast--error { border-color: #EF4444; }

/* ─── 13. Utility classes ─────────────────────────────────────────────── */
.udm-text-center { text-align: center; }
.udm-text-muted  { color: var(--udm-text-muted); }
.udm-text-secondary { color: var(--udm-text-secondary); }
.udm-text-green  { color: var(--udm-green); }
.udm-mt-0 { margin-top: 0 !important; }
.udm-mb-0 { margin-bottom: 0 !important; }
.udm-mt-sm { margin-top: 8px; }
.udm-mt-md { margin-top: 16px; }
.udm-mt-lg { margin-top: 32px; }
.udm-mt-xl { margin-top: 64px; }
.udm-mb-lg { margin-bottom: 32px; }
.udm-hidden { display: none !important; }

/* WordPress admin bar offset */
.admin-bar .udm-header { top: 32px; }
@media (max-width: 782px) {
    .admin-bar .udm-header { top: 46px; }
}

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

/* ─── 14. Archive (blog index, search results) ───────────────────────── */
.udm-archive {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-top: 32px;
}
@media (max-width: 768px) {
    .udm-archive { grid-template-columns: 1fr; }
}
.udm-archive__item {
    display: flex;
    flex-direction: column;
}
.udm-archive__title { margin: 0 0 8px 0; }
.udm-archive__title a {
    color: var(--udm-text-primary);
    text-decoration: none;
}
.udm-archive__title a:hover { color: var(--udm-green); }
.udm-archive__meta {
    font-size: 13px;
    color: var(--udm-text-muted);
    margin: 0 0 12px 0;
}
.udm-archive__excerpt {
    color: var(--udm-text-secondary);
    font-size: 14px;
    line-height: 1.7;
    margin: 0 0 18px 0;
    flex: 1;
}
.udm-archive__pagination {
    margin-top: 48px;
    text-align: center;
}
.udm-archive__pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 3px;
    border: 1px solid var(--udm-border);
    border-radius: var(--udm-radius-sm);
    color: var(--udm-text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s;
}
.udm-archive__pagination .page-numbers:hover {
    border-color: var(--udm-border-bright);
    color: var(--udm-text-primary);
}
.udm-archive__pagination .page-numbers.current {
    background: var(--udm-green);
    border-color: var(--udm-green);
    color: #090D0A;
    font-weight: 700;
}

/* ─── 15. Search form ────────────────────────────────────────────────── */
.udm-search-form {
    display: flex;
    gap: 8px;
}
.udm-search-form__input { flex: 1; }
.udm-search-form__submit { white-space: nowrap; }
@media (max-width: 600px) {
    .udm-search-form { flex-direction: column; }
}

/* ─── 16. 404 page ───────────────────────────────────────────────────── */
.udm-404__code {
    font-size: clamp(80px, 12vw, 160px);
    color: var(--udm-green);
    margin: 0 0 16px 0;
    line-height: 1;
    letter-spacing: -0.05em;
    text-shadow: 0 0 60px rgba(34, 197, 94, 0.30);
}
