:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --side: #f4f4f4;
  --fg: #1a1a1a;
  --muted: #555555;
  --link: #0645ad;
  --line: #c8c8c8;
  --head: #f2f2f2;
  --code: #f4f4f4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --side: #1a1a1a;
    --fg: #e6e6e6;
    --muted: #a8a8a8;
    --link: #8ab4f8;
    --line: #444444;
    --head: #1e1e1e;
    --code: #1e1e1e;
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 16px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

/* A fixed menu on the left and the text beside it, the way 7-Zip's own site
   is laid out, across the full width of the window. Running text stays at a
   comfortable line length; tables use the whole width. */
.page {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
}

.side nav {
  position: sticky;
  top: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  margin: 0 0 20px;
}

.brand img { display: block; }

.side ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.side li { margin: 0; }

.side nav a {
  display: block;
  padding: 4px 8px;
  border-radius: 3px;
  text-decoration: none;
}

.side nav a:hover { background: var(--head); text-decoration: underline; }

.content {
  padding: 32px clamp(16px, 4vw, 64px) 48px;
}

.content p, .content ul, .content ol, .content pre { max-width: 90ch; }

h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 4px; }
h2 { font-size: 1.25rem; line-height: 1.3; margin: 32px 0 8px; }
h3 { font-size: 1rem; line-height: 1.3; margin: 24px 0 8px; }

/* Title on the left, the GitHub link on the right; stacked on phones. */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 24px;
}

a.gh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--side);
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
a.gh:hover { background: var(--head); text-decoration: underline; }

img.shot {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 16px 0 24px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

/* The download most visitors need, one per system. */
.gets { display: flex; flex-wrap: wrap; gap: 8px; }
a.get {
  display: inline-block;
  min-width: 120px;
  text-align: center;
  padding: 10px 20px;
  border-radius: 4px;
  background: var(--link);
  color: var(--bg);
  font-weight: bold;
  text-decoration: none;
}
a.get:hover { text-decoration: underline; }

.lead { font-size: 1.125rem; margin: 0 0 16px; }
.note, small, footer { color: var(--muted); }
.note { font-size: 0.875rem; }

a { color: var(--link); text-underline-offset: 2px; }

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

code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.875em;
}

code {
  background: var(--code);
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
}

pre {
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 12px;
  margin: 0 0 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

pre code { padding: 0; background: none; font-size: 1em; white-space: inherit; }

ul, ol { padding-left: 24px; }
li { margin: 4px 0; }

table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 20px;
  font-size: 0.9375rem;
}

caption {
  text-align: left;
  font-weight: 600;
  padding: 0 0 4px;
}

th, td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

thead th { background: var(--head); }
tbody th { font-weight: normal; }
td a, .nw { white-space: nowrap; }
th code, td code { background: none; padding: 0; }

footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
}

footer p { margin: 4px 0; }

/* Phones: the menu becomes a bar on top. */
@media (max-width: 760px) {
  .page { display: block; }

  .side {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 12px 16px;
  }

  .side nav { position: static; }

  .brand { margin: 0 0 8px; font-size: 1.125rem; }
  .brand img { width: 32px; height: 32px; }

  .side ul {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 4px;
  }

  .side nav a { padding: 2px 6px; }

  .content { padding: 16px 16px 32px; }

  h1 { font-size: 1.75rem; }
}

/* Small phones: each table row becomes a small card, so nothing has to
   scroll sideways. */
@media (max-width: 560px) {
  .gets a.get { flex: 1 1 0; min-width: 0; padding: 10px 8px; }

  table.stack thead { display: none; }

  table.stack,
  table.stack tbody,
  table.stack tr,
  table.stack th,
  table.stack td {
    display: block;
    width: 100%;
  }

  table.stack tr {
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 6px 10px;
    margin: 0 0 8px;
  }

  table.stack th,
  table.stack td {
    border: none;
    padding: 1px 0;
  }

  table.stack caption { display: block; width: 100%; }

  table.stack tbody th { font-weight: 600; }

  table.stack td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
  }

  td a { white-space: normal; overflow-wrap: anywhere; }
}
