/* Pangolin Photo Challenge — the Pangolin Shot Data palette, so the club's tools look like one family. */
:root {
  --ground: #FAF6F0;
  --surface: #FFFFFF;
  --surface-2: #F4ECE0;
  --ink: #3F2308;
  --ink-2: #7A5A38;
  --ink-3: #8B7050;
  --line: #E7DAC6;
  --line-soft: #F1E8DA;
  --accent: #E2A31B;
  --accent-soft: #FCF2DB;
  --deep: #6B3A11;
  --on-deep: #F7D488;
  --danger: #B3261E;
  --danger-soft: #FBE9E7;
  --ok: #2F6B2F;
  --ok-soft: #E7F2E3;
  --shadow: 0 1px 0 rgba(63,35,8,.04), 0 12px 30px -20px rgba(63,35,8,.55);
  --radius: 14px;
  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #17110A;
    --surface: #201709;
    --surface-2: #2B2011;
    --ink: #F7EDDD;
    --ink-2: #C9AF89;
    --ink-3: #9C8362;
    --line: #3B2C18;
    --line-soft: #2C2013;
    --accent: #F0B429;
    --accent-soft: #3A2B10;
    --deep: #F0B429;
    --on-deep: #201709;
    --danger: #F2B8B5;
    --danger-soft: #3B1D1A;
    --ok: #A8D5A2;
    --ok-soft: #1E2E1C;
    --shadow: 0 12px 30px -20px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--deep); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 24px;
}
header.top img { height: 40px; width: auto; display: block; }
@media (prefers-color-scheme: dark) { header.top img, .hero img { filter: brightness(1.6) saturate(.9); } }
header.top .who { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--ink-2); min-width: 0; }
header.top .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.stack > * + * { margin-top: 16px; }

