/*
Theme Name: CRPT Corporate
Theme URI: https://port-log.ru/
Author: CRPT
Author URI: https://port-log.ru/
Description: Светлая корпоративная блочная тема для Центра развития портовых технологий. Поддерживает Full Site Editing и стандартные блоки Gutenberg.
Requires at least: 6.6
Requires PHP: 7.4
Version: 1.0.3
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: crpt-corporate
Tags: block-patterns, full-site-editing, accessibility-ready, custom-colors, custom-logo, editor-style, translation-ready
*/

:root {
  --crpt-navy: #082a4d;
  --crpt-red: #c81018;
  --crpt-gold: #c99a45;
  --crpt-white: #ffffff;
  --crpt-mist: #e5ecf2;
  --crpt-gray: #667789;
  --crpt-radius: 14px;
  --crpt-shadow: 0 14px 34px rgba(8, 42, 77, 0.08);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { text-underline-offset: 0.18em; }

.crpt-skip-link {
  position: fixed;
  z-index: 100000;
  top: 12px;
  left: 12px;
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--crpt-navy);
  color: var(--crpt-white);
  font-weight: 750;
  text-decoration: none;
  transform: translateY(-180%);
}

.crpt-skip-link:focus {
  color: var(--crpt-white);
  transform: translateY(0);
}

.wp-element-button,
.wp-block-button__link { transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease; }

.wp-block-button:not(.is-style-outline) .wp-block-button__link:hover {
  border-color: var(--crpt-navy);
  background: var(--crpt-navy);
}

.wp-block-button.is-style-outline .wp-block-button__link {
  border: 2px solid var(--crpt-navy);
  background: transparent;
  color: var(--crpt-navy);
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
  border-color: var(--crpt-navy);
  background: var(--crpt-navy);
  color: var(--crpt-white);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--crpt-white);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--crpt-navy);
}

img { height: auto; }

.wp-site-blocks { min-height: 100vh; }

.wp-block-post-content :where(h1, h2, h3) {
  overflow-wrap: anywhere;
  hyphens: auto;
}

/* Steel gray passes AA on white; use navy when the background is Harbor Mist. */
.has-harbor-mist-background-color .has-steel-gray-color,
.crpt-hero-mark .has-steel-gray-color,
.crpt-media-placeholder .has-steel-gray-color,
.crpt-contact-placeholder .has-steel-gray-color {
  color: var(--crpt-navy) !important;
}

/*
 * Transitional safety for the already-published self-contained homepage.
 * The body class is added only while its legacy `.crpt-app` wrapper exists.
 */
.crpt-legacy-home > .wp-site-blocks > header.wp-block-template-part,
.crpt-legacy-home > .wp-site-blocks > footer.wp-block-template-part {
  display: none;
}

.crpt-legacy-home > .wp-site-blocks > main {
  margin-block-start: 0;
}

.crpt-legacy-home .wp-block-post-content > .crpt-app {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

.crpt-legacy-home #cargo-request .crpt-eyebrow {
  color: var(--crpt-gold) !important;
}

.crpt-site-header {
  z-index: 20;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid var(--crpt-mist);
}

/*
 * The global header starts in the normal document flow, scrolls away, then
 * returns after a short delay. The sticky state lives on the template-part
 * wrapper so it is not limited by the height of the inner header group.
 */
.crpt-site-header-shell {
  --crpt-header-offset: 96px;
  position: sticky;
  z-index: 1000;
  top: calc(-1 * var(--crpt-header-offset));
  transition: top 220ms ease;
}

.crpt-site-header-shell.is-delayed-sticky {
  top: 0;
}

.crpt-site-header-shell.is-delayed-sticky .crpt-site-header {
  box-shadow: 0 10px 18px rgba(8, 42, 77, 0.13);
}

.crpt-site-header-shell:has(.wp-block-navigation__responsive-container.is-menu-open) {
  top: 0;
}

body.admin-bar .crpt-site-header-shell {
  top: calc(32px - var(--crpt-header-offset));
}

body.admin-bar .crpt-site-header-shell.is-delayed-sticky { top: 32px; }

body.admin-bar .crpt-site-header-shell:has(.wp-block-navigation__responsive-container.is-menu-open) {
  top: 32px;
}

