/* ============================================================
   Our Day — styles
   Base palette vars, chrome, hold buttons and form bases come
   from toolshed-common.css (loads first). This file adds the
   schedule board and the week builder only.
   ============================================================ */

.wrap {
  max-width: 940px;
  margin: 0 auto;
  padding: 1.2rem 1.1rem 2.5rem;
}
.wrap.wide { max-width: 1240px; }

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.5rem; margin: 0 0 .2rem; }
h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0; }

.meta, .hint {
  color: var(--dim);
  font-size: .92rem;
  margin: .2rem 0 .9rem;
}
.hint { font-size: .85rem; }

/* ---------- Day heading ---------- */
.day-head {
  display: flex;
  align-items: center;
  gap: .7rem;
  flex-wrap: wrap;
  margin-bottom: .9rem;
}
.day-pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .2rem .7rem;
  font-size: .8rem;
  font-weight: 700;
  color: var(--dim);
}
.day-pill.on { color: var(--accent2); border-color: var(--accent2); }

/* ---------- Gentle reminder banner ---------- */
.reminder-banner {
  display: flex;
  align-items: center;
  gap: .7rem;
  background: var(--hold-bg);
  border: 1.5px solid var(--hold-border);
  color: var(--hold-text);
  border-radius: 12px;
  padding: .7rem .9rem;
  margin-bottom: .9rem;
  animation: bannerIn .4s ease;
}
.reminder-banner[hidden] { display: none; }
@keyframes bannerIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.banner-band {
  width: 8px;
  align-self: stretch;
  border-radius: 4px;
  background: var(--hold-text);
  flex-shrink: 0;
}
.banner-text { margin: 0; font-weight: 700; flex: 1; }
.banner-x {
  background: transparent;
  border: 1px solid var(--hold-border);
  color: var(--hold-text);
  border-radius: 8px;
  width: 2rem;
  height: 2rem;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.banner-x:hover { background: rgba(0,0,0,.06); }

/* ---------- Now / Next cards ---------- */
.now-next {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: .8rem;
  margin-bottom: 1rem;
}

.now-card {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem 1.1rem 1.3rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.now-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 8px;
  background: var(--band, var(--accent));
}
/* Next card hidden (day over / setting off): let Now take the full width. */
.now-next:has(.next-card[hidden]) { grid-template-columns: 1fr; }

.now-kicker {
  margin: 0;
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--dim);
}
.now-subject {
  margin: .1rem 0 .1rem;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text);
  overflow-wrap: anywhere;
}
.now-where { margin: 0; color: var(--accent); font-weight: 700; }
.now-range { margin: .1rem 0 0; color: var(--dim); font-size: .9rem; }
.now-left {
  margin: .5rem 0 .1rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.now-progress {
  height: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: .4rem;
}
.now-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--band, var(--accent));
  border-radius: 999px;
  transition: width 1s linear;
}
.now-note {
  margin: .5rem 0 0;
  font-size: .9rem;
  color: var(--dim);
  font-style: italic;
}
.now-cta { margin: .6rem 0 0; font-size: .92rem; }
.now-cta:empty { display: none; }

.now-card:not([data-mode="now"]) .now-progress,
.now-card:not([data-mode="now"]) .now-note { display: none; }
.now-card[data-mode="now"] .now-cta { display: none; }
.now-card:not([data-mode="now"]) .now-range { display: none; }
.now-card:has(.now-cta:empty) { padding-bottom: 1rem; }

.next-card {
  background: var(--surface);
  border: 1.5px dashed var(--border-strong);
  border-radius: 16px;
  padding: .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  justify-content: center;
}
.next-card[hidden] { display: none; }
.next-kicker {
  margin: 0;
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--dim);
}
.next-line { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.next-where { margin: 0; color: var(--dim); font-size: .88rem; }

.color-chip {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  display: inline-block;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,.15);
}

/* ---------- Check-off list ---------- */
.list-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: .9rem 1rem 1rem;
}
.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.list-count { color: var(--dim); font-size: .85rem; font-weight: 700; }