button, .btn {
  font: 600 .9rem var(--font); border-radius: 10px; padding: 10px 16px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
  min-height: 42px;
}
button:hover, .btn:hover { border-color: var(--ink-3); }
button.primary, .btn.primary { background: var(--deep); color: var(--on-deep); border-color: var(--deep); }
button.danger { color: var(--danger); }
button.swap { background: #2F6B2F; border-color: #2F6B2F; color: #FFFFFF; }
button.swap:hover { background: #255825; border-color: #255825; }
button.link { border: 0; background: none; padding: 4px; min-height: 0; color: var(--deep); text-decoration: underline; }
button:disabled { opacity: .55; cursor: default; }

label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 6px; }
label .hint { font-weight: 400; color: var(--ink-2); }
input[type=text], input[type=email], input[type=datetime-local], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; font: 400 1rem var(--font); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field + .field { margin-top: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.grow { flex: 1 1 200px; }
.row > select { width: auto; flex: 0 1 auto; }

.notice { border-radius: 10px; padding: 12px 14px; background: var(--accent-soft); border: 1px solid var(--line); }
.notice.error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.notice.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

.hero { text-align: center; padding: 24px 0 8px; }
.hero img { max-width: 280px; width: 70%; height: auto; }
.hero h1 { margin-top: 16px; }
.signin { max-width: 440px; margin: 24px auto; }

.pill {
  display: inline-block; font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
}
.pill.open { background: var(--ok-soft); color: var(--ok); }
.pill.closed { background: var(--danger-soft); color: var(--danger); }

.meter { display: flex; gap: 6px; margin: 10px 0 4px; }
.meter i { flex: 1; height: 8px; border-radius: 4px; background: var(--line); }
.meter i.on { background: var(--accent); }

.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .slots { grid-template-columns: minmax(0, 1fr); } }
.slot {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.slot .pic { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.slot .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot .body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.slot .body h3 { margin: 0; overflow-wrap: anywhere; }
.slot .actions { display: flex; gap: 6px; padding: 0 14px 14px; flex-wrap: wrap; }
.slot .actions button { flex: 1; min-height: 36px; padding: 6px 10px; font-size: .8rem; }
.slot.empty { border-style: dashed; box-shadow: none; background: transparent; cursor: pointer; min-height: 220px; justify-content: center; align-items: center; color: var(--ink-2); font-weight: 600; }
.slot.empty:hover { border-color: var(--ink-3); color: var(--ink); }
.slot.empty.locked { cursor: default; }
@media (max-width: 560px) { .slot.empty { min-height: 72px; } }

.challenges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .challenges { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .challenges { grid-template-columns: minmax(0, 1fr); } }
.challenges .c { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.challenges .art {
  aspect-ratio: 3 / 2; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--surface-2), var(--accent-soft));
}
.challenges .art span { font-size: 2.6rem; font-weight: 700; color: var(--line); }
.challenges .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.challenges .c-body { padding: 12px 16px 14px; }
.challenges .c b { display: block; font-size: 1.02rem; }

/* the entry form */
.sheet { position: fixed; inset: 0; background: rgba(23,17,10,.55); display: grid; place-items: start center; overflow-y: auto; padding: 24px 12px; z-index: 10; }
.sheet .card { width: 100%; max-width: 860px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 720px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 24px; text-align: center;
  background: var(--surface-2); cursor: pointer; display: grid; place-items: center; min-height: 220px; gap: 8px;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop img { max-width: 100%; max-height: 360px; border-radius: 8px; display: block; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.exif { width: 100%; border-collapse: collapse; font-size: .85rem; }
.exif th { text-align: left; font-weight: 600; color: var(--ink-2); padding: 5px 10px 5px 0; vertical-align: top; width: 38%; }
.exif td { padding: 5px 0; overflow-wrap: anywhere; }
.exif tr + tr { border-top: 1px solid var(--line-soft); }
details summary { cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--ink-2); margin-top: 8px; }

/* organiser screens */
nav.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
nav.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; color: var(--ink-2); white-space: nowrap; }
nav.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.list th { text-align: left; color: var(--ink-2); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--surface-2); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.thumbs .t { cursor: pointer; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.thumbs .t img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--surface-2); }
.thumbs .t div { padding: 8px 10px; font-size: .8rem; }
.thumbs .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.big-pic { width: 100%; max-height: 70vh; object-fit: contain; background: #0d0905; border-radius: 10px; display: block; }
.stat { font-size: 1.6rem; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: .85em; overflow-wrap: anywhere; }

/* culling and scoring: the photograph fills the screen, the keyboard does the work */
.viewer {
  position: fixed; inset: 0; z-index: 20; background: #000; color: #F7EDDD;
}
/* The photograph takes the whole screen; the controls float over its edges. */
.viewer .top, .viewer .keys { position: absolute; left: 0; right: 0; z-index: 2; transition: opacity .2s; }
.viewer .top { top: 0; }
.viewer.bare .top, .viewer.bare .keys { opacity: 0; pointer-events: none; }
.viewer .bar {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px; font-size: .85rem;
  background: linear-gradient(rgba(0,0,0,.7), rgba(0,0,0,.35)); flex-wrap: wrap;
}
.viewer .bar .grow { min-width: 0; }
.viewer .bar b { color: #F7D488; }
.viewer .bar button { background: transparent; color: #F7EDDD; border-color: #3B2C18; min-height: 34px; padding: 4px 12px; }
.viewer .stage { position: absolute; inset: 0; overflow: hidden; }
.viewer .stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.viewer .stage.zoom { overflow: auto; }
.viewer .stage.zoom img { position: static; width: auto; height: auto; max-width: none; }
.viewer .verdict {
  position: absolute; top: 64px; right: 16px; z-index: 1; font-weight: 700; font-size: 1.1rem; padding: 6px 14px; border-radius: 999px;
}
.viewer .verdict.Y { background: #2F6B2F; color: #E7F2E3; }
.viewer .verdict.N { background: #8C1D18; color: #FBE9E7; }
.viewer .verdict.score { background: #F0B429; color: #201709; }
.viewer .info {
  position: absolute; left: 16px; bottom: 76px; z-index: 3; max-width: min(560px, calc(100% - 32px)); max-height: 70%; overflow: auto;
  background: rgba(23,17,10,.92); border: 1px solid #3B2C18; border-radius: 12px; padding: 14px 16px; font-size: .85rem;
}
.viewer .info h3 { color: #F7D488; }
.viewer .info .exif th { color: #C9AF89; }
.viewer .info .exif tr + tr { border-color: #2C2013; }
.viewer .keys { bottom: 0; display: flex; gap: 8px; justify-content: center; padding: 10px 16px; flex-wrap: wrap; background: linear-gradient(rgba(0,0,0,.35), rgba(0,0,0,.7)); }
.viewer .keys button { min-width: 56px; background: #201709; color: #F7EDDD; border-color: #3B2C18; }
.viewer .keys button.yes { background: #2F6B2F; border-color: #2F6B2F; }
.viewer .keys button.no { background: #8C1D18; border-color: #8C1D18; }
.viewer .keys button.on { background: #F0B429; color: #201709; border-color: #F0B429; }
.viewer .keys button.on kbd { color: #201709; border-color: #201709; }
.viewer .keys button.num kbd { border: 0; margin: 0; font-size: 1rem; color: inherit; }
.viewer kbd { font: 600 .75rem var(--font); border: 1px solid #5c4a3a; border-radius: 4px; padding: 0 5px; margin-right: 4px; color: #C9AF89; }
.viewer .saving { color: #F2B8B5; }
.progress-line { height: 4px; background: #2B2011; }
.progress-line i { display: block; height: 100%; background: #F0B429; }
