/* shoto — the only colour in this interface comes from the photographs. */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@75..125,300..700&display=swap');

/* Dark is the base. Photo tools are grey so the surround does not bias how you
   read the picture; light mode is a paper neutral for the same reason, never a
   stark white. The accent in both is simply maximum contrast against the ground,
   so the only hue in the interface still comes from the photographs. */
:root {
  color-scheme: dark;

  --ink: #0e0e0f;
  --surface: #17181a;
  --raised: #212327;
  --line: #33363b;
  --line-soft: #25272b;
  --text: #e8e6e3;
  --muted: #8a8b8f;
  --dim: #5c5e63;

  --hover: #ffffff0a;
  --hover-strong: #ffffff14;
  --warn: #e0a196;
  --warn-line: #a84a3d;
  --shadow: 0 18px 44px #00000073;

  --scrim: #0e0e0f;        /* the password screen's gradient is built from this */
  --scrim-1: 96%;          /* its strength at the bottom edge, */
  --scrim-2: 82%;          /* through the middle, */
  --scrim-3: 40%;          /* and where it lets the photo through */
  --wallpaper: .34;        /* how present the cover photo is behind it */
  --veil: #08080999;       /* lightbox backdrop */

  --gap: 4px;
  --bar: 58px;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

/* Three states: no attribute follows the system, the attribute wins either way. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;

    --ink: #edecea;
    --surface: #dedcd8;
    --raised: #f8f7f5;
    --line: #c6c4bf;
    --line-soft: #dbd9d4;
    --text: #17171a;
    --muted: #64656a;
    --dim: #9a9ca0;

    --hover: #0000000a;
    --hover-strong: #00000012;
    --warn: #9e3320;
    --warn-line: #c2604c;
    --shadow: 0 18px 44px #0000002e;

    --scrim: #f3f2f0;
    --scrim-1: 98%;
    --scrim-2: 93%;
    --scrim-3: 66%;
    --wallpaper: .34;
    --veil: #eceae7d6;
  }
}

:root[data-theme="light"] {
  color-scheme: light;

  --ink: #edecea;
  --surface: #dedcd8;
  --raised: #f8f7f5;
  --line: #c6c4bf;
  --line-soft: #dbd9d4;
  --text: #17171a;
  --muted: #64656a;
  --dim: #9a9ca0;

  --hover: #0000000a;
  --hover-strong: #00000012;
  --warn: #9e3320;
  --warn-line: #c2604c;
  --shadow: 0 18px 44px #0000002e;

  --scrim: #f3f2f0;
  --scrim-1: 98%;
  --scrim-2: 93%;
  --scrim-3: 66%;
  --wallpaper: .34;
  --veil: #eceae7d6;
}

* { box-sizing: border-box; }

/* Author display rules otherwise beat the user-agent [hidden] rule. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: Archivo, ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }

::selection { background: var(--text); color: var(--ink); }

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

/* ------------------------------------------------------------- primitives */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 0 14px;
  height: 34px;
  border-radius: 2px;
  font-weight: 500;
  letter-spacing: .01em;
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease);
}
.btn:hover:not(:disabled) { border-color: var(--muted); background: var(--hover); }

/* The file pickers are labels wrapping a visually hidden input, so the focus
   ring has to come from the input inside them. */
.btn:has(> input:focus-visible) {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.btn:disabled { opacity: .38; cursor: not-allowed; }

.btn.solid {
  background: var(--text);
  border-color: var(--text);
  color: var(--ink);
}
.btn.solid:hover:not(:disabled) { background: #fff; border-color: #fff; }

.btn.quiet { border-color: transparent; color: var(--muted); padding: 0 10px; }

.theme-toggle { width: 34px; padding: 0; flex: none; }
.theme-toggle svg { width: 15px; height: 15px; display: block; }
.btn.quiet:hover:not(:disabled) { color: var(--text); background: var(--hover); }

.btn.danger:hover:not(:disabled) {
  border-color: var(--warn-line);
  color: var(--warn);
  background: color-mix(in srgb, var(--warn-line) 12%, transparent);
}

.field {
  display: block;
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 9px 2px;
  border-radius: 0;
  transition: border-color .18s var(--ease);
}
.field::placeholder { color: var(--dim); }
.field:focus { outline: 0; border-bottom-color: var(--text); }

.label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
  font-weight: 500;
}

.meta { color: var(--muted); font-variant-numeric: tabular-nums; }
.err { color: var(--warn); font-size: 13px; min-height: 18px; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--bar);
  padding: 0 18px;
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}
.topbar h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  font-variation-settings: 'wdth' 108;
  letter-spacing: -.005em;
}
.topbar .spacer { flex: 1; }

.mark {
  font-weight: 700;
  font-variation-settings: 'wdth' 78;
  letter-spacing: .16em;
  font-size: 12px;
  text-transform: lowercase;
  color: var(--muted);
  padding-right: 16px;
  border-right: 1px solid var(--line-soft);
  margin-right: -2px;
}

/* ------------------------------------------------------ the contact sheet */

.sheet { padding: var(--gap); }

.row { display: flex; gap: var(--gap); margin-bottom: var(--gap); }

.tile {
  position: relative;
  flex: none;
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  border-radius: 1px;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .5s var(--ease), filter .18s var(--ease);
}
.tile img.in { opacity: 1; }

/* Selection reads as light: the picked frames stay lit, the rest sit back. */
.sheet.picking .tile img { opacity: .52; }
.sheet.picking .tile.on img { opacity: 1; }

.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  transition: border-color .14s var(--ease);
  pointer-events: none;
}
.tile.on::after {
  border-color: var(--text);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.check {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  /* This disc sits on a photograph, not on the page, so it stays light-on-dark
     in both themes; only its selected state follows the palette. */
  border: 1.5px solid #ffffff9c;
  background: #0e0e0f5c;
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: scale(.85);
  transition: opacity .14s var(--ease), transform .14s var(--ease), background .14s var(--ease);
  display: grid;
  place-items: center;
}
.tile:hover .check, .tile.on .check, .sheet.picking .check { opacity: 1; transform: scale(1); }

/* No hover on touch, so the circles have to be there from the start. */
@media (hover: none) {
  .check { opacity: 1; transform: scale(1); }
}
.tile.on .check { background: var(--text); border-color: var(--text); }
.check svg { width: 11px; height: 11px; stroke: var(--ink); stroke-width: 2.6; fill: none; opacity: 0; }
.tile.on .check svg { opacity: 1; }

.tile .flag {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 3px 7px;
  border-radius: 2px;
  background: var(--text);
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
