/* Kalender – interface styles. Large controls, few options. */

:root {
  --paper: #f3f5f2;
  --card: #ffffff;
  --ink: #1b2226;
  --muted: #55616a;
  --line: #c5cdc8;
  --spruce: #1f4a3f;
  --spruce-dark: #163930;
  --marigold: #f0b323;
  --marigold-dark: #d99b0c;
  --error: #a3231c;
  --ui: "Avenir Next", "Montserrat", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --display: "Alfa Slab One", "Rockwell", "Roboto Slab", Georgia, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { font-size: 19px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  line-height: 1.45;
}

/* the strip of punched holes a wall calendar hangs from */
.binding {
  height: 34px;
  background-color: var(--spruce);
  background-image: radial-gradient(circle at 50% 55%, var(--paper) 0 7px, transparent 7.5px);
  background-size: 44px 34px;
  background-position: center;
}

.top, main, .foot {
  width: min(1120px, 100% - 2.4rem);
  margin-inline: auto;
}
.top { padding: 1.6rem 0 0.4rem; }
.top-kicker { margin: 0; color: var(--muted); font-size: 1rem; }
.top h1 {
  margin: 0.1rem 0 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  letter-spacing: 0.04em;
  line-height: 1.05;
  color: var(--spruce);
  overflow-wrap: anywhere;
}

.step {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.3rem 1.4rem 1.5rem;
  margin-top: 1.2rem;
}
.step h2, .results h2 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  font-weight: 700;
}
.num {
  display: inline-grid;
  place-items: center;
  width: 1.9rem; height: 1.9rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--spruce);
  color: #fff;
  font-size: 1.05rem;
}

.row { display: flex; flex-wrap: wrap; gap: 1rem; }
.field { display: block; flex: 1 1 16rem; margin-top: 0.9rem; }
.row .field { margin-top: 0; }
.field-year { flex: 0 1 9rem; }
.field > span { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }

select, input[type="text"], input[type="number"] {
  width: 100%;
  min-height: 3.1rem;
  padding: 0.5rem 0.8rem;
  font: inherit;
  font-size: 1.15rem;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 6px;
}
select:focus-visible, input:focus-visible, button:focus-visible, .format input:focus-visible + span {
  outline: 3px solid var(--marigold);
  outline-offset: 2px;
  border-color: var(--spruce);
}
::placeholder { color: #98a39d; }

.formats { border: 0; padding: 0; margin: 1.1rem 0 0; }
.formats legend { font-weight: 600; padding: 0; margin-bottom: 0.4rem; }
.format-list { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.format { position: relative; }
.format input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.format > span {
  display: flex; align-items: center; gap: 0.7rem;
  min-height: 3.6rem;
  padding: 0.5rem 1rem 0.5rem 0.8rem;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-weight: 600;
}
.format input:checked + span { border-color: var(--spruce); background: #e9f1ee; }
.sheet {
  display: block;
  border: 2px solid var(--spruce);
  background: #fff;
  border-radius: 2px;
}
.format input:checked + span .sheet { background: var(--spruce); }

.drop {
  border: 2px dashed var(--line);
  border-radius: 6px;
  padding: 1.4rem 1rem 1.1rem;
  text-align: center;
  background: #fafbfa;
}
.drop.over { border-color: var(--spruce); background: #e9f1ee; }
.drop-main { margin: 0 0 0.8rem; font-size: 1.15rem; }
kbd {
  font: inherit; font-size: 0.9em;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
  background: #fff;
}
.hint { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.92rem; }
.msg { margin: 0.6rem 0 0; color: var(--error); font-weight: 600; min-height: 0; }
.msg:empty { display: none; }

.thumbs { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.8rem; }
.thumb {
  position: relative;
  width: 9.2rem;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
  cursor: grab;
}
.thumb.first { border-color: var(--spruce); }
.thumb.dragging { opacity: 0.4; }
.thumb.target { outline: 3px solid var(--marigold); outline-offset: 2px; }
.thumb canvas { display: block; width: 100%; height: 7rem; object-fit: cover; }
.thumb .badge {
  position: absolute; top: 0.35rem; left: 0.35rem;
  background: var(--spruce); color: #fff;
  font-size: 0.74rem; font-weight: 700;
  padding: 0.1rem 0.45rem; border-radius: 3px;
}
.thumb-bar { display: flex; justify-content: space-between; border-top: 1px solid var(--line); }
.thumb-bar button {
  flex: 1; min-height: 2.5rem;
  font: inherit; font-size: 1.05rem;
  background: #fff; color: var(--ink);
  border: 0; border-right: 1px solid var(--line);
  cursor: pointer;
}
.thumb-bar button:last-child { border-right: 0; }
.thumb-bar button:hover:not(:disabled) { background: #e9f1ee; }
.thumb-bar button:disabled { color: #b9c1bc; cursor: default; }

.btn {
  font: inherit; font-weight: 700;
  min-height: 3.2rem;
  padding: 0.6rem 1.4rem;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
}
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-primary {
  font-size: 1.3rem;
  min-height: 4rem;
  padding-inline: 2rem;
  background: var(--marigold);
  color: #201a05;
  border-color: var(--marigold-dark);
}
.btn-primary:hover:not(:disabled) { background: #f6c145; }
.btn-secondary { background: #fff; color: var(--spruce-dark); border-color: var(--spruce); }
.btn-secondary:hover:not(:disabled) { background: #e9f1ee; }
.btn-download { background: var(--spruce); color: #fff; border-color: var(--spruce-dark); width: 100%; font-size: 1.1rem; }
.btn-download:hover:not(:disabled) { background: var(--spruce-dark); }
.btn-link {
  font: inherit; font-size: 0.92rem;
  background: none; border: 0; padding: 0.5rem 0.2rem;
  color: var(--spruce-dark); text-decoration: underline; cursor: pointer;
}

.go { margin: 1.4rem 0 0; }

.results { margin-top: 2.4rem; }
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
  align-items: start;
  margin-top: 1rem;
}
.cards.wide { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
@media (max-width: 820px) { .cards { grid-template-columns: minmax(0, 1fr); } }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.8rem;
}
.card-view {
  display: block; width: 100%;
  padding: 0; border: 0; background: #dfe4e1;
  cursor: zoom-in;
}
.card-view canvas { display: block; width: 100%; height: auto; }
.card-view.pending { cursor: progress; }
.card-name { margin: 0.7rem 0 0.6rem; font-weight: 700; font-size: 1.05rem; }
.card-actions { text-align: center; }

.again { margin-top: 1.4rem; }
.exhausted {
  margin-top: 1.2rem; padding: 1rem 1.2rem;
  background: #fff7e0; border: 2px solid var(--marigold); border-radius: 6px;
}
.exhausted p { margin: 0 0 0.8rem; font-weight: 600; }

.foot { padding: 2.4rem 0 2rem; color: var(--muted); font-size: 0.8rem; }

.zoom {
  border: 0; border-radius: 6px; padding: 1rem;
  max-width: 96vw; max-height: 96vh;
  text-align: center;
}
.zoom::backdrop { background: rgba(15, 25, 22, 0.75); }
.zoom canvas { display: block; max-width: 90vw; max-height: 80vh; width: auto; height: auto; margin: 0 auto 0.8rem; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .format > span, .drop { transition: background-color 0.12s ease, border-color 0.12s ease; }
}