.block-list {
  list-style: none;
  margin: .4rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.block-row {
  display: flex;
  align-items: center;
  gap: .7rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: .55rem .75rem;
}
.block-row[data-state="now"] {
  border-color: var(--band, var(--accent));
  background: var(--surface-2);
  box-shadow: inset 4px 0 0 var(--band, var(--accent));
}
.block-row[data-state="next"] { border-style: dashed; }
.block-row[data-state="done"] { opacity: .62; }
.block-row[data-state="past"] { opacity: .78; }

.check-btn {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: transparent;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.check-btn:hover { border-color: var(--accent); }
.check-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.block-row[data-state="done"] .check-btn {
  background: var(--accent2);
  border-color: var(--accent2);
  color: #fff;
}

.block-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.block-subject { font-weight: 700; overflow-wrap: anywhere; }
.block-row[data-state="done"] .block-subject { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.block-meta { color: var(--dim); font-size: .85rem; }

.block-state {
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-radius: 999px;
  padding: .18rem .6rem;
  flex-shrink: 0;
  background: var(--surface-2);
  color: var(--dim);
  border: 1px solid var(--border);
}
.block-row[data-state="now"] .block-state {
  background: var(--band, var(--accent));
  color: #fff;
  border-color: transparent;
}
.block-row[data-state="next"] .block-state { color: var(--accent); border-color: var(--accent); }
.block-row[data-state="done"] .block-state { color: var(--accent2); border-color: var(--accent2); }

/* ---------- Setup: intro actions ---------- */
.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: .6rem 0 1.4rem;
}
.ghost-btn.small {
  padding: .35rem .7rem;
  font-size: .85rem;
  border-radius: 8px;
}
.ghost-btn.danger { color: #b04a3a; border-color: #e0b9b2; }
.ghost-btn.danger:hover { background: #fbeeea; border-color: #b04a3a; }
.file-btn { cursor: pointer; }
[data-theme="dark"] .ghost-btn.danger,
[data-theme="midnight"] .ghost-btn.danger,
[data-theme="high"] .ghost-btn.danger,
[data-theme="warm"] .ghost-btn.danger { color: #ff9c86; border-color: #7a4a40; }
[data-theme="dark"] .ghost-btn.danger:hover,
[data-theme="midnight"] .ghost-btn.danger:hover,
[data-theme="high"] .ghost-btn.danger:hover,
[data-theme="warm"] .ghost-btn.danger:hover { background: #3a221c; }

/* ---------- Setup: week grid ---------- */
.week-scroll { overflow-x: auto; padding-bottom: .4rem; }
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(140px, 1fr));
  gap: .55rem;
  min-width: 1040px;
  align-items: start;
}
.day-col {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: .55rem .5rem .6rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  min-height: 140px;
}
.day-col.day-off { opacity: .62; background: var(--surface-2); }
.day-col-head { display: flex; flex-direction: column; gap: .2rem; }
.day-col-head h3 { color: var(--accent); font-size: .95rem; }
.day-on {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--dim);
  cursor: pointer;
}
.day-on input { margin: 0; accent-color: var(--accent2); }

.day-blocks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  flex: 1;
}
.bcard-empty {
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: .7rem .5rem;
  text-align: center;
  color: var(--dim);
  font-size: .8rem;
}
.bcard { margin: 0; }
.bcard-open {
  display: flex;
  flex-direction: column;
  gap: .05rem;
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 5px solid var(--c, var(--accent));
  border-radius: 9px;
  padding: .45rem .55rem;
  cursor: pointer;
  color: var(--text);
}
.bcard-open:hover { border-color: var(--c, var(--accent)); background: var(--surface-2); }
.bcard-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.bcard-time { font-size: .72rem; font-weight: 700; color: var(--dim); }
.bcard-subject { font-size: .88rem; font-weight: 700; overflow-wrap: anywhere; }
.bcard-loc { font-size: .72rem; color: var(--dim); overflow-wrap: anywhere; }

.day-actions { display: flex; gap: .35rem; }
.day-actions .ghost-btn { flex: 1; padding: .35rem .4rem; font-size: .8rem; }

/* ---------- Setup: settings ---------- */
.settings-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem 1.2rem;
  margin-top: 1.4rem;
}
.settings-card h2:not(:first-child) { margin-top: 1.3rem; }

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.set-row:last-of-type { border-bottom: none; }
.set-label { font-weight: 700; font-size: .93rem; }
.set-hint { display: block; font-weight: 400; font-size: .8rem; color: var(--dim); margin-top: .1rem; }
.set-row select,
.set-row input[type="checkbox"] {
  font-size: .92rem;
  accent-color: var(--accent);
}
.set-row select {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .35rem .5rem;
}
.notify-status { font-size: .8rem; color: var(--dim); width: 100%; margin: .1rem 0 0; }

/* Theme picker (markup consumed by toolshed-common) */
.theme-wrap { position: relative; display: inline-block; }
#themePanel { right: 0; left: auto; }

/* ---------- Dialogs ---------- */
dialog {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 1.1rem 1.2rem 1.2rem;
  width: min(460px, 92vw);
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
dialog::backdrop { background: rgba(15, 20, 26, .45); }
dialog h2 { margin-top: 0; }
dialog label {
  display: block;
  font-size: .85rem;
  font-weight: 700;
  margin: .6rem 0 .15rem;
}
dialog input[type="text"],
dialog input[type="time"],
dialog select {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .5rem .6rem;
  font-size: 1rem;
}
.time-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.color-row {
  border: none;
  padding: 0;
  margin: .7rem 0 0;
}
.color-row legend {
  font-size: .85rem;
  font-weight: 700;
  padding: 0;
  margin-bottom: .35rem;
}
.swatches { display: flex; flex-wrap: wrap; gap: .4rem; }
.swatch {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 2px solid rgba(0,0,0,.12);
  cursor: pointer;
  padding: 0;
}
.swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch.active { outline: 2.5px solid var(--text); outline-offset: 2px; }
.custom-color {
  display: inline-flex !important;
  align-items: center;
  gap: .4rem;
  margin: .5rem 0 0 !important;
  font-weight: 600 !important;
  color: var(--dim);
  cursor: pointer;
}
.custom-color input[type="color"] {
  width: 42px;
  height: 30px;
  padding: 0;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}
.form-warn {
  background: var(--hold-bg);
  border: 1px solid var(--hold-border);
  color: var(--hold-text);
  border-radius: 8px;
  padding: .45rem .6rem;
  font-size: .87rem;
  font-weight: 600;
  margin: .7rem 0 0;
}
.form-warn[hidden] { display: none; }
.dlg-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.dlg-actions .ghost-btn { padding: .5rem .8rem; font-size: .9rem; }
#fDup, #fDel { display: none; }
dialog.editing #fDup, dialog.editing #fDel { display: inline-flex; }

/* ---------- Day tracker (a smooth clock down the school day) ---------- */
.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 1rem;
  align-items: stretch;
}
.day-track {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: .9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
}
.track-head {
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--dim);
}
.track-rail {
  position: relative;
  flex: 1;
  min-height: 300px;
  margin-top: .5rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
}
.track-seg {
  position: absolute;
  left: 8px;
  right: 8px;
  background: var(--band, var(--accent));
  border-radius: 7px;
  opacity: .78;
  overflow: hidden;
  transition: opacity .3s ease, box-shadow .3s ease;
}
.track-seg.is-done { opacity: .28; }
.track-seg.is-now {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--band, var(--accent));
}
.track-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: .15rem .5rem;
  font-size: .7rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-label[hidden] { display: none; }