.crpt-header-inner {
  width: calc(100% - 32px);
  max-width: 1320px !important;
  min-height: 82px;
}

.crpt-header-logo img {
  display: block;
  width: min(220px, 25vw);
  height: auto;
  max-height: 58px;
  object-fit: contain;
  object-position: left center;
}

.crpt-header-logo picture { display: block; }

.crpt-site-header .wp-block-navigation-item__content {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--crpt-navy);
  font-size: 1rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.crpt-site-header .wp-block-navigation__submenu-container {
  min-width: 280px !important;
  padding: 10px !important;
  border: 1px solid var(--crpt-mist) !important;
  border-radius: 12px;
  box-shadow: var(--crpt-shadow);
}

.crpt-site-header .wp-block-navigation__responsive-container-open,
.crpt-site-header .wp-block-navigation__responsive-container-close {
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

.crpt-site-footer { margin-block-start: 0; }

.crpt-footer-logo img {
  display: block;
  width: min(330px, 100%);
  max-height: 170px;
  object-fit: contain;
  object-position: left center;
}

.crpt-site-footer a {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  color: var(--crpt-white);
}

body:not(.crpt-legacy-home) .crpt-site-footer :where(p, a, li) {
  font-size: 0.875rem;
  line-height: 1.55;
}

body:not(.crpt-legacy-home) .crpt-site-footer h2 {
  font-size: 1rem !important;
  line-height: 1.35;
}

body:not(.crpt-legacy-home) .crpt-site-footer .crpt-footer-bottom :where(p, a) {
  font-size: 0.8125rem;
}

.crpt-site-footer .wp-block-column { min-width: 0; }

.crpt-site-footer :where(a, p, li) { overflow-wrap: anywhere; }

.crpt-site-footer .wp-block-list { padding-left: 1.1em; }

.crpt-site-footer .wp-block-list li { margin-block-end: 0.55rem; }

.crpt-site-footer a:hover { color: var(--crpt-gold); }

.crpt-section { padding-block: clamp(48px, 7vw, 96px); }

.crpt-section--compact { padding-block: clamp(34px, 5vw, 64px); }

.crpt-section-heading {
  max-width: 780px;
  margin-inline: auto;
  text-align: center;
}

.crpt-kicker {
  margin-block-end: 12px;
  color: var(--crpt-red);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.has-harbor-navy-background-color .crpt-kicker {
  color: var(--crpt-gold);
}

.crpt-gold-rule {
  width: 72px;
  height: 4px;
  margin: 18px auto 0;
  border: 0;
  background: var(--crpt-gold);
}

.crpt-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--crpt-mist);
}

.crpt-hero::after {
  content: "";
  position: absolute;
  inset: auto -6% -38% auto;
  width: min(500px, 48vw);
  aspect-ratio: 1;
  border: clamp(36px, 5vw, 72px) solid rgba(201, 154, 69, 0.13);
  border-radius: 50%;
  pointer-events: none;
}

.crpt-hero .wp-block-columns { position: relative; z-index: 1; }

.crpt-hero h1 { max-width: 880px; }

.crpt-home-brand-mark img {
  display: block;
  width: 100%;
  max-width: 100%;
  object-fit: contain;
}

.crpt-hero-facts {
  gap: 12px !important;
  margin-block-start: 28px;
}

.crpt-hero-fact {
  min-width: 0;
  min-height: 74px;
  padding: 14px 16px;
  border-left: 4px solid var(--crpt-gold);
  border-radius: 0 10px 10px 0;
  background: rgba(255, 255, 255, 0.86);
  overflow-wrap: anywhere;
}

.crpt-hero-mark {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 420px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  background: var(--crpt-mist);
}

.crpt-hero-mark::before,
.crpt-media-placeholder::before {
  content: "";
  position: absolute;
  inset: 15%;
  border: 2px solid rgba(8, 42, 77, 0.15);
  border-radius: 50%;
}

.crpt-hero-mark::after,
.crpt-media-placeholder::after {
  content: "";
  width: 48%;
  height: 3px;
  background: var(--crpt-gold);
  transform: rotate(-22deg);
}

