@import url("../fonts/fonts.css");

/* ==========================================================================
   Jockey Club de São Paulo — design system
   Tema: изумруд + золото, editorial paulista. Mobile-first, custom properties.
   ========================================================================== */

/* ---- 1. Design tokens --------------------------------------------------- */
:root {
  /* Brand (из ТЗ §4.1) */
  --emerald-900: #052E22;
  --emerald-800: #063D2E;   /* brand-primary */
  --emerald-700: #0E5C42;   /* brand-secondary */
  --emerald-600: #146E50;
  --emerald-500: #1C8A64;
  --gold:        #D4AF37;   /* brand-accent */
  --gold-600:    #B8942A;
  --gold-700:    #6E570F;   /* тёмное золото для текста на светлом фоне (WCAG AA) */
  --gold-200:    #EBD9A3;
  --gold-100:    #F3EAC6;
  --gold-050:    #FBF6E6;
  --ink:         #101317;   /* brand-accent-2 */
  --paper:       #F7F8F5;   /* bg */
  --white:       #FFFFFF;

  /* Semantic */
  --bg:            var(--paper);
  --surface:       var(--white);
  --surface-2:     #FDFDFB;
  --surface-3:     #F0F2ED;
  --surface-dark:  var(--emerald-800);
  --surface-darker:var(--emerald-900);

  --text:          #16201B;
  --text-muted:    #56605A;
  --text-soft:     #7A857D;
  --text-invert:   #F4F6F1;
  --text-invert-muted: rgba(244, 246, 241, .74);

  --hairline:       rgba(16, 19, 23, .10);
  --hairline-strong:rgba(16, 19, 23, .16);
  --hairline-gold:  rgba(212, 175, 55, .40);
  --hairline-invert:rgba(244, 246, 241, .16);

  --success: #1C8A64;
  --danger:  #C2413B;
  --warning: #C98A12;

  /* Radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* Shadows */
  --sh-sm: 0 1px 2px rgba(16, 19, 23, .06), 0 1px 3px rgba(16, 19, 23, .05);
  --sh:    0 4px 14px rgba(16, 19, 23, .08), 0 2px 6px rgba(16, 19, 23, .05);
  --sh-lg: 0 18px 48px rgba(6, 61, 46, .16), 0 6px 18px rgba(16, 19, 23, .08);
  --sh-gold: 0 10px 30px rgba(212, 175, 55, .28);

  /* Typography */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", "Work Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --fs-xs:  0.76rem;
  --fs-sm:  0.875rem;
  --fs-base:1rem;
  --fs-md:  1.125rem;
  --fs-lg:  1.35rem;
  --fs-xl:  clamp(1.55rem, 1.2rem + 1.4vw, 2rem);
  --fs-2xl: clamp(2rem, 1.5rem + 2.2vw, 2.75rem);
  --fs-3xl: clamp(2.5rem, 1.8rem + 3.4vw, 3.8rem);

  --lh-tight: 1.1;
  --lh-snug: 1.28;
  --lh: 1.62;

  /* Layout */
  --container: 1200px;
  --container-narrow: 780px;
  --gutter: clamp(1rem, 4vw, 2.25rem);
  --header-h: 72px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --dur: .28s;
}

/* ---- 2. Reset / base ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
/* overflow-x: clip на корне обрезает off-canvas fixed-меню, не создавая
   scroll-контейнер (в отличие от hidden) — position: sticky продолжает работать. */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, picture, svg, video { display: block; max-width: 100%; }
img { height: auto; }
/* Иконки Lucide: размер по умолчанию (наследует от текста). Контекстные правила
   (.btn .ic, .badge .ic, .tile__ic .ic и т.д.) перекрывают этот дефолт. */
.ic { width: 1.15em; height: 1.15em; display: inline-block; vertical-align: -0.16em; flex: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
ul, ol { list-style: none; padding: 0; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--gold-200); color: var(--ink); }

