@font-face {
  font-family: "Unbounded";
  src: url("assets/fonts/unbounded-cyrillic.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Unbounded";
  src: url("assets/fonts/unbounded-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Literata";
  src: url("assets/fonts/literata-cyrillic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Literata";
  src: url("assets/fonts/literata-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Literata";
  src: url("assets/fonts/literata-italic-cyrillic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Literata";
  src: url("assets/fonts/literata-italic-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Palette taken from a great tit: sky it sits in, pine of its house,
   yellow chest, olive back, slate wing, white cheek. */
:root {
  --sky: #D6E6EC;
  --sky-line: #A9C5D1;
  --pine: #E6C48A;
  --pine-dark: #B98D52;
  --tit: #F2C230;
  --olive: #4F5B26;
  --slate: #22384A;
  --birch: #F7F6F1;

  --display: "Unbounded", "Arial Black", sans-serif;
  --text: "Literata", Georgia, serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 1.75rem;
  --step-3: clamp(1.75rem, 1.2rem + 2vw, 2.625rem);
  --step-4: clamp(2rem, 1.1rem + 2.8vw, 3.375rem);

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --max: 76rem;
}

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--sky);
  color: var(--slate);
  font-family: var(--text);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--display);
  line-height: 1.12;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }

:focus-visible {
  outline: 3px solid var(--slate);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 1rem;
  background: var(--slate);
  color: var(--birch);
  z-index: 10;
}
.skip:focus { top: 1rem; }

/* Header */
.site-header {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--step-1);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.wordmark svg { width: 2rem; height: 2rem; }
.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}
.site-header nav a {
  text-decoration: none;
  padding-block: 0.25rem;
  border-bottom: 2px solid transparent;
}
.site-header nav a:hover { border-bottom-color: var(--slate); }

/* Hero */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.5rem) var(--gutter) clamp(3rem, 7vw, 6rem);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  grid-template-areas:
    "copy house"
    "controls house";
  grid-template-rows: auto 1fr;
  column-gap: clamp(2rem, 5vw, 5rem);
}
.hero-copy { grid-area: copy; align-self: end; }
.house { grid-area: house; margin: 0; align-self: center; }
.hero-controls { grid-area: controls; margin-top: 2.5rem; }

.hero h1 {
  font-size: var(--step-4);
  font-weight: 800;
  letter-spacing: -0.025em;
  max-width: 15ch;
}
.lede {
  margin-top: 1.5rem;
  font-size: var(--step-1);
  line-height: 1.55;
  max-width: 34ch;
}

.house svg {
  display: block;
  width: 100%;
  max-width: 30rem;
  height: auto;
  margin-inline: auto;
}
.dim-label {
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  fill: var(--slate);
}

/* The ruler slider */
.ruler-label {
  display: block;
  font-family: var(--display);
  font-weight: 500;
  font-size: var(--step-0);
  margin-bottom: 0.75rem;
}
.ruler-label output { font-weight: 800; }

.ruler {
  --thumb: 1.5rem;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  max-width: 30rem;
  height: 3.25rem;
  margin: 0;
  padding: 0;
  /* 1 mm ticks, taller 10 mm ticks; inset by half a thumb so they line up with its centre */
  background:
    repeating-linear-gradient(90deg, var(--slate) 0 2px, transparent 2px calc((100% - 2px) / 40)) calc(var(--thumb) / 2 - 1px) 100% / calc(100% - var(--thumb) + 2px) 0.6rem no-repeat,
    repeating-linear-gradient(90deg, var(--slate) 0 2px, transparent 2px calc((100% - 2px) / 4)) calc(var(--thumb) / 2 - 1px) 100% / calc(100% - var(--thumb) + 2px) 1.3rem no-repeat,
    linear-gradient(var(--slate), var(--slate)) 0 100% / 100% 2px no-repeat,
    var(--pine);
  border-radius: 3px 3px 0 0;
  cursor: pointer;
}
.ruler::-webkit-slider-runnable-track { height: 3.25rem; background: transparent; }
.ruler::-moz-range-track { height: 3.25rem; background: transparent; }
.ruler::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--thumb);
  height: 3.25rem;
  border: 0;
  background:
    radial-gradient(circle at 50% 0.7rem, var(--tit) 0 0.55rem, var(--slate) 0.56rem 0.68rem, transparent 0.69rem),
    linear-gradient(var(--slate), var(--slate)) center / 3px 100% no-repeat;
}
.ruler::-moz-range-thumb {
  width: var(--thumb);
  height: 3.25rem;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 0.7rem, var(--tit) 0 0.55rem, var(--slate) 0.56rem 0.68rem, transparent 0.69rem),
    linear-gradient(var(--slate), var(--slate)) center / 3px 100% no-repeat;
}
.ruler:focus-visible { outline-offset: 4px; }

