/* ═══════════════════════════════════════════════════════════════
   EDITORIAL OCEAN SUNRISE
   Magazine-inspired layout with asymmetric grids
═══════════════════════════════════════════════════════════════ */

:root {
    /* Light theme (default) */
    --background: 48 28% 96%;
    --foreground: 190 20% 18%;
    --card: 45 24% 91%;
    --card-foreground: 190 20% 18%;
    --primary: 190 35% 42%;
    --primary-foreground: 48 28% 96%;
    --secondary: 45 22% 85%;
    --secondary-foreground: 190 20% 18%;
    --muted: 42 18% 85%;
    --muted-foreground: 190 15% 46%;
    --accent: 185 45% 48%;
    --accent-foreground: 48 28% 96%;
    --interaction: 185 55% 45%;
    --interaction-foreground: 0 0% 100%;
    --border: 42 15% 83%;

    --radius: 0.5rem;
    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-sans: 'Outfit', system-ui, sans-serif;

    --type-display-xl: clamp(3.5rem, 10vw, 8rem);
    --type-display-l: clamp(2.5rem, 6vw, 5rem);
    --type-display-m: clamp(1.75rem, 3.5vw, 3rem);
    --type-display-s: clamp(1.25rem, 2vw, 1.75rem);
    --type-body-l: clamp(1.1rem, 1.5vw, 1.25rem);
    --type-body-m: 1rem;
    --type-caption: 0.8125rem;
    --type-overline: 0.6875rem;
}

/* Dark theme */
[data-theme="dark"] {
    --background: 190 20% 11%;
    --foreground: 45 24% 87%;
    --card: 190 18% 16%;
    --card-foreground: 45 24% 87%;
    --primary: 185 55% 58%;
    --primary-foreground: 190 20% 11%;
    --secondary: 190 15% 25%;
    --secondary-foreground: 45 24% 87%;
    --muted: 190 15% 25%;
    --muted-foreground: 185 25% 63%;
    --accent: 180 60% 62%;
    --accent-foreground: 190 20% 11%;
    --interaction: 180 60% 62%;
    --interaction-foreground: 190 20% 11%;
    --border: 190 15% 27%;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-serif);
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    line-height: 1.7;
    font-size: var(--type-body-l);
    overflow-x: hidden;
}

/* Subtle grain texture */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.025;
    z-index: 1000;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

a {
    color: inherit;
    text-decoration: none;
}

/* ═══════════════════════════════════════════════════════════════
   LAYOUT CONTAINERS
═══════════════════════════════════════════════════════════════ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(24px, 5vw, 80px);
}

.container--narrow {
    max-width: 720px;
}

/* ═══════════════════════════════════════════════════════════════
   SECTION HEADERS — Editorial label style
═══════════════════════════════════════════════════════════════ */

.section-label {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    font-family: var(--font-sans);
    font-size: var(--type-overline);
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: hsl(var(--accent));
    margin-bottom: 48px;
}

.section-label::before {
    content: '';
    width: 32px;
    height: 2px;
    background: hsl(var(--accent));
}

/* ═══════════════════════════════════════════════════════════════
   MASTHEAD — Minimal editorial header
═══════════════════════════════════════════════════════════════ */

.masthead {
    padding: clamp(32px, 6vh, 64px) 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid hsl(var(--border));
}

.masthead__name {
    font-family: var(--font-sans);
    font-size: var(--type-overline);
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: hsl(var(--primary));
}

.masthead__meta {
    font-family: var(--font-sans);
    font-size: var(--type-overline);
    color: hsl(var(--muted-foreground));
    letter-spacing: 0.1em;
    font-weight: 300;
}

.masthead__back {
    font-family: var(--font-sans);
    font-size: var(--type-overline);
    color: hsl(var(--muted-foreground));
    letter-spacing: 0.1em;
    font-weight: 300;
    transition: color 0.2s ease;
}

.masthead__back:hover {
    color: hsl(var(--interaction));
}

/* ═══════════════════════════════════════════════════════════════
   FOOTER — Minimal colophon
═══════════════════════════════════════════════════════════════ */

.colophon {
    padding: 48px 0;
    border-top: 1px solid hsl(var(--border));
    text-align: center;
}

.colophon__text {
    font-family: var(--font-sans);
    font-size: var(--type-overline);
    color: hsl(var(--muted-foreground));
    letter-spacing: 0.15em;
    font-weight: 300;
}

/* ═══════════════════════════════════════════════════════════════
   CASE STUDY CARDS — shared between index and case-studies
═══════════════════════════════════════════════════════════════ */

.cs-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 28px 24px;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-left: 3px solid hsl(var(--accent));
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-left-color 0.2s ease;
    cursor: pointer;
}

.cs-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px hsl(var(--primary) / 0.1);
    border-left-color: hsl(var(--interaction));
}

.cs-card__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cs-card__type {
    font-family: var(--font-sans);
    font-size: var(--type-overline);
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: hsl(var(--accent));
}

.cs-card__date {
    font-family: var(--font-sans);
    font-size: var(--type-overline);
    color: hsl(var(--muted-foreground));
}

.cs-card__title {
    font-family: var(--font-serif);
    font-size: var(--type-display-s);
    font-weight: 600;
    color: hsl(var(--foreground));
    line-height: 1.3;
}

