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

/*
 * La Cave family theme — R2 preview.
 * Presentation only: no behaviour hooks, storage keys or API contracts.
 */
:root {
  --bg: #faf7f1;
  --bg2: #f5f0e8;
  --bg3: #eee8dd;
  --bg4: #e5ddd0;
  --surface: #ffffff;
  --text: #172026;
  --text2: #4d595f;
  --text3: #626d73;
  --border: rgba(23, 32, 38, 0.1);
  --border2: rgba(23, 32, 38, 0.18);
  --accent: #b72e55;
  --accent2: #982344;
  --gold: #4f7652;
  --green: #4f7652;
  --blue: #a9d5df;
  --rose: #d65d7c;
  --danger: #9c2342;
  --danger-soft: #f8e8ed;
  --overlay: rgba(23, 32, 38, 0.58);
  --card-shadow: 0 10px 28px rgba(23, 32, 38, 0.05);
  --radius-pill: 999px;
  --radius: 24px;
  --radius-sm: 16px;
  --radius-xs: 12px;
}

/* The legacy monolith sets typography inline; the preview theme owns type. */
[style*="font-family:'Playfair Display'"],
[style*='font-family:"Playfair Display"'] {
  font-family: Georgia, "Times New Roman", serif !important;
  font-style: normal !important;
  letter-spacing: -0.035em !important;
}

[style*="font-family:'DM Sans'"],
[style*='font-family:"DM Sans"'] {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif !important;
}

.lcp-brand-lockup {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.45rem;
  color: var(--accent) !important;
  font-family: Georgia, "Times New Roman", serif !important;
  font-style: normal !important;
  font-weight: 600 !important;
  letter-spacing: -0.04em !important;
}

.lcp-brand-lockup--inverse {
  color: #ffffff !important;
}

.lcp-brand-lockup--inverse strong {
  color: var(--blue);
}

.lcp-brand-lockup strong {
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.26em;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.header h1.lcp-brand-lockup {
  font-size: 27px;
}

#screen-welcome .lcp-brand-lockup,
.screen .lcp-brand-lockup {
  font-size: 44px !important;
  line-height: 1 !important;
}

#screen-welcome,
#screen-login,
#screen-create {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

#screen-welcome .lcp-brand-lockup span,
#screen-login .lcp-brand-lockup span,
#screen-create .lcp-brand-lockup span {
  font-family: Georgia, "Times New Roman", serif;
  font-style: normal;
  font-weight: 600;
  letter-spacing: -0.04em;
}

#screen-login .fl,
#screen-create .fl {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.br {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 13%, var(--surface));
}

.bw {
  color: #755d1c;
  background: color-mix(in srgb, #d7bf72 18%, var(--surface));
}

.bp {
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 20%, var(--surface));
}

.bo {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
}

.ap,
#trial-banner {
  background: color-mix(in srgb, var(--sky, #a9d5df) 20%, var(--surface)) !important;
  border-color: color-mix(in srgb, var(--blue) 45%, var(--border)) !important;
}

.apt,
#trial-banner,
#trial-banner span {
  color: var(--text) !important;
}

html {
  background: #eee9e0;
}

html,
body,
button,
input,
select,
textarea {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  width: min(100%, 46rem);
  min-width: min(320px, 100%);
  margin-inline: auto;
  background: var(--bg);
  box-shadow: 0 1rem 3rem rgba(23, 32, 38, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

.header {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  min-height: 68px;
  padding: 12px 20px 14px;
}

.header h1 {
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}

.header p {
  color: var(--text);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

#account-btn {
  width: 40px !important;
  height: 40px !important;
  color: var(--accent) !important;
  background: var(--bg2) !important;
  border: 1px solid var(--border) !important;
}

.nav {
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border);
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 900;
  height: 64px !important;
  min-height: 64px !important;
  padding-bottom: 0 !important;
  box-shadow: 0 -8px 28px rgba(17, 16, 16, 0.06);
}

.page {
  padding-bottom: 72px !important;
  scroll-padding-bottom: 72px;
}

.nav button {
  min-height: 54px;
  color: var(--text3);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.nav button.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border-radius: 12px;
}

#nav-add,
#nav-add svg {
  color: var(--accent) !important;
  stroke: var(--accent) !important;
}

.page {
  scrollbar-color: color-mix(in srgb, var(--accent) 25%, transparent) transparent;
}

#cellarSearch,
.fi,
.si,
.toolbar select {
  color: var(--text) !important;
  background: var(--surface) !important;
  border: 1px solid var(--border2) !important;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif !important;
}

