@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-alt: #1c2128;
  --border: #30363d;
  --border-hover: #484f58;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --text-faint: #6e7681;
  --accent: #238636;
  --accent-light: #1a2e22;
  --accent-hover: #2ea043;
  --green: #238636;
  --green-light: #3ecf8e;
  --amber: #d29922;
  --amber-light: #302200;
  --red: #da3633;
  --red-light: #301ch2;
  --cyan: #1a8a8a;
  --cyan-light: #0d2020;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'Inter', sans-serif;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; background: var(--bg); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 760px; margin: 0 auto; padding: 40px 24px 80px; }

/* ── Typography ─────────────────────── */
h1 { font-weight: 700; font-size: 28px; letter-spacing: -0.025em; color: var(--text); margin-bottom: 6px; }
h2 { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; color: var(--text); margin-bottom: 10px; }
h3 { font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 6px; }
p { font-size: 13.5px; color: var(--text-dim); line-height: 1.7; }

header { margin-bottom: 36px; }
.subtitle { font-weight: 400; font-size: 13px; color: var(--text-dim); margin-top: 6px; }
.section-sub { font-size: 12px; color: var(--text-faint); margin-bottom: 16px; }

/* ── Navigation ─────────────────────── */
.top-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13,17,23,0.88);
  border-bottom: 1px solid var(--border);
}
.top-nav-inner { max-width: 760px; margin: 0 auto; padding: 0 24px; height: 48px; display: flex; align-items: center; }
.back-link {
  font-family: var(--sans); font-weight: 500; font-size: 12px; color: var(--accent);
  text-decoration: none; transition: all var(--transition);
  display: flex; align-items: center; gap: 5px; padding: 5px 12px; margin-left: -12px;
  border-radius: var(--radius-sm);
}
.back-link:hover { background: var(--accent-light); color: var(--accent-hover); }

.brand-label {
  font-family: var(--sans); font-weight: 500; font-size: 12px; color: var(--text-dim);
  text-decoration: none;
  display: flex; align-items: center; gap: 6px; padding: 5px 12px; margin-left: -12px;
  border-radius: var(--radius-sm);
}
.brand-label img { width: 18px; height: 18px; }

.nav-menu { position: relative; margin-left: auto; }
.nav-menu summary {
  list-style: none; cursor: pointer;
  font-family: var(--sans); font-size: 11px; font-weight: 500;
  color: var(--text-faint); background: transparent;
  border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 6px;
  transition: all var(--transition);
}
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary:hover { color: var(--text); border-color: var(--border-hover); }
.nav-menu[open] summary { color: var(--text); border-color: var(--border-hover); }
.nav-menu ul {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px; min-width: 120px;
  box-shadow: var(--shadow-lg); z-index: 200;
  list-style: none; margin: 0;
}
.nav-menu li { text-align: center; }
.nav-menu li a,
.nav-menu li button {
  display: block; width: 100%; padding: 7px 10px; border-radius: 4px;
  font-family: var(--sans); font-size: 12px; color: var(--text-dim);
  text-decoration: none; text-align: center; background: none; border: none; cursor: pointer;
  transition: background var(--transition);
}
.nav-menu li a:hover,
.nav-menu li button:hover { background: var(--accent-light); color: var(--text); }

/* ── Components ─────────────────────── */
section { margin-bottom: 40px; }

.tray-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.tray-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  box-shadow: var(--shadow-sm);
}
.tray-card.interactive { cursor: pointer; }
.tray-card.interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.detail-row {
  display: flex; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--border);
  font-size: 13px; gap: 14px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
  color: var(--text-faint); font-family: var(--sans); font-weight: 500;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em;
  width: 120px; flex-shrink: 0;
}
.detail-value { color: var(--text); flex: 1; font-size: 13px; }

/* ── Status Bar ─────────────────────── */
.status-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.status-btn {
  font-family: var(--sans); font-size: 10px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 5px 14px; border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer; transition: all var(--transition);
}
.status-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.status-btn.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
  cursor: default;
}

