@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=Public+Sans:wght@400;500;600&display=swap");

/* ---------- Tokens ---------- */
:root {
  --ink: #1b262c;
  --steel: #2c4252;
  --steel-dark: #213443;
  --crayon: #f0b429;
  --paper: #eceee9;
  --surface: #ffffff;
  --line: #d3d8d1;
  --muted: #5a6670;

  --amber-bg: #fbeec1;  --amber: #6b4e00;
  --blue-bg: #dbe8f3;   --blue: #1f4a6b;
  --good-bg: #d9efe1;   --good: #1d5a37;
  --bad-bg: #f6dada;    --bad: #8a2323;

  --display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.1;
  margin: 0 0 0.5rem;
}
h2 { font-size: 2.1rem; }
h3 { font-size: 1.5rem; }

p { margin: 0 0 0.9rem; }
a { color: var(--steel); }
a:hover { color: var(--ink); }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

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

/* ---------- Header and navigation ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: 0.75rem 1.5rem;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.18);
}

header h1 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-size: 1.7rem;
  font-weight: 700;
  color: #fff;
}

/* End of a log: growth rings, so it reads as a logo and not a menu icon */
header h1::before {
  content: "";
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, var(--crayon) 0 3px, transparent 3px 6px);
}

/* The whole logo (mark and name) links to the home page */
header h1 { position: relative; }
header h1 a { color: inherit; text-decoration: none; }
header h1 a::after { content: ""; position: absolute; inset: 0; }

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
}

