@layer reset, tokens, base, layout, components, sections, utilities;

/* ── Reset ── */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
  body { min-height: 100vh; }
  img, svg { display: block; max-width: 100%; }
  button, input, select, textarea { font: inherit; color: inherit; }
  a { color: inherit; }
  ul, ol { list-style: none; }
  address { font-style: normal; }
  dialog { border: none; padding: 0; }
  dialog::backdrop { background: oklch(0% 0 0 / 0.6); }
}

/* ── Tokens: Petroleum Authority ── */
@layer tokens {
  :root {
    --color-bg: #F3F1EC;
    --color-surface: #FAF9F6;
    --color-surface-raised: #EBE8E1;
    --color-ink: #12151A;
    --color-ink-soft: #2A3038;
    --color-text: #1C2128;
    --color-text-muted: #5E6670;
    --color-text-on-dark: #F5F2EB;
    --color-accent: #C9A227;
    --color-accent-dark: #A8871A;
    --color-accent-soft: #F5EDD4;
    --color-navy: #0E1218;
    --color-navy-mid: #1A222D;
    --color-success: #2F6B45;
    --color-danger: #B33A3A;
    --color-border: #D8D3C8;
    --color-border-dark: #2A3340;
    --font-display: 'Unbounded', system-ui, sans-serif;
    --font-body: 'Manrope', system-ui, sans-serif;
    --container: 1160px;
    --container-narrow: 680px;
    --header-h: 72px;
    --topbar-h: 0px;
    --radius: 2px;
    --radius-sm: 2px;
    --shadow-md: 0 12px 40px rgba(14, 18, 24, 0.08);
    --shadow-lg: 0 24px 60px rgba(14, 18, 24, 0.14);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
  }
}

/* ── Base ── */
@layer base {
  body {
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    line-height: 1.65;
    color: var(--color-text);
    background: var(--color-bg);
  }

  h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--color-ink);
  }

  h1 {
    font-size: clamp(2.4rem, 6vw, 4.25rem);
    line-height: 1.05;
    font-weight: 800;
  }

  h2 {
    font-size: clamp(1.65rem, 3.2vw, 2.35rem);
    line-height: 1.15;
  }

  h3 {
    font-size: clamp(1.05rem, 1.8vw, 1.25rem);
    line-height: 1.3;
  }

  h4 {
    font-size: 1rem;
    line-height: 1.35;
  }

  p + p { margin-top: 1rem; }

  .eyebrow {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-accent-dark);
    margin-bottom: 0.85rem;
  }

  .eyebrow--on-dark { color: var(--color-accent); }
}

/* ── Layout ── */
@layer layout {
  .container {
    width: min(100% - 2.5rem, var(--container));
    margin-inline: auto;
  }

  .container--narrow {
    width: min(100% - 2.5rem, var(--container-narrow));
    margin-inline: auto;
  }

  .section {
    padding-block: clamp(4.5rem, 8vw, 7rem);
  }

  .section--alt { background: var(--color-surface-raised); }

  .section__header { margin-bottom: 2.75rem; max-width: 560px; }
  .section__lead { color: var(--color-text-muted); margin-top: 0.85rem; }
}

/* ── Components ── */
@layer components {
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.95rem 1.85rem;
    min-height: 50px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: transform 220ms var(--ease), background 220ms var(--ease), box-shadow 220ms var(--ease), border-color 220ms var(--ease), color 220ms var(--ease);
    text-decoration: none;
    white-space: nowrap;
  }

  .btn--primary {
    background: var(--color-accent);
    color: var(--color-ink);
    box-shadow: 0 10px 32px rgba(201, 162, 39, 0.32);
  }

  .btn--primary:hover {
    background: #D8B83A;
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(201, 162, 39, 0.4);
  }

  .btn--outline {
    background: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
  }

  .btn--outline:hover {
    border-color: var(--color-ink);
    color: var(--color-ink);
  }

  .btn--ghost {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
  }

  .btn--ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.6);
  }

  .btn--inverse {
    background: #fff;
    color: var(--color-ink);
    box-shadow: none;
  }

  .btn--inverse:hover { background: var(--color-accent-soft); }

  .btn--sm { padding: 0.65rem 1.25rem; font-size: 0.82rem; min-height: 42px; }
  .btn--lg { padding: 1.05rem 2.1rem; font-size: 0.95rem; min-height: 54px; }
  .btn--full { width: 100%; }

  .form-group { margin-bottom: 1.15rem; }

  .form-row {
    display: grid;
    gap: 0 1rem;
  }

  @media (min-width: 640px) {
    .form-row { grid-template-columns: 1fr 1fr; }
  }

  .form-group label,
  .form-group legend {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 0.45rem;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    min-height: 48px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
  }

  .form-group input:focus,
  .form-group select:focus,
  .form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18);
  }

  fieldset.form-group { border: none; }

  .checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
  }

  .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    min-height: 44px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--color-text);
  }

  .checkbox-label input { width: auto; min-height: auto; }

  .form-message {
    margin-top: 1rem;
    font-size: 0.9rem;
    min-height: 1.4em;
  }

  .form-message--success { color: var(--color-success); }
  .form-message--error { color: var(--color-danger); }

  .faq { display: flex; flex-direction: column; gap: 0; }

  .faq__item {
    border-bottom: 1px solid var(--color-border);
    background: transparent;
    overflow: hidden;
  }

  .faq__question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 0;
    font-weight: 600;
    font-size: 1.02rem;
    cursor: pointer;
    list-style: none;
    min-height: 44px;
  }

  .faq__question::-webkit-details-marker { display: none; }

  .faq__icon::before {
    content: '+';
    font-size: 1.35rem;
    font-weight: 400;
    color: var(--color-accent-dark);
  }

  .faq__item[open] .faq__icon::before { content: '−'; }

  .faq__answer {
    overflow: hidden;
    max-height: 0;
    transition: max-height 300ms var(--ease);
  }

  .faq__item[open] .faq__answer { max-height: 220px; }

  .faq__answer p {
    padding: 0 0 1.35rem;
    color: var(--color-text-muted);
    font-size: 0.95rem;
  }

  .modal {
    max-width: 480px;
    width: calc(100% - 2rem);
    border-radius: 4px;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-lg);
  }

  .modal__inner { padding: 2.25rem; position: relative; }

  .modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
  }

  .modal__close:hover { color: var(--color-ink); }

  .modal h2 { margin-bottom: 0.5rem; font-size: 1.35rem; }
  .modal__desc { color: var(--color-text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

  .fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 90;
  }

  .fab__btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform 200ms var(--ease);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  }

  .fab__btn:hover { transform: scale(1.08); }
  .fab__btn--phone { background: var(--color-accent); color: var(--color-ink); }
  .fab__btn--mail { background: var(--color-navy); color: #fff; }
}

