/*
 * SilverWell - Base Design System
 * Version 3.8.0
 *
 * A warm, editorial design system optimized for readability
 * and accessibility for senior health & home safety content.
 */

:root {
    /* === Warm Editorial Color Palette === */
    --color-primary: #9c4a32;
    --color-primary-light: #c47862;
    --color-primary-dark: #7a3826;
    --color-secondary: #5e7c6b;
    --color-secondary-light: #82a090;
    --color-accent: #d4a056;
    --color-accent-light: #e4b978;

    --color-text: #2c2420;
    --color-text-muted: #5a4f49;
    --color-text-light: #6f645d;
    --color-bg: #fdf8f3;
    --color-bg-alt: #f5ede4;
    --color-bg-warm: #f9f1e8;
    --color-surface: #ffffff;
    --color-border: #e8ddd1;
    --color-border-light: #f0e6dc;

    /* === Typography === */
    --font-heading: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
    --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --text-xs: 0.8125rem;   /* 13px */
    --text-sm: 0.9375rem;   /* 15px */
    --text-base: 1.125rem;  /* 18px */
    --text-lg: 1.25rem;     /* 20px */
    --text-xl: 1.5rem;      /* 24px */
    --text-2xl: 1.875rem;   /* 30px */
    --text-3xl: 2.25rem;    /* 36px */
    --text-4xl: 3rem;       /* 48px */

    /* === Spacing (8px grid) === */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* === Layout === */
    --content-max-width: 780px;
    --page-max-width: 1200px;
    --header-height: 76px;

    /* === Radius === */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    /* === Shadows (soft, warm) === */
    --shadow-sm: 0 1px 2px rgba(44, 36, 32, 0.04), 0 2px 4px rgba(44, 36, 32, 0.03);
    --shadow-md: 0 4px 6px rgba(44, 36, 32, 0.04), 0 8px 16px rgba(44, 36, 32, 0.05);
    --shadow-card: 0 2px 8px rgba(44, 36, 32, 0.04), 0 12px 24px rgba(44, 36, 32, 0.06);
    --shadow-card-hover: 0 8px 16px rgba(44, 36, 32, 0.06), 0 24px 48px rgba(44, 36, 32, 0.08);
    --shadow-lg: 0 12px 32px rgba(44, 36, 32, 0.1), 0 4px 12px rgba(44, 36, 32, 0.06);

    /* === Motion === */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* === Reset & Base === */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (min-width: 768px) {
    html {
        font-size: 18px;
    }
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 400;
    line-height: 1.75;
    color: var(--color-text);
    background-color: var(--color-bg);
    margin: 0;
    min-height: 100vh;
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.25;
    color: var(--color-text);
    margin: 0 0 var(--space-4);
    letter-spacing: -0.02em;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.08em; }

@media (min-width: 768px) {
    h1 { font-size: var(--text-4xl); }
    h2 { font-size: var(--text-3xl); }
    h3 { font-size: var(--text-2xl); }
}

p {
    margin: 0 0 var(--space-5);
}

a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-color: rgba(184, 92, 63, 0.3);
    text-underline-offset: 0.2em;
    transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-dark);
    text-decoration-color: var(--color-primary);
}

