.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(18px);
}

.site-header__inner {
  display: flex;
  min-height: 4.5rem;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.85rem;
  font-weight: 850;
}

.site-brand::before {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  background: var(--accent);
  content: '';
  box-shadow: 0.35rem 0.35rem 0 var(--signal);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.65rem;
}

.site-nav a {
  position: relative;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.site-nav a::after {
  position: absolute;
  right: 0;
  bottom: -0.45rem;
  left: 0;
  height: 2px;
  background: var(--accent);
  content: '';
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.site-nav a:hover,
.site-nav a[aria-current='page'] {
  color: var(--text);
}

.site-nav a:hover::after,
.site-nav a[aria-current='page']::after {
  transform: scaleX(1);
}

.project-menu {
  position: relative;
}

.project-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.project-menu__trigger:hover,
.project-menu__trigger[aria-current='page'],
.project-menu[data-open] .project-menu__trigger {
  color: var(--text);
}

.project-menu__trigger i {
  width: 0.42rem;
  height: 0.42rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.12rem) rotate(45deg);
  transition: transform 160ms ease;
}

.project-menu[data-open] .project-menu__trigger i {
  transform: translateY(0.12rem) rotate(225deg);
}

.project-menu__panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 1.15rem);
  left: 50%;
  display: none;
  width: 15rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.project-menu[data-open] .project-menu__panel {
  display: grid;
}

.site-nav .project-menu__panel a {
  display: grid;
  grid-template-columns: 4.6rem 1fr;
  min-height: 2.8rem;
  padding: 0.65rem 0.75rem;
  border-radius: 4px;
  align-items: center;
  color: var(--text);
}

.site-nav .project-menu__panel a::after {
  display: none;
}

.project-menu__panel a:hover,
.project-menu__panel a[aria-current='page'] {
  background: var(--surface-soft);
}

.project-menu__panel a span {
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 750;
}

.project-menu__panel a strong {
  font-size: 0.82rem;
}

.project-menu__all {
  margin-top: 0.35rem;
  border-top: 1px solid var(--line);
}

.attachment-menu {
  position: relative;
}

.attachment-menu__trigger {
  display: inline-flex;
  width: auto;
  height: 1.9rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.attachment-menu__trigger:hover,
.attachment-menu[data-open] .attachment-menu__trigger {
  color: var(--accent);
}

.attachment-menu__trigger > span:first-child {
  position: relative;
  width: 0.55rem;
  height: 1rem;
  border: 1.5px solid currentColor;
  border-radius: 0.35rem;
  transform: rotate(35deg);
}

.attachment-menu__trigger > span:first-child::after {
  position: absolute;
  top: 0.16rem;
  left: 0.13rem;
  width: 0.18rem;
  height: 0.55rem;
  border: 1px solid currentColor;
  border-radius: 0.2rem;
  content: '';
}

.attachment-menu__panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 1.15rem);
  right: 0;
  display: none;
  width: 20rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.attachment-menu[data-open] .attachment-menu__panel {
  display: grid;
}

.attachment-menu__heading {
  padding: 0.6rem 0.75rem 0.75rem;
  color: var(--muted);
  font-size: 0.68rem;
}

.site-nav .attachment-menu__panel a {
  display: flex;
  min-height: 3.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.75rem;
  border-top: 1px solid var(--line);
  color: var(--text);
}

.site-nav .attachment-menu__panel a::after {
  display: none;
}

.site-nav .attachment-menu__panel a:hover {
  background: var(--surface-soft);
}

.attachment-menu__panel a > span {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.attachment-menu__panel a strong {
  font-size: 0.78rem;
}

.attachment-menu__panel a small,
.attachment-menu__panel a > i {
  color: var(--muted);
  font-size: 0.66rem;
  font-style: normal;
}

.welcome-dialog {
  width: min(46rem, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-strong);
}

.welcome-dialog::backdrop {
  background: rgb(7 8 11 / 0.76);
  backdrop-filter: blur(10px);
}

.welcome-dialog__panel {
  position: relative;
  padding: clamp(1.5rem, 5vw, 3rem);
}

.welcome-dialog__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
}

