/**
 * Pargas Platform — Base
 * Reset, typography, layout primitives, section rhythm, utilities, motion.
 */

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
        scroll-behavior: smooth;
        -webkit-text-size-adjust: 100%;
}
body {
        background: var(--pg-bg);
        color: var(--pg-fg);
        font-family: var(--pg-font);
        font-size: var(--pg-fs-body);
        line-height: var(--pg-lh);
        font-weight: 400;
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        min-height: 100vh;
        overflow-x: hidden;
}
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--pg-primary); text-decoration: none; transition: color var(--pg-dur) var(--pg-ease); }
a:hover { color: var(--pg-primary-strong); }
ul, ol { padding: 0; }
h1, h2, h3, h4, h5, h6 { font-weight: 900; line-height: 1.6; color: var(--pg-fg); }
p { margin-block: 0; }
:focus-visible {
        outline: 2px solid var(--pg-ring);
        outline-offset: 2px;
        border-radius: 4px;
}
::selection { background: var(--pg-primary); color: #fff; }
body.pg-modal-open { overflow: hidden; }

/* ===== Containers & rhythm ===== */
.pg-container {
        width: 100%;
        max-width: var(--pg-container);
        margin-inline: auto;
        padding-inline: var(--pg-gutter);
}
.pg-section + .pg-section { margin-top: var(--pg-section-gap); }

/* Full-bleed bands & floating rounded bands */
.pg-band { padding-block: var(--pg-section-pad); }
.pg-band--dark {
        background: linear-gradient(135deg, var(--pg-ink) 0%, var(--pg-ink-2) 100%);
        color: var(--pg-on-ink);
        position: relative;
        overflow: hidden;
}
.pg-band--dark h2, .pg-band--dark h3 { color: #fff; }
.pg-band--tint { background: var(--pg-surface); }
.pg-float-band {
        background: var(--pg-surface);
        border: 1px solid var(--pg-border);
        border-radius: var(--pg-radius-xl);
        padding: var(--pg-space-8);
}
.pg-dot-pattern {
        position: absolute;
        inset: 0;
        pointer-events: none;
        opacity: 0.16;
        background-image: radial-gradient(rgba(255, 255, 255, 0.55) 1.2px, transparent 1.2px);
        background-size: 26px 26px;
}
.pg-dot-pattern--ink {
        background-image: radial-gradient(rgba(15, 76, 129, 0.28) 1.2px, transparent 1.2px);
}

/* ===== Typography scale ===== */
.pg-display {
        font-size: var(--pg-fs-display);
        font-weight: 900;
        line-height: 1.55;
        text-wrap: balance;
}
.pg-h2 { font-size: var(--pg-fs-h2); font-weight: 900; line-height: 1.6; }
.pg-h3 { font-size: var(--pg-fs-h3); font-weight: 900; line-height: 1.7; }
.pg-lead { color: var(--pg-fg-muted); font-size: var(--pg-fs-body); line-height: var(--pg-lh); }
.pg-muted { color: var(--pg-fg-muted); }
.pg-soft { color: var(--pg-fg-soft); }
.pg-small { font-size: var(--pg-fs-small); }
.pg-meta { font-size: var(--pg-fs-meta); color: var(--pg-fg-soft); }
.pg-strong { font-weight: 700; }
.pg-num {
        font-feature-settings: "ss01";
        letter-spacing: 0;
}
[dir="ltr"], .pg-ltr { direction: ltr; unicode-bidi: isolate; }

/* ===== Section heading pattern ===== */
.pg-section-head {
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        gap: var(--pg-space-4);
        margin-bottom: var(--pg-space-6);
}
.pg-section-head__titles { max-width: 640px; }
.pg-section-head__kicker {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: var(--pg-fs-meta);
        font-weight: 700;
        color: var(--pg-primary);
        background: var(--pg-primary-soft);
        border-radius: var(--pg-round);
        padding: 3px 12px;
        margin-bottom: var(--pg-space-2);
}
.pg-band--dark .pg-section-head__kicker { background: rgba(255, 255, 255, 0.12); color: var(--pg-accent-bright); }
.pg-section-head__sub { color: var(--pg-fg-muted); font-size: var(--pg-fs-small); margin-top: 6px; }
.pg-section-head__link {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: var(--pg-fs-small);
        font-weight: 700;
        color: var(--pg-fg-muted);
        white-space: nowrap;
        padding-bottom: 6px;
}
.pg-section-head__link:hover { color: var(--pg-primary); }
.pg-section-head__link .pg-ico { width: 16px; height: 16px; }

/* ===== Icon system (inline SVG via pg_icon()) ===== */
.pg-ico {
        width: 20px;
        height: 20px;
        flex: none;
        stroke-width: 2;
}
.pg-ico--sm { width: 16px; height: 16px; }
.pg-ico--lg { width: 26px; height: 26px; }

/* Icon-in-tile pattern */
.pg-tile {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: var(--pg-radius);
        background: var(--pg-primary-soft);
        color: var(--pg-primary);
        flex: none;
        transition: background var(--pg-dur) var(--pg-ease), color var(--pg-dur) var(--pg-ease);
}
.pg-tile--amber { background: var(--pg-accent-soft); color: var(--pg-accent-strong); }
.pg-tile--green { background: var(--pg-success-soft); color: var(--pg-success); }
.pg-tile--on-dark { background: rgba(255, 255, 255, 0.1); color: var(--pg-accent-bright); }
a:hover > .pg-tile, .pg-hover-invert:hover .pg-tile, button:hover > .pg-tile {
        background: var(--pg-primary);
        color: #fff;
}

/* ===== Motion ===== */
@keyframes pg-fade-in-up {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: translateY(0); }
}
.pg-anim {
        animation: pg-fade-in-up var(--pg-dur-slow) var(--pg-ease) both;
}
@keyframes pg-spin { to { transform: rotate(360deg); } }
.pg-spin-slow { animation: pg-spin 9s linear infinite; }
@keyframes pg-pulse-soft {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.45; }
}
.pg-pulse { animation: pg-pulse-soft 2.4s ease-in-out infinite; }

