/* Hub — plain CSS, no framework, no build step.
 *
 * Colours, type, radii and easing are taken from the engineering portfolio so
 * the two sites read as one hand. If you change a token there, change it here.
 */

:root {
  --bg:         #FAFAF8;
  --bg-elev:    #FFFFFF;
  --bg-tint:    #F3F1EB;
  --ink:        #1C1C1C;
  --ink-soft:   #3D3D3D;
  --ink-mute:   #666666;
  --ink-faint:  #A8A8A8;
  --emerald:    #0F766E;
  --emerald-hi: #14867D;
  --emerald-deep: #0A5952;
  --emerald-soft: rgba(15, 118, 110, 0.08);
  --emerald-tint: #E8F2F0;
  --gold:       #C89B3C;
  --gold-hi:    #D8AB4C;
  --gold-deep:  #A17F30;
  --gold-soft:  rgba(200, 155, 60, 0.12);
  --gold-tint:  #F7EFD9;
  --line:       rgba(28, 28, 28, 0.10);
  --line-soft:  rgba(28, 28, 28, 0.06);

  /* The system UI font — whatever the device already uses. Nothing to
     download, nothing to lose, and it renders correctly at small sizes on
     every phone. */
  --font-heading: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
                  "Helvetica Neue", Arial, sans-serif;
  --font-body:    var(--font-heading);

  --max: 1180px;
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --pad: 20px;
}

* { box-sizing: border-box; }

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

/* Must win over the display values set below, or a hidden overlay keeps
   swallowing clicks meant for the page underneath it. */
[hidden] { display: none !important; }

body {
  margin-inline: auto;
  max-width: var(--max);
  padding: 0 var(--pad) 64px;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16.5px;
  line-height: 1.6;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (min-width: 900px) { body { font-size: 15px; } }

h1, h2, h3 { font-family: var(--font-heading); line-height: 1.2; }

a { color: var(--emerald); text-decoration: none; }
a:hover { color: var(--emerald-hi); text-decoration: underline; }

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

/* ---------- offline banner ---------- */

.offline {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 calc(var(--pad) * -1);
  padding: 9px var(--pad);
  background: var(--gold-tint);
  border-bottom: 1px solid var(--gold-soft);
  color: var(--gold-deep);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(var(--bg) 84%, transparent);
  padding: 26px 0 12px;
  padding-top: calc(26px + env(safe-area-inset-top));
}

.topbar-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.ghost-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 15px;
  color: var(--ink);
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  transition: all 0.3s var(--ease);
}
.ghost-btn:hover {
  border-color: var(--emerald);
  color: var(--emerald);
  transform: translateY(-2px);
  text-decoration: none;
}

.search-wrap { position: relative; margin-top: 18px; }

#search {
  width: 100%;
  padding: 12px 44px 12px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
#search:focus {
  outline: none;
  border-color: var(--emerald);
  box-shadow: 0 0 0 4px var(--emerald-soft);
}
#search::placeholder { color: var(--ink-faint); }

.search-wrap kbd {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  font-family: var(--font-body);
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  pointer-events: none;
}

/* ---------- stats ---------- */

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.stats b {
  color: var(--ink-soft);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stats .stat-warn, .stats .stat-warn b { color: var(--gold-deep); }

/* ---------- filters ---------- */

.filters {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.filters::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 7px 15px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s var(--ease);
}
.chip:hover { border-color: var(--emerald); color: var(--emerald); }
.chip[aria-pressed="true"] {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #fff;
}
.chip .count { opacity: 0.55; margin-left: 6px; font-variant-numeric: tabular-nums; }

/* ---------- sections ---------- */

main h2 {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--emerald);
  margin: 40px 0 6px;
}
main h2::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
}

.section-note { margin: 0 0 18px; font-size: 13.5px; color: var(--ink-mute); }

.attention h2 { color: var(--gold-deep); }

.grid {
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.5rem);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* ---------- card ---------- */

.card {
  position: relative;
  overflow: hidden;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.3rem, 2.6vw, 1.6rem);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 11px;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

/* The signature move from the portfolio: a rule that draws itself across the
   top of the card on hover. */
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--emerald);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}
.card:hover::before { transform: scaleX(1); }

.card:hover {
  transform: translateY(-4px);
  border-color: var(--emerald-soft);
  box-shadow: 0 12px 32px rgba(28, 28, 28, 0.06);
}

/* Neglected work wears its rule permanently, in gold. */
.card.attention-card { border-color: rgba(200, 155, 60, 0.4); }
.card.attention-card::before { background: var(--gold); transform: scaleX(1); }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.2rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
}

/* ---------- status pills ----------
   Emerald = healthy and moving (tinted while in flight, solid once shipped).
   Gold    = a spark not yet worked. Neutral = dormant. */

