:root {
  color-scheme: dark;
  --background: #131211;
  --panel: #1c1a18;
  --card: #24211e;
  --line: #403a34;
  --text: #f8f3ec;
  --muted: #c7bdb2;
  --accent: #ffba88;
  --paper: #fbf5e9;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--background);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--text);
}

:focus-visible,
.file-button:focus-within,
.mode-options input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.site-shell {
  width: min(1120px, calc(100% - 48px));
  margin-inline: auto;
  padding-bottom: 56px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  min-height: 72px;
  padding-block: 12px;
  border-bottom: 1px solid var(--line);
}

.wordmark,
.site-nav a {
  color: var(--text);
  text-decoration: none;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.brand-mark {
  position: relative;
  width: 22px;
  height: 18px;
  color: var(--accent);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
}

.brand-mark::before {
  inset: 0 auto auto 0;
  border-top: 2px solid;
  border-left: 2px solid;
}

.brand-mark::after {
  inset: auto 0 0 auto;
  border-right: 2px solid;
  border-bottom: 2px solid;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 0.9rem;
  font-weight: 650;
}

.site-nav a:hover,
.site-nav a[aria-current] {
  color: var(--accent);
}

.hero {
  padding: clamp(36px, 6vw, 72px) 0 clamp(28px, 4vw, 48px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 950px;
  font-size: clamp(2.55rem, 7.2vw, 5.7rem);
  font-weight: 760;
  letter-spacing: -0.07em;
  line-height: 1;
  text-wrap: balance;
}

.guide-shell h1 {
  max-width: 820px;
  font-size: clamp(2.45rem, 6vw, 4.8rem);
}

.lede {
  max-width: 59ch;
  margin-top: 19px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.17rem);
}

h2 {
  font-size: 1.25rem;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.workspace {
  padding: clamp(12px, 2.2vw, 22px);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background: var(--panel);
  scroll-margin-top: 16px;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-bottom: 16px;
}

.file-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.file-button,
.secondary-button {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 750;
}

.file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--background);
  background: var(--accent);
  cursor: pointer;
}

.file-button:hover {
  background: #ffd0ab;
}

.file-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.secondary-button {
  border-color: var(--line);
  color: var(--text);
  background: var(--card);
  cursor: pointer;
}

.secondary-button:not(:disabled, [aria-disabled="true"]):hover {
  border-color: var(--accent);
}

.secondary-button:disabled,
.secondary-button[aria-disabled="true"] {
  color: var(--muted);
  opacity: 0.55;
  cursor: default;
}

.photo-status,
.privacy-note,
.guide-workspace noscript {
  color: var(--muted);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.photo-status {
  margin-top: 4px;
}

.privacy-note,
.guide-workspace noscript p {
  margin-top: 14px;
}

.print-grid,
.guide-layout,
.guide-notes {
  display: grid;
  gap: 14px;
}

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

.guide-layout {
  grid-template-columns: minmax(0, 1.8fr) minmax(240px, 1fr);
  align-items: start;
}

.print-card,
.group-photo-example,
.border-panel {
  min-width: 0;
  margin: 0;
  padding: clamp(12px, 1.4vw, 16px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.print-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0 0 10px;
}

.print-heading h3 {
  font-size: 1.45rem;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.print-heading span {
  color: var(--muted);
  font-size: 0.85rem;
}

.print-frame {
  width: 100%;
  overflow: hidden;
  border-radius: 3px;
  background: var(--paper);
}

.print-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-position: center;
  user-select: none;
}

.print-frame[data-mode="fill"] img {
  object-fit: cover;
}

.print-frame[data-mode="whole"] img {
  object-fit: contain;
}

.print-frame[data-adjustable] {
  cursor: grab;
}

.print-frame[data-adjustable="horizontal"] {
  touch-action: pan-y pinch-zoom;
}

.print-frame[data-adjustable="vertical"] {
  touch-action: pinch-zoom;
}

.print-frame[data-dragging] {
  cursor: grabbing;
}

.position-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.position-control label {
  grid-column: 1;
  grid-row: 1;
}

.position-control input {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 26px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.position-control output {
  grid-column: 2;
  grid-row: 1;
  font-variant-numeric: tabular-nums;
}

.face-controls {
  margin-top: 12px;
}

.face-status {
  color: var(--muted);
  font-size: 0.9rem;
}

.face-status:not(:empty) {
  margin-top: 8px;
}

.print-card > figcaption:not(.print-heading) {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.crop-details {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.crop-details summary {
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.crop-figure {
  margin: 10px 0 0;
}

.crop-source {
  position: relative;
  width: min(100%, calc(24rem * var(--source-aspect, 1.5)));
  aspect-ratio: var(--source-aspect, 1.5);
  margin-inline: auto;
  overflow: hidden;
  border-radius: 3px;
  background: var(--paper);
}

.crop-source img {
  display: block;
  width: 100%;
  height: 100%;
}

.crop-outline {
  position: absolute;
  /* The centered sample trims 50 of 1,500 source pixels on each side. */
  inset: 0 3.333333%;
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 100vmax rgb(0 0 0 / 58%), inset 0 0 0 1px rgb(0 0 0 / 65%);
  pointer-events: none;
}

.crop-figure figcaption,
.crop-figure figcaption p + p,
.crop-calculation {
  margin-top: 8px;
}

.crop-calculation strong {
  color: var(--text);
}

.guide-workspace .preview-toolbar {
  align-items: end;
}

.guide-workspace .photo-status {
  flex-basis: 100%;
  margin-top: -4px;
}

.mode-controls {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.mode-controls legend {
  margin-bottom: 7px;
  padding: 0;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 650;
}

.mode-options {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--background);
}

.mode-options label {
  position: relative;
  display: flex;
  min-width: 0;
}

.mode-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.mode-options span {
  display: grid;
  align-items: center;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}

.mode-options label:hover span {
  color: var(--text);
}

.mode-options input:checked + span {
  color: var(--background);
  background: var(--accent);
}

.group-photo-example {
  scroll-margin-top: 9rem;
}

.group-photo-example p {
  margin-top: 10px;
  color: var(--muted);
}

.group-photo-example strong {
  color: var(--text);
}

.border-list {
  margin: 14px 0;
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.border-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.border-list dt,
.border-panel p {
  color: var(--muted);
  font-size: 0.9rem;
}

.border-list dd {
  margin: 0;
  font-weight: 700;
}

.worked-example {
  max-width: 72ch;
  padding: 36px 0 32px;
}

.worked-example h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.worked-example h3 {
  margin-top: 22px;
}

.worked-example p {
  margin-top: 10px;
  color: var(--muted);
}

.worked-example strong {
  color: var(--text);
}

.site-footer {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

@media (max-width: 700px) {
  .site-shell {
    width: calc(100% - 32px);
  }

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

  .group-photo-example {
    scroll-margin-top: 16px;
  }
}
