/*
 * Stardew Mod Doctor — styles.
 * Tokens and the reasoning behind them: docs/design/brand.md
 */

@font-face {
  font-family: "Vollkorn";
  src: url("fonts/vollkorn-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Vollkorn";
  src: url("fonts/vollkorn-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Next";
  src: url("fonts/atkinson-hyperlegible-next-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Next";
  src: url("fonts/atkinson-hyperlegible-next-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Mono";
  src: url("fonts/atkinson-hyperlegible-mono-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --paper: #f5f7f3;
  --paper-sunk: #ebefe8;
  --raised: #ffffff;
  --ink: #17241d;
  --stem: #56665c;
  --furrow: #d3dbd2;
  --field: #1e6b45;
  --field-ink: #ffffff;
  --field-wash: #e3eee6;
  --sev-high: #b42318;
  --sev-medium: #8a5a00;
  --sev-low: #3b5694;

  --console-bg: #0e1410;
  --console-ink: #d7e0d9;
  --console-dim: #7d8a82;
  --console-error: #ff7b72;
  --console-warn: #e3b341;

  --serif: "Vollkorn", "Noto Serif SC", "Songti SC", Georgia, serif;
  --sans: "Atkinson Next", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: "Atkinson Mono", ui-monospace, Consolas, monospace;
  --title: "Vollkorn", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Georgia, serif;

  --s-13: 0.8125rem;
  --s-15: 0.9375rem;
  --s-17: 1.0625rem;
  --s-21: 1.3125rem;
  --s-27: 1.6875rem;
  --s-34: 2.125rem;
  --s-52: 3.25rem;

  --wide: 1080px;
  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131915;
    --paper-sunk: #0f1411;
    --raised: #19211c;
    --ink: #e4ebe5;
    --stem: #9aaba0;
    --furrow: #2a352e;
    --field: #63c690;
    --field-ink: #0c1a12;
    --field-wash: #1a2a20;
    --sev-high: #ff8b7e;
    --sev-medium: #e8b64c;
    --sev-low: #9db3ee;
    --console-bg: #0a0e0b;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--s-17) / 1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

html[lang="zh-CN"] {
  /* Vollkorn has no CJK; mixing it with a CJK sans in one heading reads as a
     fallback. Chinese pages set every heading in the sans stack instead. */
  --title: var(--sans);
}

html[lang="zh-CN"] body {
  line-height: 1.75;
}

html[lang="zh-CN"] :is(h1, h2, h3, .brand, .drop-title, .step-title, .specimen-label) {
  font-weight: 700;
  letter-spacing: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

a {
  color: var(--field);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--field);
  outline-offset: 2px;
  border-radius: 4px;
}

h1,
h2,
h3 {
  font-family: var(--title);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0 0 0.9em;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
}

/* ---------- header ---------- */

.site-header {
  display: flex;
  align-items: center;
  gap: 8px 32px;
  flex-wrap: wrap;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 22px 24px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--title);
  font-weight: 700;
  font-size: var(--s-21);
  letter-spacing: -0.01em;
}

.brand .mark {
  width: 1.45em;
  height: 1.45em;
  color: var(--field);
  flex: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  font-size: var(--s-15);
}

.site-nav a {
  color: var(--stem);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--field);
}

.lang-switch {
  margin-left: auto;
  font-size: var(--s-15);
  color: var(--ink);
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid var(--furrow);
  border-radius: 6px;
}

.lang-switch:hover {
  border-color: var(--stem);
}

/* ---------- layout ---------- */

main {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: 56px;
  align-items: start;
  padding: 56px 0 24px;
}

.hero h1 {
  font-size: clamp(2.25rem, 1.2rem + 3.6vw, var(--s-52));
  line-height: 1.04;
  letter-spacing: -0.02em;
  max-width: 13ch;
  margin-bottom: 20px;
}

html[lang="zh-CN"] .hero h1 {
  font-size: clamp(2rem, 1.2rem + 2.6vw, 2.75rem);
  max-width: 12em;
  letter-spacing: 0;
  line-height: 1.2;
}

.lede {
  font-size: var(--s-21);
  line-height: 1.5;
  color: var(--stem);
  max-width: 34ch;
  margin-bottom: 32px;
}

html[lang="zh-CN"] .lede {
  max-width: 26em;
  font-size: var(--s-17);
  line-height: 1.8;
}

.trust {
  font-size: var(--s-15);
  color: var(--stem);
  margin: 16px 0 0;
  max-width: 48ch;
}

/* ---------- tool ---------- */

.tabs {
  flex-wrap: wrap;
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--furrow);
  margin-bottom: 16px;
}

.tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  padding: 8px 0 10px;
  font: inherit;
  font-size: var(--s-15);
  font-weight: 700;
  color: var(--stem);
  cursor: pointer;
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--field);
}

.dropzone {
  background: var(--raised);
  border: 2px dashed var(--furrow);
  border-radius: 14px;
  padding: 36px 28px 28px;
  transition: border-color 0.15s, background-color 0.15s;
}

.dropzone.drag {
  border-color: var(--field);
  border-style: solid;
  background: var(--field-wash);
}

.drop-title {
  font-family: var(--title);
  font-weight: 600;
  font-size: var(--s-21);
  line-height: 1.3;
  margin: 0 0 20px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75em;
  padding: 0.55em 1.3em;
  line-height: 1.2;
  text-align: center;
  border: 2px solid var(--field);
  border-radius: 8px;
  background: var(--field);
  color: var(--field-ink);
  font: 700 var(--s-17) / 1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:active {
  transform: translateY(1px);
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--furrow);
}

.btn.ghost:hover {
  border-color: var(--stem);
  filter: none;
}

.btn.quiet {
  background: transparent;
  border-color: transparent;
  color: var(--field);
  padding-inline: 0.5em;
}

.btn.quiet:hover {
  text-decoration: underline;
  filter: none;
}

.hint {
  color: var(--stem);
  font-size: var(--s-15);
  margin: 16px 0 0;
}

.dropzone .hint {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--furrow);
}

