/* 7-Zip reference site — classic desktop web + grayscale ramp (white→gray→black gradients, layout unchanged) */

:root {
  /* Grayscale ramp: white → light gray → mid → charcoal → black */
  --g-0: #ffffff;
  --g-1: #f5f5f5;
  --g-2: #e8e8e8;
  --g-3: #d4d4d4;
  --g-4: #b0b0b0;
  --g-5: #8a8a8a;
  --g-6: #5c5c5c;
  --g-7: #3a3a3a;
  --g-8: #1c1c1c;
  --g-9: #0a0a0a;
  --bg-page: var(--g-3);
  --bg-panel: var(--g-0);
  --sidebar-bg: var(--g-7);
  --sidebar-hover: #4a4a4a;
  --sidebar-active: #707070;
  --text: var(--g-9);
  --text-muted: #5a5a5a;
  --accent: var(--g-8);
  --accent-soft: var(--g-2);
  --accent-on-soft: var(--g-8);
  --border: #939393;
  --shadow: none;
  --radius: 0;
  --bevel-light: var(--g-0);
  --bevel-mid: #dedede;
  --bevel-dark: #505050;
  --sidebar-w: 260px;
  --header-h: 72px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "MS Sans Serif", Tahoma, Verdana, Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: linear-gradient(165deg, var(--g-0) 0%, var(--g-2) 42%, var(--g-4) 100%);
  background-attachment: fixed;
}

a {
  color: var(--accent);
  text-decoration: underline;
}

a:visited {
  color: var(--g-6);
}

a:hover {
  color: var(--g-9);
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* ----- Sidebar ----- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: linear-gradient(185deg, #5a5a5a 0%, var(--sidebar-bg) 55%, #2a2a2a 100%);
  color: var(--g-0);
  padding: 1rem 0;
  z-index: 20;
  border-right: 2px solid var(--g-9);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem 1rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.sidebar-brand img {
  width: 44px;
  height: auto;
  max-height: 44px;
  border-radius: 0;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: linear-gradient(145deg, var(--g-1) 0%, var(--g-3) 100%);
}

.sidebar-brand span {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0.75rem 0.75rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.65rem;
  border-radius: 0;
  color: var(--g-1);
  text-decoration: none;
  font-weight: 400;
  font-size: 13px;
  border: 1px solid transparent;
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: var(--g-0);
}

.sidebar-nav a[aria-current="page"] {
  background: var(--sidebar-active);
  color: var(--g-0);
  border: 1px dotted rgba(255, 255, 255, 0.85);
}

.nav-ico {
  width: 1.25rem;
  text-align: center;
  opacity: 0.85;
  font-size: 0.9rem;
}

.sidebar-foot {
  margin-top: auto;
  padding: 0.75rem 1rem 1rem;
  font-size: 11px;
  color: var(--g-4);
  line-height: 1.35;
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
}

/* ----- Main column ----- */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(180deg, var(--g-0) 0%, var(--g-2) 55%, var(--g-3) 100%);
  backdrop-filter: none;
  border-bottom: 2px solid var(--border);
}

.top-header-logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.top-header-logo img {
  width: 48px;
  height: auto;
  max-height: 48px;
  border-radius: 0;
  box-shadow: none;
  border: 1px solid var(--border);
  object-fit: contain;
  background: linear-gradient(145deg, var(--g-0) 0%, var(--g-2) 100%);
}

.top-header-titles .brand-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text);
}

