/* Malinowy Dwór: tokens, typography, buttons, header, menu overlay, footer */

:root {
  --paper: oklch(97.4% 0.011 85);
  --paper-2: oklch(94.6% 0.019 82);
  --paper-3: oklch(90.5% 0.026 80);
  --ink: oklch(24% 0.03 155);
  --ink-soft: oklch(41% 0.025 150);
  --line: oklch(84% 0.025 85);
  --leaf: oklch(31% 0.052 158);
  --leaf-deep: oklch(23.5% 0.04 160);
  --leaf-night: oklch(19% 0.03 162);
  --sage: oklch(80% 0.055 135);
  --brass: oklch(74% 0.115 82);
  --brass-hi: oklch(82% 0.11 86);
  --brass-ink: oklch(50% 0.095 72);
  --malina: oklch(50% 0.175 6);
  --malina-hi: oklch(60% 0.18 6);
  --malina-deep: oklch(30% 0.105 4);
  --malina-night: oklch(23.5% 0.075 4);
  --blush: oklch(84% 0.06 6);
  --cream: oklch(95.5% 0.022 86);
  --cream-soft: oklch(86% 0.025 100);

  --f-display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --f-body: "Albert Sans", "Segoe UI", system-ui, sans-serif;
  --f-script: "Pinyon Script", "Snell Roundhand", cursive;

  --step--1: clamp(0.84rem, 0.8rem + 0.15vw, 0.92rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1: clamp(1.25rem, 1.12rem + 0.55vw, 1.6rem);
  --step-2: clamp(1.6rem, 1.3rem + 1.2vw, 2.4rem);
  --step-3: clamp(2.1rem, 1.6rem + 2.2vw, 3.6rem);
  --step-4: clamp(2.7rem, 1.8rem + 4vw, 5.6rem);
  --step-5: clamp(3.2rem, 1.9rem + 6vw, 8rem);

  --gutter: clamp(1rem, 0.6rem + 2.4vw, 3rem);
  --wrap: 1240px;
  --header-h: 92px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.68 var(--f-body);
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
p { margin: 0 0 1.1em; max-width: 68ch; }
h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 400;
  line-height: 1.04;
  margin: 0 0 0.45em;
  letter-spacing: -0.01em;
  font-optical-sizing: auto;
  text-wrap: balance;
}
h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); line-height: 1.12; }
em { font-style: italic; }
h1 em, h2 em, h3 em { color: var(--malina); }
.on-dark h1 em, .on-dark h2 em, .on-dark h3 em { color: var(--brass-hi); }
::selection { background: var(--malina); color: var(--cream); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 200; background: var(--cream); color: var(--ink); padding: 0.7em 1.1em; }
.skip:focus { left: 8px; }
.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.on-dark { color: var(--cream); }
.lead { font-size: var(--step-1); line-height: 1.55; color: var(--ink-soft); max-width: 46ch; }
.on-dark .lead { color: var(--cream-soft); }
.script { font-family: var(--f-script); font-weight: 400; letter-spacing: 0; line-height: 1; }
.kicker { font: 500 var(--step--1)/1.3 var(--f-body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--brass-ink); margin: 0 0 1.1rem; }
.on-dark .kicker { color: var(--brass); }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn {
  --bg: var(--brass); --fg: var(--leaf-night);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  min-height: 48px; padding: 0.85em 1.7em;
  background: var(--bg); color: var(--fg);
  border: 1px solid transparent; border-radius: 999px;
  font: 600 0.82rem/1 var(--f-body); letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none;
  cursor: pointer; transition: background-color 0.35s var(--ease-out), color 0.35s var(--ease-out), border-color 0.35s, transform 0.35s var(--ease-out);
}
.btn:hover { --bg: var(--brass-hi); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--ghost { --bg: transparent; --fg: var(--ink); border-color: currentColor; }
.btn--ghost:hover { --bg: var(--ink); --fg: var(--paper); border-color: var(--ink); }
.on-dark .btn--ghost { --fg: var(--cream); }
.on-dark .btn--ghost:hover { --bg: var(--cream); --fg: var(--leaf-night); border-color: var(--cream); }
.btn--malina { --bg: var(--malina); --fg: var(--cream); }
.btn--malina:hover { --bg: var(--malina-hi); }
.btn svg { width: 1.15em; height: 1.15em; flex: none; }
.link-arrow {
  display: inline-flex; align-items: center; gap: 0.7em;
  font: 600 0.82rem/1 var(--f-body); letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none;
  padding-block: 1em 0.8em; min-height: 44px; border-bottom: 1px solid var(--brass);
}
.link-arrow::after { content: ""; width: 1.6em; height: 1px; background: currentColor; transition: width 0.4s var(--ease-out); }
.link-arrow:hover::after { width: 2.6em; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 90;
  height: var(--header-h);
  display: flex; align-items: center; gap: clamp(1rem, 2vw, 2.4rem);
  padding-inline: clamp(1rem, 2.4vw, 2.6rem);
  color: var(--cream);
  transition: height 0.45s var(--ease-out), background-color 0.45s var(--ease-out), box-shadow 0.45s;
}
.site-header.is-scrolled { --header-h: 68px; background: var(--leaf-night); box-shadow: 0 1px 0 oklch(74% 0.115 82 / 0.25); }
.site-header.is-hidden { transform: translateY(-100%); }
.site-header { transition: height 0.45s var(--ease-out), background-color 0.45s var(--ease-out), transform 0.5s var(--ease-out); }
.brand { display: flex; align-items: center; gap: 0.8rem; text-decoration: none; flex: none; }
.brand img { width: 52px; height: 52px; transition: width 0.45s var(--ease-out), height 0.45s var(--ease-out); }
.is-scrolled .brand img { width: 42px; height: 42px; }
.brand span { font: 400 1.25rem/1 var(--f-display); letter-spacing: 0.02em; }
.home .site-header:not(.is-scrolled) .brand { opacity: 0; pointer-events: none; }
.brand { transition: opacity 0.5s var(--ease-out); }
.brand small { display: block; font: 500 0.62rem/1 var(--f-body); letter-spacing: 0.22em; text-transform: uppercase; color: var(--brass); margin-top: 0.4em; }
.nav-main { display: flex; gap: clamp(0.9rem, 1.6vw, 1.9rem); margin-inline: auto; }
.nav-main a {
  position: relative; text-decoration: none; font: 500 0.8rem/1 var(--f-body); letter-spacing: 0.13em; text-transform: uppercase; padding-block: 0.8em;
}
.nav-main a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0.25em; height: 1px; background: var(--brass); transform: scaleX(0); transform-origin: right; transition: transform 0.45s var(--ease-out); }
.nav-main a:hover::after, .nav-main a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }
.header-cta { display: flex; align-items: center; gap: 1.2rem; flex: none; }
.header-phone { display: inline-flex; align-items: center; gap: 0.55em; text-decoration: none; font: 500 0.92rem/1 var(--f-body); letter-spacing: 0.04em; white-space: nowrap; }
.header-phone svg { width: 18px; height: 18px; color: var(--brass); }
.header-cta .btn { min-height: 42px; padding: 0.75em 1.35em; font-size: 0.74rem; }
.burger {
  display: none; align-items: center; gap: 0.8rem; background: none; border: 0; color: inherit; cursor: pointer;
  font: 500 0.82rem/1 var(--f-body); letter-spacing: 0.16em; text-transform: uppercase; padding: 0.6rem 0; min-height: 44px;
}
.burger i { position: relative; display: block; width: 34px; height: 9px; }
.burger i::before, .burger i::after { content: ""; position: absolute; right: 0; height: 1.5px; background: currentColor; transition: transform 0.45s var(--ease-out), width 0.45s var(--ease-out); }
.burger i::before { top: 0; width: 100%; }
.burger i::after { bottom: 0; width: 66%; }
.burger:hover i::after { width: 100%; }

