/*
  Farmer Agents.

  One stylesheet for every page. The palette is a working farm at mid-morning:
  earth, straw, painted barn wood, and a sky that is doing nothing dramatic. It
  is warm on purpose — this is a farm, not a trading terminal — but the numbers
  are set in a mono face and given room, because they are the part people are
  actually here to read.
*/

:root {
  --soil: #43301f;
  --soil-dark: #2e2015;
  --soil-light: #5d452c;
  --field: #79913f;
  --field-dark: #5b7030;
  --straw: #e3b448;
  --straw-pale: #f2dfa8;
  --barn: #a8352a;
  --barn-dark: #7c241c;
  --sky: #bcd9e6;
  --cream: #f7f1e3;
  --ink: #241a12;
  --ink-soft: #5a4a38;
  --line: #d8cbb0;
  --panel: #fffdf7;
  --good: #3f7d43;
  --warn: #b8791f;
  --bad: #a33327;

  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  --radius: 10px;
  --shadow: 0 1px 0 rgba(36, 26, 18, 0.08), 0 8px 24px -12px rgba(36, 26, 18, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--barn-dark);
  text-decoration-color: rgba(124, 36, 28, 0.35);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: currentColor;
}

/* --- chrome --------------------------------------------------------------- */

.top {
  display: flex;
  align-items: baseline;
  gap: 1.4rem;
  flex-wrap: wrap;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.brand .ticker {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--barn);
  border: 1px solid rgba(168, 53, 42, 0.3);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  background: rgba(168, 53, 42, 0.06);
}

.top nav {
  display: flex;
  gap: 1.1rem;
  font-size: 0.92rem;
}

.top nav a {
  color: var(--ink-soft);
  text-decoration: none;
}

.top nav a:hover,
.top nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom: 2px solid var(--straw);
}

.top .right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 5rem;
}

main.wide {
  max-width: none;
  padding: 0 0 4rem;
}

h1 {
  font-size: 1.9rem;
  margin: 0 0 0.3rem;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.2rem;
  margin: 2.2rem 0 0.75rem;
}

.lede {
  color: var(--ink-soft);
  max-width: 60ch;
  margin: 0 0 1.5rem;
}

/* --- the scene ------------------------------------------------------------ */

.scene {
  position: relative;
  width: 100%;
  height: min(68vh, 660px);
  min-height: 420px;
  background: var(--sky);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  cursor: grab;
}

.scene:active {
  cursor: grabbing;
}

.scene canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.scene .hint {
  position: absolute;
  right: 0.9rem;
  bottom: 0.7rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: rgba(36, 26, 18, 0.5);
  background: rgba(255, 253, 247, 0.75);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  pointer-events: none;
}

.scene .empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--soil-dark);
  background: rgba(247, 241, 227, 0.82);
}

/* The card that follows the cursor over a plot. */
.tip {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  min-width: 190px;
  max-width: 280px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.6rem 0.7rem;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 90ms;
}

.tip[data-show="1"] {
  opacity: 1;
}

.tip .who {
  font-weight: 700;
}

.tip .row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
}

/* What the category the farmer is growing actually covers. Without it the card
   says "meme" and leaves the reader to guess whether that is a token, a plant
   or a mood. */
.tip .means {
  margin: 0.3rem 0 0.15rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--ink);
}

.tip .persona {
  margin-top: 0.4rem;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.4;
}

/* --- stat strip ----------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
}

.stats div {
  background: var(--panel);
  padding: 0.85rem 1rem;
}

.stats dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0;
}

.stats dd {
  margin: 0.15rem 0 0;
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 600;
}

.stats dd.muted {
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 400;
}

/* --- panels and tables ---------------------------------------------------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-weight: 600;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 0.6rem;
  border-bottom: 1px solid rgba(216, 203, 176, 0.5);
  vertical-align: top;
}

tbody tr:hover {
  background: rgba(227, 180, 72, 0.08);
}

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

.muted {
  color: var(--ink-soft);
}

.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--cream);
  white-space: nowrap;
}

.pill[data-stage="ripe"] {
  border-color: rgba(63, 125, 67, 0.4);
  background: rgba(63, 125, 67, 0.12);
  color: var(--good);
}

.pill[data-stage="rotten"] {
  border-color: rgba(163, 51, 39, 0.4);
  background: rgba(163, 51, 39, 0.1);
  color: var(--bad);
}

.pill[data-stage="fallow"] {
  color: var(--ink-soft);
}

/* --- the forge ------------------------------------------------------------ */

.form-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 900px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
  }
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

label .note {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

input[type="text"],
textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: inherit;
}

textarea {
  min-height: 6.5rem;
  resize: vertical;
  line-height: 1.5;
}

input:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--straw);
  outline-offset: 1px;
}

.field-row {
  margin-bottom: 1.3rem;
}

.counter {
  float: right;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.counter[data-over="1"] {
  color: var(--bad);
}

/*
  The sixteen categories.

  Laid out so the *category* is the headline and the plant is a caption under
  it. The first version gave them equal weight and people read the grid as a
  menu of things to create rather than as subjects an agent may launch about —
  which is the single thing about this project that is easy to misread, so the
  type sizes are doing real work here.
*/
.crops {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.6rem;
}

.crop {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  background: var(--panel);
  transition: border-color 120ms, background 120ms;
}

.crop[data-pick="like"] {
  border-color: var(--field-dark);
  background: rgba(121, 145, 63, 0.1);
}

.crop[data-pick="dislike"] {
  border-color: rgba(163, 51, 39, 0.5);
  background: rgba(163, 51, 39, 0.07);
}

.crop-head {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 0.6rem;
}

.crop canvas {
  width: 38px;
  height: 38px;
}

.crop .name {
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

/* The plant, demoted to a caption. It is a picture of the category, not a
   second thing you are choosing between. */
.crop .plant {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-soft);
  opacity: 0.75;
}

.crop .means {
  margin: 0.5rem 0 0;
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--ink);
}

.crop .eg {
  margin: 0.3rem 0 0;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--ink-soft);
}

.crop .eg b {
  font-weight: 600;
  font-style: normal;
}

.crop .picks {
  display: flex;
  gap: 0.25rem;
}

.crop button {
  font-family: var(--mono);
  font-size: 0.78rem;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--cream);
  cursor: pointer;
  color: var(--ink-soft);
  line-height: 1;
}

.crop button:hover {
  border-color: var(--ink-soft);
}

.crop button[aria-pressed="true"] {
  color: var(--panel);
}

.crop button.like[aria-pressed="true"] {
  background: var(--field-dark);
  border-color: var(--field-dark);
}

.crop button.dislike[aria-pressed="true"] {
  background: var(--bad);
  border-color: var(--bad);
}

.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: 1px solid var(--barn-dark);
  background: var(--barn);
  color: #fff;
  cursor: pointer;
}

.btn:hover {
  background: var(--barn-dark);
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.ghost {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}

.slider {
  width: 100%;
  accent-color: var(--barn);
}

.notice {
  border-left: 3px solid var(--straw);
  background: rgba(227, 180, 72, 0.1);
  padding: 0.7rem 0.9rem;
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
  margin: 1rem 0;
}

.notice.bad {
  border-left-color: var(--bad);
  background: rgba(163, 51, 39, 0.08);
}

.notice.good {
  border-left-color: var(--good);
  background: rgba(63, 125, 67, 0.1);
}

footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

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