#cellarSearch:focus,
.fi:focus,
.si:focus,
.toolbar select:focus {
  border-color: var(--accent) !important;
  outline: 3px solid var(--blue) !important;
  outline-offset: 2px;
}

#cellar-category-view > div:nth-child(1) > div:nth-child(2) > div {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: 0 10px 28px rgba(23, 32, 38, 0.05);
}

.stats-row {
  gap: 8px;
}

.stat-card {
  padding-block: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

.stat-num,
.dn,
.rn,
.sp,
.pin-logo {
  font-family: Georgia, "Times New Roman", serif;
  font-style: normal;
}

.stat-num,
.sp {
  color: var(--accent);
  font-weight: 600;
}

.wine-row,
.dp,
.card,
.rc {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 28px rgba(23, 32, 38, 0.05);
}

.wine-row {
  min-height: 68px;
  padding: 14px;
}

.wrn {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.wrx {
  color: var(--text2);
}

.group-hdr,
.fl,
.sl,
.dl,
.al {
  color: var(--text3);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.bg,
.sbtn {
  min-height: 50px;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
}

.bo2 {
  min-height: 48px;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 999px;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
}

#screen-welcome > div > div:first-child > div:first-child {
  color: var(--accent) !important;
  font-family: Georgia, "Times New Roman", serif !important;
  font-style: normal !important;
  font-weight: 600 !important;
  letter-spacing: -0.04em !important;
}

#screen-welcome > div > div:first-child > div:last-child {
  color: var(--text) !important;
  font-weight: 700 !important;
}

#screen-welcome > div > div:nth-child(2) > div {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: 0 10px 28px rgba(23, 32, 38, 0.05);
}

.screen {
  background: var(--bg);
}

.pin-title,
#edit-title,
#ui-dialog-title {
  font-family: Georgia, "Times New Roman", serif !important;
  font-size: 24px !important;
  font-style: normal !important;
  font-weight: 600 !important;
  letter-spacing: -0.035em !important;
}

.ar {
  background: var(--text);
  border-radius: var(--radius-sm);
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 48rem) {
  .header-inner {
    padding-inline: 28px;
  }

  #page-cellar > div,
  #cellar-category-view > div,
  #cellar-list-view > div {
    padding-inline: 28px !important;
  }
}

/* R3: all static and runtime-created customer surfaces */
#cat-count-red,
#cellar-category-view [onclick="showCellarList('red')"] {
  color: var(--accent) !important;
}

#cellar-category-view [onclick="showCellarList('red')"] > div:first-child {
  background: var(--accent) !important;
}

#cat-count-white,
#cellar-category-view [onclick="showCellarList('white')"] {
  color: var(--green) !important;
}

#cellar-category-view [onclick="showCellarList('white')"] > div:first-child {
  background: var(--green) !important;
}

#cat-count-rose,
#cellar-category-view [onclick="showCellarList('rose')"] {
  color: var(--rose) !important;
}

#cellar-category-view [onclick="showCellarList('rose')"] > div:first-child {
  background: var(--rose) !important;
}

#cat-count-sparkling,
#cat-count-sweet,
#cat-count-fortified {
  color: var(--text) !important;
}

#cellar-category-view [onclick="showCellarList('sparkling')"] > div:first-child {
  background: color-mix(in srgb, var(--blue) 70%, var(--green)) !important;
}

#cellar-category-view [onclick="showCellarList('sweet')"] > div:first-child {
  background: color-mix(in srgb, var(--blue) 35%, var(--green)) !important;
}

#cellar-category-view [onclick="showCellarList('fortified')"] > div:first-child {
  background: color-mix(in srgb, var(--accent) 55%, var(--green)) !important;
}

svg [stroke="#C5C0B8" i],
svg[stroke="#C5C0B8" i],
svg [stroke="#9A948C" i],
svg[stroke="#9A948C" i],
svg [stroke="#B0A89E" i],
svg[stroke="#B0A89E" i] {
  stroke: var(--text3);
}

[style*="color:#9A948C" i],
[style*="color:#B0A89E" i],
[style*="color:#666" i] {
  color: var(--text3) !important;
}

[style*="color:#7A1828" i],
[style*="color:#8B1A2F" i],
[style*="color:#9B2335" i],
[style*="color:#6B1422" i] {
  color: var(--accent) !important;
}

[style*="background:#7A1828" i],
[style*="background:#8B1A2F" i],
[style*="background:#9B2335" i],
[style*="background:#6B1422" i] {
  background: var(--accent) !important;
}

