:root {
  --bg: #b8502a;
  --text: #ffffff;
  --glow: rgba(255, 255, 255, 0.25);
  --size: 11px;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 3rem;
  --header-clear: clamp(100px, 12vh, 150px);
  --font-display: "Righteous", sans-serif;
  --font-mono: "VT323", "Tiny5", monospace;
  --font-body: "Geist", system-ui, sans-serif;
  font-size: clamp(16px, 1.1vw, 24px);
}

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

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: var(--text);
}

main {
  margin: 0 var(--space-lg);
  max-width: 100%;
}

main section {
  min-height: 100dvh;
  height: auto;
}

pre {
  font-size: clamp(5px, 1.8vw, var(--size));
  line-height: 1.05;
  white-space: pre;
  text-align: center;
  text-shadow: 0 0 6px var(--glow);
  user-select: none;
  pointer-events: none;
  width: 100%;
  overflow: hidden;
}

.hl {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.65);
}

main header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  margin: 0.9rem 2.12rem 0 2.12rem;
  transition:
    margin 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    padding 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: none;
}

main header ul {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  list-style: none;
}

main header ul li {
  font-size: clamp(2rem, 7vw, 6.438rem);
  font-family: var(--font-display);
  font-weight: 400;
  flex: 0 0 auto;
}

main header ul li a {
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: inline-block;
  transition: transform 0.25s ease;
}

main header.scrolled ul li a {
  color: #ffffff;
}

main header ul li a.active {
  font-family: "Tiny5", monospace;
  font-size: clamp(2.5rem, 8vw, 7rem);
  color: #ffffff;
  text-shadow: 0 0 clamp(8px, 1.5vw, 12px) rgba(255, 255, 255, 0.65);
  animation: fontSwitch 0.25s ease forwards;
}

@keyframes fontSwitch {
  0% {
    transform: translateY(3px);
  }
  100% {
    transform: translateY(0);
  }
}

main section p.home-about {
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-family: var(--font-body);
  font-weight: 300;
  position: absolute;
  padding-right: var(--space-lg);
  bottom: 2.2rem;
  max-width: 100%;
}

#Work {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  contain: layout style paint;
}

section div.work-showcase {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: clamp(0.5rem, 2vw, 1.2rem);
  padding: 0 0 3.5rem 0;
}

section div.work-showcase img {
  display: none;
  width: auto;
  height: auto;
  max-width: 14%;
  transform-origin: center center;
  will-change: transform;
  flex-shrink: 0;
}
.work-showcase img.visible {
  display: block;
}

section .accordion {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg);
  color: var(--text);
  cursor: pointer;
  width: 100%;
  border: none;
  padding: 1.25rem 0;
  gap: 1rem;
  transition:
    background-color 0.4s ease,
    color 0.4s ease;
  scroll-margin-top: var(--header-clear);
  position: relative;
  z-index: 1;
  touch-action: manipulation;
}

section .accordion:first-of-type {
  border-top: 0.15rem solid var(--text);
}
section .accordion:hover {
  background-color: var(--text);
  color: var(--bg);
}

section .accordion div.project-subtitle {
  display: flex;
  font-family: var(--font-mono);
  font-weight: 400;
  text-wrap: nowrap;
  text-align: left;
  font-size: 1.5rem;
}
section .accordion div.project-subtitle div {
  padding-right: 3rem;
}

section .accordion div.project-title {
  text-wrap: wrap;
  min-width: 0;
}
section .accordion div.project-title p {
  font-size: clamp(38px, 3.6vw, 53.2px);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1;
  white-space: normal; /* Fixed overflow contradiction */
  letter-spacing: -0.02em;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-align: left;
}

section div.panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  border-bottom: var(--text) solid 0.15rem;
  width: 100%;
  position: relative;
  contain: layout style paint;
}

section div.panel div.grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: var(--space-xl);
  padding: 0 var(--space-md) var(--space-md) var(--space-md);
  max-width: 100%;
}
section div.panel div.grid p {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(1rem, 1.5vw, 1.3rem);
  line-height: 1.4;
  padding-right: 0;
  margin-bottom: 0;
}
section div.panel div.grid div.img-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  width: 100%;
}
section div.panel div.grid div.img-grid .bottom-img {
  grid-column: span 2;
  width: 100%;
  margin-top: 0;
}
section div.panel div.grid div.img-grid img,
section div.panel div.img-grid-2 img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

section div.panel div.img-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  width: 100%;
  max-width: 60%;
  margin-left: 0;
  margin-right: auto;
  padding: 0 var(--space-md) 2.5rem;
}
section div.panel div.img-grid-2 > img {
  grid-column: span 2;
}
section div.panel div.img-grid-2 .img-flex {
  display: contents;
}

#Info {
  display: flex;
  height: auto;
  min-height: 100dvh;
  contain: layout style paint;
}

.info-content {
  display: flex;
  /*align-items: last baseline;*/
  align-items: flex-end;
  gap: 2rem;
  padding-bottom: 1.8rem;
  width: 100%;
}