.ruler-scale {
  display: flex;
  justify-content: space-between;
  max-width: 30rem;
  padding-inline: calc(0.75rem - 1ch);
  font-family: var(--display);
  font-size: 0.75rem;
  margin-top: 0.35rem;
  font-variant-numeric: tabular-nums;
}
.ruler-scale span { width: 2ch; text-align: center; }

.tenant { margin-top: 2rem; max-width: 32rem; min-height: 9.5rem; }
.tenant-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--step-2);
  line-height: 1.15;
}
.tenant-latin {
  font-style: italic;
  margin-top: 0.15rem;
  opacity: 0.8;
}
.tenant-note { margin-top: 0.75rem; max-width: 38ch; }

/* Bird animation: a single hop up into the hole */
.bird { transform-box: view-box; }
.bird.pop { animation: pop 420ms cubic-bezier(.2, .9, .3, 1.25) both; }
.bird.arrive { animation: pop 900ms 250ms cubic-bezier(.2, .9, .3, 1.15) both; }
@keyframes pop {
  from { transform: translateY(110px); }
  to { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .bird.pop, .bird.arrive { animation: none; }
}

/* Shared section layout */
.who, .build, .hang, .year {
  padding: clamp(3.5rem, 8vw, 7rem) var(--gutter);
}
.who > *, .build > *, .hang > *, .year > * {
  max-width: var(--max);
  margin-inline: auto;
}
.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem clamp(2rem, 5vw, 5rem);
  align-items: end;
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}
.section-head h2 {
  font-size: var(--step-3);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.section-head p { max-width: 46ch; }

/* Tenants table */
.who { background: var(--birch); }
.tenants {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.tenants th {
  text-align: left;
  font-family: var(--display);
  font-weight: 500;
  font-size: var(--step--1);
  padding: 0 1rem 0.75rem 0;
  border-bottom: 2px solid var(--slate);
}
.tenants td {
  padding: 1rem 1rem 1rem 0;
  border-bottom: 1px solid var(--sky-line);
  vertical-align: baseline;
}
.tenants td:nth-child(2) {
  font-family: var(--display);
  font-weight: 700;
  white-space: nowrap;
}
.tenants td:nth-child(3),
.tenants td:nth-child(4) { white-space: nowrap; }
.tenants .col-note { width: 40%; }
.tenants tr[aria-current="true"] td { background: color-mix(in srgb, var(--tit) 35%, transparent); }
.tenants tr[aria-current="true"] td:first-child { box-shadow: inset 4px 0 0 var(--tit); }

.pick {
  font: inherit;
  font-weight: 600;
  color: inherit;
  background: none;
  border: 0;
  padding: 0 0 0 0.75rem;
  cursor: pointer;
  text-align: left;
}
.pick span {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}
.pick:hover span { text-decoration-thickness: 2px; }
.pick small {
  display: block;
  font-style: italic;
  font-weight: 400;
  font-size: var(--step--1);
  opacity: 0.75;
}

/* Build */
.build { background: var(--sky); }
.plank { margin: 0 0 clamp(3rem, 6vw, 5rem); }
.plank-scroll { overflow-x: auto; padding-bottom: 0.5rem; }
.plank svg { display: block; width: 100%; min-width: 52rem; height: auto; }
.plank-label text {
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  fill: var(--slate);
  text-anchor: middle;
}
.plank-label .plank-dim {
  font-family: var(--text);
  font-weight: 400;
  font-size: 20px;
}
.plank figcaption { margin-top: 0.75rem; font-size: var(--step--1); max-width: 70ch; }

.build-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}
.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2rem;
}
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  column-gap: 1rem;
}
.steps li::before {
  content: counter(step);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--slate);
  color: var(--birch);
  font-family: var(--display);
  font-weight: 700;
}
.steps h3 { font-size: var(--step-1); font-weight: 700; padding-top: 0.45rem; }
.steps p { margin-top: 0.4rem; max-width: 52ch; }

