/* ==========================================================================
   Grupo Caseiro - Página Pública | MOBILE FIRST
   ========================================================================== */

/* === CSS Variables & Themes === */
:root, [data-theme="escuro"] {
    --bg: #0a0a1a;
    --surface: #111128;
    --surface-light: #1a1a38;
    --accent: #c9a84c;
    --accent-glow: rgba(201, 168, 76, 0.15);
    --text: #e8e8ec;
    --text-secondary: #b0b0c0;
    --text-muted: #6b6b80;
    --border: rgba(255, 255, 255, 0.06);
    --card-bg: #111128;
    --hero-gradient: linear-gradient(180deg, #111128, #0a0a1a);
}

[data-theme="claro"] {
    --bg: #f5f3ef;
    --surface: #ffffff;
    --surface-light: #f0ede6;
    --accent: #8b6914;
    --accent-glow: rgba(139, 105, 20, 0.1);
    --text: #2d2a26;
    --text-secondary: #5a5650;
    --text-muted: #8a8580;
    --border: rgba(0, 0, 0, 0.08);
    --card-bg: #ffffff;
    --hero-gradient: linear-gradient(180deg, #ffffff, #f5f3ef);
}

[data-theme="sepia"] {
    --bg: #f4e8d1;
    --surface: #efe2cb;
    --surface-light: #e8d9be;
    --accent: #7a4f1e;
    --accent-glow: rgba(122, 79, 30, 0.12);
    --text: #3e2b1e;
    --text-secondary: #5c4a3a;
    --text-muted: #8a7560;
    --border: rgba(92, 61, 46, 0.12);
    --card-bg: #efe2cb;
    --hero-gradient: linear-gradient(180deg, #efe2cb, #f4e8d1);
}

[data-theme="noturno"] {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-light: #21262d;
    --accent: #58a6ff;
    --accent-glow: rgba(88, 166, 255, 0.1);
    --text: #c9d1d9;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border: rgba(255, 255, 255, 0.06);
    --card-bg: #161b22;
    --hero-gradient: linear-gradient(180deg, #161b22, #0d1117);
}

/* === Reset & Base (Mobile) === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    overflow-x: hidden;
    transition: background 0.4s, color 0.4s;
}

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

/* === HEADER (Mobile) === */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0; z-index: 100;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 10, 26, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: all 0.3s;
    gap: 10px;
}

[data-theme="claro"] .site-header,
[data-theme="sepia"] .site-header {
    background: rgba(245, 243, 239, 0.92);
}

.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.logo-mark {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent), #000 30%));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Cormorant Garamond', serif;
    font-size: 15px; font-weight: 700; color: var(--bg);
}

.logo-text { font-family: 'Cormorant Garamond', serif; font-size: 18px; font-weight: 600; }
.logo-sub { display: none; }

.header-right { display: flex; align-items: center; gap: 8px; }

.header-search {
    display: flex; align-items: center; gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 7px 14px;
    width: 140px;
    transition: all 0.3s;
}

.header-search:focus-within { border-color: var(--accent); width: 180px; }

.header-search input {
    background: none; border: none; color: var(--text);
    font-family: 'DM Sans', sans-serif; font-size: 13px; outline: none; width: 100%;
}

.header-search input::placeholder { color: var(--text-muted); }
.search-icon { color: var(--text-muted); min-width: 16px; }

/* Theme Switcher */
.theme-switcher {
    position: relative;
}

.theme-btn {
    width: 36px; height: 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

.theme-btn:hover { border-color: var(--accent); background: var(--surface-light); }

.theme-dropdown {
    display: none;
    position: absolute;
    top: 48px; right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 6px;
    min-width: 170px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    z-index: 200;
    animation: dropIn 0.2s ease;
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.theme-dropdown.open { display: block; }

.theme-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    border: none;
    background: none;
    width: 100%;
    font-family: 'DM Sans', sans-serif;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    margin: 0;
    line-height: 1;
}

.theme-option:hover {
    background: var(--accent-glow);
    color: var(--text);
}

.theme-option.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 600;
}

.theme-option.active .theme-dot {
    box-shadow: 0 0 0 2px var(--accent);
}

.theme-dot {
    width: 18px; height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.15);
    transition: box-shadow 0.2s;
}

[data-theme="claro"] .theme-dot,
[data-theme="sepia"] .theme-dot {
    border-color: rgba(0,0,0,0.12);
}

/* === HERO (Mobile) === */
.hero {
    min-height: 85vh;
    display: flex; align-items: center; justify-content: center;
    text-align: center;
    padding: 90px 20px 40px;
    position: relative; overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -30%; left: -20%; width: 140%; height: 160%;
    background: radial-gradient(ellipse at 50% 40%, var(--accent-glow), transparent 60%);
    animation: bgFloat 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0,0); }
    50% { transform: translate(10px,-10px); }
}