section.content img {
  width: 50%;
  max-width: 38.3rem;
  height: 100%;
  padding-top: 2.8rem;
  display: block;
  object-fit: cover;
}

section.content div.info-contact {
  padding: 0;
  width: 100%;
}
section.content div.info-contact p {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(1rem, 1.7vw, 1.5rem);
  margin-bottom: 1rem;
}

section.content div.info-contact ul {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 1.5rem;
  justify-content: space-between;
}

section.content div.info-content ul a {
  text-decoration: underline;
}

.project-back-to-top {
  position: fixed;
  bottom: 2.5rem;
  right: 2.5rem;
  background: var(--text);
  color: var(--bg);
  border: 0.1rem solid var(--text);
  padding: 0.6rem 1.2rem;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9998;
  letter-spacing: 0.05em;
}
.project-back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.project-back-to-top:hover {
  background: var(--bg);
  color: var(--text);
}

@media screen and (max-width: 1025px) {
  main section {
    min-height: auto;
    height: auto;
  }
  main section:first-of-type {
    min-height: 100dvh;
  }
  main {
    margin: 0 var(--space-lg);
  }
  main header {
    margin: 1.5rem 2.4rem 0 2.3rem;
  }
  main header ul li {
    font-size: clamp(2.5rem, 5vw, 5rem);
  }
  main header ul li a.active {
    font-size: clamp(3rem, 6vw, 6rem);
  }
  main section p.home-about {
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    padding: 0 var(--space-lg) 0 0;
  }
  #Work {
    padding-top: 0;
  }
  section div.work-showcase {
    padding: 2.5rem 0 2.5rem 0;
    gap: 1.2rem;
  }
  section div.work-showcase img {
    max-width: 26%;
    min-width: 230px;
  }
  section .accordion {
    padding: 1.5rem 0;
  }
  section .accordion div.project-subtitle div {
    font-size: 1rem;
    padding-right: var(--space-lg);
  }
  section .accordion div.project-title p {
    font-size: clamp(1.8rem, 4vw, 3.3rem);
  }
  section div.panel div.grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0 1.5rem 1.5rem 1.5rem;
  }
  section div.panel div.grid div.img-grid {
    gap: 1.5rem;
  }
  section div.panel div.img-grid-2 {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1.5rem 2.5rem 1.5rem;
    gap: 1.5rem;
  }
  .project-back-to-top {
    bottom: 2.5rem;
    right: 2.5rem;
    padding: 0.5rem 1rem;
    font-size: 1.1rem;
  }
  #Info {
    display: flex;
    height: auto;
    min-height: auto;
    padding: 0 0 2rem 0;
  }
  .info-content {
    padding: 0;
    margin: 0;
    text-align: left;
  }
  section.content div.info-contact {
    padding: 1rem 0 0 0;
  }
  section.content div.info-contact p {
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    margin-bottom: 0.5rem;
  }
}

@media screen and (max-width: 769px) {
  main {
    margin: 0 var(--space-lg) 2rem var(--space-lg);
  }
  main header {
    margin: 1.5rem 2.1rem 0.9rem 2.3rem;
  }
  main header ul {
    margin: 0;
    flex-direction: row;
    justify-content: space-between;
  }
  main header ul li {
    font-size: clamp(2rem, 6vw, 4rem);
  }
  main header ul li a.active {
    font-size: clamp(2.5rem, 7vw, 5rem);
  }
  main section p.home-about {
    font-size: clamp(1rem, 2.2vw, 1.3rem);
    padding: 0 var(--space-lg) 0 0;
    line-height: 1.33em;
  }
  section div.work-showcase {
    padding: 2rem 0 2.5rem 0;
  }
  section div.work-showcase img {
    max-width: 30%;
    min-width: 222px;
  }
  section .accordion {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1.2rem;
    padding: 1.5rem 0;
    margin: 0;
    width: 100%;
  }
  section .accordion div.project-title {
    flex: 1 1 0%;
    min-width: 0;
    text-align: left;
  }
  section .accordion div.project-title p {
    font-size: clamp(1.7rem, 4.5vw, 2.35rem);
    text-align: right;
  }
  #Info {
    height: auto;
    min-height: auto;
    padding: 2.5rem 0 0 0;
  }
  .info-content {
    display: block;
    text-align: left;
    padding: 0;
    margin: 0;
  }
  section.content img {
    max-width: 100%;
    max-height: 63.3vh;
    padding-top: 0;
    width: 100%;
    height: auto;
    aspect-ratio: 4/3;
    object-fit: cover;
  }
  section.content div.info-contact {
    padding: 1.5em 0 0 0;
  }
  section.content div.info-contact p {
    font-size: clamp(1rem, 2vw, 1.2rem);
    text-align: left;
    line-height: 1.33em;
  }
  section .accordion div.project-subtitle {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
  }
  section .accordion div.project-subtitle div:first-child {
    display: block;
    font-size: 1.8rem;
    font-family: var(--font-mono);
    line-height: 1;
    transition: color 0.4s ease;
  }
  section .accordion div.project-subtitle div:first-child p {
    font-size: 1.8rem;
    font-family: var(--font-mono);
    font-weight: 400;
    color: var(--text);
    margin: 0;
    transition: color 0.4s ease;
  }
  section .accordion div.project-subtitle div:last-child {
    display: none;
  }
  section .accordion:hover div.project-subtitle div:first-child p {
    color: var(--bg);
  }
}

