/**
 * Base Styles
 *
 * Reset, typography, and utility classes.
 * Uses CSS variables from branding (set via PHP).
 */

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

* {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
}

body {
    font-family: var(--irf-font-body);
    font-size: 16px;
    line-height: 1.5;
    color: var(--irf-text);
    background-color: var(--irf-background);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

a {
    color: var(--irf-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--irf-font-heading);
    font-weight: 600;
    color: var(--irf-secondary);
    line-height: 1.2;
}

h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

h4 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1rem;
}

p:last-child {
    margin-bottom: 0;
}

small {
    font-size: 0.875rem;
}

.text-muted {
    color: var(--irf-text-light);
}

/* Container */
.irf-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .irf-container {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .irf-container {
        max-width: 1100px;
        padding: 0 2rem;
    }
}

@media (min-width: 1280px) {
    .irf-container {
        max-width: 1200px;
    }
}

/* Main content area */
.irf-main {
    padding: 1.5rem 0;
    min-height: calc(100vh - 140px);
}

/* Screen reader only */
.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;
}

/* Flex utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

/* Spacing utilities */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

/* Text alignment */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

/* Icon sizing */
.irf-icon {
    width: 1.25em;
    height: 1.25em;
    display: inline-block;
    vertical-align: middle;
    fill: currentColor;
}

.irf-icon--sm {
    width: 1em;
    height: 1em;
}

.irf-icon--lg {
    width: 1.5em;
    height: 1.5em;
}

/* Loading spinner */
.irf-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--irf-tertiary);
    border-top-color: var(--irf-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Fade transitions */
.fade-enter-active,
.fade-leave-active {
    transition: opacity 0.2s ease;
}

.fade-enter-from,
.fade-leave-to {
    opacity: 0;
}

/* Slide transitions */
.slide-enter-active,
.slide-leave-active {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.slide-enter-from {
    transform: translateY(10px);
    opacity: 0;
}

.slide-leave-to {
    transform: translateY(-10px);
    opacity: 0;
}

/* Header */
.irf-header {
    background: var(--irf-background);
    border-bottom: 1px solid var(--irf-tertiary);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.irf-header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.irf-header__logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.irf-header__logo-link:hover {
    text-decoration: none;
}

/* Logo - header logo constrained for consistent UI */
.irf-logo {
    max-width: 200px !important;
    max-height: 80px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

.irf-logo--text {
    font-family: var(--irf-font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--irf-secondary);
}

/* Footer */
.irf-footer {
    background: var(--irf-background);
    border-top: 1px solid var(--irf-tertiary);
    padding: 1.5rem 0;
    margin-top: auto;
}

.irf-footer__content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.irf-footer__text {
    color: var(--irf-text-light);
    font-size: 0.875rem;
    margin: 0;
}

.irf-footer__links {
    display: flex;
    gap: 1.5rem;
}

.irf-footer__link {
    color: var(--irf-text-light);
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.irf-footer__link:hover {
    color: var(--irf-primary);
    text-decoration: underline;
}

@media (max-width: 480px) {
    .irf-footer__content {
        flex-direction: column;
        text-align: center;
    }
}

/* Modal base styles */
.irf-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.irf-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.irf-modal__content {
    position: relative;
    background: white;
    border-radius: var(--irf-border-radius, 12px);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.irf-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--irf-border, #e2e8f0);
}

.irf-modal__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.irf-modal__close {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--irf-text-light);
    transition: color 0.2s ease;
}

.irf-modal__close:hover {
    color: var(--irf-text);
}

.irf-modal__body {
    padding: 1.5rem;
    overflow-y: auto;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--irf-text-secondary, #475569);
}

.irf-modal__body h3,
.irf-modal__body h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--irf-text);
}

.irf-modal__body h3:first-child {
    margin-top: 0;
}

.irf-modal__body p,
.irf-modal__body ul,
.irf-modal__body ol {
    margin-bottom: 1rem;
}

.irf-modal__body li {
    margin-bottom: 0.5rem;
}

/* Modal (footer version) */
.irf-modal--footer .irf-modal__content {
    max-width: 600px;
    max-height: 80vh;
}

.irf-modal--footer .irf-modal__body {
    padding: 1.5rem;
    overflow-y: auto;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--irf-text-secondary, #475569);
}

.irf-modal--footer .irf-modal__body h3,
.irf-modal--footer .irf-modal__body h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--irf-text);
}

.irf-modal--footer .irf-modal__body h3:first-child {
    margin-top: 0;
}

.irf-modal--footer .irf-modal__body p,
.irf-modal--footer .irf-modal__body ul,
.irf-modal--footer .irf-modal__body ol {
    margin-bottom: 1rem;
}

.irf-modal--footer .irf-modal__body li {
    margin-bottom: 0.5rem;
}
