/**
 * Base Styles - AezelGuess
 * CSS Reset, global styles, and utility classes
 */

/* ========================================
   CSS RESET & NORMALIZATION
   ======================================== */

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    min-height: 100vh;
    transition: background-color var(--transition-base), color var(--transition-base);
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
    margin-bottom: var(--space-4);
    color: var(--color-text-primary);
}

h1 {
    font-size: var(--font-size-4xl);
}

h2 {
    font-size: var(--font-size-3xl);
}

h3 {
    font-size: var(--font-size-2xl);
}

h4 {
    font-size: var(--font-size-xl);
}

h5 {
    font-size: var(--font-size-lg);
}

h6 {
    font-size: var(--font-size-base);
}

p {
    margin-bottom: var(--space-4);
    max-width: 70ch;
    /* Readability measure */
}

a {
    color: var(--color-text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
    font-weight: var(--font-weight-medium);
}

a:hover {
    color: var(--color-primary-700);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

a:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-200), 0 0 0 5px var(--color-primary-500);
    border-radius: var(--radius-sm);
}

strong {
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

small {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

/* ========================================
   LISTS
   ======================================== */

ul,
ol {
    list-style: none;
}

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

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

img {
    border-style: none;
}

/* ========================================
   FORMS & INPUTS
   ======================================== */

button,
input,
optgroup,
select,
textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: inherit;
    margin: 0;
}

button {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

input,
textarea,
select {
    width: 100%;
}

/* ========================================
   INTERACTIVE ELEMENTS
   ======================================== */

[role="button"],
button,
input[type="submit"],
input[type="button"] {
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Skip to content link */
.skip-link {
    position: absolute;
    top: var(--space-4);
    left: var(--space-4);
    padding: var(--space-3) var(--space-6);
    background: var(--color-primary-600);
    color: var(--color-text-inverse);
    border-radius: var(--radius-md);
    font-weight: var(--font-weight-bold);
    z-index: var(--z-tooltip);
    transform: translateY(-200%);
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-lg);
}

.skip-link:focus {
    transform: translateY(0);
}

/* 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-width: 0;
}

/* Focus visible styles - High visibility */
:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-200), 0 0 0 5px var(--color-primary-500);
    border-radius: var(--radius-sm);
}

/* ========================================
   LAYOUT UTILITIES
   ======================================== */

.container {
    width: 100%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

@media (min-width: 768px) {
    .container {
        padding-left: var(--space-6);
        padding-right: var(--space-6);
    }
}

@media (min-width: 1024px) {
    .container {
        padding-left: var(--space-8);
        padding-right: var(--space-8);
    }
}

/* ========================================
   FLEX UTILITIES
   ======================================== */

.flex {
    display: flex;
}

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

.flex-row {
    flex-direction: row;
}

.flex-wrap {
    flex-wrap: wrap;
}

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

.items-start {
    align-items: flex-start;
}

.items-end {
    align-items: flex-end;
}

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

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

.justify-start {
    justify-content: flex-start;
}

.justify-end {
    justify-content: flex-end;
}

.gap-2 {
    gap: var(--space-2);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-6 {
    gap: var(--space-6);
}

.gap-8 {
    gap: var(--space-8);
}

/* ========================================
   GRID UTILITIES
   ======================================== */

.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 767px) {

    .grid-cols-2,
    .grid-cols-3 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .grid-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ========================================
   SPACING UTILITIES
   ======================================== */

.m-0 {
    margin: 0;
}

.m-2 {
    margin: var(--space-2);
}

.m-4 {
    margin: var(--space-4);
}

.m-6 {
    margin: var(--space-6);
}

.m-8 {
    margin: var(--space-8);
}

.mt-0 {
    margin-top: 0;
}

.mt-2 {
    margin-top: var(--space-2);
}

.mt-4 {
    margin-top: var(--space-4);
}

.mt-6 {
    margin-top: var(--space-6);
}

.mt-8 {
    margin-top: var(--space-8);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-2 {
    margin-bottom: var(--space-2);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-6 {
    margin-bottom: var(--space-6);
}

.mb-8 {
    margin-bottom: var(--space-8);
}

.p-0 {
    padding: 0;
}

.p-2 {
    padding: var(--space-2);
}

.p-4 {
    padding: var(--space-4);
}

.p-6 {
    padding: var(--space-6);
}

.p-8 {
    padding: var(--space-8);
}

/* ========================================
   TEXT UTILITIES
   ======================================== */

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

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

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

.text-xs {
    font-size: var(--font-size-xs);
}

.text-sm {
    font-size: var(--font-size-sm);
}

.text-base {
    font-size: var(--font-size-base);
}

.text-lg {
    font-size: var(--font-size-lg);
}

.text-xl {
    font-size: var(--font-size-xl);
}

.text-2xl {
    font-size: var(--font-size-2xl);
}

.text-3xl {
    font-size: var(--font-size-3xl);
}

.font-light {
    font-weight: var(--font-weight-light);
}

.font-normal {
    font-weight: var(--font-weight-regular);
}

.font-medium {
    font-weight: var(--font-weight-medium);
}

.font-semibold {
    font-weight: var(--font-weight-semibold);
}

.font-bold {
    font-weight: var(--font-weight-bold);
}

.text-primary {
    color: var(--color-text-primary);
}

.text-secondary {
    color: var(--color-text-secondary);
}

.text-tertiary {
    color: var(--color-text-tertiary);
}

.text-inverse {
    color: var(--color-text-inverse);
}

/* ========================================
   DISPLAY UTILITIES
   ======================================== */

.block {
    display: block;
}

.inline-block {
    display: inline-block;
}

.inline {
    display: inline;
}

.hidden {
    display: none;
}

/* Responsive visibility */
@media (max-width: 767px) {
    .hide-mobile {
        display: none;
    }
}

@media (min-width: 768px) {
    .hide-desktop {
        display: none;
    }
}

/* ========================================
   POSITION UTILITIES
   ======================================== */

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.sticky {
    position: sticky;
}

/* ========================================
   MISC UTILITIES
   ======================================== */

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.rounded-sm {
    border-radius: var(--radius-sm);
}

.rounded-md {
    border-radius: var(--radius-md);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-xl {
    border-radius: var(--radius-xl);
}

.rounded-full {
    border-radius: var(--radius-full);
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.shadow-md {
    box-shadow: var(--shadow-md);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

.shadow-xl {
    box-shadow: var(--shadow-xl);
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pointer {
    cursor: pointer;
}

/* ========================================
   MOBILE OPTIMIZATIONS
   ======================================== */

/* Touch target minimum sizes (WCAG AAA) */
@media (max-width: 768px) {

    button,
    a,
    input[type="button"],
    input[type="submit"],
    [role="button"] {
        min-height: 44px;
        min-width: 44px;
    }
}

/* iOS momentum scrolling */
body,
.blog-container,
.results-container,
.final-container {
    -webkit-overflow-scrolling: touch;
}

/* Prevent zoom on double-tap for interactive elements */
button,
a,
input,
select,
textarea {
    touch-action: manipulation;
}

/* Safe area insets for notched devices (iPhone X+) */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
}

/* Disable text selection on interactive elements */
@media (max-width: 768px) {

    button,
    .nav-link,
    .btn {
        -webkit-user-select: none;
        user-select: none;
    }
}