[style*="linear-gradient(160deg,#2A1015,#4A1828)" i],
[style*="linear-gradient(135deg,#2A1015,#4A1828)" i] {
  background: var(--text) !important;
}

#list-view-title,
#page-search > div:first-child > div:first-child,
#memories-title,
#memories-detail-view > div:first-child,
#account-title,
#modal-wine-name,
#res-score,
#qtyDisplay,
#account-count,
#account-value {
  font-family: Georgia, "Times New Roman", serif !important;
  font-style: normal !important;
  font-weight: 600 !important;
  letter-spacing: -0.035em !important;
}

#memory-modal,
#edit-modal,
#ui-dialog {
  background: var(--overlay) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#memory-modal > div,
#edit-modal > div,
#ui-dialog > div {
  background: var(--surface) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0 !important;
  box-shadow: 0 -18px 54px rgba(23, 32, 38, 0.18);
}

#plan-monthly,
#plan-yearly {
  background: var(--surface) !important;
  border-color: var(--border2) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--card-shadow);
}

#plan-monthly {
  border: 2px solid var(--accent) !important;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface)) !important;
}

#account-avatar {
  color: #ffffff !important;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--blue))) !important;
}

#account-sub-badge,
#account-sub-status {
  border-radius: var(--radius-pill) !important;
}

.delbtn,
[style*="color:#f08090" i] {
  color: var(--danger) !important;
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border)) !important;
}

#ui-toast {
  color: #ffffff !important;
  background: var(--text) !important;
  border-radius: var(--radius-pill) !important;
}

#cellar-content [style*="Playfair Display"],
#search-wine-detail [style*="Playfair Display"],
#memories-list [style*="Playfair Display"],
#memory-detail-content [style*="Playfair Display"],
#search-result [style*="Playfair Display"],
#search-wines [style*="Playfair Display"] {
  font-family: Georgia, "Times New Roman", serif !important;
  font-style: normal !important;
}

#cellar-content > div,
#search-wine-detail > div,
#memories-list > div,
#memory-detail-content > div,
#search-wines > div {
  border-color: var(--border) !important;
}

body > div[style*="background:#FAFAF8" i],
body > div[style*="background:#fff" i] {
  background: var(--bg) !important;
}

/* R4: decisive hierarchy for every customer-facing runtime surface */
#page-search,
#page-memories,
#page-account,
#cellar-content,
#search-result,
#search-wines,
#memory-detail-content {
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

#cellar-content [style*="font-style:italic"],
#search-result [style*="font-style:italic"],
#search-wines [style*="font-style:italic"],
#memories-list [style*="font-style:italic"],
#memory-detail-content [style*="font-style:italic"] {
  font-style: normal !important;
}

#cellar-content > div,
#search-result > div,
#search-wines > div,
#memories-list > div,
#memory-detail-content > div,
#page-account > div {
  border-radius: var(--radius-sm) !important;
}

.match-title {
  margin: 4px 0 8px;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 8vw, 44px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.match-intro {
  max-width: 35rem;
  margin-bottom: 18px;
  color: var(--text2);
  font-size: 14px;
  line-height: 1.55;
}

.match-directions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.match-direction {
  min-height: 118px;
  padding: 14px;
  color: var(--text);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.match-direction:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
}

.match-direction.active {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  border: 2px solid var(--accent);
}

.match-direction-icon {
  display: block;
  margin-bottom: 10px;
  font-size: 21px;
}

.match-direction strong,
.match-direction small {
  display: block;
}

.match-direction strong {
  font-size: 13px;
  font-weight: 800;
}

.match-direction small {
  margin-top: 3px;
  color: var(--text3);
  font-size: 11px;
  line-height: 1.35;
}

#searchInput {
  min-height: 112px !important;
  padding: 16px 56px 16px 44px !important;
  background: var(--surface) !important;
  border: 1px solid var(--border2) !important;
  border-radius: var(--radius-sm) !important;
}

#searchInput:focus {
  border-color: var(--accent) !important;
  outline: 3px solid color-mix(in srgb, var(--blue) 65%, transparent) !important;
  outline-offset: 2px;
}

#occasion-btns button {
  min-height: 34px;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-pill) !important;
}

#screen-paywall > div,
#screen-login > div,
#screen-create > div,
#screen-forgot > div,
#screen-reset > div {
  border-radius: var(--radius) !important;
}

@media (max-width: 390px) {
  .match-directions {
    grid-template-columns: 1fr;
  }

  .match-direction {
    min-height: 84px;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .match-direction-icon {
    margin: 0;
  }
}
