/* ==========================================================================
   base.css — Privacy Shade
   CSS custom properties, modern reset, base typography
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
    /* Brand colours */
    --color-accent:        #2C6E49;
    --color-accent-dark:   #1e4d33;
    --color-accent-light:  #e8f4ee;
    --color-accent-mid:    #4a9068;

    /* Text */
    --color-text:           #1a1a1a;
    --color-text-secondary: #4a4a4a;
    --color-text-muted:     #767676;
    --color-text-inverse:   #ffffff;

    /* Backgrounds */
    --color-bg:         #ffffff;
    --color-bg-alt:     #f8f9f7;
    --color-bg-dark:    #1a1a1a;
    --color-bg-overlay: rgba(0, 0, 0, 0.5);

    /* Borders */
    --color-border:       #e0e0e0;
    --color-border-light: #f0f0f0;
    --color-border-dark:  #c0c0c0;

    /* Typography */
    --font-body:    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-heading: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono:    'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

    /* Fluid type scale using clamp(min, preferred, max) */
    --text-xs:   clamp(0.694rem, 0.65rem + 0.2vw,  0.75rem);
    --text-sm:   clamp(0.833rem, 0.80rem + 0.2vw,  0.875rem);
    --text-base: clamp(1rem,     0.95rem + 0.25vw,  1rem);
    --text-lg:   clamp(1.125rem, 1.05rem + 0.35vw,  1.25rem);
    --text-xl:   clamp(1.25rem,  1.1rem  + 0.75vw,  1.5rem);
    --text-2xl:  clamp(1.5rem,   1.2rem  + 1.2vw,   2rem);
    --text-3xl:  clamp(1.875rem, 1.4rem  + 2vw,     2.5rem);
    --text-4xl:  clamp(2.25rem,  1.6rem  + 2.8vw,   3.25rem);
    --text-5xl:  clamp(2.75rem,  1.8rem  + 4vw,     4rem);

    /* Spacing scale (base-4, multiply up) */
    --space-xs:  0.25rem;   /* 4px */
    --space-sm:  0.5rem;    /* 8px */
    --space-md:  1rem;      /* 16px */
    --space-lg:  1.5rem;    /* 24px */
    --space-xl:  2rem;      /* 32px */
    --space-2xl: 3rem;      /* 48px */
    --space-3xl: 4rem;      /* 64px */
    --space-4xl: 6rem;      /* 96px */

    /* Layout */
    --size-max-width:        1200px;
    --size-max-width-narrow: 760px;
    --size-max-width-wide:   1400px;
    --container-padding:     1.25rem;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md:  0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg:  0 10px 25px rgba(0,0,0,0.10), 0 4px 10px rgba(0,0,0,0.06);
    --shadow-xl:  0 20px 50px rgba(0,0,0,0.12), 0 8px 20px rgba(0,0,0,0.08);
    --shadow-inner: inset 0 2px 4px rgba(0,0,0,0.06);
    --shadow-focus: 0 0 0 3px rgba(44,110,73,0.35);

    /* Transitions */
    --transition:      200ms ease;
    --transition-slow: 350ms ease;
    --transition-fast: 100ms ease;

    /* Z-index scale */
    --z-below:   -1;
    --z-base:     0;
    --z-raised:   1;
    --z-dropdown: 50;
    --z-sticky:   100;
    --z-overlay:  200;
    --z-modal:    300;
    --z-toast:    400;
}

/* --------------------------------------------------------------------------
   Modern CSS Reset
   -------------------------------------------------------------------------- */

/* Box sizing */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Remove default margins and paddings */
* {
    margin: 0;
    padding: 0;
}

/* Set root font size and rendering */
html {
    font-size: 100%; /* 16px base */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    tab-size: 4;
    hanging-punctuation: first last;
}

/* Base body */
body {
    min-height: 100dvh;
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

/* Media */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Form elements inherit font */
input,
button,
textarea,
select {
    font: inherit;
}

/* Avoid text overflows */
p,
h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
}

/* Remove list styles on ul, ol elements with a list role */
ul[role='list'],
ol[role='list'] {
    list-style: none;
}

/* Remove default list decoration for nav lists */
nav ul,
nav ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Make headings not bold by default — we control weight per element */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-text);
}

/* Anchor defaults */
a {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color var(--transition), opacity var(--transition);
}

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

a:not([class]) {
    text-decoration-skip-ink: auto;
}

/* Buttons: remove browser defaults */
button {
    cursor: pointer;
    border: none;
    background: none;
    font: inherit;
    line-height: 1;
}

/* Table defaults */
table {
    border-collapse: collapse;
    width: 100%;
}

/* Horizontal rule */
hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-xl) 0;
}

/* Code */
code, kbd, samp, pre {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

/* Blockquote */
blockquote {
    border-left: 4px solid var(--color-accent);
    padding-left: var(--space-lg);
    font-style: italic;
    color: var(--color-text-secondary);
}

/* Strong / em */
strong, b { font-weight: 700; }
em, i     { font-style: italic; }

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

/* Sup / sub */
sub, sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}
sup { top: -0.5em; }
sub { bottom: -0.25em; }

/* --------------------------------------------------------------------------
   Base Typography — fluid headings
   -------------------------------------------------------------------------- */

h1 { font-size: var(--text-4xl); letter-spacing: -0.02em; }
h2 { font-size: var(--text-3xl); letter-spacing: -0.015em; }
h3 { font-size: var(--text-2xl); letter-spacing: -0.01em; }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
    margin-bottom: var(--space-md);
    line-height: 1.7;
    color: var(--color-text-secondary);
}

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

/* Lead paragraph variant */
.lead {
    font-size: var(--text-lg);
    line-height: 1.65;
    color: var(--color-text-secondary);
}

/* Prose content links */
.prose a {
    color: var(--color-accent);
    font-weight: 500;
}

.prose a:hover {
    color: var(--color-accent-dark);
}

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

.prose li {
    margin-bottom: var(--space-xs);
    color: var(--color-text-secondary);
    line-height: 1.65;
}

.prose h2,
.prose h3,
.prose h4 {
    margin-top: var(--space-2xl);
    margin-bottom: var(--space-md);
}

/* --------------------------------------------------------------------------
   Selection
   -------------------------------------------------------------------------- */
::selection {
    background-color: var(--color-accent-light);
    color: var(--color-accent-dark);
}

::-moz-selection {
    background-color: var(--color-accent-light);
    color: var(--color-accent-dark);
}

/* --------------------------------------------------------------------------
   Focus Styles (accessibility)
   -------------------------------------------------------------------------- */

/* Remove default focus in favour of custom */
:focus {
    outline: none;
}

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

/* Interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-focus);
}

/* --------------------------------------------------------------------------
   Scrollbar styling (Webkit)
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--color-border-dark);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a,
    a:visited {
        text-decoration: underline;
    }

    a[href]::after {
        content: ' (' attr(href) ')';
        font-size: 0.8em;
    }

    a[href^='#']::after,
    a[href^='javascript:']::after,
    a[href^='tel:']::after {
        content: '';
    }

    abbr[title]::after {
        content: ' (' attr(title) ')';
    }

    pre,
    blockquote {
        border: 1px solid #999;
        page-break-inside: avoid;
    }

    thead {
        display: table-header-group;
    }

    tr,
    img {
        page-break-inside: avoid;
    }

    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }

    h2,
    h3 {
        page-break-after: avoid;
    }

    .site-header,
    .site-footer,
    .cta-section,
    .nav-toggle {
        display: none !important;
    }

    .container {
        max-width: 100% !important;
    }
}