.cs-card__tagline {
    font-family: var(--font-serif);
    font-size: var(--type-body-m);
    color: hsl(var(--muted-foreground));
    line-height: 1.6;
    flex: 1;
}

.cs-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cs-card__tag {
    font-family: var(--font-sans);
    font-size: var(--type-overline);
    color: hsl(var(--muted-foreground));
    background: hsl(var(--secondary));
    padding: 2px 8px;
    letter-spacing: 0.05em;
}

.cs-card__cta {
    font-family: var(--font-sans);
    font-size: var(--type-caption);
    font-weight: 500;
    color: hsl(var(--interaction));
    margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   THEME TOGGLE — Sunrise/Sunset Arc
═══════════════════════════════════════════════════════════════ */

.theme-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    width: 52px;
    height: 28px;
    background: linear-gradient(
        180deg,
        hsl(200 60% 85%) 0%,
        hsl(45 80% 90%) 100%
    );
    border: 1px solid hsl(var(--border));
    border-radius: 100px;
    cursor: pointer;
    transition: background 0.6s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 12px hsl(var(--primary) / 0.08);
    overflow: hidden;
    padding: 0;
}

[data-theme="dark"] .theme-toggle {
    background: linear-gradient(
        180deg,
        hsl(220 30% 20%) 0%,
        hsl(250 25% 30%) 100%
    );
}

.theme-toggle:hover {
    border-color: hsl(var(--accent));
    box-shadow: 0 8px 24px hsl(var(--primary) / 0.15);
    transform: translateY(-2px);
}

.theme-toggle__horizon {
    position: absolute;
    bottom: 8px;
    left: 6px;
    right: 6px;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        hsl(35 80% 55% / 0.6) 50%,
        transparent 100%
    );
    transition: background 0.6s ease;
}

[data-theme="dark"] .theme-toggle__horizon {
    background: linear-gradient(
        90deg,
        transparent 0%,
        hsl(220 40% 50% / 0.4) 50%,
        transparent 100%
    );
}

.theme-toggle__arc {
    position: absolute;
    bottom: 8px;
    left: 50%;
    width: 32px;
    height: 16px;
    margin-left: -16px;
    pointer-events: none;
}

.theme-toggle__sun {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(
        135deg,
        hsl(50 95% 65%) 0%,
        hsl(40 100% 55%) 100%
    );
    box-shadow:
        0 0 6px hsl(45 95% 60% / 0.8),
        0 0 12px hsl(40 100% 55% / 0.4);
    left: 50%;
    bottom: 0;
    margin-left: -6px;
    transform-origin: center calc(100% + 10px);
    transform: rotate(-80deg);
    transition: transform 0.6s cubic-bezier(0.34, 1.2, 0.64, 1),
                background 0.6s ease,
                box-shadow 0.6s ease;
}

[data-theme="dark"] .theme-toggle__sun {
    transform: rotate(80deg);
    background: linear-gradient(
        135deg,
        hsl(45 20% 85%) 0%,
        hsl(220 15% 80%) 100%
    );
    box-shadow:
        0 0 4px hsl(220 30% 80% / 0.6),
        0 0 8px hsl(220 20% 70% / 0.3);
}

.theme-toggle__glow {
    position: absolute;
    bottom: 4px;
    left: 4px;
    width: 16px;
    height: 8px;
    background: radial-gradient(
        ellipse at center bottom,
        hsl(45 100% 70% / 0.5) 0%,
        transparent 70%
    );
    transition: all 0.6s cubic-bezier(0.34, 1.2, 0.64, 1);
    opacity: 1;
    filter: blur(2px);
}

[data-theme="dark"] .theme-toggle__glow {
    left: calc(100% - 20px);
    opacity: 0.4;
    background: radial-gradient(
        ellipse at center bottom,
        hsl(220 40% 75% / 0.3) 0%,
        transparent 70%
    );
}

.theme-toggle__stars {
    position: absolute;
    inset: 4px;
    opacity: 0;
    transition: opacity 0.6s ease 0.2s;
}

.theme-toggle__stars::before,
.theme-toggle__stars::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    background: hsl(0 0% 100% / 0.7);
    border-radius: 50%;
}

.theme-toggle__stars::before {
    top: 4px;
    left: 12px;
    box-shadow:
        8px 6px 0 hsl(0 0% 100% / 0.5),
        20px 2px 0 hsl(0 0% 100% / 0.4);
}

.theme-toggle__stars::after {
    top: 8px;
    right: 10px;
}

[data-theme="dark"] .theme-toggle__stars {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Shared rules
═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .masthead {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

@media (max-width: 1024px) {
    .cs-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .cs-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .theme-toggle {
        top: 16px;
        right: 16px;
        width: 44px;
        height: 24px;
    }

    .theme-toggle__sun {
        width: 10px;
        height: 10px;
        margin-left: -5px;
    }

    .theme-toggle__horizon {
        bottom: 7px;
    }

    .theme-toggle__arc {
        bottom: 7px;
    }

    .theme-toggle__glow {
        bottom: 3px;
        width: 12px;
        height: 6px;
    }

    .theme-toggle__stars::before,
    .theme-toggle__stars::after {
        width: 1.5px;
        height: 1.5px;
    }
}