/* ===== Scroll reveal — progressive enhancement (html.js-reveal) ===== */
.js-reveal .pg-rv {
        opacity: 0;
        translate: 0 16px;
        transition: opacity 0.6s var(--pg-ease), translate 0.6s var(--pg-ease);
}
.js-reveal .pg-rv.pg-inview {
        opacity: 1;
        translate: 0 0;
}
@media (prefers-reduced-motion: reduce) {
        .js-reveal .pg-rv { opacity: 1; translate: none; transition: none; }
        .pg-spin-slow, .pg-pulse { animation: none !important; }
}

@media (prefers-reduced-motion: reduce) {
        html { scroll-behavior: auto; }
        *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ===== Utilities ===== */
.pg-hide { display: none !important; }
.pg-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;
}
.pg-no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.pg-no-scrollbar::-webkit-scrollbar { display: none; }
.pg-skip-link {
        position: absolute;
        inset-inline-start: -9999px;
        top: 8px;
        z-index: var(--pg-z-toast);
        background: var(--pg-primary);
        color: #fff;
        padding: 10px 18px;
        border-radius: var(--pg-radius);
        font-weight: 700;
}
.pg-skip-link:focus { inset-inline-start: 8px; }
body.admin-bar .pg-header--sticky { top: 32px; }

/* Grid helpers */
.pg-grid { display: grid; gap: var(--pg-space-4); }
.pg-grid--2 { grid-template-columns: repeat(2, 1fr); }
.pg-grid--3 { grid-template-columns: repeat(3, 1fr); }
.pg-grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1024px) {
        .pg-grid--3, .pg-grid--4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
        .pg-grid--3, .pg-grid--4 { grid-template-columns: repeat(2, 1fr); }
        :root { --pg-section-gap: var(--pg-space-10); --pg-section-pad: var(--pg-space-10); }
        .pg-float-band { padding: var(--pg-space-6); border-radius: var(--pg-radius-lg); }
}
@media (max-width: 480px) {
        .pg-grid--4 { grid-template-columns: repeat(2, 1fr); }
        :root { --pg-section-pad: var(--pg-space-9); }
}

/* Horizontal product rail (edge-bleed) */
.pg-rail {
        display: flex;
        gap: var(--pg-space-4);
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: var(--pg-space-2);
        margin-inline: calc(var(--pg-gutter) * -1);
        padding-inline: var(--pg-gutter);
}
.pg-rail > * { width: 252px; flex: none; scroll-snap-align: start; }
@media (min-width: 1280px) {
        .pg-rail > * { width: 272px; }
}
