/* ==========================================================================
   Typography System — Fluid Type Scale + Prose Styles
   Uses clamp() for viewport-responsive sizes with no JS needed.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fluid Type Scale (min @ 320px → max @ 1440px)
   -------------------------------------------------------------------------- */

:root {
    --fluid-xs:   clamp(0.69rem,  0.66rem + 0.16vw, 0.80rem);
    --fluid-sm:   clamp(0.83rem,  0.78rem + 0.24vw, 1.00rem);
    --fluid-base: clamp(1.00rem,  0.93rem + 0.35vw, 1.25rem);
    --fluid-md:   clamp(1.20rem,  1.10rem + 0.49vw, 1.56rem);
    --fluid-lg:   clamp(1.44rem,  1.29rem + 0.73vw, 1.95rem);
    --fluid-xl:   clamp(1.73rem,  1.51rem + 1.09vw, 2.44rem);
    --fluid-2xl:  clamp(2.07rem,  1.76rem + 1.58vw, 3.05rem);
    --fluid-3xl:  clamp(2.49rem,  2.05rem + 2.21vw, 3.82rem);
    --fluid-4xl:  clamp(2.99rem,  2.38rem + 3.04vw, 4.77rem);
    --fluid-5xl:  clamp(3.58rem,  2.75rem + 4.17vw, 5.96rem);

    /* Fluid spacing */
    --fluid-space-sm:  clamp(0.75rem, 0.69rem + 0.29vw, 1.00rem);
    --fluid-space-md:  clamp(1.00rem, 0.88rem + 0.59vw, 1.50rem);
    --fluid-space-lg:  clamp(1.50rem, 1.29rem + 1.06vw, 2.50rem);
    --fluid-space-xl:  clamp(2.00rem, 1.61rem + 1.96vw, 4.00rem);
    --fluid-space-2xl: clamp(3.00rem, 2.34rem + 3.27vw, 6.00rem);
}

/* --------------------------------------------------------------------------
   2. Base Body Typography
   -------------------------------------------------------------------------- */

body {
    font-size: var(--fluid-base);
}

p {
    font-size: var(--fluid-base);
    line-height: var(--line-height-base);
    margin-bottom: var(--space-6);
    max-width: 68ch;   /* optimal reading line length */
}

/* --------------------------------------------------------------------------
   3. Heading Scale
   -------------------------------------------------------------------------- */

h1 { font-size: var(--fluid-4xl); margin-bottom: var(--space-6); }
h2 { font-size: var(--fluid-3xl); margin-bottom: var(--space-5); }
h3 { font-size: var(--fluid-2xl); margin-bottom: var(--space-4); }
h4 { font-size: var(--fluid-xl);  margin-bottom: var(--space-4); }
h5 { font-size: var(--fluid-lg);  margin-bottom: var(--space-3); }
h6 { font-size: var(--fluid-md);  margin-bottom: var(--space-3); }

/* --------------------------------------------------------------------------
   4. Display / Hero Headings
   -------------------------------------------------------------------------- */

.display-1 {
    font-size: var(--fluid-5xl);
    font-weight: var(--font-weight-bold);
    line-height: 1.05;
    letter-spacing: 0;
}

.display-2 {
    font-size: var(--fluid-4xl);
    font-weight: var(--font-weight-bold);
    line-height: 1.1;
    letter-spacing: 0;
}

/* Eyebrow label above headings */
.eyebrow {
    display: inline-block;
    font-size: var(--fluid-xs);
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: var(--space-3);
}

/* --------------------------------------------------------------------------
   5. Prose / Long-Form Content
   Wrap article body in .prose for auto-styled rich text.
   -------------------------------------------------------------------------- */

.prose {
    font-size: var(--fluid-base);
    line-height: var(--line-height-loose);
    color: var(--color-dark-gray);
    max-width: 72ch;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
    margin-top: var(--space-12);
    margin-bottom: var(--space-4);
    color: var(--color-primary);
}

.prose h2 { font-size: var(--fluid-xl); }
.prose h3 { font-size: var(--fluid-lg); }
.prose h4 { font-size: var(--fluid-md); }

.prose p  { margin-bottom: var(--space-6); max-width: 100%; }

.prose a {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity var(--transition-base);
}
.prose a:hover { opacity: 0.75; }

.prose ul,
.prose ol {
    padding-left: var(--space-6);
    margin-bottom: var(--space-6);
}

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

.prose blockquote {
    border-left: 4px solid var(--color-accent);
    padding: var(--space-4) var(--space-6);
    margin: var(--space-8) 0;
    background: var(--color-off-white);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-style: italic;
    font-size: var(--fluid-md);
    color: var(--color-primary);
}

.prose blockquote cite {
    display: block;
    margin-top: var(--space-3);
    font-size: var(--fluid-sm);
    font-style: normal;
    font-weight: var(--font-weight-semibold);
    color: var(--color-mid-gray);
}

.prose code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--color-light-gray);
    padding: 0.1em 0.4em;
    border-radius: var(--radius-sm);
    color: var(--color-accent);
}

.prose pre {
    background: var(--color-primary);
    color: var(--color-off-white);
    padding: var(--space-6);
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: var(--fluid-sm);
    line-height: 1.7;
    margin-bottom: var(--space-8);
}

.prose pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.prose hr {
    border: none;
    border-top: 1px solid var(--color-light-gray);
    margin: var(--space-12) 0;
}

.prose img {
    border-radius: var(--radius-md);
    margin: var(--space-8) 0;
    box-shadow: var(--shadow-md);
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--space-8);
    font-size: var(--fluid-sm);
}

.prose th {
    background: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: var(--font-weight-semibold);
}

.prose td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-light-gray);
}

.prose tr:nth-child(even) td {
    background: var(--color-off-white);
}

/* --------------------------------------------------------------------------
   6. Text Effect Utilities
   -------------------------------------------------------------------------- */

.text-balance   { text-wrap: balance; }   /* Even line breaks for headings */
.text-pretty    { text-wrap: pretty; }    /* Avoids orphans in paragraphs */
.text-gradient  {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.text-outline   {
    -webkit-text-stroke: 2px var(--color-primary);
    color: transparent;
}
