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

body {
    margin: 0;
    padding: 0;
    background-color: #fffcf2;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: #2b2117;
}

/* ── Top Nav ── */
nav.topnav {
    background-color: #fffcf2;
    border-bottom: 1px solid #ece0ca;
    height: 52px;
    position: relative;
    overflow: visible;
    z-index: 200;
}

nav.topnav .nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

nav.topnav .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

nav.topnav .brand img {
    height: 36px;
    width: auto;
}

nav.topnav .brand-name {
    color: #a21542;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1.2em;
    font-weight: bold;
    letter-spacing: 0.02em;
}

@keyframes clink {
    0%   { transform: rotate(0deg); }
    20%  { transform: rotate(-18deg); }
    40%  { transform: rotate(18deg); }
    55%  { transform: rotate(-10deg); }
    70%  { transform: rotate(10deg); }
    85%  { transform: rotate(-4deg); }
    100% { transform: rotate(0deg); }
}

nav.topnav .brand-emoji {
    display: inline-block;
    transform-origin: bottom center;
}

nav.topnav .brand:hover .brand-emoji {
    animation: clink 0.6s ease;
}

nav.topnav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 4px;
    align-items: center;
}

nav.topnav ul li a {
    color: #2b2117;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 1em;
    transition: color 0.15s;
    display: block;
}

nav.topnav ul li a:hover,
nav.topnav ul li a.active {
    color: #a21542;
}

nav.topnav ul li.nav-account a {
    background-color: transparent;
    border: 1px solid #ece0ca;
}

/* ── Hamburger ── */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    flex-direction: column;
    gap: 5px;
}

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #2b2117;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-dropdown {
    display: none;
    position: absolute;
    top: 52px;
    right: 0;
    left: 0;
    background: #fffcf2;
    border-bottom: 1px solid #ece0ca;
    z-index: 100;
    padding: 8px 0;
}

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

.nav-dropdown ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.nav-dropdown ul li {
    width: 100%;
    text-align: center;
}

.nav-dropdown ul li + li {
    border-top: 1px solid #ece0ca;
    margin: 0 24px;
    width: calc(100% - 48px);
}

.nav-dropdown ul li a {
    display: block;
    padding: 14px 24px;
    color: #2b2117;
    text-decoration: none;
    font-size: 1.4em;
}

.nav-dropdown ul li a:hover { color: #a21542; }

@media (max-width: 600px) {
    nav.topnav .nav-inner ul { display: none; }
    .nav-hamburger { display: flex; }
}

/* ── Hero / Search ── */
.hero {
    background: #fffcf2;
    padding: 52px 24px 48px;
    text-align: center;
}

.hero h1 {
    margin: 0 0 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2em;
    font-weight: normal;
    color: #2b2117;
    letter-spacing: 0.02em;
}

.hero p.subtitle {
    margin: 0 0 32px;
    color: #888;
    font-size: 0.95em;
    text-wrap: balance;
}

.search-bar {
    display: flex;
    max-width: 680px;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #d5c9b5;
    border-radius: 6px;
    overflow: hidden;
}

.search-bar input[type="text"] {
    flex: 1;
    border: none;
    padding: 14px 16px;
    font-size: 1em;
    color: #2b2117;
    outline: none;
}

.search-bar button {
    background-color: #a21542;
    color: #fff;
    border: none;
    padding: 0 28px;
    font-size: 0.95em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

.search-bar button:hover {
    background-color: #c01a50;
}

.search-hints {
    margin-top: 14px;
    color: #aaa;
    font-size: 0.8em;
}

.search-hints a {
    color: #888;
    text-decoration: none;
    margin: 0 8px;
}

.search-hints a:hover { color: #a21542; }

/* ── Main Content ── */
.content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px 24px 48px;
}

.section-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.25em;
    font-weight: normal;
    color: #531010;
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ece0ca;
}

/* ── Stats Row ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 36px;
}

.stat-card {
    background: #fff;
    border: 1px solid #ece0ca;
    border-radius: 6px;
    padding: 20px;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 1.8em;
    font-family: Georgia, "Times New Roman", serif;
    color: #531010;
    font-weight: normal;
}

.stat-card .stat-label {
    font-size: 0.8em;
    color: #888;
    margin-top: 4px;
}

/* ── Charts Grid ── */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 36px;
}

.chart-card {
    background: #fff;
    border: 1px solid #ece0ca;
    border-radius: 6px;
    padding: 20px;
}

.chart-card .chart-title {
    font-size: 0.85em;
    font-weight: bold;
    color: #531010;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 16px;
}

.chart-placeholder {
    background: #faf6ee;
    border: 1px dashed #d5c9b5;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b0a090;
    font-size: 0.85em;
    font-style: italic;
}

.chart-placeholder.tall   { height: 220px; }
.chart-placeholder.medium { height: 160px; }
.chart-placeholder.short  { height: 110px; }

/* ── Recent Results Table ── */
.recent-section {
    margin-bottom: 36px;
}

table.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88em;
}

table.results-table th {
    text-align: left;
    padding: 8px 10px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.1em;
    font-weight: 600;
    color: #531010;
    border-bottom: 2px solid #ece0ca;
}

table.results-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #ece0ca;
    color: #444;
}

table.results-table tbody tr:hover {
    background-color: #fdf8f0;
}

table.results-table td.wine-name {
    color: #2b2117;
    font-weight: bold;
}

table.results-table td.price {
    color: #531010;
    font-weight: bold;
    text-align: right;
}

table.results-table td.lot-count {
    color: #888;
    text-align: right;
}

.table-placeholder-row td {
    text-align: center;
    padding: 32px;
    color: #b0a090;
    font-style: italic;
}

/* ── Bottom Grid ── */
.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .bottom-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.5em; }
}

@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .hide-mobile {
        display: none;
    }
}