.welcome-dialog__close:hover {
  color: var(--accent);
}

.welcome-dialog__intro {
  max-width: 38rem;
  padding-right: 2.5rem;
}

.welcome-dialog__intro h2 {
  margin-bottom: 1rem;
  font-size: clamp(2rem, 6vw, 3.25rem);
}

.welcome-dialog__intro > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.welcome-dialog__attachments {
  margin-block: 2rem;
  border-block: 1px solid var(--line);
}

.welcome-dialog__attachments a {
  display: flex;
  min-height: 4.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}

.welcome-dialog__attachments a:last-child {
  border-bottom: 0;
}

.welcome-dialog__attachments a:hover strong,
.welcome-dialog__attachments a:focus-visible strong,
.welcome-dialog__attachments a:hover > i {
  color: var(--accent);
}

.welcome-dialog__attachments a > span {
  display: grid;
  gap: 0.15rem;
}

.welcome-dialog__attachments strong {
  font-size: 0.95rem;
}

.welcome-dialog__attachments small,
.welcome-dialog__attachments i {
  color: var(--muted);
  font-size: 0.75rem;
  font-style: normal;
}

.welcome-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.icon-button,
.nav-toggle,
.track-control,
.ui-expand,
.dialog-close {
  display: inline-flex;
  width: 2.6rem;
  height: 2.6rem;
  flex: 0 0 2.6rem;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.icon-button:hover,
.nav-toggle:hover,
.track-control:hover,
.ui-expand:hover,
.dialog-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.85rem;
  height: 0.85rem;
}

.site-nav .theme-toggle {
  width: 1.9rem;
  height: 1.9rem;
  flex-basis: 1.9rem;
  border: 0;
  border-radius: 5px;
  background: transparent;
}

.theme-toggle__mark::before {
  content: '\25D0';
  font-size: 1rem;
  line-height: 1;
}

.nav-toggle {
  display: none;
}

.nav-toggle__mark,
.nav-toggle__mark::before,
.nav-toggle__mark::after {
  width: 1rem;
  height: 2px;
  background: currentColor;
  content: '';
}

.nav-toggle__mark {
  position: relative;
}

.nav-toggle__mark::before,
.nav-toggle__mark::after {
  position: absolute;
  left: 0;
}

.nav-toggle__mark::before {
  top: -0.33rem;
}

.nav-toggle__mark::after {
  top: 0.33rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-3);
}

.project-card {
  display: grid;
  min-height: 36rem;
  grid-column: span 6;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.project-card:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: var(--shadow-strong);
  transform: translateY(-4px);
}

.project-card__visual {
  position: relative;
  min-height: 20rem;
  padding: 2rem;
  overflow: hidden;
  background: var(--surface-soft);
}

.project-card__visual::after {
  position: absolute;
  right: 1rem;
  bottom: 0.7rem;
  color: color-mix(in srgb, var(--muted) 58%, transparent);
  content: attr(data-index);
  font-size: 4.5rem;
  font-weight: 800;
  line-height: 1;
}

.project-card__body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2);
  padding: 1.6rem;
  border-top: 1px solid var(--line);
  align-items: end;
}

.project-card__body h3 {
  margin-bottom: 0.35rem;
  font-size: 1.6rem;
}

.project-card__body p {
  max-width: 42ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.project-card__arrow {
  font-size: 1.5rem;
}

.tag-row,
.case-meta,
.role-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}

.tag-row li,
.case-meta li,
.role-list li {
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
}

.case-meta li:first-child,
.role-list li:first-child {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  color: var(--accent-strong);
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer__inner {
  display: flex;
  min-height: 7rem;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 0.85rem;
}

.site-footer__links {
  display: flex;
  gap: var(--space-2);
}

.product-ui {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.ui-window {
  display: grid;
  min-height: 25rem;
  grid-template-columns: 4.5rem 1fr;
}

.ui-sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0.75rem;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-soft) 60%, var(--surface));
}

.ui-logo,
.ui-icon,
.ui-avatar {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 5px;
  background: var(--line);
}

.ui-logo {
  margin-bottom: 1rem;
  background: var(--accent);
}

