:root {
  --paper: #f4f2ec;
  --card: #ffffff;
  --ink: #141310;
  --dim: #6f6a5a;
  --line: #ccc7b8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  padding: 0 5vw;
  background: var(--paper);
  color: var(--ink);
  font-family: "Encode Sans Semi Expanded", sans-serif;
}

.site-header {
  height: 15vh;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.6vh;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(20px, 2.6vw, 40px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.05;
}

.header-sub {
  margin: 0;
  font-size: clamp(9px, 0.75vw, 12px);
  font-weight: 500;
  letter-spacing: 0.28em;
  color: var(--dim);
}

.layout {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 2vw;
  padding: 2vh 0;
}

.sidebar {
  flex: 0 0 25vw;
  min-width: 220px;
  overflow-y: auto;
  padding-right: 1.2vw;
  border-right: 1px solid var(--line);
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: var(--dim);
  padding-bottom: 1.2vh;
}

.week {
  border-top: 1px solid var(--line);
}

.week summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.2vh 0;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.week summary::-webkit-details-marker {
  display: none;
}

.week summary::after {
  content: "+";
  font-weight: 400;
  color: var(--dim);
}

.week[open] summary::after {
  content: "–";
}

.week-count {
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--dim);
  margin-left: 0.6em;
}

.group {
  padding: 0 0 1.8vh 0.6em;
}

.group-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 0.8vh;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.thumb {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  aspect-ratio: 1 / 1;
  padding: 5px;
  cursor: pointer;
  display: block;
  width: 100%;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.thumb:hover {
  border-color: var(--ink);
}

.thumb.active {
  border-color: var(--ink);
  outline: 1px solid var(--ink);
}

.thumb:focus-visible {
  outline: 2px solid var(--ink);
}

.viewer {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.viewer-meta {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  padding-bottom: 0.8vh;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

#crumb {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-holder {
  height: 58vh;
  min-height: 300px;
  aspect-ratio: 3 / 4;
  max-width: 100%;
  align-self: center;
  flex: none;
  border: none;
  background: var(--paper);
  cursor: crosshair;
  overflow: hidden;
}

.canvas-holder.white-base {
  background: #ffffff;
  border: 1px solid var(--line);
}

.canvas-holder canvas,
#fallback-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.copy {
  padding: 2.5vh 0 4vh;
  max-width: 68ch;
}

.copy h2 {
  margin: 0 0 1.2vh;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: var(--dim);
}

.copy p {
  margin: 0 0 1.4em;
  font-size: clamp(13px, 1vw, 16px);
  font-weight: 400;
  line-height: 1.7;
}

.site-footer {
  height: 5vh;
  min-height: 34px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1em;
  border-top: 1px solid var(--line);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.24em;
  color: var(--dim);
  text-transform: uppercase;
}

.sidebar::-webkit-scrollbar,
.viewer::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-thumb,
.viewer::-webkit-scrollbar-thumb {
  background: var(--line);
}

@media (max-width: 900px) {
  body {
    height: auto;
    min-height: 100%;
  }

  .layout {
    flex-direction: column;
  }

  .sidebar {
    flex: none;
    width: 100%;
    max-height: 40vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
  }

  .viewer {
    overflow: visible;
  }
}
