/* MacTidy — mactidy.dev
   One family (Archivo, variable width + weight), self-hosted so the site makes
   no third-party requests. Colour encodes safety level, the same way the app does. */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #eef2f5;
  --surface: #ffffff;
  --ink: #13233a;
  --ink-2: #4a5a70;
  --line: #cbd5df;
  --focus: #2f6fed;

  --safe: #1f8a5b;
  --safe-tint: #d3eee0;
  --review: #b87d06;
  --review-tint: #f7e6bf;
  --keep: #8a9aae;
  --keep-tint: #dde4eb;
  --free-tint: #f7f9fb;

  --radius-s: 4px;
  --radius-m: 10px;
  --radius-l: 16px;

  --measure: 64ch;
  --page: 1160px;
  --gutter: clamp(16px, 4vw, 40px);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1a2a;
    --surface: #16243a;
    --ink: #e7edf4;
    --ink-2: #a3b1c2;
    --line: #2a3b55;
    --focus: #7aa7ff;

    --safe: #3dbe85;
    --safe-tint: #173d31;
    --review: #e9b23f;
    --review-tint: #45361a;
    --keep: #7d8ea4;
    --keep-tint: #24344b;
    --free-tint: #122036;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", system-ui, -apple-system, sans-serif;
  font-size: 1.125rem;
  line-height: 1.6;
  font-stretch: 100%;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

[hidden] { display: none !important; }

a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 14px;
  border-radius: var(--radius-s);
  z-index: 10;
}
.skip:focus { left: 8px; }

.wrap {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Type ---------- */

h1, h2, h3 {
  margin: 0;
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.75rem, 7.4vw, 5.5rem);
  font-stretch: 72%;
  font-weight: 850;
}

h2 {
  font-size: clamp(2rem, 4.4vw, 3.25rem);
  font-stretch: 78%;
}

h3 {
  font-size: 1.3125rem;
  font-stretch: 92%;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
}

p { margin: 0 0 1em; max-width: var(--measure); }

.lede {
  font-size: clamp(1.1875rem, 1.6vw, 1.375rem);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 54ch;
}

.small { font-size: 0.875rem; line-height: 1.5; color: var(--ink-2); }

.num { font-variant-numeric: tabular-nums; }

/* ---------- Header ---------- */

.site-header { padding: 18px 0; }

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-stretch: 85%;
  font-size: 1.3125rem;
  letter-spacing: -0.005em;
}
.brand svg { width: 30px; height: 30px; }

.site-nav { display: flex; align-items: center; gap: 28px; }
.site-nav a:not(.button) {
  text-decoration: none;
  font-size: 1rem;
  color: var(--ink-2);
}
.site-nav a:not(.button):hover { color: var(--ink); }

@media (max-width: 820px) {
  .site-nav a:not(.button) { display: none; }
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: 1rem;
  font-weight: 650;
  font-stretch: 92%;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.button:hover { text-decoration: none; filter: brightness(1.15); }

.button.quiet {
  background: transparent;
  color: var(--ink);
}
.button.quiet:hover { background: var(--surface); filter: none; }

.button[aria-disabled="true"] {
  cursor: default;
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line);
  filter: none;
}

.button.small-btn { min-height: 36px; padding: 6px 14px; font-size: 0.9375rem; }

/* ---------- Hero ---------- */

.hero { padding: clamp(32px, 6vw, 72px) 0 clamp(48px, 7vw, 96px); }

.hero-top {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 28px clamp(32px, 6vw, 96px);
  align-items: end;
}
.hero-top h1 { grid-column: 1 / -1; }
.hero h1 span { display: block; }
.hero-top .lede { margin: 0; }
.hero-cta { justify-self: end; }
.hero-cta .hero-actions { margin-top: 0; }

@media (max-width: 900px) {
  .hero-top { grid-template-columns: 1fr; }
  .hero h1 span { display: inline; }
  .hero-cta { justify-self: start; }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 28px;
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.hero-facts li { position: relative; }

/* ---------- Disk map (the demo) ---------- */

.diskmap {
  margin: clamp(40px, 6vw, 72px) 0 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  overflow: hidden;
}

.diskmap-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.diskmap-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.diskmap-title strong { font-stretch: 88%; font-weight: 700; font-size: 1rem; }
.diskmap-title span { font-size: 0.875rem; color: var(--ink-2); }

.diskmap-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.diskmap-status {
  padding: 12px 18px 0;
  font-size: 0.9375rem;
  color: var(--ink-2);
  min-height: 2.6em;
}
.diskmap-status b { color: var(--ink); font-weight: 650; }

.treemap {
  position: relative;
  margin: 10px 18px 0;
  aspect-ratio: 16 / 7;
  min-height: 320px;
}

@media (max-width: 700px) {
  .treemap { aspect-ratio: 4 / 5; min-height: 0; margin: 10px 12px 0; }
}

.tile {
  position: absolute;
  padding: 3px;
  transition:
    left 600ms cubic-bezier(.2,.7,.2,1),
    top 600ms cubic-bezier(.2,.7,.2,1),
    width 600ms cubic-bezier(.2,.7,.2,1),
    height 600ms cubic-bezier(.2,.7,.2,1),
    opacity 400ms ease;
}

.tile button {
  all: unset;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  width: 100%;
  height: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-m);
  overflow: hidden;
  cursor: pointer;
  color: var(--ink);
  background: var(--keep-tint);
  box-shadow: inset 0 0 0 1.5px transparent;
}
.tile button:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.tile button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ink); }

