/**
 * Base Typography & Element Styles
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

html,
body {
    height: 100%;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-bg);
    transition: background-color var(--transition-base), color var(--transition-base);
    overflow-x: hidden;
    position: relative;
}

/* Urdu specific font */
body.lang-ur {
    font-family: var(--font-urdu);
}

/* ==================== Typography ==================== */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    word-wrap: break-word;
    /* ADDED: Prevent text overflow */
    overflow-wrap: break-word;
    /* ADDED: Prevent text overflow */
}

h1 {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-4);
}

h2 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-4);
}

h3 {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-3);
}

h4 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-3);
}

h5 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
}

h6 {
    font-size: var(--text-base);
    margin-bottom: var(--space-2);
}

p {
    font-family: var(--font-body);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-4);
    word-wrap: break-word;
    /* ADDED: Prevent text overflow */
    overflow-wrap: break-word;
    /* ADDED: Prevent text overflow */
}

/* Links */
a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary);
}

/* Lists */
ul,
ol {
    list-style: none;
}

/* Buttons */
button {
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
}

/* ADDED: Media Elements - Prevent Overflow */
img,
video,
iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==================== Utility Classes ==================== */

.container {
    width: 100%;
    max-width: var(--container-max-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
}

.hero-section .container,
.reels-section .container {
    padding-left: 0;
    padding-right: 0;
}

/* Text Alignment */
.text-left {
    text-align: left;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* RTL Support */
.rtl {
    direction: rtl;
    text-align: right;
}

.ltr {
    direction: ltr;
    text-align: left;
}

/* Visibility */
.hidden {
    display: none !important;
}

/* 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;
}

/* ADDED: Prevent Container Overflow */
.hero-layout,
.trending-layout,
.category-grid,
.recommended-layout,
.random-picks-grid {
    max-width: 100%;
    overflow-x: hidden;
}

/* ADDED: Ensure main sections don't overflow */
section {
    max-width: 100vw;
    overflow-x: hidden;
}