.linkish {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--field);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

textarea {
  display: block;
  width: 100%;
  min-height: 190px;
  background: var(--raised);
  color: var(--ink);
  border: 1px solid var(--furrow);
  border-radius: 10px;
  padding: 14px 16px;
  font: var(--s-13) / 1.55 var(--mono);
  resize: vertical;
  margin-bottom: 12px;
}

textarea[aria-invalid="true"] {
  border-color: var(--sev-high);
  border-width: 2px;
}

textarea:focus {
  border-color: var(--field);
  outline: none;
  box-shadow: 0 0 0 3px var(--field-wash);
}

details.where {
  margin-top: 16px;
  font-size: var(--s-15);
}

details.where > summary {
  cursor: pointer;
  font-weight: 700;
}

.status {
  min-height: 1.5em;
  margin: 12px 0 0;
  font-size: var(--s-15);
  color: var(--stem);
}

.status:empty {
  margin: 0;
  min-height: 0;
}

.status.error {
  color: var(--sev-high);
  font-weight: 700;
}

.dropzone + .status:not(:empty) {
  margin-top: 14px;
}

.panel .row + .status:not(:empty) {
  margin: 10px 0 4px;
}

.panel .row .linkish {
  align-self: center;
  margin-left: 6px;
}

/* ---------- OS tabs (log location) ---------- */

.os-tabs .tabs {
  margin: 14px 0 12px;
  gap: 18px;
  flex-wrap: wrap;
}

.os-panel h3 {
  font-size: var(--s-17);
  margin: 0 0 6px;
}

.os-panel ol {
  padding-left: 1.3em;
  margin: 8px 0 0;
}

.os-panel li {
  margin: 4px 0;
}

code.path {
  display: inline-block;
  background: var(--paper-sunk);
  border: 1px solid var(--furrow);
  border-radius: 6px;
  padding: 3px 9px;
  word-break: break-all;
}

/* ---------- specimen (hero right) ---------- */

.specimen {
  margin: 8px 0 0;
  padding: 0;
}

.specimen-label {
  font-family: var(--title);
  font-weight: 600;
  font-size: var(--s-21);
  margin-bottom: 18px;
}

.specimen-cap {
  font-size: var(--s-13);
  font-weight: 700;
  color: var(--stem);
  margin: 0 0 8px;
}