.tile .t-name {
  font-size: 0.875rem;
  font-weight: 650;
  font-stretch: 82%;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile .t-size {
  font-size: 0.8125rem;
  font-stretch: 82%;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.tile.compact .t-name,
.tile.compact .t-size { display: none; }

/* Safety levels. Hatching marks "safe to remove" independent of colour. */
.tile[data-level="safe"] button {
  background:
    repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--safe) 22%, transparent) 7px 9px),
    var(--safe-tint);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--safe) 55%, transparent);
}
.tile[data-level="review"] button {
  background: var(--review-tint);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--review) 50%, transparent);
}
.tile[data-level="keep"] button { background: var(--keep-tint); }
.tile[data-level="free"] button {
  background: var(--free-tint);
  box-shadow: inset 0 0 0 1.5px var(--line);
  color: var(--ink-2);
}
.tile[data-level="trash"] button {
  background:
    repeating-linear-gradient(45deg, transparent 0 5px, color-mix(in srgb, var(--ink-2) 18%, transparent) 5px 6px),
    var(--free-tint);
  outline: 1.5px dashed var(--ink-2);
  outline-offset: -1.5px;
}

.tile[data-level="safe"] button[aria-pressed="true"],
.tile[data-level="review"] button[aria-pressed="true"],
.tile[data-level="keep"] button[aria-pressed="true"],
.tile[data-level="free"] button[aria-pressed="true"],
.tile[data-level="trash"] button[aria-pressed="true"] { box-shadow: inset 0 0 0 2.5px var(--ink); }

.tile.leaving { opacity: 0; }
.tile.entering { opacity: 0; }

/* Scan reveal on first load */
.treemap.scanning .tile { opacity: 0; }
.treemap .tile.revealed { opacity: 1; }

.diskmap-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 32px;
  padding: 16px 18px 18px;
  align-items: start;
}
@media (max-width: 700px) {
  .diskmap-foot { grid-template-columns: 1fr; }
}

.detail { min-height: 5.2em; }
@media (max-width: 700px) { .detail { min-height: 0; } }
.detail h3 { font-size: 1.0625rem; font-stretch: 90%; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.detail .path {
  margin: 4px 0 6px;
  font-size: 0.875rem;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.detail p { margin: 0; font-size: 0.9375rem; max-width: 70ch; }

.level {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-stretch: 90%;
  color: var(--ink-2);
}
.swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex: none;
}
.swatch.safe {
  background:
    repeating-linear-gradient(135deg, transparent 0 3px, color-mix(in srgb, var(--safe) 45%, transparent) 3px 4.5px),
    var(--safe-tint);
  box-shadow: inset 0 0 0 1.5px var(--safe);
}
.swatch.review { background: var(--review-tint); box-shadow: inset 0 0 0 1.5px var(--review); }
.swatch.keep { background: var(--keep-tint); box-shadow: inset 0 0 0 1.5px var(--keep); }
.swatch.free { background: var(--free-tint); box-shadow: inset 0 0 0 1.5px var(--line); }
.swatch.trash { background: var(--free-tint); outline: 1.5px dashed var(--ink-2); outline-offset: -1.5px; }

.legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (max-width: 700px) {
  .legend { flex-direction: row; flex-wrap: wrap; gap: 6px 16px; }
}

.map-fallback { padding: 0 18px 18px; }

/* ---------- Sections ---------- */

.section { padding: clamp(56px, 8vw, 112px) 0; border-top: 1px solid var(--line); }

.section-head { display: grid; gap: 16px; margin-bottom: clamp(32px, 4vw, 56px); }
.section-head p { color: var(--ink-2); margin: 0; }

/* How it works: a real sequence, so it is numbered */
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 40px);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }

.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step);
  display: block;
  font-size: 4rem;
  line-height: 1;
  font-weight: 850;
  font-stretch: 62%;
  color: var(--line);
  margin-bottom: 12px;
}
@media (prefers-color-scheme: dark) { .steps li::before { color: var(--keep); } }
.steps h3 { margin-bottom: 10px; }
.steps p { color: var(--ink-2); margin: 0; }