.crpt-card,
.crpt-service-card,
.crpt-document-card,
.crpt-news-card {
  height: 100%;
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid var(--crpt-mist);
  border-radius: var(--crpt-radius);
  background: var(--crpt-white);
  box-shadow: 0 10px 28px rgba(8, 42, 77, 0.05);
}

.crpt-card:hover,
.crpt-service-card:hover {
  border-color: rgba(201, 154, 69, 0.65);
  box-shadow: var(--crpt-shadow);
}

.crpt-service-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.crpt-service-card .wp-block-image {
  width: 78px;
  height: 78px;
  margin: 0;
  border-radius: 50%;
  background: var(--crpt-mist);
}

.crpt-service-card .wp-block-image img {
  width: 100%;
  height: 100%;
  padding: 11px;
  object-fit: contain;
}

.crpt-service-card .wp-block-buttons { margin-block-start: auto; }

.crpt-grid-5 {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px !important;
}

.crpt-grid-4 {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px !important;
}

.crpt-grid-3 {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px !important;
}

.crpt-grid-2 {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px !important;
}

.crpt-process {
  position: relative;
  counter-reset: crpt-step;
}

.crpt-process::before {
  content: "";
  position: absolute;
  top: 27px;
  left: 7%;
  right: 7%;
  height: 3px;
  background: var(--crpt-gold);
}

.crpt-process-step {
  position: relative;
  z-index: 1;
  counter-increment: crpt-step;
}

.crpt-step-number {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin-block-end: 18px;
  border: 5px solid var(--crpt-white);
  border-radius: 50%;
  background: var(--crpt-navy);
  color: var(--crpt-white);
  font-weight: 800;
  box-shadow: 0 0 0 2px var(--crpt-gold);
}

.crpt-step-number::before { content: counter(crpt-step); }

.crpt-audience-card { border-top: 4px solid var(--crpt-gold); }

.crpt-data-list li,
.crpt-check-list li { margin-block-end: 0.65rem; }

.crpt-data-list li::marker,
.crpt-check-list li::marker { color: var(--crpt-red); }

.crpt-faq details {
  margin-block-end: 12px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--crpt-mist);
  border-radius: 12px;
  background: var(--crpt-white);
}

.crpt-faq summary {
  min-height: 54px;
  padding: 17px 50px 17px 20px;
  color: var(--crpt-navy);
  font-weight: 750;
  cursor: pointer;
}

.crpt-faq details > :not(summary) { margin-inline: 20px; }

.crpt-faq details > :last-child { margin-block-end: 20px; }

.crpt-cta {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
}

.crpt-cta::after {
  content: "";
  position: absolute;
  width: 230px;
  aspect-ratio: 1;
  right: -80px;
  bottom: -130px;
  border: 38px solid rgba(201, 154, 69, 0.25);
  border-radius: 50%;
  pointer-events: none;
}

.crpt-cta .wp-block-button.is-style-outline .wp-block-button__link {
  border-color: var(--crpt-white);
  color: var(--crpt-white);
}

.crpt-service-cta.has-harbor-navy-background-color > h2:not(.has-text-color) {
  color: var(--crpt-white);
}

.crpt-crm-slot {
  padding: clamp(24px, 4vw, 42px);
  border: 2px dashed var(--crpt-gold);
  border-radius: var(--crpt-radius);
  background: rgba(229, 236, 242, 0.45);
}

.crpt-crm-slot code {
  padding: 0.15em 0.4em;
  border-radius: 5px;
  background: var(--crpt-white);
  color: var(--crpt-navy);
}

.crpt-media-placeholder {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(8, 42, 77, 0.12);
  border-radius: var(--crpt-radius);
  background: var(--crpt-mist);
}

.crpt-media-placeholder > * { position: relative; z-index: 1; }
.crpt-media--hero { aspect-ratio: 16 / 10; }
.crpt-media--wide { aspect-ratio: 16 / 9; }
.crpt-media--content { aspect-ratio: 3 / 2; }
.crpt-hero-mark.crpt-media--content { min-height: clamp(240px, 36vw, 360px); }
.crpt-media--card { aspect-ratio: 4 / 3; }
.crpt-media--square { aspect-ratio: 1; }

.crpt-contact-placeholder {
  padding: 18px;
  border-left: 4px solid var(--crpt-gold);
  background: var(--crpt-mist);
}