/* ── Sections ── */
@layer sections {
  .header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--header-h);
    display: flex;
    align-items: center;
    background: rgba(250, 249, 246, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    transition: background 300ms var(--ease), box-shadow 300ms var(--ease), border-color 300ms var(--ease);
  }

  .header--scrolled:not(.header--over-hero) {
    border-bottom-color: var(--color-border);
    box-shadow: var(--shadow-md);
  }

  .header--over-hero {
    background: transparent;
    backdrop-filter: none;
  }

  .header--over-hero .header__logo-text,
  .header--over-hero .header__phone { color: rgba(255, 255, 255, 0.95); }

  .header--over-hero .header__logo-mark {
    background: var(--color-accent);
  }

  .header--over-hero .header__link { color: rgba(255, 255, 255, 0.55); }
  .header--over-hero .header__link:hover { color: #fff; }
  .header--over-hero .header__burger span { background: #fff; }
  .header--over-hero .header__phone:hover { color: var(--color-accent); }

  .header__inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
  }

  .header__logo {
    text-decoration: none;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
  }

  .header__logo-mark {
    width: 10px;
    height: 10px;
    background: var(--color-accent);
    border-radius: 1px;
    flex-shrink: 0;
  }

  .header__logo-text {
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-ink);
  }

  .header__nav { flex: 1; }

  .header__menu {
    display: flex;
    gap: 1.65rem;
    justify-content: center;
  }

  .header__link {
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: color 200ms var(--ease);
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .header__link:hover { color: var(--color-ink); }

  .header__phone {
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--color-ink);
    text-decoration: none;
    white-space: nowrap;
    display: none;
  }

  .header__phone:hover { color: var(--color-accent-dark); }

  @media (min-width: 1024px) {
    .header__phone { display: block; }
  }

  .header__cta { flex-shrink: 0; }

  .header__burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    margin-left: auto;
  }

  .header__burger span {
    display: block;
    width: 22px;
    height: 1.5px;
    background: var(--color-ink);
    transition: transform 200ms var(--ease), opacity 200ms var(--ease);
  }

  .header__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .header__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .header__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  @media (max-width: 767px) {
    .header__nav,
    .header__cta,
    .header__phone { display: none; }
    .header__burger { display: flex; }
  }

  .nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 99;
    background: var(--color-navy);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 300ms var(--ease), visibility 300ms var(--ease);
  }

  .nav-overlay--open {
    opacity: 1;
    visibility: visible;
  }

  .nav-overlay nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }

  .nav-overlay__menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
  }

  .nav-overlay__link {
    font-family: var(--font-display);
    font-size: 1.45rem;
    color: var(--color-text-on-dark);
    text-decoration: none;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .nav-overlay__link:hover { color: var(--color-accent); }

  .nav-overlay__phone {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 0.5rem;
  }

  /* About */
  .about-grid {
    display: grid;
    gap: 3rem;
    align-items: center;
  }

  @media (min-width: 960px) {
    .about-grid { grid-template-columns: 1.05fr 1fr; gap: 4rem; }
  }

  .about-grid__media {
    position: relative;
    overflow: hidden;
    border-radius: 2px;
    background: var(--color-navy);
  }

  .about-grid__img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    object-position: center 20%;
  }

  .about-grid__caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(transparent, rgba(14, 18, 24, 0.92));
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.88rem;
    line-height: 1.45;
  }

  .about-grid__caption strong {
    display: block;
    color: #fff;
    font-family: var(--font-display);
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
  }

  .about-grid__text p {
    color: var(--color-text-muted);
  }

  .about-features {
    margin-top: 2rem;
    display: grid;
    gap: 1.15rem;
  }

  .about-features__item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
  }

  .about-features__mark {
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-accent-dark);
    padding-top: 0.2rem;
  }

  .about-features__item strong {
    display: block;
    font-size: 0.95rem;
    color: var(--color-ink);
    margin-bottom: 0.15rem;
  }

  .about-features__item span {
    font-size: 0.88rem;
    color: var(--color-text-muted);
  }

  /* Advantages — no card chrome */
  .advantages {
    display: grid;
    gap: 0;
    border-top: 1px solid var(--color-border);
  }

  @media (min-width: 768px) {
    .advantages { grid-template-columns: repeat(2, 1fr); }
    .advantages--3 { grid-template-columns: repeat(3, 1fr); }
  }

  @media (min-width: 1024px) {
    .advantages { grid-template-columns: repeat(4, 1fr); }
    .advantages--3 { grid-template-columns: repeat(3, 1fr); }
  }

  .advantage {
    padding: 1.75rem 1.5rem 1.75rem 0;
    border-bottom: 1px solid var(--color-border);
  }

  @media (min-width: 768px) {
    .advantage {
      padding: 2rem 1.75rem 2rem 0;
      border-right: 1px solid var(--color-border);
      border-bottom: 1px solid var(--color-border);
    }

    .advantages:not(.advantages--3) .advantage:nth-child(2n) {
      padding-right: 0;
      padding-left: 1.75rem;
      border-right: none;
    }

    .advantages--3 .advantage {
      border-bottom: none;
    }

    .advantages--3 .advantage:not(:first-child) {
      padding-left: 1.75rem;
    }

    .advantages--3 .advantage:last-child {
      border-right: none;
      padding-right: 0;
    }
  }

  @media (min-width: 1024px) {
    .advantage {
      padding: 2rem 1.75rem 2rem 0;
      border-bottom: none;
      border-right: 1px solid var(--color-border);
    }

    .advantages:not(.advantages--3) .advantage:nth-child(2n) {
      padding-left: 0;
      padding-right: 1.75rem;
      border-right: 1px solid var(--color-border);
    }

    .advantage:last-child {
      border-right: none;
      padding-right: 0;
    }

    .advantage:not(:first-child) {
      padding-left: 1.75rem;
    }
  }

  .advantage h4 { margin-bottom: 0.55rem; }
  .advantage p {
    font-size: 0.92rem;
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.55;
  }

  /* CTA */
  .cta-band {
    background:
      radial-gradient(ellipse 80% 60% at 20% 50%, rgba(201, 162, 39, 0.12), transparent 55%),
      var(--color-navy);
    color: var(--color-text-on-dark);
    padding-block: clamp(4rem, 7vw, 5.5rem);
  }

  .cta-band__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
  }

  .cta-band__text { max-width: 520px; }

  .cta-band h2 {
    color: #fff;
    margin-bottom: 0.75rem;
  }

  .cta-band p {
    color: rgba(255, 255, 255, 0.65);
    margin: 0;
  }

  .cta-band__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
  }

  /* Contact */
  .contact-split {
    display: grid;
    gap: 3rem;
  }

  @media (min-width: 1024px) {
    .contact-split { grid-template-columns: 1.15fr 0.85fr; gap: 4rem; }
  }

  .contact-form-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 2rem;
  }

  .contact-info__block { margin-bottom: 2rem; }
  .contact-info__block h3 {
    margin-bottom: 0.75rem;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-family: var(--font-body);
    font-weight: 700;
  }

  .contact-info__phone {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    text-decoration: none;
    margin-bottom: 0.5rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    letter-spacing: -0.02em;
    color: var(--color-ink);
  }

  .contact-info__phone:hover { color: var(--color-accent-dark); }

  .contact-info__email {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .contact-info__email:hover { color: var(--color-accent-dark); }

  .contact-info__messengers {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .messenger-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 0.95rem;
    min-height: 44px;
    color: var(--color-text-muted);
  }

  .messenger-link:hover { color: var(--color-accent-dark); }
  .messenger-link svg { color: var(--color-accent-dark); }

  .contact-info__address {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .contact-info__director {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
  }

  .footer {
    background: #0A0D11;
    color: rgba(255, 255, 255, 0.55);
    padding: 2.75rem 0;
  }

  .footer__inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1.5rem;
  }

  .footer__logo {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--color-text-on-dark);
    display: block;
    margin-bottom: 0.5rem;
  }

  .footer__desc { font-size: 0.85rem; }

  .footer__rekvizity {
    display: inline-block;
    margin-top: 0.85rem;
    font-size: 0.85rem;
    color: var(--color-accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(201, 162, 39, 0.35);
  }

  .footer__rekvizity:hover { color: #E0C04A; }

  .footer__legal { font-size: 0.78rem; text-align: right; }
  .footer__legal p + p { margin-top: 0.25rem; }

  @media (max-width: 767px) {
    .footer__legal { text-align: left; }
  }
}