.top-header-titles p {
  margin: 0.1rem 0 0;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.content {
  flex: 1;
  padding: 1.75rem 1.75rem 3rem;
  max-width: 900px;
}

/* ----- Typography blocks ----- */
.lead {
  font-size: 15px;
  color: var(--text-muted);
  margin-top: 0;
}

.card {
  background: var(--bg-panel);
  border-radius: 0;
  padding: 1rem;
  border: 2px solid var(--border);
  box-shadow: inset -1px -1px 0 var(--bevel-dark), inset 1px 1px 0 var(--bevel-light);
  margin-bottom: 1rem;
}

.card h2,
.card h3 {
  margin-top: 0;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.feature-tile {
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: 0;
  padding: 0.85rem;
  transition: none;
}

.feature-tile:hover {
  transform: none;
  outline: 1px dotted var(--g-6);
}

.feature-tile h2,
.feature-tile h3,
.feature-tile .feature-tile-heading {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
}

.feature-tile p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.content-shot {
  margin: 1.5rem 0 2rem;
  border-radius: 0;
  overflow: hidden;
  border: 2px solid var(--border);
  box-shadow: none;
  background: var(--bg-panel);
}

.content-shot img {
  width: 100%;
  height: auto;
  display: block;
  vertical-align: bottom;
}

.content-shot figcaption {
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.content-shot--compact {
  max-width: 720px;
}

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 0;
  background: linear-gradient(180deg, var(--g-1) 0%, var(--g-3) 100%);
  color: var(--g-8);
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

/* ----- Tables & lists ----- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 1rem 0;
  border: 2px solid var(--border);
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.format-list {
  columns: 2;
  column-gap: 2rem;
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .format-list {
    columns: 1;
  }
}

/* ----- Download buttons (local media only) ----- */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: 0;
  font-weight: 400;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid var(--border);
  background: var(--bevel-mid);
  color: var(--text);
  box-shadow: inset -1px -1px 0 var(--bevel-dark), inset 1px 1px 0 var(--bevel-light);
  transition: none;
}

.btn:active {
  box-shadow: inset 1px 1px 0 var(--bevel-dark), inset -1px -1px 0 var(--bevel-light);
  transform: none;
}

.btn-primary {
  background: var(--bevel-mid);
  color: var(--text);
}

.btn-primary:hover {
  background: linear-gradient(180deg, var(--g-1) 0%, var(--g-2) 100%);
  color: var(--text);
}

.btn-secondary {
  background: var(--bevel-mid);
  color: var(--text);
}

.btn-secondary:hover {
  background: linear-gradient(180deg, var(--g-1) 0%, var(--g-2) 100%);
  color: var(--text);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.callout {
  background: linear-gradient(90deg, var(--g-2) 0%, var(--g-1) 60%);
  border: 2px solid var(--border);
  border-left: 4px solid var(--g-7);
  padding: 0.65rem 0.85rem;
  border-radius: 0;
  font-size: 13px;
  margin: 1rem 0;
  box-shadow: inset -1px -1px 0 var(--bevel-dark), inset 1px 1px 0 var(--bevel-light);
}

details.faq-item {
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: 0;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.5rem;
}

details.faq-item summary {
  font-weight: 700;
  cursor: pointer;
}

details.faq-item p {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ----- Mobile ----- */
.menu-toggle {
  display: none;
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 30;
  width: 48px;
  height: 48px;
  border-radius: 0;
  border: 2px solid var(--border);
  background: var(--bevel-mid);
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: inset -1px -1px 0 var(--bevel-dark), inset 1px 1px 0 var(--bevel-light);
}

@media (max-width: 880px) {
  :root {
    --sidebar-w: 0px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: min(280px, 85vw);
  }

  html[dir="rtl"] .sidebar {
    transform: translateX(100%);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 0 var(--g-9);
  }

  html[dir="rtl"] body.nav-open .sidebar {
    box-shadow: -4px 0 0 var(--g-9);
  }

  .main-wrap {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .top-header {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .content {
    padding: 1.25rem 1rem 4.5rem;
  }
}

body.nav-open::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 15;
}

@media (min-width: 881px) {
  body.nav-open::after {
    display: none;
  }
}

/* ----- Accessibility & SEO UX ----- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.75rem;
  z-index: 100;
  padding: 0.35rem 0.75rem;
  background: var(--bevel-mid);
  color: var(--text);
  font-weight: 700;
  border-radius: 0;
  text-decoration: none;
  border: 2px solid var(--border);
  box-shadow: inset -1px -1px 0 var(--bevel-dark), inset 1px 1px 0 var(--bevel-light);
}

.skip-link:focus {
  left: 0.75rem;
  outline: 2px dotted var(--g-9);
  outline-offset: 0;
}

.page-heading {
  margin: 0 0 0.75rem;
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
  color: var(--text);
}

.breadcrumbs {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breadcrumbs ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin-left: 0.35rem;
  color: var(--border);
  font-weight: 400;
}

.breadcrumbs a {
  font-weight: 500;
}

.breadcrumbs [aria-current="page"] {
  font-weight: 600;
  color: var(--text);
}

a:focus-visible,
button:focus-visible,
.skip-link:focus-visible,
details.faq-item summary:focus-visible {
  outline: 2px dotted var(--g-9);
  outline-offset: 1px;
}

/* ----- Technical code blocks (SEO / documentation) ----- */
.code-snippet {
  margin-bottom: 1.25rem;
  padding: 0;
  overflow: hidden;
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: 0;
  box-shadow: inset -1px -1px 0 var(--bevel-dark), inset 1px 1px 0 var(--bevel-light);
}

.code-snippet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.65rem;
  background: var(--bevel-mid);
  border-bottom: 2px solid var(--border);
}

.code-snippet-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.btn-copy {
  font-family: inherit;
  font-size: 11px;
  font-weight: 400;
  padding: 0.2rem 0.55rem;
  border-radius: 0;
  border: 2px solid var(--border);
  background: var(--bg-panel);
  color: var(--text);
  cursor: pointer;
  box-shadow: inset -1px -1px 0 var(--bevel-dark), inset 1px 1px 0 var(--bevel-light);
  transition: none;
}

.btn-copy:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--g-2) 0%, var(--g-3) 100%);
  border-color: var(--border);
}

.btn-copy:disabled {
  opacity: 0.85;
  cursor: default;
}

.code-snippet pre {
  margin: 0;
  padding: 0.75rem 0.85rem;
  overflow: auto;
  max-height: 22rem;
  background: linear-gradient(175deg, var(--g-0) 0%, var(--g-2) 100%);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  border-radius: 0;
  border-top: 1px solid var(--border);
}

.code-snippet code {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  white-space: pre;
}

/* ----- Language switcher + locale layout ----- */
.lang-switcher {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
}

.lang-switcher__link {
  padding: 0.2rem 0.45rem;
  border-radius: 0;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.lang-switcher__link:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--bg-panel);
}

