/* ──────────────────────────────────────────────────────────────────────
   Operations Desk — factory-ledger system
   paper + ink + brass · Bricolage Grotesque / IBM Plex Mono
   ────────────────────────────────────────────────────────────────────── */

:root {
  --paper: #f5efe3;
  --paper-2: #ede3d0;
  --paper-3: #e4d8c0;
  --ink: #1c2b3a;
  --ink-soft: #46586c;
  --ink-faint: rgba(28, 43, 58, 0.14);
  --brass: #a3792c;
  --brass-bright: #c9a24b;
  --steel: #3e6c8e;
  --amber: #b65c2a;
  --green: #2f5d46;
  --white: #fdfaf3;
  --shadow: 0 2px 0 rgba(28, 43, 58, 0.16);
  --shadow-lift: 0 10px 28px -14px rgba(28, 43, 58, 0.45);
  --font-display: "Bricolage Grotesque", "Avenir Next", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --pad-x: clamp(1.25rem, 4vw, 4rem);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-display);
  font-weight: 400;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  font-size: 1.0625rem;
  position: relative;
}

/* paper grain over everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.mono { font-family: var(--font-mono); }

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

a { color: inherit; }

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

/* ── Top bar ─────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.7rem var(--pad-x);
}

.wordmark { display: flex; align-items: baseline; gap: 0.6rem; }

.wordmark-initials {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--white);
  background: var(--ink);
  padding: 0.28rem 0.45rem;
  border-radius: 3px;
}

.wordmark-title {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.topnav {
  display: flex;
  gap: 1.4rem;
  margin-inline: auto;
}

.topnav a {
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color 160ms ease, border-color 160ms ease;
}

.topnav a:hover { color: var(--ink); border-bottom-color: var(--brass); }

.topbar-date {
  font-size: 0.78rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ── Status band ─────────────────────────────────────────────────────── */

.status {
  border-bottom: 2px solid var(--ink);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0 30px,
      rgba(28, 43, 58, 0.055) 30px 31px
    ),
    var(--paper-2);
  overflow: hidden;
}

.status-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(2rem, 5vw, 5rem);
  padding: clamp(3rem, 7vw, 5.5rem) var(--pad-x);
}

.kicker {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 1rem;
}

.status h1 {
  font-size: clamp(2.1rem, 5.4vw, 3.9rem);
  font-weight: 750;
  line-height: 1.04;
  letter-spacing: -0.025em;
  max-width: 14ch;
}

.status h1 em {
  font-style: italic;
  font-weight: 650;
  color: var(--brass);
}

.status-note {
  margin-top: 1.1rem;
  max-width: 44ch;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

.progress {
  margin-top: 1.6rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  max-width: 26rem;
}

.progress-track {
  flex: 1;
  height: 8px;
  border: 1.5px solid var(--ink);
  border-radius: 99px;
  background: var(--paper);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brass), var(--brass-bright));
  transition: width 500ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.progress-count { font-size: 0.8rem; color: var(--ink-soft); }

/* the day stamp */
.day-stamp {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 1.4rem 1.9rem 1.2rem;
  border: 3px double var(--brass);
  border-radius: 10px;
  color: var(--brass);
  transform: rotate(-3.5deg);
  background: rgba(253, 250, 243, 0.55);
  box-shadow: var(--shadow-lift);
  animation: stamp-in 600ms cubic-bezier(0.2, 1.4, 0.3, 1) both;
  animation-delay: 250ms;
}

@keyframes stamp-in {
  from { transform: rotate(-3.5deg) scale(1.5); opacity: 0; }
  to   { transform: rotate(-3.5deg) scale(1);   opacity: 1; }
}

.day-stamp-word { font-size: 0.8rem; letter-spacing: 0.35em; font-weight: 600; }

.day-stamp-num {
  font-size: clamp(3.2rem, 6vw, 4.6rem);
  font-weight: 600;
  line-height: 1;
}

.day-stamp-sub {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ── Sections ────────────────────────────────────────────────────────── */

.section { padding: clamp(3rem, 6vw, 4.75rem) var(--pad-x); }

.section-head { margin-bottom: 2.2rem; max-width: 60rem; }

.section-head h2 {
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
}

.section-head .index {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brass);
  letter-spacing: 0.1em;
}

.section-sub { margin-top: 0.5rem; color: var(--ink-soft); max-width: 58ch; }

/* ── Day cards ───────────────────────────────────────────────────────── */

.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 1.1rem;
}

.day {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
  position: relative;
  transition: box-shadow 180ms ease, transform 180ms ease;
}

