/* Shared pieces of the home page: the cookie bar and the Windows notice. Copied from styles.css, which the legal and thank-you pages still use. */
/*
 * Cookie preferences stay outside the transformed scrolling surface, and sit along the bottom
 * edge rather than in the middle of the screen. The bar is opened non-modally (`show()`, in
 * js/cookies.js), so the page behind it stays readable and scrollable while the choice is
 * pending — which is the whole reason to prefer a bar to a box.
 *
 * `display` is set on `[open]` and nowhere else: an author `display` on the bare selector beats
 * the UA's `dialog:not([open]) { display: none }`, and the bar would sit there with the page
 * closed over it.
 */
.cookie-dialog {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 130;
  width: 100%;
  max-width: none;
  max-height: min(72dvh, 100%);
  overflow: auto;
  margin: 0;
  padding: 16px clamp(16px, 4vw, 40px);
  color: var(--ink);
  background: var(--panel);
  border: 0;
  border-top: 1px solid var(--line-strong);
  border-radius: 0;
  box-shadow: 0 -16px 60px #0007;
}
.cookie-dialog[open] {
  display: block;
}
.cookie-bar {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px clamp(20px, 4vw, 48px);
}
.cookie-copy {
  flex: 1 1 420px;
  min-width: 0;
}
.cookie-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cookie-label {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.12em;
  font-weight: 700;
}
.cookie-dialog h2 {
  font-size: clamp(18px, 2.4vw, 21px);
  line-height: 1.2;
  margin: 4px 0 6px;
}
.cookie-dialog p {
  line-height: 1.55;
  font-size: 14px;
}
.cookie-detail {
  font-size: 13px;
  color: var(--ink-dim);
  margin: 6px 0 0;
}
.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.cookie-actions button {
  flex: 0 1 auto;
  min-height: 44px;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.cookie-actions button:last-child {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.cookie-actions button:disabled {
  opacity: 0.6;
  cursor: wait;
}
.cookie-actions button:focus-visible,
.cookie-settings:focus-visible {
  outline: 2px solid var(--accent-lift);
  outline-offset: 4px;
}
/* It sits on the footer's base line, so it takes that line's size, case and colour. */
.cookie-settings {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  text-align: left;
  transition: color 0.18s;
}
.cookie-settings:hover {
  color: var(--ink);
}
.cookie-status {
  font-size: 13px;
  color: var(--ink-dim);
}
.cookie-status:empty {
  display: none;
}
/* Cookie settings: one row per cookie category, a checkbox, a name and the facts about it. */
.cookie-panel {
  display: grid;
}
/* An author `display` beats the UA's `[hidden]`, so the closed state is spelled out. */
.cookie-panel[hidden] {
  display: none;
}
.cookie-panel {
  gap: 10px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line-strong);
  max-width: 420px;
}
.cookie-category {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}
.cookie-category input {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--accent);
}
.cookie-category input:disabled {
  cursor: default;
}
.cookie-category span {
  display: grid;
  gap: 2px;
}
.cookie-category strong {
  font-size: 13px;
  font-weight: 700;
}
.cookie-category em {
  margin-left: 6px;
  font-style: normal;
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-faint);
}
.cookie-category small {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-dim);
}
.cookie-save,
.cookie-close {
  justify-self: start;
  min-height: 38px;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.cookie-save:hover,
.cookie-close:hover {
  border-color: var(--ink-dim);
}

/* On a phone the bar is two stacked blocks, and the buttons take the width they are given. */
@media (max-width: 620px) {
  /* The bar must not hide the first screen: the footnote about changing your mind is left out. */
  .cookie-dialog {
    padding-block: 12px;
  }
  .cookie-detail {
    display: none;
  }
  .cookie-dialog h2 {
    margin-bottom: 4px;
  }
  .cookie-dialog p {
    font-size: 13px;
    line-height: 1.45;
  }
  .cookie-side,
  .cookie-actions {
    width: 100%;
  }
  .cookie-actions button {
    flex: 1 1 140px;
  }
}

@media (min-width: 620px) {
  .cookie-dialog {
    max-width: 70%;
    margin: 0 auto;
    margin-bottom: 20px;
    border-radius: 30px;
  }
}

/* ── the Windows notice ──────────────────────────────────────────────────────
 *
 * Opened modally by js/windows-notice.js before the Windows installer is handed over. The
 * padding is on the body, not the dialog, so a click on the dialog itself is the backdrop.
 */
html:has(.win-notice[open]) {
  overflow: hidden;
}

.win-notice {
  width: min(540px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: auto;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  box-shadow: 0 40px 120px #000c;
}

.win-notice::backdrop {
  background: rgba(4, 4, 6, 0.74);
  backdrop-filter: blur(6px);
}

.win-notice-body {
  padding: clamp(22px, 5vw, 34px);
}

.win-notice-label {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.win-notice h2 {
  margin: 8px 0 12px;
  font-size: clamp(22px, 3.4vw, 28px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.win-notice p:not(.win-notice-label) {
  margin: 0;
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1.55;
}

.win-notice p:not(.win-notice-label) + p {
  margin-top: 12px;
}

.win-notice ol {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: win-step;
}

.win-notice li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  font-size: 15.5px;
  counter-increment: win-step;
}

.win-notice li::before {
  content: counter(win-step);
  color: var(--accent);
  font-weight: 700;
}

.win-notice-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.win-notice .btn {
  justify-content: center;
}

/* The count changes every second; the button should not change width with it. */
.win-notice-go {
  min-width: 14em;
  font-variant-numeric: tabular-nums;
}

.win-notice-go:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

button.btn-ghost {
  background: none;
}

/* ── the language menu, in the header of the home page and the guides ──────────────────────── */
/* A flag button opens the list of languages, each with its flag. On the home page i18n.js marks the
   current one and keeps the choice; on a guide each item is the guide in that language. Flags are
   drawn as SVG, since Windows shows a flag emoji as two letters. */
.lang-menu {
  position: relative;
}
.lang-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
}
.lang-menu-btn:hover,
.lang-menu-btn[aria-expanded="true"] {
  border-color: var(--ink-dim);
  color: var(--ink);
}
.lang-menu-btn:focus-visible,
.lang-menu-list a:focus-visible {
  outline: 2px solid var(--accent, #ff7a1a);
  outline-offset: 1px;
}
.lang-menu-flag {
  display: grid;
}
.lang-menu-chev {
  width: 12px;
  height: 12px;
  transition: transform 0.15s ease;
}
.lang-menu-btn[aria-expanded="true"] .lang-menu-chev {
  transform: rotate(180deg);
}
.lang-menu-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 168px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel, #141418);
  box-shadow: 0 18px 50px -12px rgb(0 0 0 / 0.8);
}
.lang-menu-list[hidden] {
  display: none;
}
.lang-menu-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink-dim);
  font-size: 14px;
  text-decoration: none;
}
.lang-menu-list a:hover {
  background: rgb(255 255 255 / 0.06);
  color: var(--ink);
}
.lang-menu-list a[aria-current] {
  color: var(--ink);
  background: rgb(255 255 255 / 0.08);
}
.lang-menu svg:not(.lang-menu-chev) {
  display: block;
  flex: none;
  width: 21px;
  height: 14px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.14);
}