.console {
  margin: 0 0 22px;
  padding: 16px 18px;
  background: var(--console-bg);
  color: var(--console-ink);
  border-radius: 10px;
  font: var(--s-13) / 1.6 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.console .ln {
  display: block;
  padding-left: 2ch;
  text-indent: -2ch;
}

.console .ln + .ln {
  margin-top: 4px;
}

.console .ts {
  color: var(--console-dim);
}

.console .lv-error .ts {
  color: var(--console-error);
}

.console .lv-warn .ts {
  color: var(--console-warn);
}

.hero:has(~ .report:not([hidden])) .specimen {
  display: none;
}

/* ---------- steps: the fix list ---------- */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.step {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  column-gap: 8px;
  padding: 28px 0;
  border-top: 1px solid var(--furrow);
}

.step:last-child {
  border-bottom: 1px solid var(--furrow);
}

.step-num {
  font-family: var(--serif);
  font-weight: 700;
  font-size: var(--s-52);
  line-height: 0.82;
  color: var(--field);
  font-variant-numeric: lining-nums;
}

.step-body {
  min-width: 0;
  max-width: var(--measure);
}

.step-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  margin: 0 0 6px;
  font-size: var(--s-15);
}

.step-meta .sev {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
}

.step-meta .sev::before {
  content: "";
  width: 0.62em;
  height: 0.62em;
  flex: none;
  border-radius: 2px;
  background: currentColor;
}

.sev-high .sev {
  color: var(--sev-high);
}

.sev-medium .sev {
  color: var(--sev-medium);
}

.sev-low .sev {
  color: var(--sev-low);
}

.step-meta .conf {
  color: var(--stem);
}

.step-meta .start {
  font-weight: 700;
  color: var(--field-ink);
  background: var(--field);
  padding: 1px 9px;
  border-radius: 4px;
}

.step-title {
  font-family: var(--title);
  font-weight: 700;
  font-size: var(--s-27);
  line-height: 1.2;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}

.step .why {
  color: var(--stem);
}

.step .reassure {
  font-weight: 700;
}

.fix {
  margin: 14px 0;
}

.fix-label {
  font-weight: 700;
  margin: 0 0 4px;
}

.fix ol {
  margin: 0;
  padding-left: 1.4em;
}

.fix li {
  margin: 6px 0;
  padding-left: 4px;
  overflow-wrap: anywhere;
}

.fix li::marker {
  font-weight: 700;
  color: var(--stem);
}

.verify {
  font-size: var(--s-15);
  background: var(--paper-sunk);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 14px 0 0;
}

.tech {
  margin-top: 12px;
  font-size: var(--s-15);
}

.tech summary {
  cursor: pointer;
  color: var(--stem);
}

