/*
 * Peninsula Web Design - Design Tokens & Utilities
 *
 * To change the site's look and feel, edit the :root variables below.
 * All components reference these tokens, so a single change propagates everywhere.
 * Component-specific styles live inline in generate.ts, not here.
 */

/* ── Fonts ──────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Tokens ─────────────────────────────────────────────────────────────────── */
:root {
    /* Brand */
    --color-primary:       #1e40af;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #eff6ff;
    --color-accent:        #3b82f6;

    /* Text */
    --color-text:          #111827;
    --color-text-muted:    #6b7280;
    --color-text-light:    #9ca3af;
    --color-text-inverse:  #f9fafb;

    /* Backgrounds */
    --color-bg:            #ffffff;
    --color-bg-subtle:     #f8fafc;
    --color-bg-dark:       #0f172a;
    --color-bg-dark-card:  #1e293b;

    /* Borders & shadows */
    --color-border:        #e2e8f0;
    --shadow-sm:           0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md:           0 4px 12px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
    --shadow-lg:           0 10px 40px rgba(0,0,0,.12);

    /* Shape */
    --radius:              0.5rem;
    --radius-lg:           0.875rem;
    --radius-xl:           1.25rem;

    /* Typography */
    --font:                'Inter', system-ui, -apple-system, sans-serif;

    /* Layout */
    --container:           1200px;
    --section-gap:         5rem;
}

/* apply dark mode to all child elements when "dark" is a class on a parent element */
@custom-variant dark (&:where(.dark, .dark *));

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ── Layout utilities ────────────────────────────────────────────────────────── */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1.5rem;
}
.section {
    padding: var(--section-gap) 0;
}
.section--dark {
    background: var(--color-bg-dark);
    color: var(--color-text-inverse);
}
.section--subtle {
    background: var(--color-bg-subtle);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.75rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center  { display: flex; align-items: center; justify-content: center; gap: 1rem; }

/* ── Section header ──────────────────────────────────────────────────────────── */
.section-header {
    text-align: center;
    margin-bottom: 3rem;
}
.section-header .label {
    margin-bottom: 0.75rem;
}
.section-header h2 {
    margin-bottom: 1rem;
}
.section-header .lead {
    max-width: 600px;
    margin: 0 auto;
}

/* ── Typography ──────────────────────────────────────────────────────────────── */
.label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-accent);
}
h1 {
    font-size: clamp(2.25rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.025em;
}
h2 {
    font-size: clamp(1.75rem, 3vw, 2.375rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}
h3 {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
}
.lead {
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--color-text-muted);
}
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.625rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 2px solid transparent;
    white-space: nowrap;
    line-height: 1;
    text-decoration: none;
}
.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30,64,175,.3);
}
.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.btn-outline:hover {
    background: var(--color-primary-light);
}
.btn-ghost {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-color: rgba(255,255,255,.25);
}
.btn-ghost:hover {
    background: rgba(255,255,255,.2);
}
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}
.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    transition: all 0.2s ease;
}
.card--dark {
    background: var(--color-bg-dark-card);
    border-color: rgba(255,255,255,.08);
    color: var(--color-text-inverse);
}

/* ── Nav ─────────────────────────────────────────────────────────────────────── */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
}
.nav__inner {
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}
.nav__logo {
    font-weight: 800;
    font-size: 1rem;
    color: var(--color-primary);
    white-space: nowrap;
    flex-shrink: 0;
}
.nav__links {
    display: flex;
    align-items: center;
    gap: 2rem;
}
.nav__link {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: color 0.15s;
}
.nav__link:hover { color: var(--color-primary); }

/* ── Blog card ───────────────────────────────────────────────────────────────── */
.blog-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}
.blog-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.blog-card__img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: var(--color-bg-subtle);
}
.blog-card__img-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, var(--color-primary-light), #e0e7ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}
.blog-card__body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.blog-card__meta {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}
.blog-card__title {
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}
.blog-card__excerpt {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    flex: 1;
    margin-bottom: 1rem;
}
.blog-card__link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-accent);
}
.blog-card__link:hover { text-decoration: underline; }

/* ── FAQ / accordion ─────────────────────────────────────────────────────────── */
details.faq-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
details.faq-item + details.faq-item {
    margin-top: 0.5rem;
}
details.faq-item summary {
    padding: 1.125rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
    user-select: none;
    background: var(--color-bg);
}
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item summary::after {
    content: '+';
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--color-accent);
    flex-shrink: 0;
}
details.faq-item[open] summary::after {
    content: '−';
}
details.faq-item .faq-answer {
    padding: 0 1.25rem 1.25rem;
    color: var(--color-text-muted);
    line-height: 1.7;
    font-size: 0.9375rem;
}

/* ── Form ────────────────────────────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
}
.form-input,
.form-textarea {
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-bg);
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}
.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-textarea { resize: vertical; min-height: 120px; }
.form-success {
    padding: 1rem 1.25rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    color: #15803d;
    font-weight: 500;
    display: none;
}
.form-error {
    padding: 1rem 1.25rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    color: #dc2626;
    font-weight: 500;
    display: none;
}

/* ── Blog loading skeleton ────────────────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--color-bg-subtle) 25%, #e2e8f0 50%, var(--color-bg-subtle) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius);
}
@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    :root { --section-gap: 3.5rem; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: 1fr 1fr; }
    .nav__links { display: none; }
}
@media (max-width: 480px) {
    .grid-4 { grid-template-columns: 1fr; }
    .container { padding: 0 1rem; }
}
