:root,
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f2ed;
  --surface: #fbfaf7;
  --surface-2: #e9ece6;
  --text: #171a18;
  --muted: #626862;
  --subtle: #686e68;
  --line: #d7dad3;
  --line-strong: #bdc3bb;
  --accent: #536e5b;
  --accent-hover: #3e5646;
  --accent-soft: #dde7df;
  --focus: #2f6f55;
  --backdrop: rgba(243, 242, 237, 0.94);
  --shadow: 0 18px 60px rgba(32, 39, 34, 0.08);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111411;
  --surface: #171b18;
  --surface-2: #1e2520;
  --text: #f0f2ec;
  --muted: #a7aea6;
  --subtle: #7e887f;
  --line: #2d352f;
  --line-strong: #414b43;
  --accent: #9fc2a6;
  --accent-hover: #b8d7be;
  --accent-soft: #243329;
  --focus: #b8d7be;
  --backdrop: rgba(17, 20, 17, 0.94);
  --shadow: 0 18px 70px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  transition: background-color 220ms ease, color 220ms ease;
}

body.is-lightbox-open {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
}

button,
a {
  font: inherit;
}

a,
button {
  color: inherit;
}

::selection {
  background: var(--accent);
  color: var(--surface);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

h1,
h2,
h3,
p,
li,
dd,
dt,
a,
button {
  overflow-wrap: anywhere;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  translate: 0 -160%;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  text-decoration: none;
  transition: translate 160ms ease;
}

.skip-link:focus {
  translate: 0;
}

#projects,
#links {
  scroll-margin-top: 72px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 72px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.header-inner {
  width: 100%;
  max-width: 1240px;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto minmax(210px, 1fr);
  align-items: center;
  gap: 32px;
  margin: 0 auto;
  padding: 0 24px;
}

.logo,
.main-nav a,
.button-primary,
.button-secondary,
.project-link,
.site-footer a {
  text-decoration: none;
}

.logo {
  width: fit-content;
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0.2em;
}

.logo span {
  color: var(--accent);
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 4vw, 48px);
}

.main-nav a {
  position: relative;
  padding: 26px 0 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main-nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 20px;
  left: 0;
  height: 1px;
  scale: 0 1;
  background: var(--accent);
  transform-origin: left;
  transition: scale 180ms ease;
}

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

.main-nav a:hover::after,
.main-nav a[aria-current="page"]::after {
  scale: 1;
}

.header-controls {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-switch {
  display: grid;
  grid-template-columns: repeat(2, 40px);
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.language-switch button,
.theme-toggle {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.language-switch button {
  height: 32px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 740;
  letter-spacing: 0.05em;
}

.language-switch button:hover {
  color: var(--text);
}

.language-switch button.is-active {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}

.theme-toggle:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.theme-toggle svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.5;
  transition: rotate 280ms ease;
}

html[data-theme="dark"] .theme-toggle svg {
  rotate: 45deg;
}

.hero {
  border-bottom: 1px solid var(--line);
}

.hero-inner {
  max-width: 1240px;
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(310px, 0.52fr);
  gap: clamp(56px, 8vw, 112px);
  margin: 0 auto;
  padding: clamp(76px, 9vw, 118px) 24px clamp(72px, 8vw, 104px);
}

.hero-copy {
  position: relative;
  min-width: 0;
}

.meta-label {
  margin: 0;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 850px;
  margin: 24px 0 0;
  color: var(--text);
  font-size: clamp(62px, 8.6vw, 118px);
  font-weight: 535;
  line-height: 0.9;
  letter-spacing: -0.073em;
}

.hero-intro {
  max-width: 620px;
  margin: 34px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 1.7vw, 21px);
  line-height: 1.62;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 22px;
  margin-top: 36px;
}

.button-primary,
.button-secondary {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 9px;
  padding: 0 18px;
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.button-primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--surface);
}

html[data-theme="dark"] .button-primary {
  color: var(--bg);
}

.button-primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.button-secondary {
  border: 1px solid var(--line);
  color: var(--text);
}

.button-secondary:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.hero-aside {
  align-self: start;
  display: grid;
  gap: 34px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 30px;
}

.work-list {
  display: grid;
  margin: 17px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: work;
}

.work-list li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  border-top: 1px solid var(--line);
  color: var(--text);
  padding: 11px 0;
  counter-increment: work;
}

.work-list li::before {
  content: "0" counter(work);
  color: var(--subtle);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
}

.platform-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 17px 0 0;
  padding: 0;
  list-style: none;
}

.platform-list li {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 0 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
}

.projects {
  padding-bottom: 104px;
}

