/**
 * ========================================================
 * BASE.CSS - Typography & Base Elements
 * ========================================================
 *
 * This file establishes the foundational typography and
 * base element styles for the Spirit Skin Slim Bloom website.
 *
 * Contents:
 * 1. Root Element Styles
 * 2. Typography (Headings, Paragraphs, Lists)
 * 3. Links
 * 4. Blockquotes
 * 5. Code & Preformatted Text
 * 6. Horizontal Rules
 * 7. Selection Styles
 * 8. Focus Styles
 * 9. Skip Link
 *
 * Dependencies: variables.css, reset.css
 *
 * ========================================================
 */


/* ========================================================
   1. ROOT ELEMENT STYLES
   ========================================================
   Core body and html styling
   ======================================================== */

html {
    font-size: 16px; /* Base font size for rem calculations */
    scroll-padding-top: calc(var(--nav-height) + var(--space-md));
}

body {
    font-family: var(--font-body);
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
    color: var(--color-charcoal);
    background-color: var(--color-white);

    /* Smooth font rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern" 1, "liga" 1;
}


/* ========================================================
   2. TYPOGRAPHY
   ========================================================
   Headings, paragraphs, and text elements
   ======================================================== */

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--color-near-black);
    margin-bottom: var(--space-md);
}

h1 {
    font-size: var(--font-size-h1);
    letter-spacing: var(--letter-spacing-tight);
    font-weight: var(--font-weight-bold);
}

h2 {
    font-size: var(--font-size-h2);
    letter-spacing: var(--letter-spacing-tight);
}

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

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

h5 {
    font-size: var(--font-size-h5);
    font-family: var(--font-body);
    font-weight: var(--font-weight-semibold);
}

h6 {
    font-size: var(--font-size-h6);
    font-family: var(--font-body);
    font-weight: var(--font-weight-semibold);
}

/* Paragraph spacing */
p {
    margin-bottom: var(--space-md);
}

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

/* Lead/intro paragraph */
.lead {
    font-size: var(--font-size-body-lg);
    line-height: var(--line-height-loose);
    color: var(--color-dark-gray);
}

/* Small text */
small,
.small {
    font-size: var(--font-size-small);
}

.tiny {
    font-size: var(--font-size-tiny);
}

/* Strong/Bold */
strong,
b {
    font-weight: var(--font-weight-semibold);
}

/* Italic/Emphasis */
em,
i {
    font-style: italic;
}

/* Underline */
u {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

/* Strikethrough */
s,
del {
    text-decoration: line-through;
}

/* Mark/Highlight */
mark {
    background-color: rgba(201, 169, 98, 0.3);
    color: inherit;
    padding: 0.1em 0.3em;
    border-radius: var(--radius-xs);
}


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

/* Unordered lists with bullets */
ul.list,
.content ul {
    list-style-type: disc;
    padding-left: var(--space-lg);
    margin-bottom: var(--space-md);
}

ul.list li,
.content ul li {
    margin-bottom: var(--space-xs);
    padding-left: var(--space-xs);
}

/* Ordered lists */
ol.list,
.content ol {
    list-style-type: decimal;
    padding-left: var(--space-lg);
    margin-bottom: var(--space-md);
}

ol.list li,
.content ol li {
    margin-bottom: var(--space-xs);
    padding-left: var(--space-xs);
}

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


/* ========================================================
   3. LINKS
   ========================================================
   Base link styling with hover effects
   ======================================================== */

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition-colors);
}

a:hover {
    color: var(--color-primary-dark);
}

/* Links within content areas */
.content a,
p a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: var(--color-primary-light);
}

.content a:hover,
p a:hover {
    text-decoration-color: var(--color-primary-dark);
}

/* External link indicator (optional) */
a[target="_blank"]::after {
    content: '';
    /* Uncomment to add external link icon:
    content: ' ↗';
    font-size: 0.8em;
    */
}


/* ========================================================
   4. BLOCKQUOTES
   ========================================================
   Styled quotations
   ======================================================== */

blockquote {
    font-family: var(--font-accent);
    font-size: var(--font-size-h4);
    font-style: italic;
    line-height: var(--line-height-loose);
    color: var(--color-dark-gray);
    padding: var(--space-lg);
    padding-left: var(--space-xl);
    margin: var(--space-xl) 0;
    border-left: 4px solid var(--color-primary);
    background-color: var(--color-secondary-light);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    position: relative;
}

blockquote::before {
    content: '"';
    font-family: var(--font-display);
    font-size: 4rem;
    color: var(--color-primary-light);
    position: absolute;
    left: var(--space-md);
    top: var(--space-sm);
    line-height: 1;
}

