/* The app's identity, not a separate web brand: the same tokens as
   lib/ui/theme.dart, IBM Plex Sans for prose and Plex Mono for anything
   that is a measurement. Fonts are served from this site, never a font CDN,
   so loading the page tells no third party anyone visited. */

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/IBMPlexSans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/IBMPlexSans-Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/IBMPlexSans-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../fonts/IBMPlexMono-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../fonts/IBMPlexMono-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}

:root {
  --paper: #eef1f0;
  --ink: #14213d;
  --precision: #b23a2e;
  --line: #9ca39a;
  --fit: #3b6e4f;
  /* Ink at 60%: Line is too low-contrast for text. */
  --muted: rgb(20 33 61 / 0.6);

  --background: var(--paper);
  --text: var(--ink);
  --accent: var(--precision);

  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #12151c;
    --text: #eef1f0;
    --accent: #d9695c;
    --line: #3a4048;
    --fit: #4f9268;
    --muted: rgb(238 241 240 / 0.6);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 400 16px/1.5 var(--sans);
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.site-header {
  border-bottom: 0.5px solid var(--line);
  padding: 14px 16px;
}

.wordmark {
  font-weight: 600;
  font-size: 20px;
  text-decoration: none;
}

.tool {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

h1 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 4px;
}

.target {
  font: 600 14px/1.5 var(--mono);
  margin: 0 0 12px;
}

.note {
  color: var(--muted);
  font-size: 14px;
  margin: 12px 0;
}

.measure {
  font-family: var(--mono);
  font-size: 14px;
}
.strong {
  font-weight: 600;
}
.muted {
  color: var(--muted);
}

.label {
  font: 500 12px/1.5 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 24px 0 8px;
}

/* Pick */

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 32px 16px;
  border: 1px dashed var(--line);
  cursor: pointer;
}
.drop.over {
  border-color: var(--text);
}
.drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.drop:focus-within .button {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.hint {
  color: var(--muted);
  font-size: 14px;
}

.button {
  display: inline-block;
  background: var(--text);
  color: var(--background);
  font: 500 16px/1 var(--sans);
  padding: 14px 24px;
  border: 0;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}

.text-button {
  display: block;
  margin: 12px 0 0;
  padding: 8px 0;
  background: none;
  border: 0;
  color: var(--text);
  font: 500 16px/1.5 var(--sans);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.progress {
  margin-top: 24px;
}

.error {
  color: var(--accent);
  margin-top: 24px;
}

/* Result */

.preview {
  margin: 24px 0 0;
}
.preview img {
  display: block;
  max-width: 100%;
  max-height: 280px;
  outline: 0.5px solid var(--line);
}

.gauge-track {
  position: relative;
  height: 10px;
  outline: 0.5px solid var(--line);
  outline-offset: -0.5px;
}
.gauge-fill {
  height: 100%;
  background: var(--fit);
}
.gauge.over .gauge-fill {
  background: var(--accent);
}
.gauge-text {
  display: flex;
  gap: 0.4em;
  margin: 6px 0 0;
}
.gauge-bytes {
  color: var(--fit);
}
.gauge-percent {
  margin-left: auto;
  color: var(--fit);
}
.gauge.over .gauge-bytes,
.gauge.over .gauge-percent {
  color: var(--accent);
}
/* The file-size floor, where a preset has one. */
.gauge-min {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 1px;
  background: var(--text);
}

.bracket {
  display: block;
  width: 100%;
  height: 44px;
  overflow: visible;
}
.bracket .rule {
  stroke: var(--line);
  stroke-width: 0.5;
}
.bracket .mark {
  stroke: var(--text);
  stroke-width: 1.2;
  fill: none;
}
.bracket .value {
  fill: var(--fit);
  stroke: var(--fit);
  stroke-width: 2;
}
.bracket text {
  font: 12px var(--mono);
  fill: var(--muted);
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  list-style: none;
  padding: 0;
  margin: 16px 0;
  color: var(--fit);
  font: 14px var(--mono);
}
/* A drawn tick, not ✓: Plex Mono draws that code point as a radical (√). */
.checks li::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 5px;
  margin: 0 7px 3px 2px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

hr {
  border: 0;
  border-top: 0.5px solid var(--line);
  margin: 20px 0 12px;
}

.before-after {
  border-collapse: collapse;
}
.before-after th {
  text-align: left;
  padding: 0 16px 0 0;
}
.before-after th.label {
  margin: 0;
}
.before-after td {
  padding: 6px 16px 6px 0;
  font: 14px var(--mono);
}
.before-after td:first-child {
  font-family: var(--sans);
  color: var(--muted);
}
.before-after td:nth-child(2) {
  color: var(--muted);
}
.before-after td:nth-child(3) {
  font-weight: 600;
}

.field {
  display: block;
  margin: 24px 0 16px;
}
.field-label {
  display: block;
  font-size: 14px;
  color: var(--muted);
}
.field-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}
.field-row:focus-within {
  border-bottom-color: var(--text);
}
.field input {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font: 16px var(--sans);
}

/* Home: the preset list, like the app's home screen. */

.home {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.home > h2.label {
  margin-top: 32px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid var(--line);
}

.group {
  font: 500 14px/1.5 var(--sans);
  color: var(--muted);
  margin: 16px 0 0;
}

.presets {
  list-style: none;
  margin: 0;
  padding: 0;
}
.presets li + li {
  border-top: 0.5px solid var(--line);
}
.presets a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 24px 12px 0;
  text-decoration: none;
  position: relative;
}
/* A drawn chevron, like the app's row arrow. */
.presets a::after {
  content: '';
  position: absolute;
  right: 6px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}
.presets a:hover .preset-name,
.presets a:focus-visible .preset-name {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.preset-name {
  font-size: 17px;
}
.presets .target {
  font: 400 13px/1.5 var(--mono);
  color: var(--muted);
  margin: 0;
}

/* Preset pages */

.crumb {
  font-size: 14px;
  margin: 0 0 16px;
}

.caution {
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 12px;
  margin: 12px 0;
}

.about p {
  margin: 12px 0;
}

.spec {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 16px 0;
  padding: 12px 0;
  border-top: 0.5px solid var(--line);
  border-bottom: 0.5px solid var(--line);
}
.spec dt {
  color: var(--muted);
  font-size: 14px;
}
.spec dd {
  margin: 0;
  font: 400 14px/1.5 var(--mono);
}

#tool {
  margin-top: 24px;
}