.hero-content { position: relative; z-index: 1; max-width: 600px; width: 100%; }

.hero-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 14px;
    background: var(--accent-glow);
    border: 1px solid rgba(201,168,76,.2);
    border-radius: 30px;
    font-size: 10px; color: var(--accent);
    letter-spacing: 1.5px; text-transform: uppercase; font-weight: 500;
    margin-bottom: 20px;
}

.hero h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    font-weight: 300; line-height: 1.35; margin-bottom: 18px;
    max-width: 640px; margin-left: auto; margin-right: auto;
}

.hero h1 em { font-style: italic; color: var(--accent); font-weight: 400; }

.hero-desc {
    font-size: 0.95rem; color: var(--text-secondary);
    margin: 0 auto 24px; line-height: 1.6;
}

.hero-cta {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent), #000 25%));
    color: var(--bg); border-radius: 50px;
    font-weight: 600; font-size: 14px; transition: all 0.3s;
}

.hero-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px var(--accent-glow);
}

.hero-stats { display: flex; justify-content: center; gap: 28px; margin-top: 32px; }

.hero-stat-number {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2rem; font-weight: 600; color: var(--accent); line-height: 1;
}

.hero-stat-label {
    font-size: 10px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1.5px; margin-top: 4px;
}

/* === DESTAQUE (Mobile) === */
.destaque-section {
    margin: -20px 16px 40px; position: relative; z-index: 2;
}

.destaque-card {
    display: block;
    background: linear-gradient(135deg, var(--surface), var(--surface-light));
    border: 1px solid var(--border);
    border-radius: 20px; overflow: hidden;
    transition: all 0.4s;
}

.destaque-card:hover {
    border-color: var(--accent-glow);
    transform: translateY(-3px);
    box-shadow: 0 14px 40px rgba(0,0,0,.25);
}

.destaque-image {
    height: 180px;
    background: var(--hero-gradient);
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}

.destaque-image img { width: 100%; height: 100%; object-fit: cover; }
.placeholder-icon, .card-placeholder { font-size: 48px; opacity: 0.1; }

.destaque-badge {
    position: absolute; top: 14px; left: 14px;
    padding: 5px 12px; background: var(--accent); color: var(--bg);
    border-radius: 6px; font-size: 10px; font-weight: 600;
    letter-spacing: 1px; text-transform: uppercase;
}

.destaque-body { padding: 24px 20px; }

.destaque-ref {
    color: var(--accent); font-size: 11px;
    letter-spacing: 2px; text-transform: uppercase; font-weight: 500; margin-bottom: 8px;
}

.destaque-body h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem; font-weight: 600; line-height: 1.25; margin-bottom: 10px;
}

.destaque-excerpt { color: var(--text-secondary); font-size: 14px; margin-bottom: 14px; line-height: 1.6; }

.destaque-meta {
    display: flex; align-items: center; gap: 10px;
    font-size: 12px; color: var(--text-muted); margin-bottom: 16px;
}

.destaque-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--accent); font-weight: 600; font-size: 13px;
    transition: gap 0.3s;
}

.destaque-link:hover { gap: 12px; }

/* === FILTERS (Mobile) === */
.filters-section { margin: 0 16px 28px; }

.filters-row {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 11px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1.2px; font-weight: 500;
    width: 100%; margin-bottom: 4px;
}

