/*
 * Additional responsive refinements for john-caffier.com.
 *
 * These overrides focus on making the layout usable on tablets and phones
 * without disturbing the desktop presentation that already works well.
 */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.mobile-nav {
  display: none;
}

.modal img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 18px;
}

.modal ul {
  padding-left: 18px;
}

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

@media (min-width: 901px) {
  .cats-filter-select {
    display: none;
  }
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  flex-shrink: 0;
  background-color: var(--nav-link-icon-color, currentColor);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  transition: background-color 0.2s ease;
}

.nav-icon--home {
  mask-image: url('../images/home.svg');
  -webkit-mask-image: url('../images/home.svg');
}

.nav-icon--projects {
  mask-image: url('../images/projects.svg');
  -webkit-mask-image: url('../images/projects.svg');
}

.nav-icon--contact {
  mask-image: url('../images/contact.svg');
  -webkit-mask-image: url('../images/contact.svg');
}

.mobile-nav__link,
.menu .tabs li a {
  --nav-link-icon-color: currentColor;
}

.mobile-nav__link:hover,
.mobile-nav__link:focus-visible,
.mobile-nav__link.is-active,
.menu .tabs li a:hover,
.menu .tabs li a:focus,
.menu .tabs li.active a,
.menu .tabs li a.active {
  --nav-link-icon-color: currentColor;
}

.menu .tabs li a .nav-icon {
  margin-right: 8px;
}

@media (min-width: 960px) {
  nav.menu {
    width: 100%;
    box-sizing: border-box;
    padding-left: 180px;
    padding-right: 130px;
  }
}

@media (max-width: 1024px) {
  #container {
    width: 100% !important;
    max-width: 100%;
    margin: 12px auto 24px;
    padding: 0 20px;
    box-sizing: border-box;
  }

  #content {
    box-shadow: none;
    border-radius: 18px;
    overflow: visible;
    padding-bottom: 24px;
  }
}

@media (max-width: 900px) {
  header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  #logo {
    width: 100%;
    text-align: center;
  }

  #not_on_mobile {
    visibility: visible !important;
    display: block !important;
  }

  #logo h2,
  #logo h4 {
    margin: 0;
    text-align: center;
  }

  .letsconnect {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 0;
    margin: 0;
    width: 100%;
  }

  .letsconnect li {
    float: none;
    margin: 0;
  }
}

