:root {
  --bg-page: #0a0f18;
  --bg-header: #0d1424;
  --bg-aside: #111827;
  --bg-main: #0c1220;
  --bg-footer: #080c14;
  --text: #b8e0ff;
  --text-muted: #7eb8e0;
  --border: rgba(125, 200, 255, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Courier New", Courier, monospace;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-page);
}

header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--bg-header);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

header .header-logo-link {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

header .header-logo-link:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 3px;
  border-radius: 6px;
}

header .header-logo {
  display: block;
  width: 128px;
  height: 128px;
  object-fit: contain;
}

header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #d4efff;
}

header h1 a {
  color: inherit;
  text-decoration: none;
}

header h1 a:hover {
  text-decoration: none;
}

.layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

aside {
  flex: 0 0 220px;
  max-width: 100%;
  padding: 1.25rem 1rem;
  background: var(--bg-aside);
  border-right: 1px solid var(--border);
}

aside h2 {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

aside nav ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
  font-size: 0.9375rem;
}

aside nav li + li {
  margin-top: 0.4rem;
}

aside nav li.nav-soft {
  padding-left: 2ch;
}

aside nav li.nav-heading {
  color: var(--text-muted);
}

aside nav li.nav-article,
aside nav li.nav-specs {
  padding-left: 2ch;
}

aside nav a {
  color: var(--text);
  text-decoration: none;
}

aside nav a:hover {
  text-decoration: underline;
  color: #d4efff;
}

aside nav a[aria-current="page"] {
  font-weight: 600;
  color: #d4efff;
}

main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem;
  background: var(--bg-main);
}

main h2 {
  margin-top: 0;
  font-size: 1.125rem;
  color: #d4efff;
}

main h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #d4efff;
}

main h3:first-of-type {
  margin-top: 1rem;
}

main p {
  color: var(--text);
}

main code {
  font-size: 0.9em;
  padding: 0.12em 0.4em;
  border-radius: 4px;
  background: rgba(125, 200, 255, 0.12);
  color: #d4efff;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 400px));
  gap: 1.25rem;
  justify-content: center;
  margin-top: 1rem;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 400px;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.6);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.card:hover {
  border-color: rgba(125, 200, 255, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transform: translateY(-2px);
}

.card:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 2px;
}

.card img {
  display: block;
  width: 320px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 320 / 241;
  object-fit: cover;
  background: var(--bg-aside);
}

.card-title {
  margin: 0;
  padding: 0.75rem 0.875rem 0.875rem;
  width: 100%;
  box-sizing: border-box;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  color: #d4efff;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.gallery-item {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  padding: 0;
  background: transparent;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.gallery-item:hover {
  border-color: rgba(125, 200, 255, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transform: translateY(-2px);
}

.gallery-item:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 2px;
}

.gallery-item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--bg-aside);
}

.gallery-item-title {
  margin: 0;
  padding: 0.7rem 0.8rem 0.8rem;
  font-size: 0.9rem;
  line-height: 1.35;
  text-align: center;
  color: #d4efff;
  background: rgba(17, 24, 39, 0.7);
}

.gallery-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.78);
  border: none;
  z-index: 1000;
}

.gallery-modal[hidden] {
  display: none;
}

.gallery-modal-inner {
  position: relative;
  display: inline-block;
  max-width: min(960px, 96vw);
  max-height: 82vh;
}

.gallery-modal-inner img {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

.gallery-modal-close {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #000;
  font-family: system-ui, sans-serif;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  text-shadow: 0 0 2px #fff, 0 0 4px #fff;
}

.gallery-modal-close:hover {
  color: #111;
}

.gallery-modal-close:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 2px;
}

.comments-widget {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
}

.grid-table {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(17, 24, 39, 0.7);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

.grid-table th,
.grid-table td {
  border: 1px solid rgba(125, 200, 255, 0.22);
  padding: 0.75rem 1rem;
  text-align: left;
  vertical-align: top;
}

.grid-table thead th {
  font-weight: 600;
  color: #d4efff;
  background: rgba(125, 200, 255, 0.1);
}

.grid-table tbody td {
  color: var(--text);
}

.grid-table tbody tr:nth-child(even) td {
  background: rgba(125, 200, 255, 0.04);
}

.grid-table tbody tr:hover td {
  background: rgba(125, 200, 255, 0.1);
}

.facts-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(17, 24, 39, 0.7);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

.facts-table tr + tr {
  border-top: 1px solid rgba(125, 200, 255, 0.16);
}

.facts-table th,
.facts-table td {
  padding: 0.8rem 1rem;
  text-align: left;
}

.facts-table th {
  width: 42%;
  font-weight: 600;
  color: #d4efff;
  background: rgba(125, 200, 255, 0.08);
}

.facts-table td {
  color: var(--text);
}

.facts-table tr:hover th,
.facts-table tr:hover td {
  background: rgba(125, 200, 255, 0.12);
}

footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  background: var(--bg-footer);
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
  border-top: 1px solid var(--border);
}

footer .footer-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0 0.35rem;
}

footer .footer-legal a {
  color: var(--text-muted);
  text-decoration: none;
}

footer .footer-legal a:hover {
  color: #d4efff;
  text-decoration: underline;
}

@media (max-width: 640px) {
  .layout {
    flex-direction: column;
  }

  aside {
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .facts-table th,
  .facts-table td {
    padding: 0.7rem 0.8rem;
    font-size: 0.92rem;
  }

  .grid-table th,
  .grid-table td {
    padding: 0.65rem 0.75rem;
    font-size: 0.92rem;
  }
}
