/* css/base.css */

/* Import Inter Variable Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap');

/* 1. Global Reset & Box Sizing
-------------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 100%; /* Equivalent to 16px by default, allows user scaling */
    line-height: 1.6; /* Base line height from STYLE_GUIDE.md */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

/* 2. Body Defaults
-------------------------------------------------------------------------------- */
body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; /* Inter as primary font with system fallbacks */
    background-color: var(--clr-paper); /* Base color */
    background-image: radial-gradient(circle at 20% 0%, 
                                     var(--clr-indigo-alpha006, rgba(91,109,251,0.06)) 0%, 
                                     transparent 60%); /* Gradient overlay */
    background-repeat: no-repeat; /* Ensure gradient doesn't tile */
    background-attachment: fixed; /* This helps if body is scrollable & gradient should stay put */
    color: var(--clr-ink); /* From theme-light.css */
    min-height: 100vh;
    font-size: 1.125rem; /* 18px base font size */
    font-weight: 400; /* Base font weight */
    line-height: 1.6; /* Optimal for ADHD readability */
}

/* Ensure main content can grow to fill space if footer is sticky or page short */
main.grid {
    flex-grow: 1;
}

/* 3. Enhanced Typography Scale (Modern Inter-based hierarchy with 4pt vertical rhythm)
-------------------------------------------------------------------------------- */
h1, .h1-style {
    font-size: 2.25rem; /* Modern, larger scale */
    font-weight: 600; /* Semi-bold for strong hierarchy */
    line-height: 1.2; /* Tighter line height for headings */
    margin-top: 1.5em; /* 1.5em spacing above headings */
    margin-bottom: 1rem; /* 16px - on 4pt scale */
    color: var(--clr-ink);
    letter-spacing: -0.02em; /* Slight negative letter spacing for large text */
}

h2, .h2-style {
    font-size: 1.5rem; /* Clean, proportional step down */
    font-weight: 500; /* Medium weight for clear hierarchy */
    line-height: 1.3;
    margin-top: 1.5em; /* 1.5em spacing above headings */
    margin-bottom: 0.75rem; /* 12px - on 4pt scale */
    color: var(--clr-ink);
    letter-spacing: -0.01em;
}

h3, .h3-style {
    font-size: 1.25rem; /* Proportional to new hierarchy */
    font-weight: 500; /* Consistent with h2 */
    line-height: 1.4;
    margin-top: 1.5em; /* 1.5em spacing above headings */
    margin-bottom: 0.75rem; /* 12px - on 4pt scale */
    color: var(--clr-ink);
}

h4, .h4-style {
    font-size: 1.1rem; /* Subtle step above body text */
    font-weight: 500; /* Consistent medium weight */
    line-height: 1.5;
    margin-top: 1.5em; /* 1.5em spacing above headings */
    margin-bottom: 0.5rem; /* 8px - on 4pt scale */
    color: var(--clr-ink);
}

h5, .h5-style {
    font-size: 1rem; /* Same as body, differentiated by weight */
    font-weight: 500;
    line-height: 1.5;
    margin-top: 1.5em; /* 1.5em spacing above headings */
    margin-bottom: 0.5rem; /* 8px - on 4pt scale */
    color: var(--clr-ink);
}