.lang-switcher__link.is-current {
  color: var(--accent-on-soft);
  background: var(--accent-soft);
  border-color: var(--border);
}

.sidebar nav.lang-switcher--sidebar {
  margin: 0.75rem 1.25rem 0;
  padding-top: 0.75rem;
  padding-bottom: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.35);
  margin-left: 0;
  width: calc(100% - 2.5rem);
  flex-shrink: 0;
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 0.35rem;
}

.sidebar nav.lang-switcher--sidebar .lang-switcher__link {
  color: var(--g-4);
}

.sidebar nav.lang-switcher--sidebar .lang-switcher__link:hover {
  color: var(--g-0);
  background: var(--sidebar-hover);
}

.sidebar nav.lang-switcher--sidebar .lang-switcher__link.is-current {
  color: var(--g-0);
  background: var(--sidebar-active);
  border-color: rgba(255, 255, 255, 0.55);
}

/* Simplified Chinese: slightly open tracking in sidebar nav */
.lang-cn .sidebar-nav a {
  letter-spacing: 0.06em;
}

/* Russian: more comfortable tap targets */
.lang-ru .btn {
  padding: 0.85rem 1.4rem;
}

.lang-ru .sidebar-nav a {
  padding: 0.8rem 1.15rem;
}

/* Arabic RTL: mirror shell layout */
html[dir="rtl"] .layout {
  flex-direction: row-reverse;
}

html[dir="rtl"] .main-wrap {
  margin-left: 0;
  margin-right: var(--sidebar-w);
}

html[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 2px solid var(--g-9);
}

html[dir="rtl"] .lang-switcher {
  margin-left: 0;
  margin-right: auto;
}

html[dir="rtl"] .breadcrumbs li:not(:last-child)::after {
  margin-left: 0;
  margin-right: 0.35rem;
}

html[dir="rtl"] .skip-link:focus {
  left: auto;
  right: 0.75rem;
}

@media (max-width: 880px) {
  html[dir="rtl"] .main-wrap {
    margin-right: 0;
  }
}