/* ---- 3. Typography ------------------------------------------------------ */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-snug);
  letter-spacing: -0.01em;
  color: var(--text);
}
h1 { font-size: var(--fs-3xl); line-height: var(--lh-tight); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
p { color: var(--text-muted); }
strong { color: var(--text); font-weight: 600; }
small { font-size: var(--fs-sm); }

/* ---- 4. Layout ---------------------------------------------------------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: var(--container-narrow); }
.section { padding-block: clamp(2.75rem, 6vw, 5rem); }
.section--tight { padding-block: clamp(2rem, 4vw, 3rem); }
.section--dark { background: var(--surface-dark); color: var(--text-invert); }
.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 { color: var(--text-invert); }
.section--dark p { color: var(--text-invert-muted); }
.stack > * + * { margin-top: 1rem; }

.grid { display: grid; gap: clamp(1rem, 2.5vw, 1.75rem); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ---- 5. Section headings ------------------------------------------------ */
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-body);
  font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold-700);
}
.section--dark .eyebrow { color: var(--gold); }
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--gold); border-radius: 2px; }
.section-head { max-width: 62ch; margin-bottom: clamp(1.5rem, 3vw, 2.5rem); }
.section-head .lead { margin-top: .75rem; font-size: var(--fs-md); }
.accent { color: var(--gold-600); font-style: italic; }
.section--dark .accent { color: var(--gold); }

/* ---- 6. Buttons --------------------------------------------------------- */
.btn {
  --btn-bg: var(--emerald-800);
  --btn-fg: var(--text-invert);
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .8rem 1.4rem; min-height: 44px;
  font-size: var(--fs-sm); font-weight: 600; letter-spacing: .01em;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid transparent; border-radius: var(--r-pill);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease), color var(--dur) var(--ease);
  white-space: nowrap;
}
.btn .ic { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--sh); }
.btn:active { transform: translateY(0); }
.btn--gold { --btn-bg: var(--gold); --btn-fg: var(--ink); }
.btn--gold:hover { box-shadow: var(--sh-gold); }
.btn--outline {
  --btn-bg: transparent; --btn-fg: var(--emerald-800);
  border-color: var(--hairline-strong);
}
.btn--outline:hover { border-color: var(--emerald-700); background: var(--surface-3); box-shadow: none; }
.btn--ghost-invert {
  --btn-bg: transparent; --btn-fg: var(--text-invert);
  border-color: var(--hairline-invert);
}
.btn--ghost-invert:hover { background: rgba(255, 255, 255, .08); box-shadow: none; }
.btn--lg { padding: 1rem 1.75rem; font-size: var(--fs-base); }
.btn--sm { padding: .55rem 1rem; font-size: var(--fs-xs); }
.btn--block { width: 100%; }
.btn--shine { position: relative; overflow: hidden; }
.btn--shine::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform .7s var(--ease);
}
.btn--shine:hover::after { transform: translateX(120%); }

/* ---- 7. Badges / pills / chips ------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .28rem .7rem; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .02em;
  background: var(--surface-3); color: var(--text-muted);
}
.badge .ic { width: 14px; height: 14px; }
.badge--gold { background: var(--gold); color: var(--ink); font-weight: 700; }
.badge--emerald { background: rgba(20, 110, 80, .12); color: var(--emerald-700); }
.badge--night { background: rgba(16, 19, 23, .9); color: var(--gold-200); }
.badge--18 {
  background: var(--danger); color: #fff; font-weight: 700;
  padding: .28rem .6rem; letter-spacing: .01em;
}
.badge--grupo { background: var(--ink); color: var(--gold); font-weight: 700; }
.pareo-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--emerald-800); color: var(--gold);
  font-weight: 700; font-size: var(--fs-sm); flex: none;
}

/* ---- 8. Cards ----------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.card--pad { padding: clamp(1.25rem, 2.5vw, 1.75rem); }
.card--hover:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); border-color: var(--hairline-gold); }
.card--dark { background: var(--surface-dark); color: var(--text-invert); border-color: var(--hairline-invert); }
.card--dark h1, .card--dark h2, .card--dark h3, .card--dark h4 { color: var(--text-invert); }
.card--dark p { color: var(--text-invert-muted); }

/* Светлые карточки внутри тёмной секции: возвращаем тёмный текст (анти «белым по белому») */
.section--dark .family-item h4,
.section--dark .card:not(.card--dark) h1,
.section--dark .card:not(.card--dark) h2,
.section--dark .card:not(.card--dark) h3,
.section--dark .card:not(.card--dark) h4 { color: var(--text); }
.section--dark .family-item p,
.section--dark .card:not(.card--dark) p { color: var(--text-muted); }

/* hairline divider */
.rule { height: 1px; background: var(--hairline); border: 0; }
.rule--gold { background: linear-gradient(90deg, transparent, var(--hairline-gold), transparent); }