.crpt-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.wp-block-table table { border-collapse: collapse; }

.wp-block-table th {
  background: var(--crpt-navy);
  color: var(--crpt-white);
  text-align: left;
}

.wp-block-table td,
.wp-block-table th { padding: 14px 16px; border-color: var(--crpt-mist); }

.crpt-post-card {
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--crpt-mist);
  border-radius: var(--crpt-radius);
  background: var(--crpt-white);
}

.crpt-post-card .wp-block-post-featured-image img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.crpt-pagination a,
.crpt-pagination span {
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
}

.wp-block-post-content > :where(*:not(.alignfull):not(.alignwide)) {
  max-width: var(--wp--style--global--content-size);
  margin-left: auto;
  margin-right: auto;
}

.wp-block-post-content > .alignwide {
  max-width: var(--wp--style--global--wide-size);
  margin-left: auto;
  margin-right: auto;
}

.crpt-screen-reader-text {
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  position: absolute;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1320px) {
  .crpt-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .crpt-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crpt-header-inner { gap: 14px; }
  .crpt-header-logo { order: 1; }
  .crpt-site-header .wp-block-buttons { order: 2; }
  .crpt-site-header .wp-block-navigation { order: 3; }
  .crpt-site-header .wp-block-buttons {
    display: flex;
    flex: 0 0 auto;
    margin-left: auto;
  }
  .crpt-site-footer .wp-block-columns { flex-wrap: wrap !important; }
  .crpt-site-footer .wp-block-column {
    flex-basis: calc(50% - 21px) !important;
    flex-grow: 1;
  }
  .crpt-site-header .wp-block-navigation__responsive-container:not(.is-menu-open) {
    display: none !important;
  }

  .crpt-site-header .wp-block-navigation__responsive-container-open {
    display: flex !important;
  }

  .crpt-site-header .wp-block-navigation__responsive-container.is-menu-open {
    padding: 24px;
  }

  .crpt-site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
    align-items: flex-start;
    padding-top: 60px;
  }

  .crpt-site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
  }
}

@media (max-width: 781px) {
  .crpt-section { padding-block: 48px; }
  .crpt-grid-5,
  .crpt-grid-4,
  .crpt-grid-3,
  .crpt-grid-2 { grid-template-columns: 1fr; }
  .crpt-header-logo img { width: 52px; height: 52px; }
  .crpt-hero-mark { min-height: 280px; }
  .crpt-media--hero { aspect-ratio: 4 / 3; }
  .crpt-process { padding-left: 30px; }
  .crpt-process::before {
    top: 24px;
    bottom: 24px;
    left: 27px;
    right: auto;
    width: 3px;
    height: auto;
  }
  .crpt-process-step {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    column-gap: 18px;
  }
  .crpt-process-step > :not(.crpt-step-number) { grid-column: 2; }
  .crpt-step-number { grid-column: 1; grid-row: 1 / span 4; }
  .crpt-site-footer .wp-block-columns { gap: 32px; }
  .crpt-site-footer .wp-block-column { flex-basis: 100% !important; }
}

@media (max-width: 782px) {
  body.admin-bar .crpt-site-header-shell {
    top: calc(46px - var(--crpt-header-offset));
  }

  body.admin-bar .crpt-site-header-shell.is-delayed-sticky { top: 46px; }

  body.admin-bar .crpt-site-header-shell:has(.wp-block-navigation__responsive-container.is-menu-open) {
    top: 46px;
  }
}

@media (max-width: 480px) {
  .crpt-header-inner { min-height: 68px; }
  .crpt-header-logo img { width: 48px; height: 48px; }
  .crpt-site-header .wp-block-buttons { width: auto; }
  .crpt-site-header .wp-block-buttons .wp-block-button { width: auto; }
  .crpt-site-header .wp-block-buttons .wp-block-button__link {
    width: auto;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 9px 12px;
    font-size: 0.76rem;
    line-height: 1.1;
  }
  .crpt-card,
  .crpt-service-card,
  .crpt-document-card,
  .crpt-news-card { padding: 20px; }
  .wp-block-buttons .wp-block-button { width: 100%; }
  .wp-block-buttons .wp-block-button__link { width: 100%; text-align: center; }
}

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