.pill {
  flex: none;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill.active   { background: var(--emerald-tint); color: var(--emerald-deep); border-color: var(--emerald-soft); }
.pill.next     { background: transparent;         color: var(--emerald);      border-color: rgba(15, 118, 110, 0.3); }
.pill.shipped  { background: var(--emerald);      color: #fff;                border-color: var(--emerald); }
.pill.idea     { background: var(--gold-tint);    color: var(--gold-deep);    border-color: var(--gold-soft); }
.pill.paused   { background: var(--bg-tint);      color: var(--ink-mute);     border-color: var(--line-soft); }
.pill.archived { background: transparent;         color: var(--ink-faint);    border-color: var(--line); }

.next-line {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-mute);
  display: flex;
  gap: 8px;
}
.next-line::before { content: "→"; color: var(--emerald); flex: none; }

/* The track stays lighter than a border would be. At 0% it must read as an
   empty scale, not as a rule dividing the card. */
.bar {
  height: 3px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
  margin: 2px 0;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--emerald);
  border-radius: 999px;
  transition: width 0.6s var(--ease);
}
.bar.done > i { background: var(--emerald-deep); }

.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: auto;
  padding-top: 11px;
  border-top: 1px solid var(--line-soft);
}
.card-foot .stale { color: var(--gold-deep); font-weight: 500; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--bg-tint);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ---------- library ---------- */

.pill.doc { background: var(--bg-tint); color: var(--ink-mute); border-color: var(--line-soft); }

.doc-card::before { background: var(--ink); }

.doc-summary {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-mute);
}

.doc-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.doc-links a { font-size: 0.95rem; }

/* ---------- resources ---------- */

.resources { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.resources li {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  transition: border-color 0.3s var(--ease);
}
.resources li:hover { border-color: var(--emerald-soft); }
.resources .from { color: var(--ink-faint); font-size: 12.5px; }
.resources .res-main { display: flex; align-items: center; gap: 10px; min-width: 0; }

.res-ext {
  flex: none;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--emerald-deep);
  background: var(--emerald-tint);
  border-radius: 5px;
  padding: 3px 7px;
}

/* A declared file that is not actually there. Loud on purpose — a dead
   reference is exactly what this dashboard is meant to stop. */
.resources li.missing { border-color: rgba(200, 155, 60, 0.45); background: var(--gold-tint); }
.resources li.missing .res-ext { color: var(--gold-deep); background: rgba(200, 155, 60, 0.18); }
.resources li.missing .from b { color: var(--gold-deep); font-weight: 600; }

/* ---------- detail ---------- */

.detail { position: fixed; inset: 0; z-index: 50; display: flex; }
.detail-backdrop { position: absolute; inset: 0; background: rgba(28, 28, 28, 0.35); }

.detail-panel {
  position: relative;
  margin: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: min(640px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 32px;
  box-shadow: 0 24px 64px rgba(28, 28, 28, 0.14);
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
  .detail-panel {
    margin: auto 0 0;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 92vh;
    padding: 26px 20px calc(30px + env(safe-area-inset-bottom));
  }
}

.close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.3s var(--ease);
}
.close:hover { color: var(--ink); }

/* Keeps the title and pill clear of the close button. */
.detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-right: 40px;
}

.detail-panel h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.6rem;
  letter-spacing: -0.025em;
}
.detail-panel h4 {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--emerald);
  margin: 26px 0 8px;
}

.detail-meta {
  margin: 16px 0 20px;
  font-size: 13px;
  color: var(--ink-mute);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 0.7rem 1.3rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  transition: all 0.3s var(--ease);
}
.btn:hover {
  border-color: var(--ink);
  background: var(--bg);
  transform: translateY(-2px);
  color: var(--ink);
  text-decoration: none;
}
.btn.primary { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.btn.primary:hover {
  background: var(--emerald-hi);
  border-color: var(--emerald-hi);
  color: #fff;
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.25);
}

.notes { font-size: 0.95rem; line-height: 1.65; color: var(--ink-soft); }
.notes ul { padding-left: 20px; }
.notes .checklist { list-style: none; padding-left: 0; }
.notes .checklist li { display: flex; gap: 10px; align-items: baseline; margin: 7px 0; }
.notes .checklist li.done { color: var(--ink-faint); text-decoration: line-through; }
.notes .box {
  flex: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
  line-height: 14px;
  text-align: center;
  color: var(--emerald);
  background: var(--bg-elev);
}
.notes .checklist li.done .box {
  border-color: var(--emerald-soft);
  background: var(--emerald-tint);
}
.notes code {
  background: var(--bg-tint);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.88em;
}
.notes pre {
  background: var(--bg-tint);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 14px;
  overflow-x: auto;
}
.notes .hint { color: var(--ink-faint); font-style: italic; }

/* ---------- misc ---------- */

.empty { color: var(--ink-faint); padding: 34px 0; text-align: center; }

footer {
  margin-top: 52px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-faint);
  align-items: center;
}

.linkish {
  background: none;
  border: none;
  color: var(--emerald);
  font: inherit;
  cursor: pointer;
  padding: 0;
}
.linkish:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .card:hover { transform: none; }
}