.day[open] { box-shadow: var(--shadow-lift); }

.day:hover { transform: translateY(-2px); }

.day summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1.1rem;
  user-select: none;
}

.day summary::-webkit-details-marker { display: none; }

.day-num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.78rem;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  padding: 0.3rem 0.45rem;
  background: var(--paper);
  white-space: nowrap;
}

.day-title { font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em; flex: 1; }

.day-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.day-chev {
  width: 9px; height: 9px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: rotate(45deg);
  transition: transform 180ms ease;
  flex-shrink: 0;
  margin-left: 0.15rem;
}

.day[open] .day-chev { transform: rotate(-135deg) translate(-2px, -2px); }

.day.is-today { border-color: var(--brass); border-width: 2.5px; }

.day.is-today::before {
  content: "TODAY";
  position: absolute;
  top: -0.85rem;
  right: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--white);
  background: var(--brass);
  padding: 0.22rem 0.5rem;
  border-radius: 3px;
}

.day-tasks {
  border-top: 1.5px dashed var(--ink-faint);
  padding: 0.5rem 1.1rem 1rem;
}

.task {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.55rem 0;
  cursor: pointer;
}

.task + .task { border-top: 1px solid rgba(28, 43, 58, 0.07); }

.task input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
}

.task-box {
  flex-shrink: 0;
  width: 1.05rem; height: 1.05rem;
  border: 2px solid var(--ink);
  border-radius: 3px;
  margin-top: 0.22rem;
  display: grid;
  place-items: center;
  background: var(--white);
  transition: background 150ms ease, border-color 150ms ease;
}

.task-box::after {
  content: "";
  width: 0.5rem; height: 0.3rem;
  border-left: 2.5px solid var(--white);
  border-bottom: 2.5px solid var(--white);
  transform: rotate(-45deg) scale(0);
  transform-origin: center;
  transition: transform 160ms cubic-bezier(0.2, 1.4, 0.3, 1);
  margin-top: -2px;
}

.task input:checked + .task-box { background: var(--brass); border-color: var(--brass); }
.task input:checked + .task-box::after { transform: rotate(-45deg) scale(1); }
.task input:focus-visible + .task-box { outline: 2px solid var(--brass); outline-offset: 2px; }

.task-text {
  font-size: 0.94rem;
  position: relative;
  color: var(--ink);
  transition: color 200ms ease;
}

.task-text::after {
  content: "";
  position: absolute;
  left: 0; top: 55%;
  width: 100%;
  height: 1.5px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.task input:checked ~ .task-text { color: var(--ink-soft); }
.task input:checked ~ .task-text::after { transform: scaleX(1); }

/* ── Question bank ───────────────────────────────────────────────────── */

.qbank {
  margin-top: 2.4rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper-2);
  padding: 1.5rem 1.7rem 1.6rem;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 30px,
    rgba(28, 43, 58, 0.05) 30px 31px
  );
}

.qbank-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
}

.qbank-sub { font-size: 0.9rem; color: var(--ink-soft); margin-top: 0.25rem; }

.qbank-list {
  margin-top: 1.1rem;
  columns: 2;
  column-gap: 3rem;
  padding-left: 1.2rem;
}

.qbank-list li {
  font-weight: 600;
  font-size: 0.98rem;
  padding: 0.32rem 0;
  break-inside: avoid;
}

.qbank-list li::marker {
  font-family: var(--font-mono);
  color: var(--brass);
  font-size: 0.85rem;
}

/* ── Businesses ──────────────────────────────────────────────────────── */

.biz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.2rem;
}

.biz {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  padding: 1.5rem 1.5rem 1.4rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.biz:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }

.biz::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 7px;
  background: var(--accent, var(--brass));
}

.biz[data-key="steel"] { --accent: var(--steel); }
.biz[data-key="products"] { --accent: var(--amber); }
.biz[data-key="properties"] { --accent: var(--green); }

.biz-kind {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent, var(--brass));
}

.biz h3 {
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  margin-top: 0.3rem;
}

.biz-desc { margin-top: 0.6rem; font-size: 0.93rem; color: var(--ink-soft); }

.biz-lists { margin-top: 1.1rem; display: grid; gap: 0.9rem; }

.biz-list-title {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.biz ul { list-style: none; margin-top: 0.35rem; }

.biz ul li {
  font-size: 0.92rem;
  font-weight: 550;
  padding: 0.22rem 0 0.22rem 1.1rem;
  position: relative;
}

.biz ul li::before {
  content: "→";
  position: absolute;
  left: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent, var(--brass));
}

