:root {
  color-scheme: light;
  --desktop-blue: #789eac;
  --desktop-blue-soft: #9bb8c1;
  --field: #7d9b72;
  --window: #eee9df;
  --window-deep: #d2cbc0;
  --window-edge: #746f67;
  --ink: #3d3833;
  --muted: #7d756d;
  --paper: #f6f1e8;
  --link: #55483f;
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  font-family: "Trebuchet MS", "Avenir Next", system-ui, sans-serif;
  background: #9fb0b7;
  overflow-x: hidden;
}

.system-desktop {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(22px, 5vw, 72px);
  isolation: isolate;
}

.system-desktop::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    linear-gradient(rgba(109,120,125,.08), rgba(109,120,125,.08)),
    url("./assets/background02.png") center center / cover no-repeat;
}

.system-desktop::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: .14;
  background: repeating-linear-gradient(to bottom, rgba(18,25,27,.26) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

.desktop-grain {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: .18;
  background-image: repeating-radial-gradient(circle at 0 0, rgba(37,42,43,.25) 0 .6px, transparent .8px 4px);
  background-size: 7px 7px;
  mix-blend-mode: multiply;
}

.system-window {
  width: min(1120px, 84vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #57534d;
  border-radius: 5px;
  background: var(--window);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.3),
    11px 15px 34px rgba(27,32,31,.25);
}

.system-titlebar {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 5px 7px 5px 11px;
  border-bottom: 1px solid #979188;
  background: linear-gradient(#f3efe7, #c8c1b6);
  font-size: 13px;
  font-weight: 700;
}

.system-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-controls {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}

.system-controls a,
.system-controls span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 20px;
  border: 1px solid #777169;
  background: linear-gradient(#ece7de, #c7c0b4);
  color: #3f3a35;
  text-decoration: none;
  font: 700 13px/1 "Trebuchet MS", sans-serif;
}

.system-controls a:active {
  border-style: inset;
}

.system-menu {
  display: flex;
  gap: 18px;
  padding: 5px 11px;
  border-bottom: 1px solid #bbb4aa;
  background: #e7e1d7;
  color: #5c554e;
  font-size: 11px;
}

.system-menu a {
  color: inherit;
  text-decoration: none;
}

.system-menu a:hover {
  text-decoration: underline;
}

.system-document {
  overflow: auto;
  padding: clamp(22px, 4vw, 42px);
  background:
    linear-gradient(rgba(255,255,255,.52), rgba(255,255,255,.52)),
    var(--paper);
  font: 14px/1.65 Georgia, "Times New Roman", serif;
}

.system-document h1 {
  margin: 0 0 8px;
  font-size: clamp(29px, 5vw, 46px);
  line-height: 1;
  font-weight: 400;
  letter-spacing: -.04em;
}

.system-document h2 {
  margin: 28px 0 8px;
  font-size: 18px;
  line-height: 1.2;
}

.system-document p,
.system-document li {
  max-width: 68ch;
}

.system-document p {
  margin: 9px 0;
}

.system-document ul {
  margin: 8px 0 14px;
  padding-left: 22px;
}

.system-document a {
  color: var(--link);
}

.doc-meta {
  margin-bottom: 24px;
  color: var(--muted);
  font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.callout {
  margin: 22px 0;
  padding: 13px 15px;
  border: 1px solid #b7afa3;
  background: #ebe4d6;
  font-family: "Trebuchet MS", system-ui, sans-serif;
  font-size: 12px;
  line-height: 1.5;
}

.system-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 29px;
  padding: 4px 9px;
  border-top: 1px solid #aaa399;
  background: linear-gradient(#ded9cf, #c7c1b6);
  color: #625c55;
  font-size: 10px;
}

.back-desktop {
  color: inherit;
  text-decoration: none;
}

.back-desktop:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .system-desktop {
    padding: 14px;
    align-items: start;
  }

  .system-window {
    width: 100%;
    max-height: calc(100vh - 28px);
  }

  .system-document {
    padding: 24px 19px;
    font-size: 13px;
  }

  .system-menu {
    gap: 12px;
    overflow-x: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #895b3e; outline-offset: 3px; }
.system-title { display: flex; align-items: center; gap: 9px; }
.system-title img { object-fit: contain; }
.system-controls a { width: 36px; height: 36px; }
.system-menu { align-items: center; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; }
.system-menu a { display: inline-flex; align-items: center; min-height: 44px; }
.language-toggle { min-height: 44px; margin-left: auto; padding: 8px 10px; border: 0; color: inherit; background: transparent; font: inherit; text-decoration: underline; cursor: pointer; }
.system-document { font-family: "Avenir Next", "Trebuchet MS", system-ui, sans-serif; font-size: 16px; }
.system-document h1 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; }
.system-document a { display: inline-block; min-height: 44px; padding-block: 10px; overflow-wrap: anywhere; }
.system-statusbar { min-height: 44px; font-size: 12px; }
.back-desktop { padding: 10px 4px; }
.doc-meta { line-height: 1.6; }
@media (max-width: 600px) { .system-document { font-size: 15px; } .system-titlebar { gap: 8px; } }

/* Match English reading sizes to the homepage. */
html:lang(en) .system-titlebar { font-size: 15px; }
html:lang(en) .system-menu { font-size: 16px; }
html:lang(en) .system-document { font-size: 18px; line-height: 1.7; }
html:lang(en) .system-document h1 { font-size: clamp(32px, 5vw, 50px); }
html:lang(en) .system-document h2 { font-size: 22px; line-height: 1.35; }
html:lang(en) .doc-meta { font-size: 13px; }
html:lang(en) .system-statusbar { font-size: 14px; }
@media (max-width: 600px) {
  html:lang(en) .system-document { font-size: 17px; }
}