.filter-chip {
    padding: 5px 14px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 30px;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px; cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.filter-chip:hover, .filter-chip.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

/* === ESTUDOS GRID (Mobile) === */
.estudos-section { margin: 0 16px; padding-bottom: 60px; }

.estudos-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.estudo-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.4s ease;
    display: flex; flex-direction: column;
    opacity: 0; transform: translateY(20px);
}

.estudo-card.visible {
    opacity: 1; transform: translateY(0);
    transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.3s, box-shadow 0.3s;
}

.estudo-card:hover {
    border-color: var(--accent-glow);
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(0,0,0,.2);
}

.card-image {
    height: 160px;
    background: var(--hero-gradient);
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}

.card-image img { width: 100%; height: 100%; object-fit: cover; }

.card-body { padding: 18px; flex: 1; display: flex; flex-direction: column; }

.card-ref {
    color: var(--accent); font-size: 10px;
    letter-spacing: 1.5px; text-transform: uppercase; font-weight: 500; margin-bottom: 6px;
}

.card-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem; font-weight: 600; line-height: 1.3; margin-bottom: 8px;
}

.card-excerpt {
    color: var(--text-muted); font-size: 13px; line-height: 1.6;
    margin-bottom: 12px; flex: 1;
}

.card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }

.card-tag {
    padding: 2px 8px;
    background: var(--accent-glow);
    color: var(--accent);
    border-radius: 4px;
    font-size: 10px; font-weight: 500;
}

.card-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 12px; border-top: 1px solid var(--border);
    font-size: 11px; color: var(--text-muted);
}

/* === LEGACY BADGE === */
.card-legacy {
    position: absolute; top: 10px; right: 10px;
    padding: 3px 8px;
    background: rgba(0,0,0,.5);
    color: #fff;
    border-radius: 4px;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* === FOOTER === */
.site-footer {
    text-align: center; padding: 36px 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted); font-size: 12px;
    line-height: 1.8;
}

.footer-links { margin-top: 6px; }
.footer-links a { color: var(--accent); }

/* ===========================================================
   TABLET (min-width: 640px)
   =========================================================== */
@media (min-width: 640px) {
    .estudos-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .hero h1 { font-size: 1.8rem; }
    .hero-stats { gap: 40px; }
    .hero-stat-number { font-size: 2.5rem; }
    .destaque-section { margin: -30px 20px 50px; }
    .filters-section { margin: 0 20px 32px; }
    .estudos-section { margin: 0 20px; }
    .filter-label { width: auto; margin-bottom: 0; }
    .logo-sub { display: block; font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 2px; }
    .header-search { width: 200px; }
    .header-search:focus-within { width: 260px; }
}

/* ===========================================================
   DESKTOP (min-width: 1024px)
   =========================================================== */
@media (min-width: 1024px) {
    .site-header { padding: 14px 40px; }
    .logo-mark { width: 44px; height: 44px; font-size: 18px; }
    .logo-text { font-size: 22px; }
    .hero { min-height: 100vh; padding: 120px 20px 80px; }
    .hero h1 { font-size: clamp(1.8rem, 2.8vw, 2.4rem); }
    .hero-desc { font-size: 1.05rem; max-width: 520px; }
    .hero-stats { gap: 48px; margin-top: 48px; }
    .hero-stat-number { font-size: 3rem; }
    .destaque-section { max-width: 1100px; margin: -40px auto 60px; padding: 0 20px; }
    .destaque-card { display: grid; grid-template-columns: 1fr 1.2fr; }
    .destaque-image { min-height: 320px; height: auto; }
    .destaque-body { padding: 48px 40px; }
    .destaque-body h2 { font-size: 2rem; }
    .filters-section { max-width: 1100px; margin: 0 auto 40px; padding: 0 20px; }
    .estudos-section { max-width: 1100px; margin: 0 auto; padding: 0 20px 80px; }
    .estudos-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; }
    .card-image { height: 180px; }
    .card-body { padding: 24px; }
    .card-title { font-size: 1.35rem; }
    .header-search { width: 280px; padding: 8px 20px; }
    .header-search:focus-within { width: 340px; }
}