.archive-header {
  max-width: 1240px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 48px;
  margin: 0 auto;
  padding: 96px 24px 42px;
}

.archive-header h2 {
  margin: 14px 0 0;
  color: var(--text);
  font-size: clamp(42px, 5.2vw, 72px);
  font-weight: 540;
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.archive-count {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.archive-count strong {
  color: var(--accent);
  font-size: 28px;
  font-weight: 540;
  letter-spacing: -0.04em;
}

.project-filters {
  max-width: 1192px;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  margin: 0 auto 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 6px;
  scrollbar-width: none;
}

.project-filters::-webkit-scrollbar {
  display: none;
}

.filter-button {
  flex: 0 0 auto;
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 14px;
  font-size: 11px;
  font-weight: 690;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background-color 160ms ease, color 160ms ease;
}

.filter-button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.filter-button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.project-list {
  max-width: 1240px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 0 auto;
  padding: 0 24px;
  list-style: none;
}

.project-row {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "image"
    "content"
    "links";
  align-content: start;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
  transition: border-color 180ms ease, translate 180ms ease, box-shadow 180ms ease;
}

.project-row:hover {
  translate: 0 -2px;
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.project-row.is-featured {
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1.42fr) minmax(330px, 0.58fr);
  grid-template-areas:
    "image content"
    "image links";
}

.project-image {
  grid-area: image;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--accent-soft);
  cursor: zoom-in;
  padding: 0;
}

.project-row.is-featured .project-image {
  height: 100%;
  min-height: 580px;
  border-right: 1px solid var(--line);
  border-bottom: 0;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.project-image:focus-visible {
  outline-offset: -4px;
}

.project-row:hover .project-image img,
.project-image:focus-visible img {
  transform: scale(1.018);
}

.project-index {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  min-width: 38px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.project-content {
  grid-area: content;
  min-width: 0;
  padding: 28px 28px 0;
}

.project-row.is-featured .project-content {
  padding: 40px 36px 0;
}

.project-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(28px, 3vw, 39px);
  font-weight: 560;
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.project-row.is-featured .project-title {
  font-size: clamp(38px, 4.2vw, 56px);
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 13px 0 0;
  padding: 0;
  color: var(--subtle);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.02em;
  list-style: none;
  text-transform: uppercase;
}

.project-meta li:not(:last-child)::after {
  content: "·";
  margin-left: 8px;
}

.project-description {
  margin: 20px 0 0;
  color: var(--muted);
  line-height: 1.62;
}

.project-facts {
  display: grid;
  margin: 26px 0 0;
  border-bottom: 1px solid var(--line);
}

.project-facts div {
  min-width: 0;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.project-facts dt {
  align-self: baseline;
}

.project-facts dd {
  margin: 0;
}

.meta-value {
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.project-links {
  grid-area: links;
  align-self: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 22px 28px 28px;
}

.project-row.is-featured .project-links {
  padding: 24px 36px 40px;
}

.project-link {
  width: fit-content;
  color: var(--accent-hover);
  font-size: 13px;
  font-weight: 710;
  transition: translate 160ms ease, color 160ms ease;
}

.project-link:hover {
  translate: 2px 0;
  color: var(--text);
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  padding: 36px;
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 28px;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: var(--backdrop);
  cursor: zoom-out;
  backdrop-filter: blur(10px);
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100vw - 56px));
  max-height: calc(100vh - 56px);
  display: grid;
  justify-items: center;
  gap: 12px;
  margin: 0;
}

.lightbox-panel img {
  max-width: 100%;
  max-height: calc(100vh - 128px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--accent-soft);
  box-shadow: var(--shadow);
  object-fit: contain;
}

.lightbox-panel figcaption {
  max-width: 760px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-align: center;
}

.lightbox-close {
  position: absolute;
  top: -16px;
  right: -16px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  box-shadow: var(--shadow);
}

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

.footer-inner {
  max-width: 1240px;
  display: grid;
  grid-template-columns: 1.35fr 0.8fr 0.8fr;
  gap: 72px;
  margin: 0 auto;
  padding: 60px 24px 72px;
}

.site-footer h2 {
  margin: 0 0 16px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.site-footer p {
  max-width: 430px;
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 14px;
}

.site-footer a {
  color: var(--text);
  font-weight: 650;
}

.site-footer a:hover {
  color: var(--accent-hover);
}

@media (max-width: 1000px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .hero-aside {
    grid-template-columns: 1.25fr 0.75fr;
  }

  .project-row.is-featured {
    grid-template-columns: 1fr;
    grid-template-areas:
      "image"
      "content"
      "links";
  }

  .project-row.is-featured .project-image {
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 8;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .footer-inner {
    gap: 42px;
  }
}

@media (max-width: 760px) {
  #projects,
  #links {
    scroll-margin-top: 116px;
  }

  .site-header {
    height: auto;
  }

  .header-inner {
    grid-template-columns: 1fr auto;
    gap: 12px 20px;
    padding: 14px 20px 12px;
  }

  .main-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    gap: 30px;
  }

  .main-nav a {
    padding: 5px 0 8px;
  }

  .main-nav a::after {
    bottom: 2px;
  }

  .hero-inner {
    padding: 64px 20px 60px;
  }

  .hero h1 {
    font-size: clamp(54px, 15.5vw, 82px);
  }

  .hero-aside {
    grid-template-columns: 1fr;
    border-radius: 14px;
    padding: 24px;
  }

  .archive-header {
    align-items: flex-start;
    padding: 68px 20px 34px;
  }

  .archive-count span {
    display: none;
  }

  .project-filters {
    margin-right: 20px;
    margin-left: 20px;
  }

  .project-list {
    grid-template-columns: 1fr;
    padding-right: 20px;
    padding-left: 20px;
  }

  .project-row.is-featured {
    grid-column: auto;
  }

  .project-row.is-featured .project-image {
    aspect-ratio: 16 / 10;
  }

  .project-row.is-featured .project-content,
  .project-content {
    padding: 25px 24px 0;
  }

  .project-row.is-featured .project-links,
  .project-links {
    padding: 22px 24px 26px;
  }

  .project-row.is-featured .project-title,
  .project-title {
    font-size: clamp(30px, 8vw, 40px);
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 34px;
    padding: 48px 20px 56px;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding-right: 16px;
    padding-left: 16px;
  }

  .header-controls {
    gap: 7px;
  }

  .language-switch {
    grid-template-columns: repeat(2, 37px);
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .button-primary,
  .button-secondary {
    width: 100%;
  }

  .archive-header {
    gap: 20px;
  }

  .project-facts div {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .image-lightbox {
    padding: 14px;
  }

  .lightbox-panel {
    width: calc(100vw - 28px);
    max-height: calc(100vh - 28px);
  }

  .lightbox-panel img {
    max-height: calc(100vh - 92px);
  }

  .lightbox-close {
    top: 8px;
    right: 8px;
  }
}

@media print {
  :root,
  html[data-theme] {
    color-scheme: light;
    --bg: #fff;
    --surface: #fff;
    --surface-2: #f3f3f0;
    --text: #111;
    --muted: #333;
    --subtle: #555;
    --line: #d2d2d2;
    --line-strong: #aaa;
    --accent: #355a41;
    --accent-hover: #355a41;
    --accent-soft: #eef4ef;
    --shadow: none;
  }

  body {
    background: #fff;
    font-size: 9.5pt;
  }

  .site-header,
  .hero-actions,
  .project-filters,
  .image-lightbox,
  .skip-link {
    display: none !important;
  }

  .hero-inner,
  .archive-header,
  .project-list,
  .footer-inner {
    max-width: none;
    padding-right: 0;
    padding-left: 0;
  }

  .hero-inner {
    grid-template-columns: 1.35fr 0.65fr;
    gap: 24pt;
    padding-top: 24pt;
    padding-bottom: 24pt;
  }

  .hero h1 {
    font-size: 38pt;
  }

  .hero-aside,
  .project-row {
    box-shadow: none;
  }

  .archive-header {
    padding-top: 26pt;
    padding-bottom: 14pt;
  }

  .archive-header h2 {
    font-size: 28pt;
  }

  .projects {
    padding-bottom: 24pt;
  }

  .project-list {
    gap: 10pt;
  }

  .project-row {
    break-inside: avoid;
    border-radius: 6pt;
  }

  .project-row:hover {
    translate: 0;
  }

  .project-row.is-featured .project-image {
    min-height: 0;
  }

  .project-content,
  .project-row.is-featured .project-content {
    padding: 12pt 12pt 0;
  }

  .project-links,
  .project-row.is-featured .project-links {
    padding: 10pt 12pt 12pt;
  }

  .project-title,
  .project-row.is-featured .project-title {
    font-size: 20pt;
  }

  .footer-inner {
    gap: 24pt;
    padding-top: 24pt;
    padding-bottom: 24pt;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }

  .project-row:hover,
  .project-link:hover {
    translate: 0;
  }

  .project-row:hover .project-image img,
  .project-image:focus-visible img {
    transform: none;
  }
}