.materials {
  position: sticky;
  top: 1.5rem;
  background: var(--pine);
  padding: 1.75rem;
  border-radius: 4px;
}
.materials h3 { font-size: var(--step-1); font-weight: 700; }
.materials ul { margin: 1rem 0 0; padding-left: 1.1rem; }
.materials li + li { margin-top: 0.6rem; }

/* Hang rules */
.hang { background: var(--birch); }
.rules {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem clamp(1.5rem, 4vw, 3.5rem);
}
.rules div { border-top: 2px solid var(--slate); padding-top: 1rem; }
.rules dt {
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--step-1);
  line-height: 1.2;
}
.rules dd { margin: 0.6rem 0 0; }

/* Year calendar */
.year { background: var(--olive); color: var(--birch); }
.year a { color: var(--birch); }
.months {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-top: 1px solid color-mix(in srgb, var(--birch) 40%, transparent);
  border-left: 1px solid color-mix(in srgb, var(--birch) 40%, transparent);
}
.months li {
  padding: 1.25rem 1rem 1.5rem;
  border-right: 1px solid color-mix(in srgb, var(--birch) 40%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--birch) 40%, transparent);
  font-size: var(--step--1);
  line-height: 1.5;
}
.months p { text-wrap: wrap; }
.months h3 { font-size: var(--step-0); font-weight: 700; margin-bottom: 0.5rem; }
.months li[aria-current="date"] { background: var(--tit); color: var(--slate); }
.months li[aria-current="date"] h3::after {
  content: "сейчас";
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.05rem 0.45rem;
  border-radius: 1rem;
  background: var(--slate);
  color: var(--tit);
  font-family: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: 0.15em;
}

/* Footer */
.site-footer {
  background: var(--slate);
  color: var(--birch);
  padding: 2.5rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--step--1);
}
.site-footer p { max-width: 50ch; }
.site-footer :focus-visible { outline-color: var(--tit); }
.year :focus-visible { outline-color: var(--tit); }

/* Responsive */
@media (max-width: 60rem) {
  .rules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .months { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .build-cols { grid-template-columns: minmax(0, 1fr); }
  .tenants .col-note { display: none; }
}

@media (max-width: 44rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "copy" "house" "controls";
    grid-template-rows: auto;
  }
  .site-header nav { gap: 0.25rem 1rem; font-size: var(--step--1); }
  .lede { font-size: var(--step-0); margin-top: 1rem; }
  .house svg { max-width: 15rem; margin-top: 1rem; }
  .hero-controls { margin-top: 1rem; }
  .tenant { margin-top: 1.25rem; min-height: 0; }
  .section-head { grid-template-columns: minmax(0, 1fr); }
  .rules { grid-template-columns: minmax(0, 1fr); }
  .months { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tenants th:nth-child(3), .tenants td:nth-child(3) { display: none; }
  .tenants td:nth-child(4) { white-space: normal; }
}