/* ── Tray Status Badges ──────────────── */
.tray-status {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: 100px;
  background: var(--accent-light); color: var(--accent);
}
.tray-status[data-status="soaking"] { background: #0d1f3c; color: #4d8bd4; }
.tray-status[data-status="blackout"] { background: #1c1530; color: #8b6fcf; }
.tray-status[data-status="light"] { background: var(--amber-light); color: var(--amber); }
.tray-status[data-status="harvested"] { background: var(--accent-light); color: var(--accent); }
.tray-status[data-status="seeded"] { background: var(--cyan-light); color: var(--cyan); }

/* ── Forms ───────────────────────────── */
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
input, select, textarea {
  background: var(--surface-alt); border: 1px solid var(--border);
  color: var(--text); font-family: var(--sans); font-size: 13px;
  padding: 8px 12px; border-radius: var(--radius-sm); outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35,134,54,0.15);
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
select {
  padding-right: 32px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236e7681' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; font-family: var(--sans); font-size: 12px; font-weight: 500;
  border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition);
  border: 1px solid transparent; text-decoration: none;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-small {
  padding: 5px 12px; font-size: 11px; font-weight: 500;
  background: var(--accent-light); color: var(--accent);
  border-color: transparent; border-radius: var(--radius-sm);
}
.btn-small:hover { background: rgba(35,134,54,0.2); }
.btn-action {
  padding: 3px 8px; font-size: 10px; font-weight: 500;
  background: var(--surface-alt); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 4px; cursor: pointer;
  transition: all var(--transition);
}
.btn-action:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }

/* ── Interaction List ────────────────── */
.interaction-list { display: grid; gap: 8px; }
.interaction-item {
  display: grid; grid-template-columns: auto 1fr;
  gap: 10px; align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: box-shadow var(--transition);
}
.interaction-item:hover { box-shadow: var(--shadow-sm); }
.interaction-icon { font-size: 14px; padding-top: 1px; color: var(--text-dim); }
.interaction-action { font-weight: 500; font-size: 12px; text-transform: capitalize; color: var(--text); }
.interaction-note { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.interaction-time { font-family: var(--sans); font-size: 10px; color: var(--text-faint); font-weight: 500; margin-top: 5px; }

/* ── Dashboard Cards ─────────────────── */
.tray-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tray-seed { font-weight: 600; font-size: 15px; color: var(--text); }
.tray-id { font-family: var(--sans); font-size: 12px; color: var(--accent); font-weight: 700; }
.tray-meta-row { display: flex; justify-content: space-between; font-size: 12px; margin-top: 4px; }
.tray-meta-label { color: var(--text-faint); }
.tray-meta-value { color: var(--text-dim); font-weight: 500; }

/* ── Journal Specific ─────────────────── */
.principles, .io-grid, .equipment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.principle, .io-item, .problem, .equipment-card {
  background: var(--surface); border: 1px solid var(--border);
  padding: 18px; border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.principle:hover, .io-item:hover, .problem:hover, .equipment-card:hover {
  box-shadow: var(--shadow-md); transform: translateY(-1px);
}
.principle strong, .io-item strong, .problem strong {
  display: block; font-size: 13px; margin-bottom: 4px; color: var(--text);
}

.lessons { display: grid; gap: 8px; }
.lesson {
  display: grid; grid-template-columns: 36px 1fr;
  gap: 12px; background: var(--surface);
  padding: 14px 16px; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.lesson:hover { box-shadow: var(--shadow-md); }
.lesson-num {
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  color: var(--accent); background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  height: 36px; border-radius: var(--radius-sm);
}

.phases { display: grid; gap: 12px; }
.phase {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: box-shadow var(--transition);
}
.phase:hover { box-shadow: var(--shadow-md); }
.phase-header {
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; background: var(--surface-alt);
}
.phase-tag {
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  color: var(--accent); background: var(--accent-light);
  padding: 2px 8px; border-radius: 100px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.phase-name { font-weight: 600; font-size: 13px; color: var(--text); }
.phase-body { padding: 16px; }
.steps { list-style: none; padding: 0; }
.steps li {
  font-size: 12.5px; color: var(--text-dim);
  padding-left: 16px; position: relative;
  margin-bottom: 6px; line-height: 1.6;
}
.steps li::before {
  content: ''; position: absolute; left: 0; top: 8px;
  width: 5px; height: 5px; background: var(--accent); border-radius: 50%; opacity: 0.6;
}

/* ── Search & Utils ─────────────────── */
.loading-placeholder, .empty-state {
  padding: 40px; text-align: center;
  color: var(--text-faint); font-family: var(--sans); font-size: 13px; font-weight: 500;
}

/* ── Modal ───────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px); display: flex; align-items: center;
  justify-content: center; z-index: 200;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 90%; max-width: 440px; overflow: hidden;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.modal-header h3 { margin: 0; font-size: 14px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-faint); padding: 0 2px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 10px; }

/* ── Landing Page ────────────────────── */
.brand-header { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 10px; }
.brand-logo { width: 64px; height: 64px; filter: drop-shadow(0 4px 12px rgba(35,134,54,0.2)); transition: transform var(--transition); }
.brand-logo:hover { transform: scale(1.05); }
.brand-title { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; text-align: center; }
.brand-subtitle { font-size: 13px; color: var(--text-faint); text-align: center; margin-top: -2px; }

/* ── Fade-up Animations ─────────────── */
.fade-up {
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}
.fade-up.visible { opacity: 1; transform: translateY(0); }

/* ── Responsive ─────────────────────── */
@media (max-width: 640px) {
  .principles, .io-grid, .equipment-grid, .tray-grid { grid-template-columns: 1fr; }
  h1 { font-size: 22px; }
  .brand-title { font-size: 26px; }
  .container { padding: 28px 14px 70px; }
}