/* ==========================================================================
   midi.sk homepage replica
   Values measured from the live site (WordPress theme "portfolio-wp",
   plugins insta-gallery + smooth-back-to-top-button). See PROJECT_CONTEXT.md.
   ========================================================================== */

/* Fonts ------------------------------------------------------------------- */
@font-face {
  font-family: "Helvetica Now";
  font-style: normal;
  font-weight: 100 900;
  font-display: fallback;
  src: url("../assets/fonts/HelveticaNowVar.ttf") format("truetype");
}

/* Icon font of the Instagram feed plugin (extracted from its stylesheet) */
@font-face {
  font-family: "qligg";
  font-style: normal;
  font-weight: normal;
  font-display: block;
  src: url("../assets/fonts/qligg-icons.ttf") format("truetype");
}

/* Icon font of the back-to-top plugin */
@font-face {
  font-family: "wpxpress";
  font-style: normal;
  font-weight: normal;
  font-display: block;
  src: url("../assets/fonts/wpxpress.ttf") format("truetype");
}

/* Design tokens ----------------------------------------------------------- */
:root {
  --color-orange: #eb7a3b;
  --color-navy: #163650;
  --color-cream: #fbf1eb;
  --color-page: #f7f2d7;
  --color-text: #0d0d0d;
  --color-light-gray: #dddddd;
  --color-mask: #d0490e;
  --color-lavender: #b5b0fd;

  --font-main: "Helvetica Now", sans-serif;
  --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Fluid sizes copied from the WordPress theme presets */
  --fs-normal: clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.364), 1.1rem);
  --fs-extra-large: clamp(1.743rem, 1.743rem + ((1vw - 0.2rem) * 2.032), 3rem);
  --fs-extra-small: 0.7rem;

  --space-20: 0.44rem;
  --space-30: 0.67rem;
  --space-50: 1.5rem;

  --content-size: 1110px;
  --wide-size: 1310px;
  --gutter: 15px;
}

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

body {
  margin: 0;
  background-color: var(--color-page);
  color: var(--color-text);
  font-family: var(--font-main);
  font-size: var(--fs-normal);
  font-weight: 300;
  line-height: 1.65;
  animation: fadein 1s ease-in forwards;
}

@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

figure {
  margin: 0;
}

strong {
  font-weight: 700;
}

a {
  color: inherit;
}

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 6px;
  z-index: 100000;
  padding: 15px 23px 14px;
  background: #f1f1f1;
  color: #21759b;
  font-size: 14px;
  font-weight: 600;
  line-height: normal;
  text-decoration: none;
  box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
}

.skip-link:focus {
  top: 7px;
}

/* Header ------------------------------------------------------------------ */
.site-header {
  position: relative;
  z-index: 99;
  padding: 24px 32px;
  background-color: var(--color-orange);
}

.site-nav-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  max-width: var(--wide-size);
  margin: 0 auto;
}

.site-logo {
  display: block;
  min-width: 0;
  line-height: 0;
}

.site-logo img {
  display: block;
  width: 190px;
  max-width: 100%;
}

.social-links {
  display: flex;
  flex-shrink: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: var(--space-20);
  margin: 0;
  padding: 0;
  font-size: 24px;
  list-style: none;
}

.social-link {
  border-radius: 9999px;
  background-color: var(--color-cream);
  color: var(--color-orange);
  transition: transform 0.1s ease;
}

.social-link:hover {
  transform: scale(1.1);
}

.social-link a {
  display: flex;
  align-items: center;
  padding: 0.25em;
  color: currentColor;
  line-height: 0;
}

.social-link svg {
  width: 1em;
  height: 1em;
  fill: currentColor;
}

/* Hero -------------------------------------------------------------------- */
.hero img {
  display: block;
  width: 100%;
  height: auto;
}

/* About ("O mne") --------------------------------------------------------- */
.about {
  padding: 1.25em 0;
  background-color: var(--color-navy);
}

.media-text {
  display: grid;
  grid-template-columns: auto 30%;
  grid-template-rows: auto;
  max-width: var(--wide-size);
  margin: 0 auto;
}

.media-text__content {
  grid-area: 1 / 1;
  align-self: center;
  padding: 0 8%;
  word-break: break-word;
}

.media-text__media {
  grid-area: 1 / 2;
  align-self: center;
}

.media-text__media img {
  display: block;
  width: 100%;
  height: auto;
}

.media-text h2 {
  margin: 0.83em 0 0;
  color: var(--color-orange);
  font-size: var(--fs-extra-large);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -1px;
}

.media-text p {
  margin: 1em 0;
  color: var(--color-cream);
}

