:root {
  color-scheme: light;
  --ink: #141414;
  --paper: #f1efeb;
  --line: #aaa59e;
  --mono: Menlo, 'DejaVu Sans Mono', Consolas, monospace;
  color: var(--ink);
  background: #fff;
  font: 15px/1.5 var(--mono);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0 auto; max-width: 1760px; padding: 0 20px; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
[hidden] { display: none !important; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(20px, 3vw, 48px);
  min-height: 150px;
  padding: 25px clamp(16px, 2vw, 34px);
}
.logo { flex: 1 1 440px; max-width: 495px; }
.logo img { width: 100%; height: auto; }
.navigation, .contacts { display: flex; align-items: center; gap: 14px; }
.navigation { gap: clamp(18px, 2vw, 34px); }
.navigation a { white-space: nowrap; text-decoration: none; }
.navigation a[aria-current]::before {
  content: ''; display: inline-block; width: 8px; height: 8px;
  margin-right: 9px; vertical-align: 2px; background: currentColor;
}
.navigation a:hover, .footer a:hover, .work:hover .work-title { text-decoration: underline; }
.header-contacts { border-left: 1px solid var(--ink); padding-left: 20px; }
.button {
  display: inline-flex; gap: 8px; align-items: center; justify-content: center;
  min-height: 44px; padding: 7px 12px; border: 1px solid var(--ink);
  background: #fff; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.button:not(:disabled):hover { background: var(--paper); }
.button:disabled { color: #555; cursor: default; }
.button svg { width: 15px; height: 15px; flex: none; fill: currentColor; }
.header-contacts .button { font-size: 12px; }

.panel { background: var(--paper); padding: clamp(24px, 4vw, 66px) clamp(18px, 2.7vw, 42px); }
.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 42px clamp(16px, 2.2vw, 34px); }
.work { display: block; min-width: 0; text-decoration: none; text-align: left; }
.work img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: transparent; }
.work-title { display: block; margin-top: 9px; letter-spacing: .035em; overflow-wrap: anywhere; }
.work-count { display: block; margin-top: 3px; color: #56514a; font-size: 11px; }
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 28px clamp(0px, 2vw, 32px); font-size: 12px; }
.footer a { text-decoration: none; }
.notice { margin: 20px; }

.project {
  color: inherit; border: 1px solid var(--ink); padding: 0; background: #fff;
  width: min(1200px, calc(100% - 56px)); max-width: none;
  max-height: calc(100dvh - 48px); overflow: auto;
}
.project::backdrop { background: rgb(241 239 235 / 72%); }
body:has(.project[open]) { overflow: hidden; }
.project-header, .project-navigation { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; }
.project-header { border-bottom: 1px solid var(--ink); }
.project-header h1 { margin: 0; font-size: clamp(16px, 2vw, 25px); font-weight: 400; overflow-wrap: anywhere; }
.project-content { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); padding: 24px; gap: 24px; }
.project-images { margin: 0; }
.project-images img { width: 100%; height: auto; max-height: 65dvh; object-fit: contain; }
#project-images.is-framed {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 2.5vw, 28px);
  background: #e9e9e9;
}
#project-images.is-framed img {
  width: auto;
  max-width: 100%;
  max-height: calc(65dvh - 56px);
  box-shadow: 0 0 0 1px #999;
}
.project-fullsize { display: inline-flex; align-items: center; min-height: 44px; font-size: 12px; }
.project-info { border-left: 1px solid var(--line); padding-left: 24px; }
.project-info h2, .cv h2 { font-size: 16px; margin: 0 0 8px; }
.project-info p { margin: 0; }
.project-info p:not([hidden]) + p { margin-top: 8px; }
.project-thumbnails { display: flex; gap: 9px; overflow-x: auto; margin-top: 20px; padding: 4px; }
.project-thumb { width: 76px; height: 66px; padding: 4px; flex: none; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.project-thumb[aria-pressed="true"] { outline: 1px solid var(--ink); border-color: var(--ink); }
.project-thumb img { width: 100%; height: 100%; object-fit: contain; }
.project-navigation { padding-top: 0; }

.cv { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 25px 36px; }
.cv h1 { grid-column: 1 / -1; margin: 0; font-size: clamp(23px, 3vw, 40px); font-weight: 400; }
.cv-details section + section { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 15px; }
.cv p, .cv ul { margin: 0; }
.cv ul { list-style: none; padding: 0; }
.cv .intro { font-size: clamp(16px, 2vw, 24px); margin-bottom: 5px; }
.cv-contact { border-left: 1px solid var(--line); padding-left: 28px; }
.contact-list { display: grid; gap: 10px; }
.contact-list .button { justify-content: flex-start; padding-inline: 16px; }

@media (min-width: 901px) {
  .work img { object-position: center; }
}
@media (max-width: 1120px) {
  .header { flex-wrap: wrap; gap: 18px 32px; min-height: auto; padding-block: 28px; }
  .logo { flex-basis: 340px; max-width: 400px; }
  .header-contacts { border-left: 0; padding-left: 0; }
}
@media (max-width: 900px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-content { grid-template-columns: minmax(0, 1fr); }
  .project-info { border-left: 0; padding-left: 0; }
}
@media (max-width: 620px) {
  body { padding: 0; }
  .header { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 18px; }
  .logo { width: min(100%, 276px); }
  .navigation { gap: 22px; font-size: 13px; }
  .navigation a { display: flex; align-items: center; min-height: 32px; }
  .navigation a[aria-current]::before { width: 6px; height: 6px; flex: none; }
  .header-contacts { display: grid; grid-template-columns: 1.15fr 1.2fr .9fr; gap: 7px; }
  .header-contacts .button { min-width: 0; padding-inline: 4px; gap: 5px; font-size: 11px; }
  .header-contacts .button svg { width: 13px; height: 13px; }
  .panel { padding: 18px; }
  .gallery { gap: 26px 14px; }
  .footer { padding: 22px 18px; font-size: 11px; }
  .project { width: calc(100% - 24px); max-height: calc(100dvh - 24px); }
  .project-header, .project-content, .project-navigation { padding: 12px; gap: 14px; }
  .project-images img { max-height: none; }
  #project-images.is-framed img { max-height: none; }
  .project-navigation { flex-direction: column; padding-top: 0; }
  .project-navigation .button { width: 100%; }
  .cv { grid-template-columns: minmax(0, 1fr); }
  .cv-page .header-contacts { display: none; }
  .cv-contact { grid-row: 2; border-left: 0; padding-left: 0; }
  .contact-list .button { justify-content: center; }
  .cv-details { font-family: system-ui, sans-serif; }
  .cv-details h2 { font-family: var(--mono); }
}
@media (max-width: 520px) {
  .gallery { grid-template-columns: minmax(0, 1fr); }
  .work img { aspect-ratio: auto; height: auto; }
  .work-title { font-size: 13px; }
}