blockquote cite {
    display: block;
    font-family: var(--font-body);
    font-size: var(--font-size-small);
    font-style: normal;
    font-weight: var(--font-weight-medium);
    color: var(--color-primary);
    margin-top: var(--space-md);
}

blockquote cite::before {
    content: '— ';
}

/* Pull quote variant */
.pullquote {
    text-align: center;
    border-left: none;
    border-top: 4px solid var(--color-gold);
    border-bottom: 4px solid var(--color-gold);
    padding: var(--space-xl);
    background: transparent;
}

.pullquote::before {
    display: none;
}


/* ========================================================
   5. CODE & PREFORMATTED TEXT
   ========================================================
   Styling for code snippets
   ======================================================== */

code,
kbd,
samp {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background-color: var(--color-secondary);
    padding: 0.2em 0.4em;
    border-radius: var(--radius-sm);
}

pre {
    font-family: var(--font-mono);
    font-size: var(--font-size-small);
    background-color: var(--color-near-black);
    color: var(--color-cream);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: var(--space-md);
}

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

kbd {
    background-color: var(--color-charcoal);
    color: var(--color-white);
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 0 var(--color-near-black);
}


/* ========================================================
   6. HORIZONTAL RULES
   ========================================================
   Divider lines
   ======================================================== */

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

hr.thick {
    border-top-width: 2px;
}

hr.accent {
    border-color: var(--color-primary);
}

/* Decorative divider */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: var(--space-xl) 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--color-light-gray);
}

.divider:not(:empty)::before {
    margin-right: var(--space-md);
}

.divider:not(:empty)::after {
    margin-left: var(--space-md);
}

.divider__icon {
    color: var(--color-primary);
    font-size: 1.5rem;
}


/* ========================================================
   7. SELECTION STYLES
   ========================================================
   Custom text selection colors
   ======================================================== */

::selection {
    background-color: var(--color-primary);
    color: var(--color-white);
}

::-moz-selection {
    background-color: var(--color-primary);
    color: var(--color-white);
}


/* ========================================================
   8. FOCUS STYLES
   ========================================================
   Accessible focus indicators
   ======================================================== */

/* Default focus ring (keyboard navigation) */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Remove outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* Button focus */
button:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(139, 168, 136, 0.2);
}

/* Input focus */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(139, 168, 136, 0.15);
}


/* ========================================================
   9. SKIP LINK
   ========================================================
   Accessibility skip navigation link
   ======================================================== */

.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-sm) var(--space-lg);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    font-weight: var(--font-weight-medium);
    z-index: var(--z-maximum);
    transition: top var(--transition-fast) var(--ease-smooth);
}

.skip-link:focus {
    top: 0;
    outline: none;
}


/* ========================================================
   MISCELLANEOUS
   ======================================================== */

/* Abbreviations */
abbr[title] {
    text-decoration: underline dotted;
    cursor: help;
    border-bottom: none;
}

/* Address */
address {
    font-style: normal;
    line-height: var(--line-height-loose);
}

/* Figure with caption */
figure {
    margin: var(--space-lg) 0;
}

figcaption {
    font-size: var(--font-size-small);
    color: var(--color-dark-gray);
    margin-top: var(--space-sm);
    text-align: center;
}

/* Details/Summary */
details {
    margin-bottom: var(--space-md);
}

summary {
    cursor: pointer;
    font-weight: var(--font-weight-medium);
    padding: var(--space-sm);
    background-color: var(--color-secondary-light);
    border-radius: var(--radius-md);
    transition: var(--transition-colors);
}

summary:hover {
    background-color: var(--color-secondary);
}

details[open] summary {
    margin-bottom: var(--space-sm);
}

/* Time element */
time {
    font-variant-numeric: tabular-nums;
}


/* ========================================================
   CONTENT WRAPPER
   ========================================================
   For rich text content areas
   ======================================================== */

.content {
    max-width: 75ch; /* Optimal reading width */
}

.content > *:first-child {
    margin-top: 0;
}

.content > *:last-child {
    margin-bottom: 0;
}

.content img {
    margin: var(--space-lg) 0;
    border-radius: var(--radius-md);
}

.content table {
    width: 100%;
    margin: var(--space-lg) 0;
    border: 1px solid var(--color-light-gray);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.content th,
.content td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--color-light-gray);
}

.content th {
    background-color: var(--color-secondary);
    font-weight: var(--font-weight-semibold);
}

.content tr:last-child td {
    border-bottom: none;
}

.content tr:hover {
    background-color: var(--color-secondary-light);
}


/* ========================================================
   MOBILE NAVIGATION STATE
   ========================================================
   Body styles when mobile navigation is open
   ======================================================== */

body.nav-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    touch-action: none;
}