/* Instagram feed ---------------------------------------------------------- */
.instagram {
  padding: var(--space-50) 0;
  background-color: var(--color-orange);
}

.instagram-feed {
  --cols: 3;
  --gap: 10px;
  max-width: var(--content-size);
  margin: 0 auto;
  font-family: var(--font-system);
  font-size: 16px;
  line-height: 1;
}

.instagram-feed__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
}

/* The plugin's clearfix ::after becomes an empty flex row and adds one extra gap
   below the grid on the original page – kept for identical spacing. */
.instagram-feed__list::after {
  content: "";
  display: block;
}

.instagram-item {
  position: relative;
  display: flex;
  width: calc(100% / var(--cols) - var(--gap) * (var(--cols) - 1) / var(--cols));
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 4px;
  line-height: 0;
  cursor: pointer;
  transition: 0.3s;
}

.instagram-item:hover {
  z-index: 2;
  transform: translateY(-2px);
}

.instagram-item:focus-visible {
  outline: 3px solid var(--color-cream);
  outline-offset: 2px;
}

.instagram-item__wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 4px;
  background-color: #fff;
}

.instagram-item__media-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.instagram-item__media {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: 0.3s;
}

.instagram-item__mask {
  position: absolute;
  inset: 0;
  z-index: 8;
  background-color: var(--color-mask);
  opacity: 0;
  transition: 0.5s ease-out;
}

.instagram-item:hover .instagram-item__mask {
  opacity: 1;
}

.instagram-item__icon {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  display: flex;
  margin: 10px;
  color: #fff;
  font-size: 16px;
  text-decoration: none;
  text-shadow: rgba(0, 0, 0, 0.15) 1px 1px;
  opacity: 0.66;
  transition: 0.3s;
}

.instagram-item__icon--views {
  font-size: 24px;
}

.instagram-item__icon--link {
  inset: auto auto 0 0;
  opacity: 0;
  pointer-events: none;
}

.instagram-item:hover .instagram-item__icon--link {
  z-index: 99;
  opacity: 0.8;
  pointer-events: all;
}

.instagram-item:hover .instagram-item__icon--link:hover {
  opacity: 1;
}

.instagram-feed__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 15px 0;
  text-align: center;
}

.instagram-feed__button {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  background-color: var(--color-cream);
  color: var(--color-orange);
  font-size: 14px;
  font-weight: 600;
  line-height: 16px;
  text-decoration: none;
  vertical-align: middle;
  transition: background-color 0.3s;
}

.instagram-feed__button:hover,
.instagram-feed__button:focus {
  background-color: var(--color-lavender);
  box-shadow: rgba(255, 255, 255, 0.2) 0 0 20px 20px inset;
}

.instagram-feed__button .qligg-icon {
  margin: 0 8px 0 0;
  font-size: 12px;
}

/* Icon glyphs (qligg font) */
.qligg-icon {
  font-family: "qligg" !important;
  font-style: normal;
  font-weight: normal;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  speak: none;
}

.qligg-icon-video::before { content: "\e901"; }
.qligg-icon-instagram::before { content: "\e905"; }
.qligg-icon-prev::before { content: "\e906"; }
.qligg-icon-next::before { content: "\e908"; }
.qligg-icon-gallery::before { content: "\e90d"; }

/* Footer ------------------------------------------------------------------ */
.site-footer {
  padding: 1.25em 0;
  background-color: var(--color-navy);
}

.site-footer__inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-30);
  max-width: var(--wide-size);
  margin: 0 auto;
  padding: 36px 0;
}

.site-footer__inner img {
  display: block;
  width: 32px;
  height: auto;
}

.site-footer__inner p {
  margin: 0;
  color: var(--color-light-gray);
  font-size: var(--fs-extra-small);
}

/* Back to top button ------------------------------------------------------ */
.back-to-top {
  position: fixed;
  right: 50px;
  bottom: 50px;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  overflow: visible;
  border-radius: 46px;
  background-color: var(--color-cream);
  box-shadow: inset 0 0 0 4px var(--color-navy);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: all 200ms linear;
}

.back-to-top.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top::after {
  content: "\e900";
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-navy);
  font-family: "wpxpress";
  font-size: 25px;
  line-height: normal;
  transition: all 200ms linear;
}

.back-to-top:hover::after {
  color: var(--color-orange);
}

.back-to-top__progress {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.back-to-top__progress path {
  fill: none;
  stroke: var(--color-orange);
  stroke-width: 6px;
  transition: all 200ms linear;
}

/* Instagram modal --------------------------------------------------------- */
.ig-modal {
  --sidebar-width: 360px;
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-main);
}

.ig-modal[hidden] {
  display: none;
}