nav a {
  color: #c4d0d8;
  text-decoration: none;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
  font-weight: 500;
}
nav a:hover { color: #fff; }
nav a.active { color: #fff; border-bottom-color: var(--crayon); }

nav a.nav-cta {
  background: var(--crayon);
  color: var(--ink);
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  border-bottom: 0;
  font-weight: 600;
}
nav a.nav-cta:hover { background: #ffc94d; color: var(--ink); }

nav a.nav-logout {
  border: 1px solid #4b6070;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
}
nav a.nav-logout:hover { border-color: #fff; }

nav .nav-user {
  color: #fff;
  font-size: 0.9rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

/* ---------- Page layout ---------- */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.page-head h2 { margin-bottom: 0.15rem; }
.page-head p { margin: 0; }

footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--line);
}

/* ---------- Buttons ---------- */
button, .btn {
  display: inline-block;
  font-family: var(--body);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  color: #fff;
  background: var(--steel);
  border: 1px solid var(--steel);
  border-radius: 4px;
  padding: 0.65rem 1.2rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
button:hover, .btn:hover { background: var(--steel-dark); border-color: var(--steel-dark); color: #fff; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.secondary, button.secondary {
  background: transparent;
  color: var(--steel);
  border-color: var(--steel);
}
.btn.secondary:hover, button.secondary:hover { background: var(--steel); color: #fff; }

.btn.accent {
  background: var(--crayon);
  border-color: var(--crayon);
  color: var(--ink);
}
.btn.accent:hover { background: #ffc94d; border-color: #ffc94d; color: var(--ink); }

td button { padding: 0.35rem 0.75rem; font-size: 0.85rem; }

/* Space between buttons, drop-downs, and boxes in a cell, including when they wrap */
td button, td select, td input {
  margin: 0.2rem 0.4rem 0.2rem 0;
}

/* ---------- Forms ---------- */
main > form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 420px;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

label { font-weight: 500; font-size: 0.9rem; margin-top: 0.4rem; }

input, select {
  font-family: var(--body);
  font-size: 1rem;
  color: var(--ink);
  padding: 0.6rem 0.7rem;
  background: #fff;
  border: 1px solid #aeb7b0;
  border-radius: 4px;
  max-width: 100%;
}
input:focus, select:focus {
  outline: 3px solid var(--crayon);
  outline-offset: 0;
  border-color: var(--steel);
}
input[type="file"] { padding: 0.45rem; border-style: dashed; font-size: 0.9rem; }

form button[type="submit"] { margin-top: 0.8rem; }

#login-message, #register-message, #add-message, #pay-message {
  min-height: 1.4em;
  font-weight: 500;
}

/* Two-column form inside a panel */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.panel h3 { margin-bottom: 0.9rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem 1rem;
}
.form-grid .field { display: flex; flex-direction: column; gap: 0.3rem; }
.form-grid label { margin-top: 0; }
.form-grid .form-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 1rem; }
.form-grid .form-actions button { margin-top: 0; }
.form-grid .form-actions p { margin: 0; }

/* ---------- Tables (tally sheet) ---------- */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
}
th {
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
  background: #e5e9e3;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
}
th:first-child { border-top-left-radius: 7px; }
th:last-child { border-top-right-radius: 7px; }
td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f6f8f5; }
td input, td select { padding: 0.35rem 0.5rem; font-size: 0.9rem; }

@media (max-width: 900px) {
  table { display: block; overflow-x: auto; }
}

/* ---------- Status pills ---------- */
.pill {
  display: inline-block;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--line);
  color: var(--ink);
}
.pill-pending, .pill-unpaid, .pill-requested { background: var(--amber-bg); color: var(--amber); }
.pill-confirmed, .pill-accepted, .pill-shipped, .pill-in_transit { background: var(--blue-bg); color: var(--blue); }
.pill-delivered, .pill-paid { background: var(--good-bg); color: var(--good); }
.pill-cancelled, .pill-void, .pill-overdue { background: var(--bad-bg); color: var(--bad); }

/* ---------- Inventory cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

/* Wood-grain swatch, tinted per species via --wood */
.card-photo {
  position: relative;
  height: 160px;
  background-color: var(--wood, #b9a27f);
  background-image:
    repeating-linear-gradient(100deg, rgba(0, 0, 0, 0.07) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(95deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 17px);
}
.card-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.swatch-note {
  position: absolute;
  left: 0.6rem;
  bottom: 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
}

.card-body { padding: 1rem 1rem 0.75rem; flex: 1; }
.card-body h3 { font-size: 1.6rem; margin-bottom: 0.4rem; }
.card-body p { margin: 0 0 0.2rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.7rem; }
.chip {
  font-size: 0.8rem;
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}

.price {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.price .unit {
  font-family: var(--body);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  background: #f7f8f5;
}
.card-actions input[type="number"] { width: 90px; padding: 0.4rem 0.5rem; }
.card-actions .photo-row {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  margin: 0.2rem 0 0;
}

.toolbar input[type="search"] { min-width: 260px; }
.empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

/* ---------- Landing page ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3rem;
  align-items: center;
  padding: 1.5rem 0 3rem;
}
.display {
  font-size: clamp(2.8rem, 6vw, 4.6rem);
  font-weight: 700;
  line-height: 0.98;
  margin-bottom: 1.1rem;
}
.lede { font-size: 1.15rem; max-width: 52ch; color: #36444d; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.cta-row .btn { padding: 0.8rem 1.5rem; font-size: 1rem; }

.ticket {
  background: var(--surface);
  border: 1px solid #aeb7b0;
  border-left: 10px solid var(--crayon);
  border-radius: 6px;
  padding: 1.4rem 1.5rem 1.2rem;
}
.ticket h3 { font-size: 2rem; margin-bottom: 0.6rem; }
.ticket dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1.25rem;
  margin: 0 0 1.1rem;
  padding-bottom: 1.1rem;
  border-bottom: 2px dashed var(--line);
}
.ticket dt { color: var(--muted); font-size: 0.9rem; }
.ticket dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; }

.track { list-style: none; margin: 0 0 0.9rem; padding: 0; display: flex; }
.track li {
  position: relative;
  flex: 1;
  padding-top: 1.1rem;
  font-size: 0.78rem;
  text-align: center;
  color: var(--muted);
}
.track li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  margin: 0 2px;
  border-radius: 3px;
  background: var(--line);
}
.track li.done { color: var(--ink); }
.track li.done::before { background: var(--steel); }
.track li.now { color: var(--ink); font-weight: 600; }
.track li.now::before { background: var(--crayon); }

.roles-section { padding: 1rem 0 3rem; }
.roles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 2px solid var(--ink);
}
.role { padding: 1.1rem 1.25rem 0.4rem 0; }
.role + .role { padding-left: 1.25rem; border-left: 1px solid var(--line); }
.role h3 { font-size: 1.7rem; }
.role p { color: #36444d; font-size: 0.95rem; }

.band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1.75rem 2rem;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
}
.band h2 { color: #fff; margin: 0; font-size: 2rem; }

/* ---------- Small screens ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; }
  .roles { grid-template-columns: repeat(2, 1fr); }
  .role:nth-child(3) { padding-left: 0; border-left: 0; }
  .role:nth-child(n+3) { border-top: 1px solid var(--line); margin-top: 0.6rem; padding-top: 1.1rem; }
}
@media (max-width: 520px) {
  header { padding: 0.75rem 1rem; }
  .roles { grid-template-columns: 1fr; }
  .role, .role + .role { padding-left: 0; border-left: 0; }
  .role + .role { border-top: 1px solid var(--line); margin-top: 0.6rem; padding-top: 1.1rem; }
  .toolbar input[type="search"] { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
