/* ==========================================================================
   Your Key Portugal — main styles (every page)
   Page blocks have their own file: blocks.css (loaded only on block pages).

   1. Tokens and base        5. Footer
   2. Utilities              6. Consultation dialog and form
   3. Buttons and links      7. Guides, text pages, archive
   4. Header and menu        8. Responsive, motion, print
   ========================================================================== */

/* 1. Tokens and base ------------------------------------------------------ */
:root {
  --ink: #102f2f;          /* main text */
  --green: #0c302e;        /* panels, buttons */
  --green-dark: #092725;   /* footer */
  --gold: #ae8350;         /* accents */
  --gold-text: #8a6230;    /* gold for small text on light backgrounds (contrast) */
  --cream: #f5f3ed;        /* page background */
  --paper: #fbfaf6;        /* header, panels */
  --muted: #566265;        /* secondary text */
  --line: #d7d5ca;         /* dividers */
  --serif: Georgia, "Times New Roman", serif;
  --sans: Arial, Helvetica, sans-serif;
  --gutter: clamp(24px, 6.6vw, 100px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 100px; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(14px, 1.1vw, 16px);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
svg, button, img { vertical-align: middle; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--gold); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: 0.6; cursor: wait; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.035em; line-height: 1.08; }
h2 { font-size: clamp(28px, 2.8vw, 42px); }
h3 { font-size: clamp(21px, 1.9vw, 28px); }
p { margin-top: 12px; }
ul { margin: 0; padding: 0; list-style: none; }
[hidden]:not([hidden="until-found"]) { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 2px; }

/* 2. Utilities ------------------------------------------------------------ */
.container { width: 100%; max-width: 1640px; margin: 0 auto; padding: 0 var(--gutter); }
.eyebrow { margin: 0 0 12px; font-size: 11px; font-weight: 600; line-height: 1.5; letter-spacing: 0.21em; text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 1000; padding: 12px; background: #fff; }
.skip-link:not(:focus) { width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.enquiry-banner { padding-top: 20px; padding-bottom: 20px; background: #e4eee4; }
.animate-ready .reveal { opacity: 0; transform: translateY(17px); transition: opacity 0.6s ease, transform 0.6s ease; }
.animate-ready .reveal.is-visible { opacity: 1; transform: none; }

/* 3. Buttons and links ---------------------------------------------------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 28px;
  padding: 15px 26px;
  background: var(--green); color: #fff; border: 1px solid var(--green);
  font-size: 15px; line-height: 1.35; text-align: center;
  transition: background 0.25s, color 0.25s, transform 0.25s;
}
.button:hover { background: #174744; color: #fff; transform: translateY(-2px); }
.button-small { padding: 12px 23px; font-size: 13px; }
.button-outline-gold { background: rgba(8, 43, 41, 0.8); border-color: #c2a16a; outline: 1px solid rgba(255, 255, 255, 0.15); outline-offset: -5px; }
.button-outline-gold:hover { background: rgba(19, 71, 66, 0.95); }
.read-more {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  padding: 0 0 4px; border-bottom: 1px solid #8b9c97;
  color: var(--ink); font-size: 14px; line-height: 1.4; text-align: left;
  transition: color 0.25s, border-color 0.25s;
}
.read-more:hover { color: var(--gold-text); border-color: var(--gold); }
.read-more span[aria-hidden] { font-size: 17px; line-height: 1; }
.text-button:hover { color: var(--gold); }

/* 4. Header and menu ------------------------------------------------------ */
.site-header { position: relative; z-index: 20; background: var(--paper); border-bottom: 1px solid rgba(16, 47, 47, 0.06); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 28px; min-height: 102px; }
.brand { display: inline-flex; flex-shrink: 0; align-items: center; gap: 22px; }
.brand-mark { display: block; width: 49px; height: 62px; color: var(--gold); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-words { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.brand-words > span { font: clamp(21px, 2vw, 30px) / 1.2 var(--serif); letter-spacing: 0.19em; white-space: nowrap; }
.brand-words > small { margin-top: 5px; padding-left: 5px; font-size: 10px; letter-spacing: 0.55em; }
.custom-logo { max-width: 240px; max-height: 64px; object-fit: contain; }

.site-navigation .menu-list { display: flex; align-items: center; gap: clamp(18px, 2.6vw, 38px); }
.site-navigation a { display: block; padding: 6px 0; border-bottom: 1px solid transparent; font-size: clamp(12px, 1vw, 14px); white-space: nowrap; }
.site-navigation .current-menu-item > a,
.site-navigation a[aria-current="page"] { border-bottom-color: var(--ink); font-weight: 600; }
.header-actions { display: flex; flex-shrink: 0; align-items: center; gap: 30px; }
.menu-toggle { display: none; }

.language-switch { display: flex; align-items: center; gap: 5px; font-size: 12px; line-height: 1; letter-spacing: 0.025em; white-space: nowrap; }
.language-switch a { padding: 6px 2px; color: var(--muted); }
.language-switch a[aria-current] { color: var(--ink); font-weight: 600; }
.language-switch span { color: var(--muted); }

/* 5. Footer --------------------------------------------------------------- */
.site-footer { padding: 25px 0 20px; background: var(--green-dark); color: #f1f2eb; }
.footer-main { display: flex; align-items: center; gap: 35px; }
.site-footer .brand { gap: 17px; }
.site-footer .brand-mark { width: 43px; height: 54px; }
.site-footer .brand-words > span { font-size: 22px; letter-spacing: 0.17em; }
.site-footer .brand-words > small { font-size: 8px; }
.footer-tagline { max-width: 240px; margin: 4px 0 0 61px; font-size: 11px; }
.footer-phone { display: block; margin: 8px 0 0 61px; font-size: 12px; }
.footer-nav { margin-left: auto; }
.footer-nav .menu-list { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; font-size: 12px; }
.footer-nav a { padding: 4px 0; }
.footer-extra { display: flex; align-items: center; gap: 22px; }
.footer-socials { display: flex; gap: 14px; }
.footer-socials a { display: grid; place-items: center; width: 28px; height: 28px; }
.site-footer .language-switch a,
.site-footer .language-switch span { color: #b9c6bf; }
.site-footer .language-switch a[aria-current] { color: #fff; }
.footer-signature { min-width: 126px; padding-left: 25px; border-left: 1px solid #789084; color: #c6a573; font-family: var(--serif); font-size: 16px; line-height: 1.25; }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; margin: 16px 151px 0 0; padding-top: 12px; border-top: 1px solid #597169; font-size: 11px; }
.footer-bottom p { margin: 0; }
.footer-legal { display: flex; gap: 22px; }
.footer-legal a { white-space: nowrap; }

/* 6. Consultation dialog and form ---------------------------------------- */
.modal-open { overflow: hidden; }
.consultation-dialog {
  position: fixed; width: min(650px, calc(100% - 32px)); margin: auto; padding: 0;
  overflow: visible; border: 0; background: var(--paper); color: var(--ink);
  box-shadow: 0 20px 100px #001d2d44;
}
.consultation-dialog::backdrop { background: #052725a6; backdrop-filter: blur(6px); }
.consultation-dialog[open] { animation: dialog-in 0.28s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: none; } }
.dialog-inner { position: relative; padding: 28px 32px; }
.dialog-close { position: absolute; top: 12px; right: 16px; font-size: 30px; font-weight: 200; line-height: 1; }
.dialog-inner > .eyebrow { margin-bottom: 8px; font-size: 10px; }
.dialog-inner h2 { max-width: 560px; margin-bottom: 10px; padding-right: 20px; font-size: 32px; line-height: 1.15; }
.dialog-intro { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 22px; }
.full-width { grid-column: 1 / -1; }
.consultation-form label, .wpcf7 label { display: block; color: var(--ink); font-size: 12px; }
.consultation-form input:not([type="checkbox"]):not([type="hidden"]),
.consultation-form select, .consultation-form textarea,
.wpcf7 input:not([type="checkbox"]):not([type="submit"]):not([type="hidden"]),
.wpcf7 select, .wpcf7 textarea {
  width: 100%; min-height: 43px; margin-top: 6px; padding: 10px 12px;
  border: 1px solid #cacfc5; border-radius: 0; background: #fff; color: var(--ink); font-size: 14px;
}
.consultation-form textarea { resize: vertical; }
.consent { display: flex !important; align-items: flex-start; gap: 11px; margin: 22px 0 12px; line-height: 1.5; }
.consent input { flex-shrink: 0; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--green); }
.consent a { text-decoration: underline; }
.form-note { color: var(--muted); font-size: 11px; }
.form-status { margin: 10px 0; font-size: 14px; line-height: 1.6; }
.form-status:empty { display: none; }
.form-status.is-error { color: #973e2f; }
.form-status.is-success { padding: 16px; background: #e6eee4; color: #1f6252; }
.consultation-form.is-success .form-grid,
.consultation-form.is-success .consent,
.consultation-form.is-success button[type="submit"] { display: none; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.wpcf7 p { margin: 0; }
.wpcf7-submit { padding: 14px 25px; border: 0; background: var(--green); color: #fff; cursor: pointer; }
.wpcf7-response-output { margin: 20px 0 !important; }
.noscript-contact form { display: grid; gap: 12px; max-width: 650px; margin: 25px 0; }

/* Three-step wizard built by main.js */
.form-progress { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 14px 0 18px; }
.step-counter { color: var(--gold-text); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; font-variant-numeric: tabular-nums; }
.step-dots { display: flex; gap: 6px; }
.step-dots i { width: 28px; height: 3px; background: #dcded4; }
.step-dots i.is-active { background: var(--gold); }
.form-step { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 18px; min-width: 0; margin: 0; padding: 0; border: 0; }
.form-step[hidden] { display: none !important; }
.form-step > label { min-width: 0; font-size: 12px; line-height: 1.4; }
.has-wizard input:not([type="checkbox"]):not([type="hidden"]):not([type="submit"]),
.has-wizard select, .has-wizard textarea { min-height: 42px; margin-top: 5px; padding: 9px 10px; border-radius: 2px; font-size: 16px; line-height: 1.25; }
.has-wizard textarea { height: 62px; resize: none; }
.has-wizard .consent { margin: 0; font-size: 11px; line-height: 1.45; }
.has-wizard .consent input { width: 15px; height: 15px; margin-top: 2px; }
.has-wizard .wpcf7-acceptance label { display: flex; align-items: flex-start; gap: 9px; font-size: 11px; line-height: 1.45; }
.has-wizard .wpcf7-list-item { margin: 0; }
.wizard-controls { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 20px; }
.wizard-controls .button, .wizard-controls .wpcf7-submit { width: auto; min-height: 44px; padding: 12px 22px; font-size: 13px; line-height: 1.4; }
.wizard-controls .wizard-next, .wizard-controls [type="submit"] { margin-left: auto; }
.wizard-controls [hidden] { display: none !important; }
.wizard-controls .wpcf7-spinner { position: absolute; bottom: 10px; left: 50%; margin: 0; }
.wizard-back { font-size: 12px; text-decoration: underline; text-underline-offset: 4px; }
.has-wizard .form-note { margin: 12px 0 0; font-size: 10px; line-height: 1.4; }
.has-wizard .form-status { margin: 12px 0 0; font-size: 13px; }
.has-wizard .wpcf7-response-output { margin: 12px 0 0 !important; padding: 8px 10px !important; font-size: 12px; line-height: 1.4; }
.has-wizard .wpcf7-not-valid-tip { font-size: 10px; line-height: 1.3; }
.has-wizard.is-success .wizard-steps, .has-wizard.is-success .wizard-controls,
.has-wizard.is-success .form-progress, .has-wizard.is-success .form-note { display: none !important; }
.consultation-dialog:has(.has-wizard.is-success) .dialog-intro { display: none; }

/* 7. Guides, text pages, archive ----------------------------------------- */
.guides-hero { padding: 75px 0 60px; background: #e7e9df; }
.guides-hero h1 { max-width: 850px; font-size: clamp(40px, 4.5vw, 68px); }
.guides-hero p:not(.eyebrow) { max-width: 680px; margin-top: 25px; color: var(--muted); font-size: 18px; }
.guides-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 45px; }
.guide-card { background: var(--paper); border: 1px solid var(--line); }
.guide-card img { width: 100%; aspect-ratio: 1.65; object-fit: cover; }
.guide-card > div { padding: 28px; }
.guide-card h2 { font-size: 29px; }
.guide-card p { margin: 16px 0 22px; color: var(--muted); }
.guide-list { display: grid; gap: 15px; padding: 30px 0; }
.guides-cta { padding: 60px 20px; text-align: center; }
.guides-cta .button { margin-top: 25px; }
.editorial-page { min-height: 60vh; padding-top: 70px; padding-bottom: 85px; }
.editorial-page h1 { max-width: 1000px; margin: 25px 0 35px; font-size: clamp(38px, 4vw, 60px); }
.editorial-page > .button { margin-top: 30px; }
.prose { max-width: 850px; }
.prose p, .prose ul, .prose ol { margin: 1.2em 0; line-height: 1.8; }
.prose ul { padding-left: 25px; list-style: disc; }
.prose h2, .prose h3 { margin: 1em 0 0.5em; }
.prose a { text-decoration: underline; }
.archive-entry { padding: 25px 0; border-bottom: 1px solid var(--line); }

/* 8. Responsive ----------------------------------------------------------- */
@media (max-width: 1250px) {
  .header-inner { gap: 20px; min-height: 85px; }
  .brand { gap: 15px; }
  .brand-mark { width: 40px; height: 52px; }
  .header-actions { gap: 20px; }
  .button-small { padding: 11px 16px; font-size: 12px; }
  .site-navigation .menu-list { gap: 22px; }
  .footer-main { gap: 25px; }
  .footer-signature { min-width: 100px; padding-left: 20px; }
  .footer-bottom { margin-right: 120px; }
}

@media (max-width: 1100px) {
  html[lang^="ru"] .header-actions > .button { display: none; }
  .footer-main { flex-wrap: wrap; }
  .footer-signature { display: none; }
  .footer-bottom { margin-right: 0; }
}

@media (max-width: 980px) {
  .menu-toggle { order: 3; display: flex; flex-direction: column; gap: 6px; width: 24px; padding: 10px 0; }
  .menu-toggle > span:not(.sr-only) { width: 24px; height: 1px; background: var(--ink); transition: transform 0.2s; }
  .menu-toggle[aria-expanded="true"] > span:first-child { transform: translateY(3.5px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] > span:nth-child(2) { transform: translateY(-3.5px) rotate(-45deg); }
  .site-navigation {
    position: absolute; top: 100%; left: 0; right: 0; display: none;
    padding: 18px var(--gutter) 24px; background: var(--paper);
    border-top: 1px solid var(--line); box-shadow: 0 15px 25px #152e3012;
  }
  .site-navigation.is-open { display: block; }
  .site-navigation .menu-list { flex-direction: column; align-items: flex-start; gap: 6px; }
  .site-navigation a { font-size: 16px; }
  .header-actions { margin-left: auto; }
  .footer-nav { margin-left: 0; }
  .footer-main { justify-content: space-between; }
}

@media (max-width: 760px) {
  :root { --gutter: 24px; }
  html { scroll-padding-top: 30px; }
  .header-inner { gap: 18px; min-height: 80px; }
  .brand { gap: 14px; }
  .brand-mark { width: 34px; height: 45px; }
  .brand-words > span { font-size: 22px; }
  .brand-words > small { font-size: 8px; }
  .header-actions { gap: 0; }
  .header-actions > .button { display: none; }
  .language-switch { font-size: 12px; }
  .site-footer { padding-top: 30px; padding-bottom: 25px; }
  .footer-main { display: grid; grid-template-columns: 1fr; gap: 25px; }
  .footer-nav .menu-list { gap: 10px 23px; font-size: 13px; }
  .footer-bottom { display: block; margin-top: 25px; padding-top: 17px; line-height: 1.8; }
  .footer-legal { flex-wrap: wrap; gap: 20px; margin-top: 10px; }
  .consultation-dialog { width: calc(100% - 24px); }
  .dialog-inner { padding: 26px 20px 22px; }
  .dialog-inner h2 { font-size: 28px; }
  .dialog-intro { font-size: 12px; line-height: 1.45; }
  .form-grid, .form-step { grid-template-columns: 1fr; gap: 12px; }
  .form-step > label { font-size: 11px; }
  .has-wizard .consent, .has-wizard .wpcf7-acceptance label { font-size: 10px; }
  .wizard-controls { gap: 12px; margin-top: 18px; }
  .wizard-controls .button, .wizard-controls .wpcf7-submit { padding: 12px 16px; font-size: 12px; }
  .guides-hero { padding: 45px 0; }
  .guides-hero h1 { font-size: 42px; }
  .guides-hero p:not(.eyebrow) { font-size: 16px; }
  .guides-grid { grid-template-columns: 1fr; margin-top: 30px; }
  .guides-cta { padding: 45px 0; }
  .editorial-page { padding-top: 40px; padding-bottom: 50px; }
}

@media (max-width: 380px) {
  .header-inner { gap: 12px; }
  .brand { gap: 10px; }
  .brand-mark { width: 29px; height: 40px; }
  .brand-words > span { font-size: 18px; }
}

/* Short screens: keep the three form steps without inner scrolling. */
@media (max-height: 650px) {
  .dialog-inner { padding-top: 20px; padding-bottom: 18px; }
  .dialog-inner > .eyebrow, .has-wizard .form-note { display: none; }
  .dialog-inner h2 { margin-bottom: 8px; font-size: 27px; }
  .dialog-intro { margin-bottom: 10px; font-size: 12px; }
  .form-progress { margin: 10px 0 14px; }
  .form-step { gap: 10px 14px; }
  .wizard-controls { margin-top: 15px; }
}
@media (max-height: 450px) {
  .dialog-inner { padding: 15px 24px; }
  .dialog-inner h2 { margin-bottom: 6px; font-size: 24px; }
  .dialog-intro { display: none; }
  .form-step { grid-template-columns: 1fr 1fr; gap: 8px 16px; }
  .has-wizard input:not([type="checkbox"]):not([type="hidden"]):not([type="submit"]),
  .has-wizard select, .has-wizard textarea { height: 34px; min-height: 34px; margin-top: 3px; padding: 6px 9px; }
  .has-wizard textarea { height: 48px; }
  .wizard-controls { margin-top: 12px; }
  .wizard-controls .button, .wizard-controls .wpcf7-submit { min-height: 34px; padding: 8px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .animate-ready .reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header, .site-footer, .consultation-dialog, button { display: none !important; }
  .ykb-panel[hidden], .disclosure-panel[hidden] { display: block !important; content-visibility: visible !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* 2.0 — form privacy notice, outline button, footer map ------------------ */
.consent.form-privacy { display: block !important; color: var(--muted, #5d6b67); }
.button-outline { background: transparent; color: var(--green); }
.button-outline:hover { background: var(--green); color: #fff; }
.footer-signature { display: flex; align-items: center; gap: 14px; }
.footer-map { flex: none; width: 34px; height: 64px; color: #c6a573; opacity: 0.9; }
.footer-signature > span { display: block; }
