:root {
  color-scheme: light;
  --portal-bg: #f2f3f0;
  --portal-surface: #ffffff;
  --portal-ink: #202521;
  --portal-muted: #68706a;
  --portal-line: #d7ddd8;
  --portal-green: #196650;
  --portal-blue: #316b8c;
  --portal-rust: #a45238;
  --portal-gold: #8a6a1f;
  --portal-charcoal: #363b37;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--portal-bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 0;
  margin: 0;
  color: var(--portal-ink);
  background: var(--portal-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

.portal-header {
  display: flex;
  width: min(1180px, calc(100% - 40px));
  min-height: 76px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--portal-line);
}

.portal-brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  color: var(--portal-ink);
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 6px;
  border: 1px solid var(--portal-line);
  background: #fff;
  object-fit: contain;
}

.portal-brand strong,
.portal-brand small {
  display: block;
}

.portal-brand strong {
  font-size: 15px;
}

.portal-brand small {
  margin-top: 2px;
  color: var(--portal-muted);
  font-size: 11px;
}

.header-shortcut {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--portal-ink);
  color: var(--portal-ink);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.portal-main,
.section-main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 58px 0 72px;
}

.portal-heading,
.section-title {
  margin-bottom: 32px;
}

.portal-eyebrow {
  margin: 0 0 8px;
  color: var(--portal-green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-heading h1,
.section-title h1 {
  max-width: 760px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 500;
  line-height: 1.03;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--portal-line);
  border-left: 1px solid var(--portal-line);
}

.portal-entry {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 176px;
  grid-template-columns: 42px minmax(0, 1fr) 32px;
  gap: 18px;
  align-items: end;
  padding: 24px;
  overflow: hidden;
  border-right: 1px solid var(--portal-line);
  border-bottom: 1px solid var(--portal-line);
  background: var(--portal-surface);
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

.portal-entry:nth-child(5) {
  grid-column: 1 / -1;
}

.portal-entry::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--entry-accent, var(--portal-green));
  content: "";
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 160ms ease;
}

.portal-entry:hover,
.portal-entry:focus-visible {
  background: #f9faf8;
  outline: none;
}

.portal-entry:hover::before,
.portal-entry:focus-visible::before {
  transform: scaleX(1);
}

.entry-games { --entry-accent: var(--portal-green); }
.entry-ai { --entry-accent: var(--portal-rust); }
.entry-journal { --entry-accent: var(--portal-gold); }
.entry-tools { --entry-accent: var(--portal-blue); }
.entry-analysis { --entry-accent: var(--portal-charcoal); }

.entry-index,
.section-number {
  align-self: start;
  color: var(--portal-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
}

.entry-copy {
  min-width: 0;
}

.entry-copy strong,
.entry-copy small,
.section-entry strong,
.section-entry small {
  display: block;
}

.entry-copy strong {
  margin-bottom: 7px;
  font-size: 25px;
  line-height: 1.1;
}

.entry-copy small,
.section-entry small {
  color: var(--portal-muted);
  font-size: 13px;
  line-height: 1.45;
}

.entry-arrow {
  align-self: end;
  justify-self: end;
  font-size: 25px;
  line-height: 1;
}

.section-main {
  max-width: 900px;
}

.section-title {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--portal-line);
}

.section-list {
  display: grid;
}

.section-entry {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: 58px minmax(0, 1fr) 32px;
  gap: 18px;
  align-items: center;
  min-height: 112px;
  padding: 20px 18px 20px 0;
  border-bottom: 1px solid var(--portal-line);
  text-decoration: none;
}

.section-entry::before {
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: -18px;
  width: 3px;
  background: var(--section-accent, var(--portal-green));
  content: "";
  opacity: 0;
  transition: opacity 150ms ease;
}

.section-entry:hover::before,
.section-entry:focus-visible::before {
  opacity: 1;
}

.section-entry:focus-visible {
  outline: 2px solid var(--portal-line);
  outline-offset: 4px;
}

.section-entry strong {
  margin-bottom: 5px;
  font-size: 21px;
}

