.layout {
  display: flex;
  justify-content: center;
  width: 100%;
}

.sheet-cluster {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  max-width: 100%;
}

.sheet-cluster .sheet {
  margin: 0;
  flex: 0 1 40rem;
  max-width: 40rem;
}

.panel-open {
  flex: 0 0 auto;
  align-self: flex-start;
  margin-top: 1.75rem;
  padding: 0.35rem 0.65rem;
  font: inherit;
  cursor: pointer;
  border: 1px solid #666;
  background: #e8e8e4;
}

.panel-open:hover {
  background: #ddd;
}

.site-chrome {
  --site-chrome-rail-min: 1.75rem;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 0.35rem;
  align-content: start;
  align-self: flex-start;
  margin-top: 1.75rem;
}

.site-chrome--start {
  margin-right: 0.5rem;
  justify-items: end;
  width: max-content;
  max-width: max-content;
}

.site-chrome--end {
  margin-left: 0.5rem;
}

.site-chrome__rail {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  min-height: var(--site-chrome-rail-min);
  height: var(--site-chrome-rail-min);
}

.site-chrome--start .site-chrome__rail {
  justify-content: flex-end;
}

.site-chrome__rail--balance {
  pointer-events: none;
}

.site-chrome__primary,
.site-chrome__secondary {
  margin: 0;
}

.site-chrome--start .site-chrome__primary,
.site-chrome--start .site-chrome__secondary {
  justify-self: end;
}

.site-chrome .panel-open,
.site-chrome .download-cv-pdf {
  align-self: auto;
  margin-top: 0;
  white-space: nowrap;
}

.site-chrome .download-cv-pdf {
  display: inline-block;
  text-decoration: none;
  color: inherit;
  text-align: center;
  box-sizing: border-box;
  cursor: pointer;
}

.site-chrome .download-cv-pdf:hover {
  background: #ddd;
}

.site-chrome--start .website-open,
.site-chrome--end .about-open {
  margin: 0;
}

.lang-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.lang-btn {
  font: inherit;
  padding: 0.15rem 0.4rem;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  color: #444;
}

.lang-btn:hover {
  background: #e0e0dc;
}

.lang-btn.is-active {
  border-color: #666;
  background: #e8e8e4;
}

.lang-switch__sep {
  color: #888;
  user-select: none;
}

.site-chrome--end .btn--github {
  justify-content: center;
}

.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.2);
}

.panel-backdrop[hidden] {
  display: none;
}

.side-panel {
  flex: 0 0 auto;
  width: 0;
  max-width: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  border: none;
  background: #eaeae6;
  transition: max-width 0.22s ease;
  align-self: stretch;
}

.side-panel.is-open {
  width: min(22rem, calc(100vw - 3rem));
  max-width: min(22rem, calc(100vw - 3rem));
  box-shadow: 2px 2px 0 #888;
}

.about-panel.is-open {
  border-left: 1px solid #666;
}

.website-panel.is-open {
  border-right: 1px solid #666;
}

@media (prefers-reduced-motion: reduce) {
  .side-panel {
    transition: none;
  }
}

.side-panel__inner {
  width: min(22rem, calc(100vw - 3rem));
  min-height: 100%;
  padding: 1.75rem 1.5rem 2rem;
  box-sizing: border-box;
}

.side-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.side-panel__head h2 {
  margin: 0;
  font-size: 1rem;
}

.panel-close {
  flex-shrink: 0;
  padding: 0.15rem 0.45rem;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  border: 1px solid #666;
  background: #f6f6f2;
}

.about-photo {
  margin: 0 0 1rem;
}

.about-photo img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border: 1px solid #666;
  background: #ddd;
}

.side-panel__body h2 {
  margin-top: 1.25rem;
}

.side-panel__body h2:first-child {
  margin-top: 0;
}

.side-panel__body p {
  margin: 0.65rem 0 0;
}

body.about-panel-open {
  overflow: hidden;
}

@media (max-width: 520px) {
  .sheet-cluster {
    flex-wrap: wrap;
    justify-content: center;
  }

  .panel-open {
    margin: 0.75rem 0 0;
    order: 4;
    width: 100%;
    max-width: 40rem;
    text-align: center;
  }

  .site-chrome--start {
    order: 3;
    margin-right: 0;
    width: 100%;
    max-width: 40rem;
  }

  .site-chrome--end {
    order: 5;
    margin-left: 0;
    width: 100%;
    max-width: 40rem;
  }

  .site-chrome .panel-open {
    order: unset;
    width: auto;
  }

  .side-panel {
    order: 2;
    flex: 1 1 100%;
  }

  .side-panel.is-open {
    width: 100%;
    max-width: 40rem;
  }

  .side-panel__inner {
    width: 100%;
  }

  .sheet-cluster .sheet {
    order: 1;
    flex: 1 1 100%;
  }
}

@media print {
  .panel-backdrop {
    display: none !important;
  }

  .sheet-cluster .sheet {
    max-width: none;
  }
}