/* ---- 9. Header ---------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--hairline);
  transition: box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.site-header.is-scrolled { box-shadow: var(--sh); background: color-mix(in srgb, var(--paper) 96%, transparent); }
.header-bar {
  display: flex; align-items: center; gap: 1rem;
  height: var(--header-h);
}
.brand { display: inline-flex; align-items: center; gap: .65rem; flex: none; }
.brand__crest { width: 44px; height: 44px; color: var(--emerald-800); flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1; }
.brand__name {
  font-family: var(--font-display); font-weight: 600; font-size: 1.02rem;
  color: var(--emerald-800); letter-spacing: -0.01em;
}
.brand__tag { font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-600); font-weight: 600; }

.nav-main { display: none; align-items: center; gap: .35rem; margin-inline: auto; }
.nav-main a {
  position: relative; padding: .5rem .8rem; border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 500; color: var(--text); white-space: nowrap;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav-main a::after {
  content: ""; position: absolute; left: .8rem; right: .8rem; bottom: .28rem; height: 2px;
  background: var(--gold); border-radius: 2px; transform: scaleX(0); transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.nav-main a:hover { color: var(--emerald-700); }
.nav-main a:hover::after,
.nav-main a[aria-current]::after { transform: scaleX(1); }
.nav-main a[aria-current] { color: var(--emerald-800); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-sm); color: var(--text);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn .ic { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--surface-3); color: var(--emerald-700); }
.header-actions .btn { display: none; }
.rg-link { color: var(--emerald-700); }
.nav-toggle { display: inline-flex; }

/* mobile nav drawer */
.mobile-nav {
  position: fixed; inset: 0; z-index: 70;
  background: var(--surface-darker); color: var(--text-invert);
  padding: 1.25rem var(--gutter) 2rem;
  transform: translateX(100%); transition: transform .34s var(--ease);
  display: flex; flex-direction: column; gap: .25rem; overflow-y: auto;
}
.mobile-nav.is-open { transform: translateX(0); }
.mobile-nav__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.mobile-nav__head .brand__name { color: var(--text-invert); }
.mobile-nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: .95rem .5rem; font-family: var(--font-display); font-size: var(--fs-lg);
  color: var(--text-invert); border-bottom: 1px solid var(--hairline-invert);
}
.mobile-nav a .ic { width: 18px; height: 18px; color: var(--gold); }
.mobile-nav__actions { margin-top: 1.5rem; display: grid; gap: .75rem; }
.mobile-nav__meta { margin-top: auto; padding-top: 1.5rem; font-size: var(--fs-sm); color: var(--text-invert-muted); }
body.nav-open { overflow: hidden; }

/* ---- 10. Footer --------------------------------------------------------- */
.site-footer { background: var(--surface-darker); color: var(--text-invert); padding-block: clamp(2.5rem, 5vw, 4rem) 1.5rem; }
.footer-top { display: grid; gap: 2rem clamp(1.5rem, 4vw, 3rem); grid-template-columns: 1fr; }
.footer-brand { max-width: 32ch; }
.footer-brand .brand__name, .footer-brand .brand__crest { color: var(--text-invert); }
.footer-brand p { color: var(--text-invert-muted); margin-top: 1rem; font-size: var(--fs-sm); }
.footer-cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.75rem; }
.footer-col h4 { font-family: var(--font-body); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .14em; color: var(--gold); margin-bottom: .9rem; }
.footer-col a { display: block; padding: .3rem 0; font-size: var(--fs-sm); color: var(--text-invert-muted); transition: color var(--dur) var(--ease); }
.footer-col a:hover { color: var(--text-invert); }
.footer-legal-strip {
  margin-top: 2.5rem; padding: 1.5rem; border: 1px solid var(--hairline-invert); border-radius: var(--r);
  display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  background: rgba(255, 255, 255, .03);
}
.footer-legal-strip .fl-block h5 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .12em; color: var(--gold-200); margin-bottom: .4rem; font-weight: 600; }
.footer-legal-strip .fl-block p { font-size: var(--fs-sm); color: var(--text-invert-muted); }
.footer-bottom {
  margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--hairline-invert);
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
  font-size: var(--fs-sm); color: var(--text-invert-muted);
}
.footer-social { display: flex; gap: .5rem; }
.footer-social a { width: 38px; height: 38px; border: 1px solid var(--hairline-invert); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text-invert); }
.footer-social a:hover { border-color: var(--gold); color: var(--gold); }
.footer-tag { color: var(--gold); font-weight: 600; letter-spacing: .04em; }