@media (max-width: 1180px) {
  .nav-main, .header-phone span { display: none; }
  .burger { display: inline-flex; margin-left: auto; }
  .header-cta { order: 3; }
  .burger { order: 2; }
}
@media (max-width: 640px) {
  :root { --header-h: 72px; }
  .site-header.is-scrolled { --header-h: 60px; }
  .brand span, .brand small { display: none; }
  .header-cta .btn { display: none; }
  .header-phone { width: 44px; height: 44px; justify-content: center; border: 1px solid oklch(74% 0.115 82 / 0.5); border-radius: 50%; }
  .brand img { width: 44px; height: 44px; }
}

/* ---------- Menu overlay (two halves) ---------- */
.menu-overlay { position: fixed; inset: 0; z-index: 120; display: grid; grid-template-columns: 1fr 1fr; visibility: hidden; pointer-events: none; }
.menu-overlay.is-open { visibility: visible; pointer-events: auto; }
.menu-overlay__half { position: relative; overflow: hidden; transition: transform 0.75s var(--ease-out); }
.menu-overlay__nav { background: var(--leaf-night); color: var(--cream); transform: translateY(-101%); display: flex; flex-direction: column; justify-content: center; padding: 6rem clamp(1.5rem, 6vw, 6rem) 3rem; }
.menu-overlay__media { background: var(--leaf); transform: translateY(101%); }
.menu-overlay.is-open .menu-overlay__half { transform: none; }
.menu-overlay__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.06); transition: opacity 0.7s var(--ease-out), transform 1.4s var(--ease-out); }
.menu-overlay__media img.is-active { opacity: 1; transform: none; }
.menu-overlay__links a { display: flex; align-items: baseline; gap: 1rem; text-decoration: none; font: 400 clamp(2rem, 1.2rem + 3vw, 3.6rem)/1.15 var(--f-display); padding-block: 0.08em; opacity: 0; transform: translateY(24px); transition: opacity 0.5s, transform 0.7s var(--ease-out), color 0.3s; }
.menu-overlay__links a small { font: 500 0.7rem/1 var(--f-body); letter-spacing: 0.16em; color: var(--brass); }
.menu-overlay__links a:hover, .menu-overlay__links a:focus-visible { color: var(--brass-hi); font-style: italic; }
.menu-overlay.is-open .menu-overlay__links a { opacity: 1; transform: none; }
.menu-overlay__meta { margin-top: 2.6rem; font-size: 0.95rem; color: var(--cream-soft); display: grid; gap: 0.3rem; opacity: 0; transition: opacity 0.6s 0.5s; }
.menu-overlay.is-open .menu-overlay__meta { opacity: 1; }
.menu-overlay__meta a { text-decoration: none; }
.menu-close { position: absolute; top: 1.4rem; right: clamp(1rem, 2.4vw, 2.6rem); z-index: 3; min-height: 44px; display: inline-flex; align-items: center; gap: 0.8rem; background: none; border: 0; color: var(--cream); cursor: pointer; font: 500 0.78rem/1 var(--f-body); letter-spacing: 0.16em; text-transform: uppercase; }
.menu-close i { position: relative; width: 28px; height: 28px; }
.menu-close i::before, .menu-close i::after { content: ""; position: absolute; top: 50%; left: 0; width: 100%; height: 1.5px; background: currentColor; transform: rotate(45deg); }
.menu-close i::after { transform: rotate(-45deg); }
@media (max-width: 860px) {
  .menu-overlay { grid-template-columns: 1fr; }
  .menu-overlay__media { display: none; }
}

/* ---------- Mobile action bar ---------- */
.action-bar { display: none; }
@media (max-width: 860px) {
  .action-bar {
    position: fixed; inset: auto 0 0; z-index: 80; display: grid; grid-template-columns: 1fr 1.35fr 1fr;
    background: var(--leaf-night); color: var(--cream); border-top: 1px solid oklch(74% 0.115 82 / 0.3);
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(110%); transition: transform 0.5s var(--ease-out);
  }
  .action-bar.is-visible { transform: none; }
  .action-bar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem; min-height: 60px; text-decoration: none; font: 600 0.78rem/1 var(--f-body); letter-spacing: 0.12em; text-transform: uppercase; }
  .action-bar a svg { width: 20px; height: 20px; color: var(--brass); }
  .action-bar a.is-main { background: var(--brass); color: var(--leaf-night); }
  .action-bar a.is-main svg { color: var(--leaf-night); }
  body { padding-bottom: calc(61px + env(safe-area-inset-bottom)); }
}
