/* Responsive layout shared by the home page and all modal pages. */

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body,
#wrapper,
#main,
#main article {
  min-width: 0;
}

img,
video,
canvas {
  max-width: 100%;
}

#header,
#header .content,
#header nav,
#main {
  width: 100%;
}

#header .content {
  width: min(100%, 64rem);
}

#header .content .inner {
  padding-inline: clamp(1rem, 5vw, 3rem);
}

#header .content h1 {
  font-size: clamp(1.6rem, 5vw, 2.25rem);
}

#header nav ul {
  width: min(100%, 64rem);
}

#header nav ul li {
  flex: 1 1 7.5rem;
}

#header nav ul li a {
  min-width: 0;
  padding-inline: 1rem;
  overflow-wrap: anywhere;
}

#accountStatus {
  max-width: 100%;
  overflow-wrap: anywhere;
}

#main article,
#main #Demo,
#main #question,
#Customer,
#Game {
  width: min(100%, 64rem) !important;
  box-sizing: border-box;
}

#Game {
  width: min(100%, 80rem) !important;
}

#main article h2,
#main article h3,
#main article p,
#main article label,
#main article summary,
#main article figcaption {
  overflow-wrap: anywhere;
}

#main article input,
#main article select,
#main article textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

button,
.button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  touch-action: manipulation;
}

#photoPreview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

#photoPreview img {
  margin: 0 !important;
}

#fourViewGrid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.auth-actions,
.customer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: stretch;
}

.auth-actions > *,
.customer-actions > * {
  max-width: 100%;
}

.pet-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.pet-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 0.35rem;
}

.pet-card h3 {
  margin: 0 0 0.4rem;
}

.pet-card p {
  margin: 0.35rem 0;
  overflow-wrap: anywhere;
}

.pet-card .auth-actions {
  margin-top: 0.8rem;
}

.customer-gallery {
  grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr));
}

.customer-gallery img {
  height: clamp(9rem, 24vw, 13rem);
}

#fourViewSource {
  width: 100%;
  box-sizing: border-box;
}

#unityWrapper {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: clamp(0.25rem, 1.5vw, 0.75rem);
  box-sizing: border-box;
  overflow: hidden;
}

#unity-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
}

#camera,
#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#camera {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#unity-canvas {
  position: relative;
  z-index: 1;
}

#unity-fullscreen-button {
  right: 0.75rem;
  bottom: 0.75rem;
  max-width: calc(100% - 1.5rem);
}

@media screen and (max-width: 980px) {
  #wrapper {
    padding-inline: clamp(1rem, 4vw, 2rem);
  }

  #header nav ul {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #header nav ul li {
    border-top: 1px solid #fff;
  }

  #header nav ul li:nth-child(-n + 3) {
    border-top: 0;
  }

  #header nav ul li:nth-child(3n + 1) {
    border-left: 0;
  }

  #header nav.use-middle::after {
    display: none;
  }

  #main article {
    padding-inline: clamp(1.5rem, 5vw, 2.5rem);
  }

  .demo-process {
    align-items: stretch;
  }

  .demo-step,
  .step-2 {
    flex: 1 1 0;
    width: auto;
  }
}

@media screen and (max-width: 736px) {
  #wrapper {
    min-height: 100dvh;
  }

  #main article,
  #main #Demo,
  #main #question,
  #Customer,
  #Game {
    width: 100% !important;
    border-radius: 0.35rem;
  }

  #main article {
    padding: 3.5rem 1.25rem 1rem;
  }

  #main article .close {
    width: 3.5rem;
    height: 3.5rem;
  }

  .demo-process,
  .photo-guide-grid {
    flex-direction: column;
  }

  .demo-step,
  .step-2,
  .photo-guide-card {
    width: 100%;
  }

  .step-3 {
    transform: none;
  }

  .pet-list {
    grid-template-columns: 1fr;
  }

  #unity-container {
    aspect-ratio: 4 / 3;
  }
}

@media screen and (max-width: 540px) {
  #wrapper {
    padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  }

  #header {
    padding-inline: 0;
  }

  #header .content .inner {
    padding-block: 1.75rem;
  }

  #header nav ul {
    display: flex;
    flex-direction: column;
    width: min(100%, 20rem);
  }

  #header nav ul li,
  #header nav ul li:nth-child(-n + 3) {
    width: 100%;
    border-left: 0;
    border-top: 1px solid #fff;
  }

  #header nav ul li:first-child {
    border-top: 0;
  }

  #header nav ul li a {
    width: 100%;
    min-height: 3rem;
    height: auto;
    line-height: 1.35;
    padding: 0.9rem 1rem;
  }

  #main article {
    padding-inline: 1rem;
  }

  #main article h2.major {
    padding-right: 2.5rem;
    font-size: clamp(1.35rem, 8vw, 1.75rem);
    letter-spacing: 0.25rem;
  }

  .auth-actions,
  .customer-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .auth-actions > button,
  .auth-actions > .button,
  .customer-actions > button,
  .customer-actions > .button {
    width: 100%;
    margin-inline: 0;
    text-align: center;
  }

  button,
  .button,
  input,
  input[type="button"],
  input[type="submit"],
  input[type="reset"],
  select,
  textarea {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  #generationPanel > button,
  #blenderPipelinePanel > button {
    width: 100%;
    margin: 0 0 0.75rem;
    white-space: normal;
  }

  #fourViewGrid {
    grid-template-columns: 1fr !important;
  }

  #fourViewGrid > div > div {
    min-height: 12rem !important;
  }

  #Customer .fields > .field.half {
    width: 100%;
  }

  .customer-gallery {
    grid-template-columns: 1fr;
  }

  .customer-gallery img {
    height: auto;
    max-height: 18rem;
  }

  #fourViewSource {
    padding: 0.75rem;
  }

  .photo-guide-card {
    padding: 1rem;
  }

  #unityWrapper {
    padding: 0;
  }

  #unity-container {
    aspect-ratio: 3 / 4;
  }
}

@media screen and (max-height: 520px) and (orientation: landscape) {
  #wrapper {
    padding-block: 0.75rem;
  }

  #header > * {
    margin-top: 1rem;
  }

  #header > *::before {
    top: calc(-1rem - 1px);
    height: calc(1rem + 1px);
  }

  #unity-container {
    max-height: calc(100dvh - 10rem);
  }
}