/* ---- 11. Cookie banner + modal ------------------------------------------ */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  background: var(--surface-darker); color: var(--text-invert);
  border-top: 2px solid var(--gold);
  padding: 1.1rem var(--gutter);
  transform: translateY(100%); transition: transform .4s var(--ease);
}
.cookie-banner.is-visible { transform: translateY(0); }
.cookie-inner { max-width: var(--container); margin-inline: auto; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.cookie-inner p { color: var(--text-invert-muted); font-size: var(--fs-sm); max-width: 62ch; }
.cookie-inner a { color: var(--gold); text-decoration: underline; }
.cookie-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
/* Кнопки в тёмном баннере — светлый контур (анти dark-on-dark) */
.cookie-banner .btn--outline { --btn-fg: var(--text-invert); border-color: var(--hairline-invert); }
.cookie-banner .btn--outline:hover { background: rgba(255, 255, 255, .1); border-color: var(--gold); }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 90; display: none;
  background: rgba(5, 24, 18, .58); backdrop-filter: blur(3px);
  padding: var(--gutter); overflow-y: auto;
}
.modal-backdrop.is-open { display: grid; place-items: center; }
.modal {
  background: var(--surface); color: var(--text); border-radius: var(--r-lg);
  max-width: 540px; width: 100%; box-shadow: var(--sh-lg);
  padding: clamp(1.5rem, 3vw, 2.25rem); max-height: 90vh; overflow-y: auto;
}
.modal h3 { margin-bottom: .5rem; }
.cookie-cat { display: flex; align-items: flex-start; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--hairline); }
.cookie-cat p { font-size: var(--fs-sm); margin-top: .2rem; }

/* toggle switch */
.switch { position: relative; width: 46px; height: 26px; flex: none; margin-top: .1rem; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--hairline-strong); border-radius: var(--r-pill); transition: background var(--dur) var(--ease); }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: #fff; border-radius: 50%; box-shadow: var(--sh-sm); transition: transform var(--dur) var(--ease); }
.switch input:checked + .track { background: var(--emerald-600); border-color: var(--emerald-600); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:disabled + .track { opacity: .55; cursor: not-allowed; }

/* ---- 12. Utilities ------------------------------------------------------ */
.text-center { text-align: center; }
.mx-auto { margin-inline: auto; }
.hidden { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 50%; top: -60px; transform: translateX(-50%);
  background: var(--emerald-800); color: #fff; padding: .6rem 1.2rem; border-radius: 0 0 var(--r) var(--r);
  z-index: 100; transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: 0; }

/* scroll-to-top */
.to-top {
  position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 55;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--emerald-800); color: var(--gold); box-shadow: var(--sh-lg);
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* marquee */
.marquee { overflow: hidden; background: var(--emerald-900); color: var(--text-invert); border-block: 1px solid var(--hairline-invert); }
.marquee__track { display: flex; gap: 3rem; width: max-content; padding-block: .7rem; animation: marquee 32s linear infinite; }
.marquee__track span { display: inline-flex; align-items: center; gap: .6rem; font-size: var(--fs-sm); color: var(--text-invert-muted); white-space: nowrap; }
.marquee__track .ic { width: 15px; height: 15px; color: var(--gold); }
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee:hover .marquee__track { animation-play-state: paused; }

/* ---- 13. Responsive ----------------------------------------------------- */
@media (min-width: 640px) {
  .footer-top { grid-template-columns: 1.4fr 2fr; }
  .footer-cols { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
  .nav-main { display: flex; }
  .header-actions .btn { display: inline-flex; }
  .nav-toggle { display: none; }
  :root { --header-h: 80px; }
}
/* На узких экранах бренд-вордмарк не помещается и раньше обрезал меню (P0):
   ниже 560px показываем только герб, действия компактнее — гамбургер всегда виден. */
@media (max-width: 560px) {
  .brand__text { display: none; }
  .header-actions { gap: .2rem; }
}
/* Тап-зоны на мобиле/планшете ≥44px (WCAG). */
@media (max-width: 1023px) {
  .icon-btn { width: 44px; height: 44px; }
}

/* ---- 14. Reduced motion ------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
}
