:root {
  --dark: #272727;
  --dark-solid: #202020;
  --black: #050505;
  --orange: #ffc085;
  --orange-strong: #ff9d52;
  --gray: #787878;
  --paper: rgba(255, 247, 239, 0.88);
  --paper-solid: #fff7ef;
  --line: #111111;
  --blue-link: #035cce;
  --green: #35d06b;
  --purple: #a679ff;
  --yellow: #f4cf53;
  --blue: #64a7ff;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--black);
  font-size: 15px;
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(120deg, rgba(70, 70, 70, 0.86), rgba(255, 192, 133, 0.9), rgba(98, 98, 98, 0.84));
  background-size: 240% 240%;
  animation: backgroundShift 18s ease-in-out infinite;
  overflow-x: hidden;
}

button,
select,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

@keyframes backgroundShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 0 0;
  background: rgba(38, 38, 38, 0.68);
  border-bottom: 2px solid rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
  transition:
    min-height 220ms ease,
    padding 220ms ease,
    background 220ms ease,
    gap 220ms ease;
}

main {
  padding-top: 118px;
}

.site-header.scrolled {
  min-height: 58px;
  flex-direction: row;
  justify-content: flex-start;
  gap: 18px;
  padding: 0 20px;
  background: var(--dark-solid);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--orange);
  font-size: clamp(2.05rem, 5vw, 3.6rem);
  font-weight: 1000;
  line-height: 0.9;
  letter-spacing: 0;
  text-decoration: none;
  -webkit-text-stroke: 1.6px var(--black);
  text-shadow:
    1.5px 1.5px 0 var(--black),
    -1px 1px 0 var(--black),
    0 4px 12px rgba(0, 0, 0, 0.45);
  transition: font-size 220ms ease, transform 220ms ease;
}

.brand-letter {
  display: inline-block;
  transform-origin: center bottom;
  animation: oceanLetter 1.85s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.105s);
}

.site-header.scrolled .brand {
  font-size: 1.45rem;
  transform: translateY(-1px);
}

.site-header.scrolled .brand-letter {
  animation: none;
  transform: none;
}

@keyframes oceanLetter {
  0%,
  100% {
    transform: translateY(0);
  }
  42% {
    transform: translateY(-6px);
  }
  78% {
    transform: translateY(0);
  }
}

.tab-bar {
  width: 100%;
  display: flex;
  align-self: stretch;
  transition: width 220ms ease, margin 220ms ease, align-self 220ms ease;
}

.site-header.scrolled .tab-bar {
  width: min(520px, 52vw);
  align-self: center;
  margin-left: auto;
}

.tab-button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 38px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-right: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.24);
  color: #fff7ef;
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0;
  transition:
    background 160ms ease,
    color 160ms ease,
    min-height 220ms ease,
    transform 160ms ease;
}

.tab-button:last-child {
  border-right: 0;
}

.tab-button:hover,
.tab-button.active {
  background: var(--orange);
  color: var(--black);
}

