/* ============================================
   Base Styles - Reset & Foundation
   I Pericoli dell'Intelligenza Artificiale
   ============================================ */

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

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

body {
    font-family: var(--font-body);
    font-size: calc(var(--text-base) * var(--font-scale));
    font-weight: var(--weight-regular);
    line-height: var(--leading-relaxed);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--duration-normal) var(--ease-out),
                color var(--duration-normal) var(--ease-out);
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--weight-medium);
    line-height: var(--leading-tight);
    color: var(--text-primary);
    text-wrap: balance;
}

h1 {
    font-size: var(--text-5xl);
    letter-spacing: var(--tracking-tight);
}

h2 {
    font-size: var(--text-3xl);
    letter-spacing: var(--tracking-tight);
}

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

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

p {
    margin-bottom: var(--space-6);
    text-wrap: pretty;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
    color: var(--color-accent-light);
}

strong, b {
    font-weight: var(--weight-semibold);
}

em, i {
    font-style: italic;
}

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

/* === Focus States === */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* === Images === */
img, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* === Buttons === */
button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

/* === Lists === */
ul, ol {
    list-style: none;
}

/* === Prose Content === */
.prose {
    font-size: calc(var(--text-lg) * var(--font-scale));
    line-height: var(--leading-loose);
    color: var(--text-secondary);
    max-width: var(--content-max);
    margin: 0 auto;
}

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

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

.prose__dropcap::first-letter {
    font-family: var(--font-display);
    font-size: 4.5em;
    font-weight: var(--weight-medium);
    float: left;
    line-height: 0.8;
    margin-right: var(--space-4);
    margin-top: var(--space-2);
    color: var(--color-accent);
}

/* === Blockquote === */
.blockquote {
    position: relative;
    margin: var(--space-12) 0;
    padding: var(--space-8) var(--space-10);
    background: var(--bg-tertiary);
    border-left: 3px solid var(--color-accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.blockquote::before {
    content: '"';
    position: absolute;
    top: var(--space-4);
    left: var(--space-4);
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    color: var(--color-accent);
    opacity: 0.3;
    line-height: 1;
}

.blockquote p {
    font-family: var(--font-display);
    font-size: calc(var(--text-xl) * var(--font-scale));
    font-style: italic;
    line-height: var(--leading-relaxed);
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.blockquote cite {
    display: block;
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-style: normal;
    color: var(--text-muted);
    letter-spacing: var(--tracking-wide);
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-600);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-600) var(--bg-secondary);
}

/* === Utility Classes === */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.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;
}