.entry-content a {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.entry-content a:hover {
    color: var(--color-primary-dark);
    background: rgba(156, 74, 50, 0.08);
    border-radius: 2px;
}

.entry-content a:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

.entry-content > p:first-of-type::first-letter {
    float: left;
    font-family: var(--font-heading);
    font-size: 3.2em;
    font-weight: 700;
    line-height: 0.85;
    padding: 0.1em 0.12em 0 0;
    color: var(--color-primary);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

figure {
    margin: var(--space-8) 0;
}

figcaption {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    text-align: center;
    margin-top: var(--space-3);
}

/* === Selection === */
::selection {
    background-color: rgba(184, 92, 63, 0.2);
    color: var(--color-text);
}

/* === Focus styles === */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* === Screen reader text === */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.screen-reader-text:focus,
.skip-link:focus {
    position: fixed;
    top: var(--space-4);
    left: var(--space-4);
    width: auto;
    height: auto;
    padding: var(--space-3) var(--space-5);
    margin: 0;
    clip: auto;
    white-space: normal;
    background: var(--color-surface);
    color: var(--color-primary);
    font-weight: 700;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100000;
    text-decoration: none;
}

/* === Layout helpers === */
.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-content {
    flex: 1;
    padding: var(--space-8) 0 var(--space-16);
}

.content-inner,
.site-content-inner,
.container {
    width: 100%;
    max-width: var(--page-max-width);
    margin: 0 auto;
    padding: 0 var(--space-5);
}

.site-content-inner,
.content-inner {
    max-width: var(--content-max-width);
}

@media (min-width: 768px) {
    .content-inner,
    .site-content-inner,
    .container {
        padding: 0 var(--space-8);
    }
}

/* === Buttons === */
.btn,
button,
input[type="submit"],
input[type="button"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 48px;
}

.btn-primary,
button[type="submit"],
input[type="submit"] {
    background-color: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.btn-primary:hover,
button[type="submit"]:hover,
input[type="submit"]:hover {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-secondary:hover {
    background-color: var(--color-primary);
    color: #fff;
    transform: translateY(-2px);
}

.btn-ghost {
    background-color: transparent;
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-ghost:hover {
    background: var(--color-bg-alt);
    color: var(--color-text);
    border-color: var(--color-border);
}

/* === Search form (non-header contexts) === */
.search-form {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.search-form input[type="search"] {
    flex: 1;
}

/* === Forms === */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 4px rgba(94, 124, 107, 0.12);
}

input::placeholder,
textarea::placeholder {
    color: var(--color-text-light);
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--color-text);
}

textarea {
    min-height: 160px;
    resize: vertical;
}

/* === Tables === */
table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-6) 0;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

th, td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}

th {
    background-color: var(--color-bg-alt);
    font-weight: 700;
    font-family: var(--font-heading);
}

/* === Lists === */
ul, ol {
    margin: 0 0 var(--space-5);
    padding-left: var(--space-6);
}

li {
    margin-bottom: var(--space-2);
}

li > ul,
li > ol {
    margin-top: var(--space-2);
}

/* === Blockquote === */
blockquote {
    position: relative;
    margin: var(--space-8) 0;
    padding: var(--space-6) var(--space-8);
    background: var(--color-bg-warm);
    border-left: 4px solid var(--color-accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    font-style: italic;
    color: var(--color-text-muted);
}

blockquote::before {
    content: '"';
    position: absolute;
    top: var(--space-3);
    left: var(--space-4);
    font-family: var(--font-heading);
    font-size: 3rem;
    line-height: 1;
    color: var(--color-accent);
    opacity: 0.3;
}

blockquote p:last-child {
    margin-bottom: 0;
}

blockquote cite {
    display: block;
    margin-top: var(--space-4);
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-style: normal;
    color: var(--color-text-light);
}

blockquote cite::before {
    content: '— ';
}

.wp-block-pullquote {
    padding: var(--space-8) var(--space-5);
    text-align: center;
    border-top: 3px solid var(--color-primary);
    border-bottom: 3px solid var(--color-primary);
}

.wp-block-pullquote blockquote {
    background: transparent;
    border-left: 0;
    border-radius: 0;
    margin: 0;
}

.wp-block-pullquote blockquote::before {
    display: none;
}

/* === Code === */
code, pre {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 0.9em;
}

pre {
    background: var(--color-text);
    color: var(--color-bg);
    padding: var(--space-5);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: var(--space-6) 0;
}

/* === Animations === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.animate-on-scroll {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s var(--ease-out-expo), transform 0.4s var(--ease-out-expo);
}

.animate-on-scroll.visible,
.no-js .animate-on-scroll {
    opacity: 1;
    transform: translateY(0);
}

.no-js .animate-on-scroll {
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    .animate-on-scroll {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* === Reading progress bar === */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    z-index: 10001;
    width: 0%;
    transition: width 0.1s linear;
}

/* === Back to top === */
#back-to-top {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-primary);
    border: 2px solid var(--color-border);
    box-shadow: var(--shadow-card);
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: all var(--transition-normal);
    z-index: 9999;
    font-size: var(--text-xl);
}

#back-to-top.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

#back-to-top:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .animate-on-scroll {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

.table-wrapper {
    overflow-x: auto;
    margin: var(--space-6) 0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.table-wrapper table {
    margin: 0;
    min-width: 100%;
}

/* === WordPress alignment & captions === */
.alignleft {
    float: left;
    margin: 0 var(--space-6) var(--space-4) 0;
}

.alignright {
    float: right;
    margin: 0 0 var(--space-4) var(--space-6);
}

.aligncenter {
    display: block;
    margin: var(--space-6) auto;
}

.alignnone {
    margin: var(--space-6) 0;
}

.alignwide {
    max-width: var(--page-max-width);
    margin-left: auto;
    margin-right: auto;
}

.alignfull {
    width: 100%;
    max-width: 100%;
    margin-left: calc(-1 * var(--space-5));
    margin-right: calc(-1 * var(--space-5));
}

@media (min-width: 768px) {
    .alignfull {
        margin-left: calc(-1 * var(--space-8));
        margin-right: calc(-1 * var(--space-8));
    }
}

.wp-caption {
    max-width: 100%;
    margin: var(--space-6) 0;
}

.wp-caption img {
    border-radius: var(--radius-md);
}

.wp-caption-text {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    text-align: center;
    margin-top: var(--space-3);
}

/* === Gallery === */
.gallery,
.blocks-gallery-grid {
    display: grid;
    gap: var(--space-4);
    margin: var(--space-6) 0;
}

.gallery-columns-1 { grid-template-columns: 1fr; }
.gallery-columns-2 { grid-template-columns: repeat(2, 1fr); }
.gallery-columns-3 { grid-template-columns: repeat(3, 1fr); }
.gallery-columns-4 { grid-template-columns: repeat(2, 1fr); }
.gallery-columns-5,
.gallery-columns-6,
.gallery-columns-7,
.gallery-columns-8,
.gallery-columns-9 { grid-template-columns: repeat(3, 1fr); }

@media (min-width: 768px) {
    .gallery-columns-4 { grid-template-columns: repeat(4, 1fr); }
    .gallery-columns-5 { grid-template-columns: repeat(5, 1fr); }
    .gallery-columns-6 { grid-template-columns: repeat(6, 1fr); }
    .gallery-columns-7 { grid-template-columns: repeat(4, 1fr); }
    .gallery-columns-8 { grid-template-columns: repeat(4, 1fr); }
    .gallery-columns-9 { grid-template-columns: repeat(5, 1fr); }
}

.gallery-item,
.blocks-gallery-item {
    margin: 0;
}

.gallery-icon img,
.blocks-gallery-item img {
    width: 100%;
    border-radius: var(--radius-md);
    transition: transform var(--transition-fast);
}

.gallery-icon img:hover,
.blocks-gallery-item img:hover {
    transform: scale(1.02);
}

.gallery-caption,
.blocks-gallery-item__caption {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    text-align: center;
    margin-top: var(--space-2);
}

/* === Sticky post === */
.sticky-label {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    padding: var(--space-1) var(--space-3);
    background: var(--color-accent);
    color: var(--color-text);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: var(--radius-full);
    z-index: 2;
}

/* === Print === */
@media print {
    html { font-size: 12pt; }
    body { background: #fff; color: #000; }
    .site-header, .site-footer, .breadcrumb-bar, .post-navigation,
    .comments-area, #reading-progress, #back-to-top, .search-wrapper {
        display: none !important;
    }
    a { color: #000; text-decoration: underline; }
    article { box-shadow: none; border: 1px solid #ccc; }
}



/* === Template-part compatibility rules === */
.posts-section .post-header,
.posts-section .post-excerpt,
.posts-section .more-link {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
}

.posts-section .more-link {
    margin-left: var(--space-6);
}

.posts-section .post-header {
    padding-top: var(--space-5);
}

.posts-section .entry-title,
.posts-section .post-title {
    font-size: var(--text-xl);
    text-wrap: balance;
}

.posts-section .entry-content,
.posts-section .post-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--color-text-muted);
    font-size: var(--text-base);
    line-height: 1.7;
}