.accent-fischer { --section-accent: #ad4e35; }
.accent-karpov { --section-accent: #315f84; }
.accent-study { --section-accent: #896b22; }
.accent-chessnote { --section-accent: #a45238; }
.accent-opening { --section-accent: #176b57; }
.accent-repertoire { --section-accent: #714f78; }

.download-main {
  max-width: 980px;
}

.download-title {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.7fr);
  gap: 48px;
  align-items: end;
  margin-bottom: 52px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--portal-line);
}

.download-title h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 7vw, 72px);
  font-weight: 500;
  line-height: 1;
}

.download-name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 18px;
}

.download-app-icon {
  width: 80px;
  height: 80px;
  flex: 0 0 80px;
  border-radius: 8px;
}

.download-lead {
  max-width: 560px;
  margin: 16px 0 0;
  color: var(--portal-muted);
  font-size: 17px;
  line-height: 1.55;
}

.download-facts {
  margin: 0;
}

.download-facts div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 0;
  border-bottom: 1px solid var(--portal-line);
}

.download-facts dt,
.download-facts dd {
  margin: 0;
  font-size: 12px;
}

.download-facts dt {
  color: var(--portal-muted);
}

.download-facts dd {
  font-weight: 750;
}

.download-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--portal-ink);
}

.download-section-head h2,
.download-notice h2,
.download-resource h2 {
  margin: 0;
  font-size: 18px;
}

.download-section-head span {
  color: var(--portal-muted);
  font-size: 12px;
  font-weight: 700;
}

.download-list {
  display: grid;
}

.download-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 30px;
  align-items: center;
  min-height: 136px;
  padding: 22px 0;
  border-bottom: 1px solid var(--portal-line);
}

.download-copy h3 {
  margin: 0 0 5px;
  font-size: 20px;
}

.download-copy p {
  margin: 0;
  color: var(--portal-muted);
  font-size: 13px;
}

.download-copy details {
  margin-top: 10px;
  color: var(--portal-muted);
  font-size: 11px;
}

.download-copy summary {
  width: max-content;
  cursor: pointer;
  font-weight: 700;
}

.download-copy code {
  display: block;
  max-width: 100%;
  margin-top: 6px;
  overflow-wrap: anywhere;
  color: var(--portal-ink);
}

.download-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
}

.download-command {
  display: inline-grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--portal-green);
  border-radius: 5px;
  background: var(--portal-green);
  color: #fff;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.download-command.secondary {
  min-width: 160px;
  border-color: var(--portal-line);
  background: var(--portal-surface);
  color: var(--portal-ink);
}

.download-command:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.download-action progress {
  width: 100%;
  height: 5px;
  border: 0;
  accent-color: var(--portal-green);
}

.download-status,
.download-loading,
.download-error {
  color: var(--portal-muted);
  font-size: 11px;
}

.download-notice {
  margin-top: 42px;
  padding: 22px 0;
  border-block: 1px solid var(--portal-line);
}

.download-notice p,
.download-resource p {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--portal-muted);
  font-size: 13px;
  line-height: 1.6;
}

.download-resource {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  padding: 30px 0;
}

.journal-sheet {
  min-height: min(560px, calc(100vh - 260px));
  border-top: 1px solid var(--portal-line);
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 45px,
    #dde2de 46px
  );
}

@media (max-width: 720px) {
  .portal-header,
  .portal-main,
  .section-main {
    width: min(100% - 28px, 1180px);
  }

  .portal-header {
    min-height: 68px;
  }

  .header-shortcut {
    font-size: 12px;
  }

  .portal-main,
  .section-main {
    padding: 38px 0 54px;
  }

  .portal-heading,
  .section-title {
    margin-bottom: 24px;
  }

  .portal-heading h1,
  .section-title h1 {
    font-size: 38px;
  }

  .portal-grid {
    grid-template-columns: 1fr;
  }

  .portal-entry,
  .portal-entry:nth-child(5) {
    min-height: 132px;
    grid-column: auto;
    grid-template-columns: 34px minmax(0, 1fr) 28px;
    gap: 12px;
    padding: 18px;
  }

  .entry-copy strong {
    font-size: 21px;
  }

  .section-entry {
    grid-template-columns: 38px minmax(0, 1fr) 26px;
    gap: 10px;
    min-height: 104px;
    padding-right: 6px;
  }

  .download-title {
    grid-template-columns: 1fr;
    gap: 26px;
    margin-bottom: 36px;
  }

  .download-title h1 {
    font-size: 48px;
  }

  .download-name {
    gap: 13px;
  }

  .download-app-icon {
    width: 62px;
    height: 62px;
    flex-basis: 62px;
  }

  .download-row {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 22px 0 26px;
  }

  .download-resource {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .portal-brand small {
    display: none;
  }

  .header-shortcut {
    max-width: 145px;
    text-align: right;
  }
}