.ig-modal__overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(11, 11, 11, 0.8);
  backdrop-filter: blur(2px);
  animation: fadein 0.25s ease;
}

.ig-modal__dialog {
  position: relative;
  width: 75vw;
  margin: auto;
  border-radius: 8px;
  box-shadow: rgba(0, 0, 0, 0.08) 0 10px 25px;
  outline: none;
  animation: modal-in 0.25s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(-15px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ig-modal__options {
  display: flex;
  justify-content: flex-end;
  padding: 0 0 8px;
}

.ig-modal__arrow {
  position: fixed;
  top: 50vh;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 10px;
  border: none;
  border-radius: 100%;
  background: none;
  color: #fff;
  font-size: 2rem;
  font-weight: bold;
  opacity: 0.6;
  cursor: pointer;
  transition: 0.2s;
}

.ig-modal__arrow:hover,
.ig-modal__arrow:focus-visible {
  background-color: rgba(204, 204, 204, 0.3);
  opacity: 1;
}

.ig-modal__arrow--prev { left: 10px; }
.ig-modal__arrow--next { right: 10px; }

.ig-modal__close {
  padding: 0;
  border: none;
  background: none;
  color: #fff;
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1.65;
  cursor: pointer;
  transition: 0.2s;
}

.ig-modal__close::before {
  content: "\2715";
}

.ig-modal__close:hover {
  color: #ed4337;
}

.ig-modal__body {
  position: relative;
  display: flex;
  width: 100%;
  max-height: 75vh;
  overflow: auto;
  border-radius: 8px;
  background-color: #fff;
  box-shadow: rgba(0, 0, 0, 0.06) 0 1px 2px;
}

.ig-modal__media {
  position: relative;
  display: flex;
  justify-content: center;
  width: calc(100% - var(--sidebar-width));
  overflow: hidden;
  background-color: #0b0b0b;
}

.ig-modal__media img {
  display: block;
  min-height: 100%;
  max-width: 100%;
  max-height: 50vh;
  object-fit: contain;
}

.ig-modal__sidebar {
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  overflow-y: auto;
  border-left: 1px solid #f5f5f5;
  background-color: #fff;
  color: #999;
  font-size: 13px;
  font-weight: 400;
}

.ig-modal__profile {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #f5f5f5;
}

.ig-modal__profile a {
  color: #8e8e8e;
  font-size: 13px;
  letter-spacing: 0.1px;
  text-decoration: none;
}

.ig-modal__profile a:hover {
  color: #262626;
}

.ig-modal__icons {
  display: flex;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #f5f5f5;
}

.ig-modal__counter,
.ig-modal__link {
  display: inline-block;
  margin: 0 20px 0 0;
  color: #999;
  font-size: 12px;
  font-weight: 400;
  text-decoration: none;
}

.ig-modal__link:hover {
  color: #0095f6;
}

.ig-modal__link .qligg-icon {
  vertical-align: middle;
}

.ig-modal__description {
  padding: 16px;
  color: #262626;
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0.1px;
  overflow-wrap: break-word;
}

.ig-modal__description p {
  margin: 0;
}

/* Responsive -------------------------------------------------------------- */
@media (max-width: 1310px) {
  .media-text,
  .instagram-feed {
    padding-right: var(--gutter);
    padding-left: var(--gutter);
  }
}

@media (max-width: 1024px) {
  .site-logo img {
    min-width: 36px;
  }
}

@media (max-width: 768px) {
  .instagram-feed {
    --cols: 2;
    --gap: 8px;
  }

  .ig-modal__dialog {
    width: 80vw;
  }

  .ig-modal__body {
    flex-direction: column;
    overflow-x: hidden;
  }

  .ig-modal__media {
    width: 100%;
    overflow: visible;
  }

  .ig-modal__sidebar {
    width: 100%;
    max-height: 40vh;
    border-top: 1px solid #f5f5f5;
    border-left: none;
  }
}

@media (max-width: 600px) {
  .media-text {
    grid-template-columns: 100%;
  }

  .media-text__media {
    grid-area: 1 / 1;
  }

  .media-text__content {
    grid-area: 2 / 1;
  }
}

@media (max-width: 480px) {
  .instagram-feed {
    --cols: 1;
    --gap: 6px;
  }

  .ig-modal__dialog {
    width: 90vw;
  }

  .ig-modal__options {
    justify-content: space-between;
  }

  .ig-modal__arrow {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    font-size: 1rem;
  }

  /* arrows sit in a 90px wide group on the original */
  .ig-modal__arrow--next {
    margin-right: auto;
    margin-left: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .ig-modal__overlay,
  .ig-modal__dialog {
    animation: none;
  }
}
