:root {
  --background: #b5b5b3;
  --surface: #f8f7f3;
  --text: #242424;
  --muted: #777775;
  --accent: #f8f7f3;
  --accent-dark: #777775;
  --detail: #d7d7d2;
  --border: #d8d7d2;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 34px 0;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  text-align: center;
}

h1,
h2,
p {
  margin-top: 0;
}

.page-header {
  width: min(92%, 1030px);
  margin: 0 auto;
  padding: 20px 42px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
}

.page-header h1 {
  margin: 0;
  font-size: 15px;
  font-weight: normal;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.button,
.back-link {
  display: inline-block;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.button {
  padding: 13px 20px;
  border: 1px solid var(--text);
  border-radius: 0;
  background: var(--accent);
  color: var(--text);
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.button:hover,
.button:focus-visible {
  background: var(--accent-dark);
  color: #fff;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: min(92%, 1030px);
  margin: 0 auto;
  padding: 46px 42px 0;
  background: var(--surface);
}

.gallery img {
  display: block;
  width: 100%;
  height: 240px;
  border: 0;
  border-radius: 0;
  object-fit: cover;
  filter: saturate(0.82);
  transition: filter 220ms ease, opacity 220ms ease;
}

.gallery img:hover {
  filter: saturate(1);
  opacity: 0.9;
}

.year {
  width: min(92%, 1030px);
  margin: 0 auto;
  padding: 10px 42px 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.16em;
}

body > main {
  display: flow-root;
  width: min(92%, 1030px);
  margin: 0 auto;
  padding-bottom: 42px;
  background: var(--surface);
}

body > main > .button:last-child {
  margin-bottom: 0;
}

.index-page,
.profile-page {
  padding-bottom: 48px;
}

.index-header {
  width: min(92%, 1030px);
  margin: 0 auto;
  padding: 20px 42px;
  background: var(--surface);
  color: var(--text);
  text-align: center;
}

.index-header h1 {
  margin: 0;
  font-size: 15px;
  font-weight: normal;
  letter-spacing: 0.12em;
}

.index-list {
  display: grid;
  gap: 0;
  width: min(92%, 1030px);
  margin: 0 auto;
  padding: 46px 42px 34px;
  background: var(--surface);
  list-style: none;
  font-family: Georgia, serif;
  font-size: 21px;
  line-height: 1.25;
}

.index-list a {
  color: var(--text);
  text-decoration: none;
  transition: color 160ms ease;
}

.index-list li {
  padding: 17px 0;
}

.index-list a:hover,
.back-link:hover {
  color: var(--accent-dark);
}

.back-link {
  display: inline-block;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.html-summary {
  width: min(92%, 850px);
  margin: 0 auto 36px;
  text-align: left;
}

.html-summary h2 {
  margin-bottom: 28px;
  font-size: 30px;
  font-weight: bold;
}

.html-summary h3 {
  margin-bottom: 24px;
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: normal;
}

.html-example {
  overflow-x: auto;
  margin: 0 0 28px;
  padding: 24px;
  background: #fff;
  color: #353535;
  font-size: 14px;
  line-height: 1.6;
}

.html-summary p {
  margin-bottom: 20px;
  font-size: 17px;
  line-height: 1.6;
}

.html-structure-section {
  width: min(92%, 850px);
  margin: 52px auto 44px;
  text-align: left;
}

.site-description {
  margin-top: 104px;
}

.site-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 390px;
  margin: 0 0 28px;
  padding: 20px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--border);
  text-align: center;
}

.site-preview-title {
  margin-bottom: 20px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-preview-button {
  margin-bottom: 18px;
  padding: 8px 12px;
  border: 1px solid var(--text);
  font-size: 8px;
  font-weight: bold;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.site-preview img {
  width: 140px;
  height: 140px;
  border: 1px solid var(--text);
  object-fit: cover;
}

.site-preview-name {
  margin: 14px 0 4px;
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 14px;
}

.site-preview-details,
.site-preview-year {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.site-preview-year {
  margin-top: 6px;
}

.html-structure-section h2 {
  margin-bottom: 28px;
  font-size: 28px;
  font-weight: normal;
}

.html-structure-section > p {
  margin-bottom: 26px;
  font-size: 17px;
  line-height: 1.6;
}

.construction-message {
  padding: 48px 0;
  font-size: 30px !important;
  text-align: center;
}

.html-structure-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 24px 16px;
  background: #fff;
}

.structure-document,
.structure-root,
.structure-node,
.structure-child,
.structure-example {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid #aeb2b3;
  border-radius: 4px;
  background: #fff;
  color: #176b9a;
  text-align: center;
}

.structure-connector {
  width: 1px;
  height: 18px;
  background: #aeb2b3;
}

.structure-branches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  width: min(100%, 650px);
  padding-top: 18px;
  border-top: 1px solid #aeb2b3;
}

.structure-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.structure-note,
.structure-example {
  margin: 0;
  color: #777775;
  font-size: 13px;
  line-height: 1.4;
}

.structure-children {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.structure-children > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.headings-section {
  width: min(92%, 850px);
  margin: 52px auto 44px;
  text-align: left;
}

.headings-section > h2 {
  margin-bottom: 28px;
  font-size: 28px;
  font-weight: normal;
}

.heading-example-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 30px;
}

.heading-code {
  overflow-x: auto;
  margin: 0;
  padding: 18px;
  background: #dcebea;
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}

.heading-preview {
  display: grid;
  gap: 8px;
}

.heading-preview h1,
.heading-preview h2,
.heading-preview h3,
.heading-preview h4,
.heading-preview h5,
.heading-preview h6 {
  margin: 0;
  color: #8d302b;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: bold;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
}

.heading-preview h1 { font-size: 22px; }
.heading-preview h2 { font-size: 19px; }
.heading-preview h3 { font-size: 17px; }
.heading-preview h4 { font-size: 15px; }
.heading-preview h5 { font-size: 13px; }
.heading-preview h6 { font-size: 12px; }

.heading-preview p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.headings-section > p {
  margin-bottom: 20px;
  font-size: 17px;
  line-height: 1.6;
}

.table-demo-wrap {
  overflow-x: auto;
  margin: 0 0 26px;
}

.table-demo {
  width: min(100%, 520px);
  margin: 0 auto;
  border-collapse: collapse;
  background: #fffaf6;
  color: var(--text);
  font-size: 18px;
  text-align: center;
}

.table-demo th {
  min-width: 120px;
  height: 72px;
  padding: 14px;
  border: 2px solid var(--text);
  font-weight: normal;
}

.style-example {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.8fr);
  align-items: stretch;
  gap: 16px;
  margin-bottom: 26px;
}

.style-example .html-example {
  margin: 0;
}

.style-preview {
  display: grid;
  min-height: 110px;
  margin: 0;
  padding: 20px;
  place-items: center;
  background: #f8f7f3;
  color: #0000ee;
  font-size: 20px;
}

.profile-content {
  width: min(92%, 1030px);
  min-height: 680px;
  padding: 56px 42px 48px;
  background: var(--surface);
  margin: 0 auto;
}

.profile-content h1 {
  margin: 0 0 42px;
  font-size: 26px;
  font-weight: normal;
  font-family: Georgia, serif;
}

.profile-image {
  display: block;
  width: min(100%, 300px);
  height: 300px;
  margin: 0 auto;
  border: 1px solid var(--text);
  background: var(--detail);
  object-fit: cover;
}

.profile-info {
  margin: 60px 0 12px;
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 21px;
}

.profile-number {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
}

@media (max-width: 700px) {
  .gallery {
    grid-template-columns: 1fr;
    width: min(86%, 420px);
    padding: 28px 20px 0;
  }

  .gallery img {
    height: 210px;
  }

  .page-header,
  .index-header {
    padding: 18px 22px;
  }

  .year {
    padding: 10px 20px 10px;
  }

  body > main,
  .index-list,
  .profile-content {
    width: 92%;
  }

  .profile-content {
    padding: 40px 22px 36px;
  }

  .index-list {
    font-size: 19px;
  }

  .html-summary h2 {
    font-size: 25px;
  }

  .html-example {
    padding: 18px;
    font-size: 12px;
  }

  .html-structure-section h2 {
    font-size: 23px;
  }

  .site-preview {
    min-height: 350px;
    padding: 18px 12px;
  }

  .structure-branches {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .heading-example-grid {
    grid-template-columns: 1fr;
  }

  .style-example {
    grid-template-columns: 1fr;
  }

  .profile-content h1 {
    font-size: 22px;
  }
}