@media (max-width: 768px) {
  body {
    background: #f7f7f7;
    padding-bottom: 64px;
  }

  #container {
    padding: 0 16px !important;
  }

  header {
    position: sticky;
    top: 0;
    z-index: 600;
    margin: 0 0 18px;
    padding: 18px 0 16px;
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    box-shadow: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    align-items: stretch;
  }

  header > *:not(:last-child) {
    margin-bottom: 16px;
  }

  #profile {
    padding: 28px 16px;
    background-size: cover;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    overflow: visible;
    margin-top: 0;
  }

  .about {
    width: 100% !important;
    float: none !important;
    margin: 0;
    text-align: center;
  }

  .about .photo-inner {
    float: none;
    margin: 0 auto 18px;
  }

  .about .photo-inner ul,
  .about .photo-inner li {
    margin: 0;
    padding: 0;
  }

  .about h1 {
    font-size: 26px;
    margin-bottom: 6px;
  }

  .about h3 {
    margin-top: 6px !important;
    font-size: 15px !important;
  }

  .about p {
    margin-top: 12px;
  }

  .personal-info {
    width: 100%;
    margin: 28px 0 0;
    padding: 20px 0 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: grid;
    gap: 14px;
    background: transparent;
  }

  .personal-info li {
    float: none;
    width: 100%;
    margin: 0;
    text-align: center;
  }

  .personal-info .personalinfotags {
    float: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: normal !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
  }

  .personal-info .personalinfotags img {
    margin: 0;
  }

  .menu {
    width: 100%;
    background: transparent;
    padding: 18px 0 12px;
    height: auto !important;
  }

  nav.menu {
    display: none;
  }

  .mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
  }

  .mobile-nav__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 16px;
    background: #ffffff;
    color: #2b2b2b;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
  }

  .mobile-nav__toggle:focus-visible {
    outline: 3px solid rgba(43, 43, 43, 0.3);
    outline-offset: 3px;
  }

  .mobile-nav__toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
  }

  .mobile-nav__toggle-icon {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  .mobile-nav__toggle-icon span {
    width: 22px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  .mobile-nav.is-open .mobile-nav__toggle-icon span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .mobile-nav.is-open .mobile-nav__toggle-icon span:nth-child(2) {
    opacity: 0;
  }

  .mobile-nav.is-open .mobile-nav__toggle-icon span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .mobile-nav__panel {
    display: none;
    flex-direction: column;
    gap: 10px;
    background: #ffffff;
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.16);
  }

  .mobile-nav.is-open .mobile-nav__panel {
    display: flex;
  }

  .mobile-nav__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    color: #2b2b2b;
    font-size: 15px;
    font-weight: 600;
    background: transparent;
    box-shadow: none;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  }

  .mobile-nav__link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(43, 43, 43, 0.25);
  }

  .mobile-nav__link:hover {
    background: rgba(43, 43, 43, 0.08);
  }

  .mobile-nav__link.is-active {
    background: #2b2b2b;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  }

    .mobile-nav__icon {
      width: 22px;
      height: 22px;
    }

  .tabs {
    position: static !important;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .tabs li {
    float: none;
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .tabs li a {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 16px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    color: #2b2b2b;
    font-size: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .tabs li a i {
    font-size: 32px;
  }

  .tabs li a:hover,
  .tabs li a:focus {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
  }

  .tabs li.active a {
    color: #2b2b2b;
  }

  .tabs li.active a i,
  .tabs li.active a span {
    color: inherit;
  }

  #menu-prev,
  #menu-next {
    display: none !important;
  }

  .portfolio-filter-bar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .portfolio-filter-bar .cats-filter {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
  }

  .portfolio-filter-bar .cats-filter li {
    float: none;
  }

  .cats-filter-select {
    display: none;
  }

  .portfolio-filter-bar .cats-filter li a {
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
  }

  .activity-switch {
    width: 100%;
    justify-content: space-between;
  }

  #portfolio-list {
    width: 100% !important;
  }

  #portfolio-list li {
    float: none !important;
    width: 100% !important;
    margin: 0 0 18px !important;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  }

  #portfolio-list li a {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px;
    height: auto;
  }

  #portfolio-list li img {
    width: 88px;
    height: 88px;
    max-height: none;
    object-fit: contain;
  }

  #portfolio-list li .title {
    font-size: 18px;
    margin: 0;
  }

  #portfolio-list li .categorie {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.4;
    gap: 2px;
  }

  #portfolio-list li .secondrow {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    margin-left: 0;
  }

  #content,
  header {
    overflow: visible !important;
  }

  section[id] {
    scroll-margin-top: 180px;
  }

  footer {
    height: auto !important;
    margin: 32px 0 12px;
    padding: 18px 12px 26px;
    text-align: center;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  }

  footer .copyright {
    line-height: 1.6;
  }
}

@media (max-width: 900px) {
  #portfolio {
    padding: 0;
    margin: 20px 0 0;
  }

  .portfolio-filter-bar {
    padding: 18px 16px;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: #ffffff;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.12);
    position: relative;
    gap: 18px;
  }

  .portfolio-filter-bar .cats-filter {
    display: none !important;
  }

  .cats-filter-select {
    display: block;
  }

  .cats-filter-select__input {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: linear-gradient(180deg, #fcfcfc 0%, #f1f1f1 100%);
    color: #2b2b2b;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: linear-gradient(180deg, #fcfcfc 0%, #f1f1f1 100%), url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"%3E%3Cpath fill="%232b2b2b" d="M6 8L0 0h12z"/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: center right 16px;
    background-size: 100% 100%, 12px;
    cursor: pointer;
  }

  .cats-filter-select__input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(43, 43, 43, 0.2);
  }

  .activity-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .activity-switch .activity-option {
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #f4f4f4;
    font-size: 12px;
    font-weight: 600;
    padding: 11px 10px;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
    color: #404040;
  }

  .activity-switch .activity-option.active {
    background: #2b2b2b;
    color: #ffffff;
    border-color: #2b2b2b;
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.25);
  }
}

@media (max-width: 540px) {
  .activity-switch {
    grid-template-columns: 1fr;
  }

  #portfolio-list li a {
    flex-direction: column;
    align-items: flex-start;
  }

  #portfolio-list li img {
    width: 100%;
    max-width: 180px;
    height: auto;
    align-self: center;
  }
}

@media (max-width: 420px) {
  .tabs li {
    max-width: none;
  }
}
