/* ShiftCal
   The look comes from the printed staff schedule: cool paper, ballpoint
   ink, a ruled table, and your own row run over with a highlighter. */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/bricolage-grotesque-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/bricolage-grotesque-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #f2f4f8;
  --sheet: #ffffff;
  --ink: #131c33;
  --ink-soft: #55607a;
  --rule: #c6cedc;
  --rule-soft: #e1e6ef;
  --pen: #1f45d8;
  --hl: #ffe23f;
  --on-hl: #131c33;
  --warn: #b3261e;
  --good: #17734a;

  --font: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --radius: 6px;
  --gap: 1rem;
  color-scheme: light;
}

:root[data-hl="green"] { --hl: #a4f07f; }
:root[data-hl="pink"] { --hl: #ffa3cf; }
:root[data-hl="orange"] { --hl: #ffb95e; }
:root[data-hl="blue"] { --hl: #93d6ff; }

:root[data-theme="dark"] {
  --paper: #0e1528;
  --sheet: #162039;
  --ink: #eaeef7;
  --ink-soft: #9ba7c2;
  --rule: #33405f;
  --rule-soft: #232e4b;
  --pen: #93abff;
  --warn: #ff8a80;
  --good: #6fd6a4;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --paper: #0e1528;
    --sheet: #162039;
    --ink: #eaeef7;
    --ink-soft: #9ba7c2;
    --rule: #33405f;
    --rule-soft: #232e4b;
    --pen: #93abff;
    --warn: #ff8a80;
    --good: #6fd6a4;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, p { margin: 0; }
h2 { font-size: var(--step-1); font-weight: 650; line-height: 1.2; }
h3 { font-size: var(--step-0); font-weight: 650; }

[hidden] { display: none !important; }

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 50;
}
.skip:focus { left: 0; }

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

/* The highlighter stroke. Used for the wordmark, the next shift and
   every shift in the table: it is the one loud thing on the page. */
.mark {
  background: linear-gradient(100deg, transparent 0.4em, var(--hl) 0.4em) left / 100% 100% no-repeat;
  background: linear-gradient(101deg, transparent 0, transparent 0.12em, var(--hl) 0.2em, var(--hl) calc(100% - 0.22em), transparent calc(100% - 0.1em));
  color: var(--on-hl);
  padding: 0.02em 0.32em;
  border-radius: 0.18em 0.5em 0.22em 0.42em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ---------------------------------------------------------- top bar */

.top { border-bottom: 1.5px solid var(--ink); background: var(--paper); }
.top__in {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.brand { font-size: var(--step-1); font-weight: 750; letter-spacing: -0.01em; }
.top__actions { display: flex; gap: 0.25rem; }

/* ---------------------------------------------------------- buttons */

.btn {
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.55rem 0.95rem;
  min-height: 2.75rem;
  cursor: pointer;
  text-align: center;
}
.btn:hover { background: var(--rule-soft); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--pen); border-color: var(--pen); color: #fff; }
:root[data-theme="dark"] .btn--primary:hover { color: #0e1528; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .btn--primary:hover { color: #0e1528; }
}
.btn--quiet { border-color: transparent; color: var(--pen); padding-inline: 0.6rem; }
.btn--danger { border-color: var(--warn); color: var(--warn); }
.link {
  font: inherit;
  color: var(--pen);
  background: none;
  border: 0;
  padding: 0.25rem 0;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.spacer { flex: 1; }

/* ---------------------------------------------------------- page */

.page { flex: 1; width: 100%; max-width: 68rem; margin: 0 auto; padding: 1.25rem 1rem 2.5rem; }
.foot { border-top: 1px solid var(--rule); color: var(--ink-soft); font-size: var(--step--1); }
.foot p { max-width: 68rem; margin: 0 auto; padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom)); }

.notice {
  border: 1.5px solid var(--ink);
  border-left-width: 6px;
  background: var(--sheet);
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}
.notice p { flex: 1 1 14rem; }

/* ---------------------------------------------------------- welcome */

.welcome { max-width: 38rem; padding-top: 6vh; }
.welcome__title {
  font-size: clamp(2.1rem, 8.5vw, 3.6rem);
  line-height: 1.02;
  font-weight: 750;
  letter-spacing: -0.025em;
}
.welcome__lead { margin-top: 1.1rem; font-size: var(--step-1); line-height: 1.4; color: var(--ink-soft); max-width: 34rem; }
.welcome__form { margin-top: 2rem; }
.welcome__form label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.welcome__form .row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.welcome__form input { flex: 1 1 14rem; }
.welcome__alt { margin-top: 1.5rem; color: var(--ink-soft); }

/* ---------------------------------------------------------- forms */

input[type="text"], input[type="date"], input[type="time"], input[type="number"], select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--sheet);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  min-height: 2.75rem;
  width: 100%;
  max-width: 100%;
}
textarea { resize: vertical; min-height: 4rem; }
input[type="number"] { width: 5.25rem; }
input::placeholder, textarea::placeholder { color: var(--ink-soft); opacity: 0.75; }
label, .label { font-weight: 600; }
.optional { font-weight: 400; color: var(--ink-soft); font-size: var(--step--1); }
.hint { color: var(--ink-soft); font-size: var(--step--1); margin-top: 0.35rem; font-weight: 400; }
.field-error { color: var(--warn); font-weight: 600; margin-top: 0.5rem; }
.fields { display: flex; flex-wrap: wrap; gap: 0.9rem 0.75rem; }
.field { flex: 1 1 100%; min-width: 0; }
.field > label, .field > .label { display: block; margin-bottom: 0.3rem; }
.field--half { flex: 1 1 calc(50% - 0.75rem); min-width: 8.5rem; }
.fields > .hint { flex: 1 1 100%; margin-top: -0.4rem; }
.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.inline label { font-weight: 400; }
.checks { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.checks label { font-weight: 400; display: flex; align-items: center; gap: 0.5rem; min-height: 2.5rem; }
input[type="checkbox"], input[type="radio"] { width: 1.2rem; height: 1.2rem; accent-color: var(--pen); margin: 0; }

.group { border: 0; border-top: 1.5px solid var(--ink); margin: 1.5rem 0 0; padding: 0.9rem 0 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 0.9rem 0.75rem; }
.group > legend { font-size: var(--step-1); font-weight: 650; padding: 0 0.6rem 0 0; float: left; width: 100%; margin-bottom: 0.2rem; }
.group > * { flex: 1 1 100%; }
.group > .field--half { flex: 1 1 calc(50% - 0.75rem); }
.group > .hint, .group > .btn-row { margin-top: 0; }

.swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.swatch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.swatch span {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  min-height: 2.5rem;
  color: #131c33;
  font-weight: 600;
  border: 1.5px solid transparent;
  border-radius: 0.3em 0.8em 0.35em 0.7em;
}
.swatch--yellow span { background: #ffe23f; }
.swatch--green span { background: #a4f07f; }
.swatch--pink span { background: #ffa3cf; }
.swatch--orange span { background: #ffb95e; }
.swatch--blue span { background: #93d6ff; }
.swatch input:checked + span { border-color: var(--ink); box-shadow: 0 0 0 2px var(--sheet), 0 0 0 4px var(--ink); }
.swatch input:focus-visible + span { outline: 3px solid var(--pen); outline-offset: 5px; }

/* ---------------------------------------------------------- dashboard */

.dash { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); }
.dash > .notice { margin-bottom: -0.75rem; }

.next__title { font-size: var(--step-0); font-weight: 600; color: var(--ink-soft); }
.next__day { font-size: var(--step-2); font-weight: 650; line-height: 1.15; margin-top: 0.15rem; letter-spacing: -0.01em; }
.next__time {
  font-size: clamp(2.5rem, 12.5vw, 4.75rem);
  font-weight: 780;
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin: 0.35rem 0 0.5rem -0.05em;
}
.next__time .mark { padding-inline: 0.16em 0.2em; }
.next__meta { font-size: var(--step-1); line-height: 1.35; }
.next__meta span { display: block; }
.next__meta .soft { color: var(--ink-soft); font-size: var(--step-0); }
.next__empty { font-size: var(--step-2); font-weight: 650; line-height: 1.2; margin-top: 0.15rem; max-width: 24rem; }
.next__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.1rem; }

.changes { border: 1.5px solid var(--ink); background: var(--sheet); border-radius: var(--radius); padding: 0.9rem 1rem 1rem; }
.changes h2 { font-size: var(--step-0); }
.changes ul { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.changes li { padding: 0.4rem 0; border-top: 1px solid var(--rule-soft); display: flex; flex-wrap: wrap; gap: 0.1rem 0.6rem; align-items: baseline; }
.changes li:first-child { border-top: 0; }
.changes .was { color: var(--ink-soft); text-decoration: line-through; }
.changes .btn-row { margin-top: 0.75rem; }

.tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1;
  padding: 0.22rem 0.42rem;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  white-space: nowrap;
}
.tag--new { color: var(--good); }
.tag--changed { color: var(--pen); }
.tag--removed { color: var(--warn); }
.tag--check { color: var(--ink-soft); }

/* The table: one row per week, your shifts highlighted. */
.rota__head, .list__head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.rota__nav { display: flex; align-items: center; }
.rota__scroll { background: var(--sheet); border: 1.5px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.rota__table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rota__table th {
  font-weight: 600;
  font-size: var(--step--1);
  padding: 0.4rem 0;
  border-bottom: 1.5px solid var(--ink);
  border-left: 1px solid var(--rule);
  background: var(--rule-soft);
}
.rota__table th:first-child, .rota__table td:first-child { border-left: 0; }
.rota__table abbr { text-decoration: none; }
#shift-google-wrap { margin-top: 0.9rem; }
.rota__table td { border-left: 1px solid var(--rule); border-top: 1px solid var(--rule); padding: 0; height: 4.4rem; vertical-align: top; }
.rota__table tr:first-child td { border-top: 0; }
.cell {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  width: 100%;
  height: 100%;
  min-height: 4.4rem;
  padding: 0.25rem 0.15rem 0.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  cursor: pointer;
  text-align: center;
}
.cell:hover { background: var(--rule-soft); }
.cell__num { font-size: 0.78rem; color: var(--ink-soft); line-height: 1.2; align-self: flex-start; padding-left: 0.2rem; }
.cell--past .cell__num, .cell--past .cell__shift { opacity: 0.55; }
.cell--today { box-shadow: inset 0 0 0 2.5px var(--pen); }
.cell--today .cell__num { color: var(--pen); font-weight: 700; }
.cell__shift {
  display: block;
  background: var(--hl);
  color: var(--on-hl);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.15;
  padding: 0.16rem 0.2rem 0.2rem;
  border-radius: 0.3em 0.7em 0.35em 0.6em;
  transform: rotate(-1.2deg);
  width: calc(100% - 0.2rem);
  white-space: nowrap;
  overflow: hidden;
}
.cell__shift span { display: block; }
.cell__shift--long { font-size: 0.68rem; letter-spacing: -0.03em; padding-inline: 0; width: 100%; }
.cell__more { font-size: 0.72rem; color: var(--ink-soft); }
.rota__totals { margin-top: 0.7rem; color: var(--ink-soft); }
.rota__totals strong { color: var(--ink); font-weight: 650; }

/* Upcoming list */
.list h3 { color: var(--ink-soft); font-weight: 600; font-size: var(--step--1); padding: 0.9rem 0 0.3rem; border-bottom: 1.5px solid var(--ink); }
.list h3:first-child { padding-top: 0.2rem; }
.shift {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr) auto;
  gap: 0.15rem 0.75rem;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--rule);
}
.shift__day { text-align: center; line-height: 1.05; }
.shift__dow { display: block; font-size: var(--step--1); color: var(--ink-soft); font-weight: 600; }
.shift__num { display: block; font-size: var(--step-2); font-weight: 700; letter-spacing: -0.02em; }
.shift__time { font-weight: 650; font-size: 1.0625rem; }
.shift__sub { color: var(--ink-soft); font-size: var(--step--1); display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; align-items: center; margin-top: 0.1rem; }
.list__empty { padding: 1rem 0; color: var(--ink-soft); }
.past { margin-top: 1.25rem; }
.past summary { cursor: pointer; color: var(--pen); font-weight: 600; padding: 0.5rem 0; }
.past .shift { opacity: 0.7; }

@media (min-width: 56rem) {
  .page { padding-top: 2.25rem; }
  .dash { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); column-gap: 3.5rem; align-items: start; }
  .dash > .notice { grid-column: 1 / -1; }
  .next, .changes, .rota { grid-column: 1; }
  .list { grid-column: 2; grid-row: 2 / span 4; }
  .dash:not(:has(#banner:not([hidden]))) .list { grid-row: 1 / span 4; }
  .cell__shift, .cell__shift--long { font-size: 0.875rem; letter-spacing: 0; }
}

/* ---------------------------------------------------------- dialogs */

.dlg {
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  padding: 0;
  width: min(32rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  overflow: auto;
  overscroll-behavior: contain;
}
.dlg--wide { width: min(40rem, calc(100vw - 1.5rem)); }
.dlg::backdrop { background: rgba(19, 28, 51, 0.55); }
.dlg__in { padding: 1.25rem 1.1rem 1.1rem; }
.dlg h2 { font-size: var(--step-2); letter-spacing: -0.01em; margin-bottom: 0.9rem; outline: none; }
.dlg p + p { margin-top: 0.6rem; }
.dlg__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.4rem; align-items: center; }
.dlg__actions:empty { display: none; }

@media (max-width: 34rem) {
  .dlg {
    width: 100vw;
    max-width: 100vw;
    margin: auto 0 0;
    border-radius: 14px 14px 0 0;
    border-width: 1.5px 0 0;
    max-height: 92dvh;
  }
  .dlg__in { padding-bottom: calc(1.1rem + env(safe-area-inset-bottom)); }
  .dlg__actions .btn--primary { flex: 1 1 auto; }
  .top__actions .btn { padding-inline: 0.4rem; }
}

.notice--check { border-left-color: var(--hl); display: block; margin-bottom: 0.75rem; }
.photo { margin-bottom: 0.9rem; }
.photo > summary { padding: 0.2rem 0; }
.photo__frame { margin-top: 0.4rem; max-height: 36dvh; overflow: auto; border: 1.5px solid var(--ink); border-radius: var(--radius); background: var(--sheet); overscroll-behavior: contain; }
.photo__frame img { display: block; width: max(100%, 44rem); height: auto; }
.pick { list-style: none; margin: 0.75rem 0 0; padding: 0; max-height: 45dvh; overflow: auto; border: 1.5px solid var(--ink); border-radius: var(--radius); background: var(--sheet); }
.pick li + li { border-top: 1px solid var(--rule); }
.pick button { font: inherit; color: inherit; background: none; border: 0; width: 100%; text-align: left; padding: 0.7rem 0.8rem; min-height: 2.75rem; cursor: pointer; }
.pick button:hover { background: var(--rule-soft); }

.review { list-style: none; margin: 0.75rem 0 0; padding: 0; border-top: 1.5px solid var(--ink); }
.review li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid var(--rule); }
.review .when { font-weight: 650; min-width: 6.5rem; }
.review .was { color: var(--ink-soft); text-decoration: line-through; }
.review .gone { color: var(--ink-soft); text-decoration: line-through; }
.choice { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.6rem 0; font-weight: 400; }
.choice input { margin-top: 0.2rem; flex: none; }
.choice strong { font-weight: 650; display: block; }
.choice small { color: var(--ink-soft); font-size: var(--step--1); }
.addlist { list-style: none; margin: 0.75rem 0 0; padding: 0; border-top: 1.5px solid var(--ink); }
.addlist li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 0.25rem 0.6rem; padding: 0.45rem 0; border-bottom: 1px solid var(--rule); }
.addlist__when { display: flex; flex-direction: column; line-height: 1.25; }
.addlist__when strong { font-weight: 650; }
.addlist__state { color: var(--good); font-weight: 650; font-size: var(--step--1); }
.addlist .is-added .addlist__when { color: var(--ink-soft); }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.more { margin-top: 1.1rem; border-top: 1px solid var(--rule); padding-top: 0.8rem; }
.more > summary { padding: 0.25rem 0; }
.more > p:first-of-type { margin-top: 0.6rem; }
.steps { margin: 0.75rem 0 0; padding-left: 1.2rem; }
.steps li { margin-top: 0.3rem; }
.busy { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0; }
.busy::before {
  content: "";
  width: 1.1rem;
  height: 1.1rem;
  border: 2.5px solid var(--rule);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.8rem; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.75rem; max-height: 16rem; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0.5rem 0 0; }
details > summary { cursor: pointer; color: var(--pen); font-weight: 600; }

/* ---------------------------------------------------------- toast, drop */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translate(-50%, 1rem);
  background: var(--ink);
  color: var(--paper);
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  max-width: calc(100vw - 2rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 60;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.drop {
  position: fixed;
  inset: 0.75rem;
  border: 3px dashed var(--ink);
  border-radius: 14px;
  background: color-mix(in srgb, var(--hl) 88%, transparent);
  color: var(--on-hl);
  display: grid;
  place-items: center;
  font-size: var(--step-2);
  font-weight: 700;
  z-index: 70;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
  .busy::before { animation-duration: 2.4s; }
  .btn:active { transform: none; }
}

@media print {
  .top__actions, .next__actions, .rota__nav, .foot, .toast, .list__head .btn, .shift .btn { display: none !important; }
  body { background: #fff; }
}
