/* ==========================================
   typography.css - Typography Styles
   ========================================== */

/* Base Typography */
body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    font-weight: var(--font-normal);
}

/* Paper texture overlay - fine lines pattern for both themes */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 1;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.03) 2px,
            rgba(0, 0, 0, 0.03) 4px
        );
}

/* Ensure content appears above texture */
body > * {
    position: relative;
    z-index: 2;
}

/* Dark mode - exact same fine lines pattern */
body.dark-mode::before {
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.03) 2px,
            rgba(0, 0, 0, 0.03) 4px
        );
}

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

/* Override for .section-title - always use medium weight */
.section-title {
    font-weight: 500 !important;
}

h1 {
    font-size: clamp(var(--text-4xl), 8vw, var(--text-7xl));
    line-height: 0.95;
    font-weight: var(--font-black);
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

h2:not(.section-title) {
    font-size: clamp(var(--text-2xl), 4vw, var(--text-4xl));
    line-height: var(--leading-tight);
    margin-bottom: var(--space-md);
    border-bottom: 4px solid var(--border-dark);
    padding-bottom: var(--space-xs);
}

h3 {
    font-size: var(--text-xl);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
}

h4 {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-xs);
}

h5 {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

h6 {
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Paragraph Styles */
p {
    margin-bottom: var(--space-sm);
}

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

.lead {
    font-size: var(--text-lg);
    line-height: var(--leading-relaxed);
    font-weight: var(--font-normal);
    color: var(--text-secondary);
}

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

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

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

a:hover {
    color: var(--highlight-red);
}

p a,
li a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

/* Lists */
ul, ol {
    margin-bottom: var(--space-sm);
    padding-left: var(--space-md);
}

li {
    margin-bottom: var(--space-xs);
}

/* Nested lists */
ul ul, ol ol, ul ol, ol ul {
    margin-top: var(--space-xs);
    margin-bottom: var(--space-xs);
}

/* Blockquotes */
blockquote {
    margin: var(--space-md) 0;
    padding-left: var(--space-md);
    border-left: 4px solid var(--border-dark);
    font-style: italic;
    font-family: var(--font-headline);
}

blockquote cite {
    display: block;
    margin-top: var(--space-sm);
    font-size: var(--text-sm);
    font-style: normal;
    text-align: right;
}

blockquote cite::before {
    content: "\2014 ";  /* Em dash with space */
}

/* Code */
code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 2px 6px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}

pre {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    margin: var(--space-md) 0;
    padding: var(--space-md);
    background-color: var(--ink-black);
    color: var(--paper-white);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

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

/* Monospace Text */
.mono {
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
}

time {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Text Utilities */
.text-uppercase {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.text-lowercase {
    text-transform: lowercase;
}

.text-capitalize {
    text-transform: capitalize;
}

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

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

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

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

/* Font Weight Utilities */
.font-normal {
    font-weight: var(--font-normal);
}

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

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

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

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

/* Text Colors */
.text-primary {
    color: var(--text-primary);
}

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

.text-highlight {
    color: var(--highlight-red);
}

.text-glow {
    color: var(--retro-glow);
}

/* Special Typography Effects */
.headline-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.text-outline {
    -webkit-text-stroke: 1px var(--ink-black);
    -webkit-text-fill-color: transparent;
}

/* Newspaper-style Drop Cap */
.drop-cap::first-letter {
    font-family: var(--font-headline);
    font-size: 4em;
    font-weight: var(--font-black);
    float: left;
    line-height: 0.8;
    margin: 0.1em 0.1em 0 0;
}

/* Selection Styles */
::selection {
    background-color: var(--retro-glow);
    color: var(--ink-black);
}

::-moz-selection {
    background-color: var(--retro-glow);
    color: var(--ink-black);
}