.track-marker {
  position: absolute;
  left: 2px;
  right: 2px;
  top: 0;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: .3rem;
  pointer-events: none;
  transition: top 1s linear, opacity .3s ease;
  z-index: 2;
}
.track-dot {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid var(--surface);
  box-shadow: 0 0 0 1.5px var(--accent);
}
.track-line {
  flex: 1;
  height: 2px;
  background: var(--accent);
  opacity: .75;
}
.track-clock {
  flex-shrink: 0;
  font-size: .7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: .1rem .45rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--surface);
}
.track-marker.parked { opacity: .4; }
.track-foot {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  margin-top: .4rem;
  font-size: .75rem;
  font-weight: 700;
  color: var(--dim);
}

/* Encouraging notes fade in when the day's note rotates. */
@keyframes encFade {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}
.now-subject.enc-fade { animation: encFade .55s ease; }

/* Our Day's nav links double as 1s hold buttons (the site's own nav
   stays plain links) — keep them looking like nav, not pills. */
.site-nav a.hold-btn {
  padding: .3rem .75rem;
  font-size: .9rem;
  color: var(--accent);
}
.site-nav a.hold-btn[aria-current="page"] {
  color: var(--text);
  font-weight: 700;
  border-color: var(--accent);
}
.site-nav a.hold-btn:hover { border-color: var(--accent); }
.site-nav a.hold-btn .hold-track { width: 1rem; height: 1rem; }

/* ---------- Today fits the screen ----------
   The class needs to see the whole day at once, so the Today page
   never scrolls: ourday.js measures the page and scales <body>
   down to the viewport (never up), then re-fits whenever the
   content or window changes size. The viewport is locked while
   scaled so a stale fit can never produce a scrollbar. Setup
   keeps its normal scrolling layout. */

body[data-page="today"] {
  overflow: hidden;
  transform-origin: top center;
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .now-next { grid-template-columns: 1fr; }
  .now-subject { font-size: 1.4rem; }
  .block-row { flex-wrap: wrap; }
  .block-state { order: 3; }
  .set-row { flex-direction: column; align-items: flex-start; gap: .4rem; }
  .list-row { grid-template-columns: 1fr; }
  .day-track { order: -1; }
  .track-rail { min-height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  .now-fill { transition: none; }
  .reminder-banner { animation: none; }
  .track-marker { transition: none; }
  .track-seg { transition: none; }
  .now-subject.enc-fade { animation: none; }
}