/* ── Targets (dark band) ─────────────────────────────────────────────── */

.section-dark {
  background: var(--ink);
  color: var(--paper);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  background-image: radial-gradient(
    rgba(245, 239, 227, 0.07) 1px,
    transparent 1px
  );
  background-size: 22px 22px;
}

.section-dark .section-sub { color: rgba(245, 239, 227, 0.65); }
.section-dark .index { color: var(--brass-bright); }

.target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 0.9rem;
}

.target {
  border: 1.5px solid rgba(245, 239, 227, 0.35);
  border-radius: 7px;
  padding: 1rem 1.1rem;
  background: rgba(245, 239, 227, 0.04);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.target:hover { border-color: var(--brass-bright); transform: translateY(-2px); }

.target-label { font-weight: 650; font-size: 0.97rem; line-height: 1.35; }

.target-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.target-source {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: rgba(245, 239, 227, 0.55);
  letter-spacing: 0.06em;
}

.target-state {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  padding: 0.24rem 0.55rem;
  border-radius: 3px;
  border: 1.5px solid rgba(245, 239, 227, 0.4);
  color: rgba(245, 239, 227, 0.65);
}

.target.is-done {
  border-color: var(--brass-bright);
  background: rgba(201, 162, 75, 0.12);
}

.target.is-done .target-state {
  border-color: var(--brass-bright);
  background: var(--brass-bright);
  color: var(--ink);
}

.target.is-done .target-label {
  color: rgba(245, 239, 227, 0.75);
}

/* ── Evening note ────────────────────────────────────────────────────── */

.note-wrap {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
  max-width: 62rem;
}

.note-toolbar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 1rem;
  border-bottom: 1.5px dashed var(--ink-faint);
  flex-wrap: wrap;
}

.note-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }

#note-picker {
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
}

.note-status { font-size: 0.72rem; color: var(--brass); margin-left: auto; min-width: 4.5rem; text-align: right; }

.note-copy {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.32rem 0.7rem;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: background 150ms ease;
}

.note-copy:hover { background: var(--paper-3); }

#note-text {
  display: block;
  width: 100%;
  border: none;
  resize: vertical;
  padding: 1.1rem 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.9;
  color: var(--ink);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0 calc(1.9 * 0.9rem - 1px),
      rgba(28, 43, 58, 0.1) calc(1.9 * 0.9rem - 1px) calc(1.9 * 0.9rem)
    );
  background-attachment: local;
  border-radius: 0 0 6px 6px;
}

#note-text:focus { outline: none; }

/* ── Software bench ──────────────────────────────────────────────────── */

.bench {
  border-top: 2px solid var(--ink);
  background: var(--paper-2);
}

.bench-inner {
  padding: 2rem var(--pad-x);
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.bench-tag {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--white);
  background: var(--ink-soft);
  padding: 0.3rem 0.6rem;
  border-radius: 3px;
  white-space: nowrap;
}

.bench p { color: var(--ink-soft); font-size: 0.95rem; max-width: 60ch; }

/* ── Footer ──────────────────────────────────────────────────────────── */

.footer {
  border-top: 2px solid var(--ink);
  background: var(--ink);
  color: rgba(245, 239, 227, 0.75);
}

.footer-inner {
  padding: 1.4rem var(--pad-x);
  display: flex;
  align-items: center;
  gap: 1.2rem;
  font-size: 0.74rem;
  flex-wrap: wrap;
}

.footer-rule { flex: 1; height: 1px; background: rgba(245, 239, 227, 0.25); min-width: 3rem; }

/* ── Load reveal ─────────────────────────────────────────────────────── */

.status-copy > * {
  animation: rise 550ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.status-copy > *:nth-child(2) { animation-delay: 70ms; }
.status-copy > *:nth-child(3) { animation-delay: 140ms; }
.status-copy > *:nth-child(4) { animation-delay: 210ms; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .status-inner { flex-direction: column-reverse; align-items: flex-start; gap: 2.2rem; }
  .day-stamp { align-self: flex-end; margin-top: 0.5rem; }
  .qbank-list { columns: 1; }
  .topnav { display: none; }
  .topbar-inner { justify-content: space-between; }
}

@media (max-width: 560px) {
  body { font-size: 1rem; }
  .day-grid, .biz-grid, .target-grid { grid-template-columns: 1fr; }
  .day-meta { display: none; }
  .note-status { min-width: 0; }
}

/* ── Reduced motion ──────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
