/**
 * PMWaves Base CSS
 * Reset, Typography, and Base Elements
 * Foundation layer for all styles
 */

/* ========================================
   RESET & NORMALIZE
   ======================================== */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--white);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    color: var(--text-primary);
    margin-bottom: var(--spacing-4);
}

h1 {
    font-size: var(--text-5xl);
    font-weight: var(--font-bold);
}

h2 {
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
}

h3 {
    font-size: var(--text-3xl);
    font-weight: var(--font-semibold);
}

h4 {
    font-size: var(--text-2xl);
    font-weight: var(--font-semibold);
}

h5 {
    font-size: var(--text-xl);
    font-weight: var(--font-medium);
}

h6 {
    font-size: var(--text-lg);
    font-weight: var(--font-medium);
}

/* Paragraphs */
p {
    margin-bottom: var(--spacing-4);
    line-height: var(--leading-relaxed);
    color: var(--text-secondary);
}

/* Links */
a {
    color: var(--info-color);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Lists */
ul, ol {
    margin-bottom: var(--spacing-4);
    padding-left: var(--spacing-6);
}

li {
    margin-bottom: var(--spacing-2);
    line-height: var(--leading-relaxed);
}

ul {
    list-style-type: disc;
}

ol {
    list-style-type: decimal;
}

/* Navigation lists (reset) */
nav ul,
.navbar ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

nav li,
.navbar li {
    margin-bottom: 0;
}

/* ========================================
   SEMANTIC ELEMENTS
   ======================================== */

/* Strong & Emphasis */
strong, b {
    font-weight: var(--font-bold);
}

em, i {
    font-style: italic;
}

/* Blockquote */
blockquote {
    margin: var(--spacing-6) 0;
    padding: var(--spacing-4) var(--spacing-6);
    border-left: 4px solid var(--primary-color);
    background: var(--gray-50);
    font-style: italic;
    color: var(--text-secondary);
}

blockquote cite {
    display: block;
    margin-top: var(--spacing-3);
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-style: normal;
}

/* Code */
code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    padding: 2px 6px;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    color: var(--error-color);
}

pre {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    padding: var(--spacing-4);
    background: var(--gray-900);
    color: var(--gray-100);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: var(--spacing-4);
}

pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* Horizontal Rule */
hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: var(--spacing-8) 0;
}

/* ========================================
   IMAGES & MEDIA
   ======================================== */

img {
    max-width: 100%;
    height: auto;
    display: block;
    border-style: none;
}

figure {
    margin: var(--spacing-6) 0;
}

figcaption {
    margin-top: var(--spacing-2);
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-align: center;
}

video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   TABLES
   ======================================== */

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-6);
}

th {
    font-weight: var(--font-semibold);
    text-align: left;
    padding: var(--spacing-3);
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-300);
}

td {
    padding: var(--spacing-3);
    border-bottom: 1px solid var(--gray-200);
}

tr:hover {
    background: var(--gray-50);
}

/* ========================================
   FORMS - Base Styles
   ======================================== */

input,
textarea,
select,
button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

label {
    display: block;
    margin-bottom: var(--spacing-2);
    font-weight: var(--font-medium);
    color: var(--text-primary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="time"],
textarea,
select {
    width: 100%;
    padding: var(--spacing-3) var(--spacing-4);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--text-primary);
    transition: var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(60, 75, 111, 0.1);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--spacing-3) center;
    padding-right: var(--spacing-10);
}

/* Checkboxes & Radios */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    margin-right: var(--spacing-2);
}

/* Fieldset */
fieldset {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    padding: var(--spacing-4);
    margin-bottom: var(--spacing-4);
}

legend {
    padding: 0 var(--spacing-2);
    font-weight: var(--font-semibold);
}

/* ========================================
   UTILITY BASE CLASSES
   ======================================== */

/* Selection */
::selection {
    background: var(--primary-color);
    color: var(--white);
}

::-moz-selection {
    background: var(--primary-color);
    color: var(--white);
}

/* Placeholder */
::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

/* Disabled */
:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ========================================
   RESPONSIVE TYPOGRAPHY
   ======================================== */

@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
    
    h1 {
        font-size: var(--text-4xl);
    }
    
    h2 {
        font-size: var(--text-3xl);
    }
    
    h3 {
        font-size: var(--text-2xl);
    }
    
    h4 {
        font-size: var(--text-xl);
    }
    
    h5 {
        font-size: var(--text-lg);
    }
    
    h6 {
        font-size: var(--text-base);
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    h1 {
        font-size: var(--text-3xl);
    }
    
    h2 {
        font-size: var(--text-2xl);
    }
}