/* ----- Fixed corner: language slide-over + direct download ----- */
.corner-fab {
  position: fixed;
  z-index: 201;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3rem;
  min-height: 3rem;
  padding: 0.4rem 0.65rem;
  border-radius: 0;
  border: 2px solid var(--border);
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  background: var(--bevel-mid);
  color: var(--text);
  box-shadow: inset -1px -1px 0 var(--bevel-dark), inset 1px 1px 0 var(--bevel-light);
  transition: none;
}

.corner-fab:hover {
  transform: none;
  background: linear-gradient(180deg, var(--g-1) 0%, var(--g-2) 100%);
}

.corner-fab--lang {
  top: 1rem;
  right: 1rem;
  background: var(--bevel-mid);
  color: var(--text);
}

.corner-fab--download {
  bottom: 1rem;
  left: auto;
  right: 1rem;
  background: var(--bevel-mid);
  color: var(--text);
  min-width: 9.25rem;
  min-height: 3rem;
  padding: 0.45rem 0.75rem;
  font-size: 13px;
  font-weight: 700;
  border-radius: 0;
  max-width: 12rem;
  text-align: center;
}

/* Mobile: keep clear of fixed menu button (bottom-right, 48px) */
@media (max-width: 880px) {
  .corner-fab--download {
    right: calc(1rem + 48px + 0.75rem);
  }
}

html[dir="rtl"] .corner-fab--lang {
  right: auto;
  left: 1rem;
}

html[dir="rtl"] .corner-fab--download {
  right: auto;
  left: 1rem;
}

.corner-lang-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

.corner-lang-overlay.is-open {
  pointer-events: auto;
}

/* Full-viewport dimmer so main column + sidebar are covered evenly */
.corner-lang-overlay__shade {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.32);
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.corner-lang-overlay.is-open .corner-lang-overlay__shade {
  opacity: 1;
}

/* Compact dropdown under globe: fade + drop (no slide toward sidebar) */
.corner-lang-sheet {
  position: absolute;
  z-index: 1;
  top: max(4.35rem, calc(env(safe-area-inset-top, 0px) + 3.75rem));
  right: max(0.75rem, env(safe-area-inset-right, 0px));
  width: min(13.75rem, calc(100vw - 1.5rem));
  max-height: min(22rem, calc(100vh - 5.5rem));
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--g-9);
  transform: translateY(-10px) scale(0.97);
  transform-origin: top right;
  opacity: 0;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.corner-lang-overlay.is-open .corner-lang-sheet {
  transform: translateY(0) scale(1);
  opacity: 1;
}

html[dir="rtl"] .corner-lang-sheet {
  right: auto;
  left: max(0.75rem, env(safe-area-inset-left, 0px));
  transform-origin: top left;
}

.corner-lang-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem 0.45rem 0.65rem;
  flex-shrink: 0;
  border-bottom: 2px solid var(--border);
  background: var(--bevel-mid);
}

.corner-lang-sheet__title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0;
}

.corner-lang-sheet__close {
  border: 2px solid var(--border);
  background: var(--bg-panel);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
  padding: 0.05rem 0.35rem;
  border-radius: 0;
  box-shadow: inset -1px -1px 0 var(--bevel-dark), inset 1px 1px 0 var(--bevel-light);
}

.corner-lang-sheet__close:hover {
  background: linear-gradient(180deg, var(--g-2) 0%, var(--g-3) 100%);
  color: var(--text);
}

.corner-lang-sheet__nav {
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.corner-lang-sheet__link {
  display: block;
  padding: 0.55rem 0.9rem;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.corner-lang-sheet__link:last-child {
  border-bottom: none;
}

.corner-lang-sheet__link:hover {
  background: var(--bg-page);
}

.corner-lang-sheet__link.is-current {
  background: var(--accent-soft);
  color: var(--accent-on-soft);
}

body.corner-lang-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .feature-tile,
  .btn {
    transition: none;
  }

  .feature-tile:hover {
    transform: none;
  }

  .corner-lang-sheet {
    transition: none;
  }

  .corner-lang-overlay__shade {
    transition: none;
  }

  .corner-fab {
    transition: none;
  }
}
