/* Hoofprints — mobile-first. One small stylesheet, designed for a phone in
   a yard: big tap targets, one column, bottom tab bar, forms that collapse
   into sections so the 30-second entry stays 30 seconds.

   Palette and type are taken from the hoofprints.online logo: forest green,
   sky blue, cream paper, and the dotted hoof trail that joins the horseshoes. */

:root {
  /* Forest green — the primary. */
  --green: #2C4A34;
  --green-dark: #1E3325;
  --green-deep: #12291B;
  --green-soft: #4A5A4C;
  --green-wash: #EAF3EC;

  /* Sky blue — the accent from the ".online" and the trail's end dot. */
  --blue: #7FBBE3;
  --blue-ink: #4A8CBE;
  --blue-wash: #EDF4FA;
  --blue-line: #D6E6F2;

  /* Cream paper. */
  --cream: #FAF5EC;
  --cream-lift: #FFFDF8;
  --card: #FFFFFF;
  --border: #E8DFCF;
  --border-soft: #F0E9DC;
  --border-chip: #E3D9C7;

  /* Ink. */
  --ink: #253023;
  --ink-chip: #4A4437;
  --muted: #8A8478;
  --muted-light: #A39C8E;
  --faint: #C4BBAA;

  --red: #B3462E;
  --amber: #B07D2A;

  --radius: 18px;
  --radius-sm: 15px;
  --radius-tile: 12px;

  --display: 'Nunito', ui-rounded, 'Segoe UI', system-ui, sans-serif;
  --body: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  /* Kept for older markup that still names the retired brown tokens. */
  --brown: var(--green);
  --brown-dark: var(--green-dark);
  --tan: var(--blue-ink);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  background: var(--cream);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  /* room for the tab bar — plus the home-indicator inset so content installed
     to the home screen isn't hidden behind the (taller) bar on notched phones */
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
body.no-tabs { padding-bottom: 0; }

h1, h2, h3, .brand, .title { font-family: var(--display); }

/* ---- Header ---- */
.app-header {
  background: var(--card);
  color: var(--ink);
  padding: 13px 16px;
  /* full-screen (home-screen) insets: status bar above, notch on the sides in landscape */
  padding-top: calc(13px + env(safe-area-inset-top));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  position: sticky; top: 0; z-index: 20;
}
.app-header .brand {
  font-family: var(--display);
  font-weight: 800; font-size: 1.2rem; letter-spacing: -0.3px; color: var(--green);
  display: flex; align-items: center; gap: 10px;
}
.app-header .brand .dot-online { color: var(--blue); }
.app-header .sub { font-size: 0.78rem; color: var(--muted); font-weight: 400; margin-top: 1px; }
.app-header a { color: var(--green); }

/* The logo mark, sat in its own white tile. */
.mark {
  width: 54px; height: 38px; border-radius: var(--radius-tile);
  background: #fff url('/img/hoofprints-mark.png') center/contain no-repeat;
  border: 1px solid var(--border); flex: none;
}

/* A green header, for the screens that take over the phone (entry, auth). */
.app-header.on-green {
  background: var(--green); border-bottom-color: var(--green);
  color: #fff;
}
.app-header.on-green .brand, .app-header.on-green a { color: #fff; }
.app-header.on-green .sub { color: rgba(255, 255, 255, 0.62); }
.app-header.on-green .accent { color: var(--blue); font-weight: 700; font-size: 0.82rem; }

/* Avatar chip at the top right of Today. */
.you-chip {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--blue-wash); border: 1px solid var(--blue-line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700; font-size: 0.82rem; color: var(--blue-ink);
  text-decoration: none;
}

/* ---- Layout ---- */
.page { max-width: 640px; margin: 0 auto; padding: 16px 16px 28px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 10px; font-size: 0.97rem; font-weight: 800; letter-spacing: -0.1px; }
.card h3 { margin: 14px 0 8px; font-size: 0.9rem; font-weight: 800; }
.muted { color: var(--muted); font-size: 0.85rem; }
.small { font-size: 0.8rem; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
a { color: var(--blue-ink); }
.link-blue { color: var(--blue-ink); font-weight: 600; font-size: 0.78rem; text-decoration: none; }

/* A field label in the entry form's voice: small, spaced, upper. */
.field-label {
  font-family: var(--body); font-weight: 700; font-size: 0.75rem;
  letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted);
  margin: 0 0 9px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.field-label .value { text-transform: none; letter-spacing: 0; font-size: 0.75rem; color: var(--green); }
.field-group { margin-bottom: 18px; }

/* ---- Buttons & forms ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer;
  font-family: var(--display); font-size: 0.97rem; font-weight: 800;
  padding: 12px 18px; min-height: 50px;
  background: var(--green); color: #fff; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s ease, color .15s ease;
}
.btn:active { background: var(--green-dark); }
.btn.secondary {
  background: var(--card); color: var(--green); border-color: var(--border);
  font-family: var(--body); font-weight: 700; font-size: 0.88rem;
}
.btn.secondary:active { background: var(--cream); }
.btn.blue { background: var(--blue); color: var(--green-deep); }
.btn.blue:active { background: #95C8EA; }
.btn.danger { background: var(--card); color: var(--red); border-color: #ECC4B8; font-family: var(--body); font-weight: 700; }
.btn.small { padding: 8px 13px; min-height: 36px; font-size: 0.78rem; font-family: var(--body); font-weight: 700; border-radius: 999px; }
.btn.pill { border-radius: 999px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* The blue "switch horse" pill that sits on white. */
.btn.tint {
  background: var(--blue-wash); color: var(--blue-ink); border-color: #D8E9F5;
  border-radius: 999px; min-height: 36px; padding: 8px 13px;
  font-family: var(--body); font-weight: 700; font-size: 0.72rem;
}

label { display: block; font-size: 0.8rem; font-weight: 700; margin: 12px 0 5px; color: var(--green-dark); }
input, select, textarea {
  width: 100%; padding: 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 16px; /* stops iOS zooming */ font-family: var(--body); background: var(--card); color: var(--ink);
}
textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238A8478' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}

/* ---- Chips: the one-tap answer rows ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.even { flex-wrap: nowrap; }
.chips.even .chip { flex: 1; padding: 11px 4px; min-width: 0; }
.chip {
  border: 1px solid var(--border-chip); border-radius: 999px;
  background: var(--card); color: var(--ink-chip);
  padding: 11px 16px; min-height: 44px;
  font-family: var(--body); font-weight: 600; font-size: 0.88rem; line-height: 1.1;
  cursor: pointer; text-align: center;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.chip.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.chip.ghost {
  border: 1px dashed #D9CFBB; background: transparent; color: #7A7263;
  padding: 7px 12px; min-height: 0; font-size: 0.78rem; font-weight: 400;
}
.chip.ghost:active { background: var(--cream); }

/* The 1–5 scales: square-ish, evenly spread, with the ends spelled out. */
.score-row { display: flex; gap: 7px; }
.score-row button {
  flex: 1; min-height: 46px; border: 1px solid var(--border-chip); border-radius: 13px;
  background: var(--card); font-family: var(--body); font-size: 0.94rem; font-weight: 600;
  color: var(--ink-chip); cursor: pointer; padding: 12px 2px; line-height: 1.1;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.score-row button.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.score-hint {
  display: flex; justify-content: space-between;
  font-size: 0.69rem; color: var(--muted-light); margin-top: 6px;
}

/* ---- Alerts & badges ---- */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 0.88rem; }
.alert.error { background: #FBE9E4; color: #8C2F1B; border: 1px solid #ECC4B8; }
.alert.success { background: var(--green-wash); color: var(--green); border: 1px solid #C4DCC8; }
.alert.info { background: var(--blue-wash); color: #33445F; border: 1px solid var(--blue-line); }
.badge {
  display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 4px 10px;
  border-radius: 999px; background: var(--cream); color: var(--green); border: 1px solid var(--border);
}
.badge.green { background: var(--green-wash); color: var(--green); border-color: #C4DCC8; }
.badge.amber { background: #F8EFDD; color: var(--amber); border-color: #E8D5AC; }
.badge.red { background: #FBE9E4; color: var(--red); border-color: #ECC4B8; }

/* The blue "Worth a look" note. */
.note-blue {
  background: var(--blue-wash); border: 1px solid var(--blue-line); border-radius: var(--radius);
  padding: 15px 16px; margin-bottom: 14px;
  display: flex; gap: 12px; align-items: flex-start;
  font-size: 0.82rem; line-height: 1.45; color: var(--green-soft);
}
.note-blue .pip { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin-top: 6px; flex: none; }
.note-blue .note-title {
  font-family: var(--display); font-weight: 800; font-size: 0.84rem;
  color: var(--green); margin-bottom: 3px;
}
.note-blue .body { flex: 1; min-width: 0; }

/* ---- Collapsible form sections ---- */
details.section {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); margin-bottom: 10px;
}
details.section > summary {
  cursor: pointer; list-style: none; padding: 15px 16px;
  font-family: var(--display); font-weight: 800; font-size: 0.92rem; color: var(--green);
  display: flex; justify-content: space-between; align-items: center;
}
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::after { content: '＋'; color: var(--muted); font-size: 1rem; font-weight: 400; }
details.section[open] > summary::after { content: '－'; }
details.section > .section-body { padding: 0 16px 16px; }

/* ---- Lists ---- */
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-top: 1px solid var(--border-soft); text-decoration: none; color: inherit;
}
.item:first-child { border-top: none; }
.item .avatar {
  width: 44px; height: 44px; border-radius: 14px; background: #F4EFE4;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
  flex-shrink: 0; overflow: hidden; border: 1px solid var(--border-soft);
}
.item .avatar img { width: 100%; height: 100%; object-fit: cover; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-family: var(--display); font-weight: 700; font-size: 0.9rem; color: var(--ink); }
.item .meta { font-size: 0.78rem; color: var(--muted); }
.item .chev { flex: none; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; font-size: 0.88rem; }

/* A striped stand-in wherever a horse has no photo yet. */
.photo-blank {
  background: repeating-linear-gradient(135deg, #E7D8BE, #E7D8BE 5px, #DCCBAC 5px, #DCCBAC 10px);
}

/* ---- The week trail: seven days, filled when logged ---- */
.week-dots { display: flex; align-items: center; gap: 7px; }
.week-dots .day {
  flex: 1; height: 34px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--body); font-weight: 700; font-size: 0.72rem;
  background: transparent; color: #B5AC9C; border: 1px dashed #DDD3C0;
}
.week-dots .day.on { background: var(--green); color: #fff; border: 1px solid var(--green); }
.week-dots .day.today { box-shadow: 0 0 0 2px var(--blue-wash), 0 0 0 3px var(--blue); }

.meter { height: 8px; border-radius: 99px; background: #EFE7D8; margin-top: 9px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--blue); border-radius: 99px; }

/* ---- Photo grid ---- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photo-grid .ph { position: relative; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-tile); border: 1px solid var(--border); display: block; }
.photo-grid .primary img { border: 2px solid var(--blue); }

/* Square photo tiles on the entry form. */
.tiles { display: flex; gap: 9px; flex-wrap: wrap; }
.tile {
  width: 78px; height: 78px; border-radius: 16px; flex: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  overflow: hidden; position: relative; border: 1px solid var(--border-soft); background: var(--card);
}
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; }
.tile.add {
  border: 1.5px dashed #CFC4AE; background: var(--card); cursor: pointer;
  color: var(--muted); font-family: var(--body); font-weight: 600; font-size: 0.66rem;
}
.tile.add .plus { font-size: 1.35rem; line-height: 1; font-weight: 400; }
.tile .kill {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  border: none; background: rgba(30, 51, 37, 0.66); color: #fff; font-size: 0.72rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
}

/* ---- Sparklines ---- */
.spark { width: 100%; height: 56px; }
.spark-label { display: flex; justify-content: space-between; font-size: 0.8rem; margin-top: 8px; }

/* ---- Bottom tab bar ---- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex; padding: 8px 4px 6px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
  padding-left: calc(4px + env(safe-area-inset-left));
  padding-right: calc(4px + env(safe-area-inset-right));
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 4px 2px; text-decoration: none;
  color: var(--muted-light); font-family: var(--body); font-size: 0.66rem; font-weight: 600;
}
.tabbar a .ico { display: block; width: 22px; height: 22px; position: relative; }
.tab-badge {
  position: absolute; top: -6px; right: -12px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--red); color: #fff; font-size: 0.62rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.tabbar a .ico svg { display: block; width: 100%; height: 100%; }
.tabbar a.on { color: var(--green); }

/* ---- A sticky action bar that floats over the page's own colour ---- */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 28;
  padding: 12px 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--cream) 62%, rgba(250, 245, 236, 0));
  display: flex; gap: 9px;
}
.action-bar .btn { flex: 1; min-height: 54px; border-radius: 16px; box-shadow: 0 8px 18px rgba(44, 74, 52, 0.28); }
.action-bar .btn.square {
  flex: none; width: 54px; height: 54px; padding: 0; font-size: 1.35rem; font-weight: 400;
  background: var(--blue-wash); color: var(--blue-ink); border: 1px solid #CFDCE9; box-shadow: none;
}
body.has-action-bar { padding-bottom: 104px; }

/* ---- Bottom sheet ---- */
.sheet-scrim {
  position: fixed; inset: 0; z-index: 60; background: rgba(30, 51, 37, 0.42);
  display: flex; align-items: flex-end;
}
.sheet {
  width: 100%; background: var(--card); border-radius: 26px 26px 0 0;
  padding: 24px 20px; padding-bottom: calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
  max-height: 86vh; overflow: auto;
}
.sheet.centred { align-items: center; text-align: center; gap: 14px; }
.sheet h2 { font-size: 1.2rem; font-weight: 800; margin: 0; }
.sheet .tick {
  width: 62px; height: 62px; border-radius: 50%; background: var(--green-wash);
  display: flex; align-items: center; justify-content: center;
}
.sheet .btn { width: 100%; }

/* ---- Auth pages ---- */
.auth-wrap { max-width: 400px; margin: 0 auto; padding: 40px 20px; }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo .paw {
  width: 108px; height: 91px; margin: 0 auto 6px;
  background: url('/img/hoofprints-mark.png') center/contain no-repeat;
}
.auth-logo h1 {
  margin: 6px 0 2px; color: var(--green); font-size: 1.7rem; font-weight: 800; letter-spacing: -0.4px;
}
.auth-logo h1 .dot-online { color: var(--blue); }
.auth-logo p { margin: 0; color: var(--muted); font-size: 0.88rem; }

/* Floating add button */
.fab {
  position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 25;
  width: 58px; height: 58px; border-radius: 20px; background: var(--green); color: var(--blue);
  font-size: 1.7rem; display: flex; align-items: center; justify-content: center;
  text-decoration: none; box-shadow: 0 10px 24px rgba(44, 74, 52, 0.3);
}

/* ---- Chat ---- */
.chat-list .item { align-items: flex-start; }
.chat-list .unread-pill {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--green); color: #fff;
  font-size: 0.7rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none;
}
.chat-list .preview { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list .stamp { font-size: 0.7rem; color: var(--muted-light); flex: none; }
.bubbles { display: flex; flex-direction: column; gap: 8px; padding: 12px 0 8px; }
.bubble {
  max-width: 82%; align-self: flex-start; background: var(--card); border: 1px solid var(--border);
  border-radius: 18px 18px 18px 6px; padding: 9px 12px; font-size: 0.92rem; line-height: 1.4; position: relative;
  word-wrap: break-word; overflow-wrap: anywhere;
}
.bubble.mine { align-self: flex-end; background: var(--green); color: #fff; border-color: var(--green); border-radius: 18px 18px 6px 18px; }
.bubble .who { font-size: 0.72rem; font-weight: 700; color: var(--blue-ink); margin-bottom: 2px; }
.bubble .when { font-size: 0.66rem; color: var(--muted-light); margin-top: 3px; text-align: right; }
.bubble.mine .when { color: rgba(255, 255, 255, 0.7); }
.bubble img, .bubble video { display: block; max-width: 100%; width: 260px; max-height: 320px; object-fit: cover; border-radius: 12px; margin: 2px 0 4px; background: #000; }
.bubble img { object-fit: contain; background: var(--cream); }
.bubble .kill { border: none; background: transparent; color: inherit; opacity: 0.55; font-size: 0.72rem; cursor: pointer; padding: 0 0 0 6px; }
.bubble .kill:active { opacity: 1; }
.day-sep { text-align: center; font-size: 0.7rem; color: var(--muted-light); margin: 8px 0 2px; }
.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 28;
  background: var(--card); border-top: 1px solid var(--border);
  padding: 8px 10px; padding-bottom: calc(8px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; align-items: flex-end;
}
.composer textarea { flex: 1; min-height: 44px; max-height: 120px; padding: 10px 12px; border-radius: 22px; resize: none; }
.composer .btn { min-height: 44px; padding: 0 14px; border-radius: 22px; }
.composer .btn.square { width: 44px; padding: 0; font-size: 1.2rem; flex: none; }
.composer .pending { position: absolute; left: 12px; top: -34px; font-size: 0.75rem; background: var(--blue-wash); color: var(--blue-ink);
  border: 1px solid var(--blue-line); border-radius: 999px; padding: 5px 10px; display: flex; gap: 8px; align-items: center; }
body.has-composer { padding-bottom: 92px; }
.person { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border-soft); }
.person:first-child { border-top: none; }
.person .name { flex: 1; min-width: 0; font-weight: 700; font-size: 0.92rem; }
.person .name .sub { display: block; font-weight: 400; font-size: 0.75rem; color: var(--muted); }
.person .btn.small { min-height: 32px; padding: 6px 11px; }
.post { padding: 12px 0; border-top: 1px solid var(--border-soft); }
.post:first-child { border-top: none; }
.post .who { font-weight: 700; font-size: 0.85rem; }
.post .when { font-size: 0.72rem; color: var(--muted); }
.post .body { white-space: pre-wrap; font-size: 0.92rem; margin-top: 4px; }
.post img { display: block; max-width: 100%; max-height: 360px; border-radius: 12px; margin-top: 8px; border: 1px solid var(--border); }

@media (min-width: 700px) {
  .page { padding-top: 20px; }
  .action-bar { max-width: 640px; margin: 0 auto; }
  .composer { max-width: 640px; margin: 0 auto; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}