.site-header.scrolled .tab-button {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.page {
  display: none;
  min-height: calc(100vh - 118px);
}

.page.active {
  display: block;
}

.home-shell,
.page-shell {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
}

.home-shell {
  min-height: calc(190vh - 118px);
  display: flex;
  flex-direction: column;
  padding: 34px 0 82px;
}

.intro-text {
  min-height: 1px;
  margin: 0;
}

.hero-image-wrap {
  width: min(1120px, 100%);
  height: clamp(340px, calc(50vh - 12px), 520px);
  margin: 0 auto clamp(28px, 6vh, 58px);
  border: 3px solid var(--line);
  background: rgba(32, 32, 32, 0.68);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.home-column {
  display: grid;
  gap: 18px;
}

.editable-section h2 {
  margin: 0 0 5px;
  font-size: 0.96rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.text-box {
  min-height: 122px;
  padding: 12px;
  border: 3px solid var(--line);
  background: var(--paper);
  color: var(--black);
  font-size: 0.88rem;
  font-family: "Trebuchet MS", "Segoe UI", Arial, Helvetica, sans-serif;
  font-weight: 700;
  line-height: 1.5;
  white-space: pre-wrap;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.18);
}

.rich-word {
  font-weight: 1000;
  text-shadow: 0 1px 0 rgba(5, 5, 5, 0.18);
}

.editable-section.compact .text-box {
  min-height: 48px;
  display: flex;
  align-items: center;
}

.links-box {
  display: grid;
  align-content: start;
  gap: 6px;
  white-space: normal;
}

.link-item {
  min-width: 0;
}

.link-item a {
  color: var(--blue-link);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.filter-button {
  border: 3px solid var(--line);
  background: var(--orange);
  color: var(--black);
  font-weight: 1000;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.filter-button:hover,
.filter-button.active {
  transform: translateY(-2px);
  box-shadow: 5px 5px 0 var(--line);
  background: #fff7ef;
}

.page-shell {
  padding: 32px 0 64px;
}

.projects-intro {
  margin: 0 auto 20px;
  text-align: center;
}

.projects-intro h1 {
  margin: 0 0 6px;
  font-size: clamp(1.8rem, 4vw, 2.9rem);
  line-height: 1;
}

.projects-intro p {
  margin: 0;
  font-weight: 900;
}

.project-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.filter-button {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 0.84rem;
  border-radius: 0;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.project-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  border: 3px solid var(--line);
  background: var(--paper-solid);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.18);
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 12px 12px 0 rgba(0, 0, 0, 0.22);
}

.project-card img {
  width: 100%;
  height: 58%;
  object-fit: cover;
  border-bottom: 3px solid var(--line);
  background: #333333;
}

.project-card-body {
  min-height: 0;
  flex: 1;
  display: grid;
  align-content: space-between;
  gap: 8px;
  padding: 11px;
}

.project-card h2 {
  margin: 0;
  font-size: clamp(0.9rem, 1.5vw, 1.1rem);
  line-height: 1.1;
}

.project-status {
  width: max-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border: 2px solid var(--line);
  background: var(--green);
  color: var(--black);
  font-size: 0.68rem;
  font-weight: 1000;
  line-height: 1;
}

.project-status[data-status="Planning"] {
  background: var(--purple);
}

.project-status[data-status="Paused"] {
  background: var(--yellow);
}

.project-status[data-status="Finished"],
.project-status[data-status="Completed"] {
  background: var(--blue);
}

.empty-projects {
  display: none;
  min-height: 42vh;
  margin: 0;
  place-items: center;
  color: rgba(0, 0, 0, 0.72);
  font-size: clamp(1.25rem, 4vw, 2.6rem);
  font-weight: 1000;
  text-align: center;
}

.empty-projects.visible {
  display: grid;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0);
  transition: background 180ms ease;
}

.modal-backdrop.open {
  display: grid;
  background: rgba(0, 0, 0, 0.7);
}

.project-detail-card {
  position: relative;
  width: min(820px, calc(100vw - 40px));
  max-height: min(640px, calc(100vh - 84px));
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  border: 3px solid var(--line);
  background: var(--paper-solid);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
  overflow: auto;
  opacity: 0;
  transform: scale(0.94);
}

.modal-backdrop.open .project-detail-card {
  opacity: 1;
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  background: var(--orange);
  color: var(--black);
  font-weight: 1000;
}

.modal-image {
  width: 100%;
  height: 100%;
  min-height: 340px;
  object-fit: cover;
  border-right: 3px solid var(--line);
  background: #333333;
}

.modal-content {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 36px 22px 22px;
}

.modal-content h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3.5vw, 2.75rem);
  line-height: 0.95;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.modal-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.modal-facts div {
  min-width: 0;
  border: 2px solid var(--line);
  background: #ffffff;
  padding: 9px;
}

.modal-facts dt {
  margin-bottom: 3px;
  color: #555555;
  font-size: 0.68rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.modal-facts dd {
  margin: 0;
  font-weight: 900;
  overflow-wrap: anywhere;
}

#modal-details {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

:focus-visible {
  outline: 4px solid #ffffff;
  outline-offset: 3px;
}

@media (max-width: 780px) {
  .site-header {
    min-height: 112px;
  }

  main {
    padding-top: 112px;
  }

  .site-header.scrolled {
    min-height: 82px;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 8px 12px;
  }

  .site-header.scrolled .tab-bar {
    width: 100%;
  }

  .site-header.scrolled .brand {
    font-size: 1.45rem;
  }

  .tab-button {
    min-height: 36px;
  }

  .home-grid,
  .projects-grid,
  .project-detail-card,
  .modal-facts {
    grid-template-columns: 1fr;
  }

  .hero-image-wrap {
    height: clamp(300px, 46vh, 420px);
  }

  .modal-image {
    min-height: 200px;
    border-right: 0;
    border-bottom: 3px solid var(--line);
  }
}

@media (max-width: 520px) {
  .home-shell,
  .page-shell {
    width: min(360px, calc(100% - 24px));
  }

  .brand {
    font-size: 2.05rem;
    -webkit-text-stroke-width: 1.2px;
  }

  .tab-button {
    font-size: 0.78rem;
    padding: 0 6px;
  }

  .text-box {
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.2);
  }
}

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