/**
 * History of Artek — parity with artek.org/about
 * Tokens: --base #001330, accent gradient 226deg #d80960 → #fec200
 */

/* Force white page chrome (theme default inner body is #f0f5ff). */
body.page-template-page-history-php,
body.page-template-page-history {
  background: #fff !important;
}

body.page-template-page-history-php .site-main--content .artek-content-entry::before,
body.page-template-page-history .site-main--content .artek-content-entry::before,
body.page-template-page-history-php .site-main--inner > .entry::before,
body.page-template-page-history .site-main--inner > .entry::before,
body.page-template-page-history-php .site-main.site-main--inner,
body.page-template-page-history .site-main.site-main--inner {
  background: #fff !important;
}

body.page-template-page-history-php .site-main--inner > .entry::before,
body.page-template-page-history .site-main--inner > .entry::before {
  background: #fff !important;
}

.artek-history {
  --artek-history-orange: #ee712b;
  --artek-history-blue: #001330;
  --artek-history-band: #e6f0ff;
  --artek-history-page: #f0f5ff; /* prod complement-weak-u */
  --artek-history-muted: #808997;
  --artek-history-gradient: linear-gradient(226deg, #d80960 0%, #fec200 100%);
  position: relative;
  z-index: 4;
  width: 100%;
  /* Prod .history.mt-16 — gap from header to capsules */
  margin-top: 4rem;
  padding-bottom: 0;
  background: #fff;
  color: var(--artek-history-blue);
}

.artek-history.is-loading {
  cursor: wait;
}

.artek-history__container {
  /* Contain H1 margin so it stacks with gallery mt-24 (prod gap ≈ 80+96). */
  display: flow-root;
  width: min(100% - 2.4rem, var(--content-max-width, 1464px));
  margin: 0 auto;
}

.artek-history__container--content {
  margin-top: 0;
}

/* Prod: .relative.mt-12.overflow-x-hidden > wave-top + pt-10 bg-complement-weak-u + wave-bottom.
 * Use clip (not hidden) so overflow-y stays visible — otherwise hover tilt on polaroids
 * is clipped by the forced overflow-y:auto pairing with overflow-x:hidden. */
.artek-history__lower {
  position: relative;
  margin-top: 3rem; /* mt-12 — gap after gallery before wave */
  overflow-x: clip;
  padding-bottom: var(--artek-content-footer-clearance, 5rem);
}

.artek-history__wave {
  display: block;
  position: relative;
  color: var(--artek-history-page);
  line-height: 0;
  pointer-events: none;
}

.artek-history__wave svg {
  display: block;
  width: 50rem;
  max-width: none;
  height: auto;
  margin-left: 50%;
  transform: translateX(-50%);
  fill: currentColor;
}

.artek-history__wave--top svg {
  width: 100%;
  min-width: 50rem;
}

.artek-history__wave--bottom {
  margin-top: -0.5rem; /* lg:-top-2 */
}

.artek-history__wave--bottom svg {
  width: 100%;
  min-width: 80rem;
}

.artek-history__lower-inner {
  background: var(--artek-history-page);
  padding-top: 2.5rem; /* pt-10 */
}

.artek-history__items-band {
  position: relative;
  margin: 0;
  padding: 0;
  background: transparent;
  overflow: visible;
}

.artek-history__page-edit {
  margin: 0 0 1rem;
  padding: 0 1.2rem;
  text-align: left;
}

.artek-history__page-edit[hidden] {
  display: none;
}

.artek-history__page-edit-link {
  color: var(--artek-history-blue, #1a3a6b);
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
}

.artek-history__page-edit-link:hover,
.artek-history__page-edit-link:focus-visible {
  color: #d80960;
}

.artek-history__items {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0;
}

.artek-history__items-list {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  gap: 0.875rem; /* space-x-3.5 */
  width: max-content;
  min-width: 100%;
  margin: 0 0 0.75rem; /* mb-3 */
  padding: 2rem 1.2rem; /* py-8 + side gutter */
  list-style: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* Prod history-tab: white pill, 96px year, title expands on hover/active */
.artek-history__tab {
  position: relative;
  flex: 0 0 auto;
  margin: 0;
  padding: 0.5rem; /* p-2 */
  border-radius: 9999px;
  background: #fff;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  list-style: none;
}

.artek-history__tab-btn {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--artek-history-blue);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.artek-history__tab-btn:focus-visible {
  outline: 2px solid var(--artek-history-orange);
  outline-offset: 2px;
}

.artek-history__tab-year,
.artek-history__tab-media {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 6rem; /* w-24 */
  height: 6rem;
  overflow: hidden;
  border-radius: 9999px;
  background: #fff;
  transition: background-color 0.3s ease;
}

.artek-history__tab:hover .artek-history__tab-year {
  background: var(--artek-history-page); /* complement-weak-u */
}

.artek-history__tab-year-grad {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--artek-history-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.artek-history__tab.is-active .artek-history__tab-year-grad {
  opacity: 1;
}

.artek-history__tab-year-text {
  position: relative;
  z-index: 1;
  margin: auto;
  color: var(--artek-history-blue);
  font-family: "Lato-Bold", Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1.5rem; /* text-2xl */
  line-height: 1;
  transition: color 0.3s ease;
}

.artek-history__tab:hover .artek-history__tab-year-text {
  color: var(--artek-history-orange);
}

.artek-history__tab.is-active .artek-history__tab-year-text,
.artek-history__tab.is-active:hover .artek-history__tab-year-text {
  color: #fff;
}

.artek-history__tab-media-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.artek-history__tab-title {
  display: block;
  width: 0;
  height: 6rem;
  overflow: hidden;
  text-transform: uppercase;
  transition: width 0.4s ease;
}

.artek-history__tab-title-inner {
  display: inline-flex;
  align-items: center;
  width: 12rem; /* w-48 */
  height: 6rem;
  padding: 0 0.75rem;
  color: var(--artek-history-blue);
  font-family: "Lato-Bold", Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 0.875rem; /* text-sm */
  font-weight: 600;
  line-height: 1.25;
  transform: scale(0) translateX(-20rem);
  transform-origin: left center;
  transition: transform 0.4s ease;
}

.artek-history__tab.is-active .artek-history__tab-title,
.artek-history__tab:hover .artek-history__tab-title {
  width: 12rem;
}

.artek-history__tab.is-active .artek-history__tab-title-inner,
.artek-history__tab:hover .artek-history__tab-title-inner {
  transform: scale(1) translateX(0);
}

/* Prod: .artek-scrollbox pb-6 + wrapper.mb-20 (80px) before title */
.artek-history__sections {
  margin: 0 0 80px;
  padding: 0 0 24px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  background: #fff;
}

.artek-history__sections-list {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: max-content;
  min-width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.artek-history__sections-item {
  flex: 0 0 auto;
}

.artek-history__section-btn {
  position: relative;
  z-index: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 16px;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: var(--artek-history-muted);
  font-family: "Lato-Regular", Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  letter-spacing: normal;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.3s ease;
}

.artek-history__section-btn:hover,
.artek-history__section-btn:focus-visible {
  color: var(--artek-history-orange);
  outline: none;
}

.artek-history__section-btn.is-active {
  color: #fff;
}

.artek-history__section-btn.is-active::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: 9999px;
  background-image: var(--artek-history-gradient);
}

@media (min-width: 1536px) {
  .artek-history__sections-list {
    justify-content: center;
  }
}

/* Prod .title: 1.5rem → 1.875rem@390 → 3.75rem@768 → 5rem@1536; mb 1.5 → 3@640 → 5@768 */
.artek-history__title {
  margin: 0 0 1.5rem;
  color: var(--artek-history-blue);
  font-family: "Lato-Black", Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 2rem;
  text-align: center;
  text-transform: uppercase;
}

@media (min-width: 390px) {
  .artek-history__title {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
}

@media (min-width: 640px) {
  .artek-history__title {
    margin-bottom: 3rem;
  }
}

@media (min-width: 768px) {
  .artek-history__title {
    margin-bottom: 5rem;
    font-size: 3.75rem;
    line-height: 1;
  }
}

@media (min-width: 1536px) {
  .artek-history__title {
    font-size: 5rem;
  }
}

/*
 * Prod: div.overflow-hidden.pb-40 > section.history-lead.mt-24.mb-8 (h=400).
 * Use padding-top (not margin) so rotated corners paint inside the clip padding
 * box and are not cut by overflow:hidden.
 */
.artek-history__gallery-clip {
  width: 100%;
  overflow: hidden;
  padding-top: 6rem; /* mt-24 band — room above rotated photos */
  padding-bottom: 10rem; /* pb-40 — room under rotated photos */
  background: transparent;
}

.artek-history__gallery-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: none;
  height: 25rem; /* h-100 = 400px */
  margin: 0 0 2rem; /* mb-8 */
  overflow: visible;
  background: transparent;
}

.artek-history__gallery {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-start;
  width: max-content;
  max-width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.artek-history__gallery-item {
  flex: 0 0 auto;
  display: block;
}

.artek-history__photo {
  position: relative;
  width: 20rem;
  height: 25rem;
  overflow: hidden;
  border-radius: 1rem;
  background: #dbe4ef;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.artek-history__photo-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.artek-history__photo-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #e8eef5 0%, #d0dae6 100%);
}

/* Prod .history-lead__img nth-child transforms */
.artek-history__gallery-item:nth-child(1) .artek-history__photo {
  left: 6rem;
  top: 2rem;
  transform: rotate(-9.05deg);
}

.artek-history__gallery-item:nth-child(2) .artek-history__photo {
  left: 4rem;
  transform: rotate(15.7deg);
  z-index: 30;
}

.artek-history__gallery-item:nth-child(3) .artek-history__photo {
  left: 2rem;
  top: 4rem;
  transform: rotate(-15.63deg);
  z-index: 40;
}

.artek-history__gallery-item:nth-child(4) .artek-history__photo {
  top: 1rem;
  transform: rotate(4.34deg);
  z-index: 50;
}

.artek-history__gallery-item:nth-child(5) .artek-history__photo {
  left: -2rem;
  top: 3rem;
  transform: rotate(-6.2deg);
  z-index: 40;
}

.artek-history__gallery-item:nth-child(6) .artek-history__photo {
  left: -4rem;
  transform: rotate(5.08deg);
  z-index: 30;
}

.artek-history__gallery-item:nth-child(7) .artek-history__photo {
  left: -6rem;
  top: 2.5rem;
  transform: rotate(-9.05deg);
}

@media (max-width: 1023px) {
  .artek-history__gallery-clip {
    overflow-x: auto;
    overflow-y: visible;
    padding-top: 3rem;
    padding-bottom: 2rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .artek-history__gallery-wrap {
    height: auto;
    margin: 0 0 1.5rem;
    overflow: visible;
  }

  .artek-history__gallery {
    gap: 0.75rem;
    padding: 1rem 1.2rem 2rem;
  }

  .artek-history__photo {
    width: 10rem;
    height: 12.5rem;
    left: 0 !important;
    top: 0 !important;
    z-index: auto !important;
  }

  .artek-history__gallery-item:nth-child(odd) .artek-history__photo {
    transform: rotate(-3deg);
  }

  .artek-history__gallery-item:nth-child(even) .artek-history__photo {
    transform: rotate(3deg);
  }
}

.artek-history__items-empty,
.artek-history__empty {
  margin: 0;
  color: var(--artek-history-muted);
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
}

.artek-history__empty--notice {
  margin: 0 auto 40px;
  max-width: 42rem;
  padding: 20px 24px;
  border: 1px dashed rgba(0, 19, 48, 0.2);
  border-radius: 12px;
  background: #f7fafc;
  color: var(--artek-history-blue);
  font-size: 18px;
}

.artek-history__content {
  color: #3d4654;
  font-size: 16px;
  line-height: 1.6;
}

.artek-history__content > *:first-child {
  margin-top: 0;
}

.artek-history__content h2,
.artek-history__content h3,
.artek-history__content h4 {
  color: var(--artek-history-blue);
}

.artek-history__content img {
  max-width: 100%;
  height: auto;
}

/* Polaroid frames need height:100% + cover; the rule above would leave a gray gap. */
.artek-history__content .artek-polaroid__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.artek-history__content .wp-block-image {
  margin: 1.25rem 0;
}

.artek-history__loader {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 19, 48, 0.16);
}

.artek-history__loader[hidden] {
  display: none !important;
}

.artek-history__loader-spin {
  display: inline-flex;
  width: 28px;
  height: 28px;
}

.artek-history__loader-spin svg {
  width: 100%;
  height: 100%;
}

@media (min-width: 640px) {
  .artek-history__items-list {
    margin-bottom: 5rem; /* sm:mb-20 — prod gap before item title */
  }
}

@media (min-width: 768px) {
  .artek-history__wave svg {
    width: 100%;
    min-width: 0;
    margin-left: 0;
    transform: none;
  }

  .artek-history__wave--top svg {
    min-width: 0;
  }
}

@media (min-width: 1536px) {
  .artek-history__items-list {
    justify-content: center;
  }

  .artek-history__wave--bottom svg {
    margin-left: 50%;
    transform: translateX(-50%);
  }
}