@media screen and (max-width: 577px) {
  main {
    margin: 0 1.5rem;
  }
  main header {
    margin: 0;
  }
  main header ul {
    margin: 1.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }
  main header ul li {
    padding-bottom: 1.5rem;
    width: 100%;
    font-size: clamp(1.8rem, 5vw, 3rem);
  }
  main header ul li a.active {
    font-size: clamp(2rem, 5.5vw, 3.5rem);
  }
  main section p.home-about {
    font-size: 16px;
    padding: 0 1.5rem 0 0;
    bottom: 1.5rem;
  }
  #Work {
    padding-top: 1rem;
  }
  section div.work-showcase {
    padding: 0 1rem 1.5rem 1rem;
    gap: 0.75rem;
  }
  section div.work-showcase img {
    display: none;
    max-width: 40%;
    min-width: 280px;
    overflow: visible;
    margin: 0 auto;
  }
  section div.work-showcase img.visible {
    display: block;
  }
  section .accordion {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem 0;
    gap: 1rem;
  }
  section .accordion div.project-subtitle,
  section .accordion div.project-subtitle div {
    display: none;
  }
  section .accordion div.project-title {
    width: 100%;
  }
  section .accordion div.project-title p {
    font-size: clamp(25px, 5.3vw, 32px);
    text-align: center;
  }
  section div.panel div.grid {
    grid-template-columns: 1fr;
    padding: 0 1rem 1rem 1rem;
    gap: 1rem;
  }
  section div.panel div.grid p {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  }
  section div.panel div.grid div.img-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  section div.panel div.grid div.img-grid .bottom-img {
    grid-column: 1;
  }
  section div.panel div.img-grid-2 {
    max-width: 100%;
    margin: 0;
    grid-template-columns: 1fr;
    padding: 0 1rem 1.5rem 1rem;
    gap: 1rem;
  }
  section div.panel div.img-grid-2 .img-flex {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
  }
  section div.panel div.img-grid-2 > img {
    grid-column: 1;
  }
  #Info {
    height: auto;
    min-height: auto;
    padding: 0.5rem 0 0.7rem 0;
  }
  .info-content {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    text-align: center;
    margin: 0;
  }
  section.content img {
    height: auto;
    max-height: clamp(300px, 55vh, 500px);
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
  }
  section.content div.info-contact {
    padding: 0;
  }
  section.content div.info-contact p {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    line-height: 1.6;
    text-align: left;
  }
  section.content div.info-contact ul {
    display: flex;
    align-content: space-between;
    font-size: 1.2rem;
  }
  .project-back-to-top {
    bottom: 1.5rem;
    right: 1.5rem;
    font-size: 1rem;
    padding: 0.4rem 0.8rem;
  }
}

@media (max-height: 500px) {
  pre {
    font-size: clamp(4px, 3.5vh, 11px);
    line-height: 1;
  }
}
@media (max-width: 480px) {
  @keyframes fontSwitch {
    0% {
      transform: translateY(2px);
    }
    100% {
      transform: translateY(0);
    }
  }
}

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

@media screen and (min-width: 578px) and (max-width: 1025px) {
  main section:first-of-type {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
    padding: 85px 0 70px 0;
    margin-left: -2.5rem;
    margin-right: -2.5rem;
    width: calc(100% + 5rem);
    box-sizing: border-box;
  }
  main section:first-of-type pre#canvas {
    width: fit-content;
    margin: 0 auto;
    text-align: center;
    white-space: pre;
    line-height: 0.88;
    font-size: clamp(15px, 2.6vw, 18px);
  }
  main section:first-of-type p.home-about {
    position: absolute;
    bottom: 1.5rem;
    left: 2.5rem;
    right: 2.5rem;
    text-align: left;
    margin: 0;
    padding: 0;
    z-index: 10;
  }
}

@media screen and (min-width: 578px) {
  main section:first-of-type {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
    padding-top: 95px;
    padding-bottom: 75px;
    box-sizing: border-box;
  }
  main section:first-of-type pre#canvas {
    width: fit-content;
    max-width: 96vw;
    margin: 0 auto;
    text-align: center;
    white-space: pre;
    line-height: 0.88;
    font-size: clamp(9px, 1.5vmin, 12.5px);
  }
  main section:first-of-type p.home-about {
    position: absolute;
    bottom: 2rem;
    left: 2.5rem;
    right: 2.5rem;
    text-align: left;
    margin: 0;
    padding: 0;
    z-index: 10;
  }
}