.tech pre {
  margin: 8px 0 0;
  padding: 12px 14px;
  background: var(--console-bg);
  color: var(--console-ink);
  border-radius: 8px;
  font: var(--s-13) / 1.55 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The hero preview is a smaller copy of the same list. */
.steps-mini .step {
  grid-template-columns: 44px minmax(0, 1fr);
  padding: 18px 0 16px;
}

.steps-mini .step-num {
  font-size: var(--s-34);
}

.steps-mini .step-title {
  font-size: var(--s-21);
  margin-bottom: 8px;
}

.steps-mini p:last-child {
  margin: 0;
  color: var(--stem);
  font-size: var(--s-15);
}

/* ---------- report ---------- */

.report {
  margin: 40px 0 0;
  padding-top: 40px;
  border-top: 3px solid var(--ink);
  scroll-margin-top: 16px;
}

.report-head {
  margin-bottom: 8px;
}

.report-head h2 {
  font-size: var(--s-34);
  margin-bottom: 8px;
}

.report-head h2:focus {
  outline: none;
}

.summary {
  color: var(--stem);
  font-size: var(--s-15);
  margin: 0 0 16px;
}

.all-clear {
  max-width: var(--measure);
  padding-top: 18px;
  border-top: 1px solid var(--furrow);
}

.notes {
  margin-top: 36px;
  max-width: calc(var(--measure) + 72px);
}

.notes h3 {
  font-size: var(--s-21);
  margin-bottom: 4px;
}

.notes ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.note {
  padding: 14px 0;
  border-bottom: 1px solid var(--furrow);
  color: var(--stem);
  font-size: var(--s-15);
}

.note p {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

.note .note-title {
  color: var(--ink);
  font-weight: 700;
  font-size: var(--s-17);
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

@media (prefers-reduced-motion: no-preference) {
  .report.arrive .step:first-child .step-num {
    animation: settle 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
}

@keyframes settle {
  from {
    transform: translateY(10px) scale(0.85);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* ---------- info under the tool ---------- */

.info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 56px;
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid var(--furrow);
}

.info > .answer,
.info > .answer + p {
  grid-column: 1 / -1;
}

.info h2 {
  font-size: var(--s-27);
  margin: 36px 0 12px;
}

.info ol,
.info ul {
  padding-left: 1.3em;
  margin: 0;
}

.info li {
  margin: 8px 0;
}

.info .faq {
  grid-column: 1 / -1;
}

.info details {
  border-top: 1px solid var(--furrow);
  padding: 14px 0;
  max-width: 820px;
}

.info details:last-child {
  border-bottom: 1px solid var(--furrow);
}

.info summary {
  cursor: pointer;
  font-weight: 700;
}

.info details p {
  margin: 8px 0 0;
  color: var(--stem);
  max-width: var(--measure);
}

.answer {
  font-size: var(--s-21);
  line-height: 1.5;
  max-width: 44ch;
}

html[lang="zh-CN"] .answer {
  font-size: var(--s-17);
  max-width: 36em;
  line-height: 1.85;
}

/* ---------- content pages ---------- */

.guide {
  max-width: 760px;
  padding-top: 48px;
}

.guide h1 {
  font-size: clamp(2rem, 1.3rem + 2.4vw, var(--s-52));
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

html[lang="zh-CN"] .guide h1 {
  line-height: 1.25;
  letter-spacing: 0;
}

.guide .answer {
  color: var(--ink);
  margin-bottom: 32px;
}

.guide > h2 {
  font-size: var(--s-27);
  margin: 44px 0 14px;
}

.guide ul {
  padding-left: 1.3em;
}

.guide li {
  margin: 8px 0;
}

.guide .steps {
  margin-top: 24px;
}

.guide .step-title {
  font-size: var(--s-21);
}

.guide .step-body p:last-child {
  margin-bottom: 0;
}

.checklist {
  list-style: none;
  padding: 0 !important;
}

.checklist li {
  position: relative;
  padding-left: 32px;
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.3em;
  width: 18px;
  height: 18px;
  border: 2px solid var(--field);
  border-radius: 4px;
}

pre.snippet {
  background: var(--console-bg);
  color: var(--console-ink);
  padding: 14px 16px;
  border-radius: 8px;
  font: var(--s-13) / 1.55 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.soon {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 3px solid var(--ink);
}

.soon h2 {
  font-size: var(--s-21);
  margin-bottom: 10px;
}

.cta {
  max-width: 760px;
  margin-top: 64px;
  padding-top: 28px;
  border-top: 3px solid var(--ink);
}

.cta h2 {
  font-size: var(--s-27);
  margin-bottom: 8px;
}

.cta p:last-child {
  margin: 18px 0 0;
}

/* ---------- footer ---------- */

.site-footer {
  width: calc(100% - 48px);
  max-width: calc(var(--wide) - 48px);
  margin: 0 auto;
  padding: 28px 0 48px;
  border-top: 1px solid var(--furrow);
  color: var(--stem);
  font-size: var(--s-15);
}

.site-footer p {
  margin: 0 0 6px;
  max-width: none;
}

.site-footer .fine {
  font-size: var(--s-13);
  margin-top: 14px;
}

/* ---------- 404 ---------- */

body > main > section[lang] {
  max-width: 640px;
  padding: 64px 0 0;
}

body > main > section[lang] h1 {
  font-size: var(--s-34);
  margin-bottom: 12px;
}

/* ---------- small screens ---------- */

@media (max-width: 56em) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
    padding-top: 36px;
  }

  .hero h1 {
    max-width: 16ch;
  }

  .info {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 35em) {
  .site-header {
    padding: 16px 16px 0;
    gap: 10px 20px;
  }

  .site-nav {
    order: 3;
    width: calc(100% + 32px);
    margin: 0 -16px;
    padding: 0 16px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 18px;
    font-size: var(--s-15);
    white-space: nowrap;
  }

  main {
    padding: 0 16px 56px;
  }

  .lede {
    font-size: var(--s-17);
  }

  .dropzone {
    padding: 24px 18px 20px;
  }

  .row .btn {
    flex: 1 1 100%;
  }

  .step {
    grid-template-columns: 44px minmax(0, 1fr);
    padding: 22px 0;
  }

  .step-num {
    font-size: var(--s-34);
  }

  .step-title {
    font-size: var(--s-21);
  }

  .site-footer {
    width: calc(100% - 32px);
    padding: 24px 0 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