.ui-icon.is-active {
  background: var(--signal);
}

.ui-avatar {
  margin-top: auto;
  border-radius: 50%;
  background: var(--secondary);
}

.ui-main {
  min-width: 0;
  padding: 1.25rem;
}

.ui-toolbar {
  display: flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.ui-title {
  font-size: 0.78rem;
  font-weight: 800;
}

.ui-actions {
  display: flex;
  gap: 0.45rem;
}

.ui-pill,
.ui-button,
.ui-chip {
  display: inline-flex;
  min-height: 1.75rem;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
}

.ui-button.is-primary,
.ui-pill.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.ui-chip {
  min-height: 1.5rem;
  border-radius: 999px;
}

.ui-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.ui-panel,
.ui-row,
.ui-message,
.ui-node {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.ui-panel {
  min-height: 8rem;
  padding: 0.9rem;
}

.ui-panel.is-accent {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.ui-kicker {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.55rem;
}

.ui-line {
  display: block;
  width: 78%;
  height: 0.38rem;
  margin-bottom: 0.45rem;
  border-radius: 99px;
  background: var(--line);
}

.ui-line.is-short {
  width: 45%;
}

.ui-line.is-accent {
  width: 62%;
  background: var(--accent);
}

.ui-bars {
  display: flex;
  height: 5rem;
  align-items: flex-end;
  gap: 0.4rem;
  padding-top: 1rem;
}

.ui-bars i {
  display: block;
  width: 0.65rem;
  height: var(--bar, 45%);
  border-radius: 2px 2px 0 0;
  background: color-mix(in srgb, var(--accent) 58%, var(--line));
}

.ui-expand {
  position: absolute;
  z-index: 3;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.25rem;
  height: 2.25rem;
  min-height: 0;
  flex-basis: 2.25rem;
  font-size: 1.05rem;
}

.ui-dialog {
  width: min(1100px, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 3.5rem 1rem 1rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-strong);
}

.ui-dialog::backdrop {
  background: rgb(7 8 11 / 0.78);
  backdrop-filter: blur(8px);
}

.ui-dialog .dialog-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
}

.ui-dialog__stage > .product-ui {
  box-shadow: none;
}

@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 1.5rem;
    display: none;
    min-width: 14rem;
    padding: 0.8rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .site-nav[data-open] {
    display: grid;
  }

  .site-nav a {
    min-height: 2.75rem;
    padding: 0.6rem 0.75rem;
  }

  .site-nav a::after {
    display: none;
  }

  .project-menu__trigger {
    width: 100%;
    min-height: 2.75rem;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    color: var(--text);
  }

  .project-menu__panel {
    position: static;
    width: 100%;
    padding: 0.25rem 0.4rem 0.5rem;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    transform: none;
  }

  .attachment-menu__trigger {
    width: 100%;
    min-height: 2.75rem;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    color: var(--text);
  }

  .attachment-menu__panel {
    position: static;
    width: 100%;
    padding: 0.25rem 0.4rem 0.5rem;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
  }


  .site-nav .theme-toggle {
    margin: 0.25rem 0.75rem;
  }

  .project-card {
    grid-column: span 12;
  }
}

@media (max-width: 640px) {
  .site-nav {
    right: 1rem;
  }

  .project-card {
    min-height: 30rem;
  }

  .project-card__visual {
    min-height: 17rem;
    padding: 1rem;
  }

  .project-card__body {
    grid-template-columns: 1fr;
  }

  .ui-window {
    min-height: 21rem;
    grid-template-columns: 3.25rem 1fr;
  }

  .ui-main {
    padding: 0.75rem;
  }

  .ui-grid {
    grid-template-columns: 1fr;
  }

  .welcome-dialog__panel {
    padding: 1.5rem;
  }

  .welcome-dialog__intro {
    padding-right: 1.5rem;
  }

  .welcome-dialog__attachments a {
    gap: 0.75rem;
  }

  .welcome-dialog__actions,
  .welcome-dialog__actions .button-link {
    width: 100%;
  }

  .site-footer__inner,
  .site-footer__links {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }
}