h6, .h6-style {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
    margin-top: 1.5em; /* 1.5em spacing above headings */
    margin-bottom: 0.5rem; /* 8px - on 4pt scale */
    color: var(--clr-ink);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Paragraph and text elements */
p {
    margin-bottom: 1em; /* 1em vertical margin between paragraphs */
    max-width: 65ch; /* Optimal reading line length for ADHD */
    line-height: 1.6; /* Enhanced readability */
    color: var(--clr-ink);
    font-weight: 400; /* Explicit base weight */
    font-size: 1rem; /* Explicit base size relative to body */
}

/* Special typography variants */
.text-large {
    font-size: 1.125rem;
    line-height: 1.6;
    font-weight: 400;
}

.text-small {
    font-size: 0.9rem;
    line-height: 1.5;
    font-weight: 400;
}

.text-muted {
    color: #5a5f78; /* Lighter ink color for secondary text */
    font-size: 0.95rem;
    font-weight: 400;
}

.text-emphasis {
    font-weight: 500; /* Use Inter's medium weight for emphasis */
    color: var(--clr-indigo);
}

.text-strong {
    font-weight: 600; /* Use Inter's semi-bold for strong emphasis */
    color: var(--clr-ink);
}

/* 4. Enhanced Link Styles
-------------------------------------------------------------------------------- */
a {
    color: var(--clr-indigo); /* From theme-light.css */
    text-decoration: none;
    transition: color 0.2s ease-out, text-decoration 0.2s ease-out;
    border-radius: 2px; /* Subtle border radius for focus states */
    font-weight: inherit; /* Inherit weight from parent */
}

a:hover {
    color: var(--clr-indigo);
    text-decoration: underline;
    text-decoration-color: var(--clr-lavender);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

a:focus-visible {
    outline: 2px solid var(--clr-highlight); /* From theme-light.css */
    outline-offset: 2px;
    text-decoration: none;
    background-color: var(--clr-highlight);
    color: var(--clr-ink);
}

/* 5. Enhanced Lists
-------------------------------------------------------------------------------- */
ul,
ol {
    margin-bottom: 1em; /* 1em vertical margin */
    padding-left: 1.5rem; /* Basic indentation for lists */
    max-width: 65ch; /* Consistent with paragraph width */
}

li {
    margin-bottom: 0.5rem; /* 8px - on 4pt scale */
    line-height: 1.6; /* Consistent with body text */
    font-weight: 400; /* Explicit base weight */
}

/* Nested lists */
li ul,
li ol {
    margin-top: 0.5rem; /* 8px - on 4pt scale */
    margin-bottom: 0.5rem; /* 8px - on 4pt scale */
}

/* Definition lists */
dl {
    margin-bottom: 1em; /* 1em vertical margin */
}

dt {
    font-weight: 500; /* Use Inter's medium weight */
    color: var(--clr-ink);
    margin-bottom: 0.25rem; /* 4px - on 4pt scale */
}

dd {
    margin-left: 1rem; /* 16px - on 4pt scale */
    margin-bottom: 0.75rem; /* 12px - on 4pt scale */
    color: var(--clr-ink);
    font-weight: 400;
}

/* 6. Enhanced Images & Media
-------------------------------------------------------------------------------- */
img,
video,
svg {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 0.5rem; /* Subtle rounding for visual softness */
}

figure {
    margin: 1.5rem 0; /* 24px top/bottom - on 4pt scale */
}

figcaption {
    font-size: 0.9rem;
    font-weight: 400;
    color: #5a5f78;
    text-align: center;
    margin-top: 0.5rem; /* 8px - on 4pt scale */
    font-style: italic;
}

/* 7. Enhanced Form Elements
-------------------------------------------------------------------------------- */
button,
input,
select,
textarea {
    font-family: inherit; /* Use Inter for all form elements */
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    border: 1px solid var(--clr-border, #ccc);
    border-radius: 0.375rem; /* Consistent with button border radius */
    padding: 0.5em 0.75em;
    transition: border-color 0.2s ease-out, background-color 0.2s ease-out;
}

button {
    cursor: pointer;
    background-color: transparent;
    color: var(--clr-ink, #333);
    font-weight: 500; /* Slightly heavier weight for buttons */
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--clr-indigo);
    outline-offset: 2px;
    border-color: var(--clr-indigo);
}

/* 8. Accessibility Enhancements
-------------------------------------------------------------------------------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: -999;
    padding: 0.75em 1em;
    background-color: var(--clr-highlight);
    color: var(--clr-ink);
    border: 2px solid var(--clr-ink);
    border-radius: 0.375rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease-out;
}

.skip-link:focus,
.skip-link:active {
    left: 1rem;
    top: 1rem;
    width: auto;
    height: auto;
    overflow: auto;
    z-index: 99999;
}

/* 9. Content Spacing Utilities
-------------------------------------------------------------------------------- */
.content-spacing > * + * {
    margin-top: 1rem;
}

.content-spacing-large > * + * {
    margin-top: 1.5rem;
}

.content-spacing-small > * + * {
    margin-top: 0.5rem;
}

/* 10. Focus Management for ADHD-friendly design
-------------------------------------------------------------------------------- */
*:focus-visible {
    outline: 2px solid var(--clr-highlight);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Remove default focus styles if using focus-visible consistently */
*:focus {
    outline: none;
}

/* 11. Font Feature Settings for Inter
-------------------------------------------------------------------------------- */
body {
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11'; /* Inter's recommended feature settings */
    font-variant-numeric: tabular-nums; /* Better number alignment */
}

/* 12. Print Styles
-------------------------------------------------------------------------------- */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a,
    a:visited {
        text-decoration: underline;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
    
    p {
        orphans: 3;
        widows: 3;
    }
}

.social-media-links a .social-icon {
  width: 24px;
  height: 24px;
  fill: var(--clr-ink-light); /* Default subtle color */
  transition: fill 0.2s ease-out;
}
.social-media-links a:hover .social-icon,
.social-media-links a:focus-visible .social-icon {
  fill: var(--clr-indigo); /* Accent color on hover/focus */
}
.social-media-links a:focus-visible { /* For keyboard navigation */
  outline: 2px solid var(--clr-highlight);
  outline-offset: 2px;
  border-radius: 4px; /* Consistent with other focus styles */
}

/* Homepage Hero Title - Calmer Typography */
.content .home-hero__title {
  font-size: clamp(1.6rem, 1.1rem + 1.8vw, 2.25rem); /* smaller, adaptive */
  line-height: 1.2;                                   /* tighter but legible */
  font-weight: 700;                                   /* keep strong, not heavier */
  letter-spacing: -0.01em;                            /* subtle optical balance */
  max-width: 26ch;                                    /* shorter measure for readability */
  margin-bottom: 0.5rem;                              /* reduce gap to subline */
}
@media (max-width: 380px) {
  .content .home-hero__title { font-size: 1.45rem; }  /* very small screens */
}

/* Homepage Section Spacing - Tighter Flow */
.content h2.section--problems { margin-top: 1.25rem; }