/* What it finds: a definition list, name on the left, contents on the right */
.finds { margin: 0; }
.finds > div {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(0, 2fr);
  gap: 8px clamp(24px, 4vw, 64px);
  padding: 26px 0;
  border-top: 1px solid var(--line);
}
.finds > div:last-child { border-bottom: 1px solid var(--line); }
@media (max-width: 700px) { .finds > div { grid-template-columns: 1fr; } }

.finds dt h3 { font-size: clamp(1.375rem, 2.2vw, 1.75rem); font-stretch: 80%; font-weight: 800; }
.finds dt .soon {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-2);
}
.finds dd { margin: 0; }
.finds dd p { margin: 0 0 8px; }
.finds .paths {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.finds .paths li {
  font-size: 0.8125rem;
  font-stretch: 88%;
  padding: 3px 9px;
  border-radius: var(--radius-s);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
}

/* Won't do */
.wont {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(24px, 4vw, 64px);
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (max-width: 760px) { .wont { grid-template-columns: 1fr; } }
.wont li { padding: 22px 0; border-top: 1px solid var(--line); }
.wont h3 { margin-bottom: 8px; }
.wont p { margin: 0; color: var(--ink-2); }

/* Pricing */
.pricing {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}
@media (max-width: 860px) { .pricing { grid-template-columns: 1fr; } }

.price-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: clamp(24px, 3.5vw, 40px);
}
.price {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.price strong {
  font-size: clamp(3.5rem, 8vw, 5.5rem);
  line-height: 1;
  font-weight: 850;
  font-stretch: 68%;
  font-variant-numeric: tabular-nums;
}
.price span { color: var(--ink-2); font-size: 1.0625rem; }

.includes {
  margin: 20px 0 28px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.includes li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
}
.includes svg { width: 20px; height: 20px; margin-top: 4px; color: var(--safe); }

.price-card h2 { margin-bottom: 18px; }
.price-card .button { width: 100%; }
.price-card .small { margin: 14px 0 0; text-align: center; max-width: none; }

.pricing-notes h3 { margin: 0 0 8px; }
.pricing-notes > div + div { margin-top: 28px; }
.pricing-notes p { color: var(--ink-2); }

/* FAQ */
.faq { max-width: 860px; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 20px 40px 20px 0;
  position: relative;
  font-weight: 700;
  font-stretch: 92%;
  font-size: 1.1875rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 11px;
  height: 11px;
  border-right: 2px solid var(--ink-2);
  border-bottom: 2px solid var(--ink-2);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 200ms ease;
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq .answer { padding: 0 0 22px; color: var(--ink-2); }
.faq .answer p:last-child { margin-bottom: 0; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px 0 56px;
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.site-footer .wrap { display: grid; gap: 20px; }
.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px 32px;
  align-items: center;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 0; list-style: none; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.site-footer p { margin: 0; max-width: 90ch; }

/* ---------- Document pages (terms, privacy, refunds, support, changelog) ---------- */

.doc { padding: clamp(32px, 6vw, 72px) 0 clamp(56px, 8vw, 112px); }
.doc .wrap { max-width: 820px; }
.doc h1 { font-size: clamp(2.5rem, 6vw, 4rem); font-stretch: 75%; margin-bottom: 12px; }
.doc .updated { color: var(--ink-2); font-size: 0.9375rem; margin-bottom: 40px; }
.doc h2 {
  font-size: clamp(1.5rem, 2.6vw, 1.875rem);
  font-stretch: 85%;
  margin: 48px 0 14px;
  line-height: 1.15;
}
.doc h3 { margin: 28px 0 8px; }
.doc p, .doc li { max-width: 70ch; }
.doc ul, .doc ol { padding-left: 1.3em; margin: 0 0 1em; }
.doc li { margin-bottom: 6px; }
.doc .summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 20px 24px;
  margin: 0 0 32px;
}
.doc .summary p:last-child, .doc .summary ul:last-child { margin-bottom: 0; }
.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 24px;
  font-size: 0.9375rem;
}
.doc th, .doc td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--line);
}
.doc th { font-weight: 700; font-stretch: 90%; }
.table-scroll { overflow-x: auto; }

@media (max-width: 640px) {
  .doc table, .doc tbody, .doc tr, .doc td { display: block; width: 100%; }
  .doc thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .doc tr { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .doc td { border: 0; padding: 2px 0; }
  .doc td::before {
    content: attr(data-label);
    display: block;
    font-weight: 700;
    font-stretch: 90%;
    font-size: 0.8125rem;
    color: var(--ink-2);
  }
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tile { transition: none; }
  .faq summary::after { transition: none; }
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.875em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}
