/* Square Helmet: design tokens + base components (plain CSS). Starting point; extend in app.css. */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,600;12..96,800&display=swap');

:root {
  --amber: #ffb400; --amber-hover: #f0a800;
  --butter: #fff7b8; --butter-hover: #fff09a;
  --ink: #16150f; --ink-2: #3d3a2f; --muted: #5b5646; --muted-2: #8f8a78;
  --link: #8a5a00; --danger: #b3261e;
  --paper: #fff; --sand: #faf8f1; --stone: #f3f1ea; --line: #f0ebdc; --placeholder: #e6e1c8; --canvas: #efece3;

  --font-head: 'Bricolage Grotesque', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;

  --r-xs: 9px; --r-sm: 10px; --r-md: 12px; --r-lg: 14px; --r-xl: 18px; --r-2xl: 22px; --r-sheet: 24px; --r-pill: 999px;

  --nav-rail: 76px; --nav-sidebar: 240px; --col-right: 320px;
  --shadow-seg: 0 1px 2px rgba(0,0,0,.08);
  --shadow-float: 0 4px 14px rgba(20,22,26,.08);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 400 14px/1.5 var(--font-body); color: var(--ink); background: var(--paper); }
a { color: var(--link); } a:hover { color: var(--ink); }
h1, h2, h3, .h { font-family: var(--font-head); font-weight: 800; letter-spacing: -.02em; line-height: 1.05; margin: 0; text-wrap: balance; }
img { max-width: 100%; display: block; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 12px 18px; border: 0; border-radius: var(--r-md); font: 700 14px var(--font-body); color: var(--ink); text-decoration: none; cursor: pointer; }
.btn-lg { min-height: 56px; border-radius: var(--r-lg); font-size: 16px; padding: 16px 26px; }
.btn-primary { background: var(--amber); } .btn-primary:hover { background: var(--amber-hover); color: var(--ink); }
.btn-soft { background: var(--butter); font-weight: 600; } .btn-soft:hover { background: var(--butter-hover); color: var(--ink); }
.btn-stone { background: var(--stone); font-weight: 600; }
.btn-ink { background: var(--ink); color: #fff; } .btn-ink:hover { background: var(--ink-2); color: #fff; }
.btn-ghost-light { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; } .btn-ghost-light:hover { background: rgba(255,255,255,.28); color: #fff; }
.btn[disabled] { background: rgba(22,21,15,.15); color: #6b6553; cursor: default; }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: 50%; background: var(--stone); }

/* Form fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > .label { font: 600 12px var(--font-body); color: var(--muted); }
.field > .label .opt { font-weight: 400; }
.input, .select, .textarea { width: 100%; background: var(--stone); border: 0; border-radius: var(--r-md); padding: 12px 14px; font: 400 14px var(--font-body); color: var(--ink); }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--ink); outline-offset: 0; }
.field .help { font-size: 13px; color: var(--ink-2); } .field .error { font-size: 13px; color: var(--danger); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 7px 12px; border-radius: var(--r-pill); background: var(--stone); color: var(--ink-2); font: 600 12px var(--font-body); border: 0; cursor: pointer; }
.chip[aria-pressed="true"], .chip.is-selected { background: var(--amber); color: var(--ink); }
.pill { display: inline-block; padding: 5px 10px; border-radius: var(--r-pill); background: var(--butter); font: 600 11px var(--font-body); }

/* Segmented control */
.seg { display: flex; background: var(--stone); border-radius: var(--r-md); padding: 4px; font: 600 13px var(--font-body); }
.seg > * { flex: 1; text-align: center; padding: 8px 0; border-radius: var(--r-xs); color: var(--muted); text-decoration: none; }
.seg > [aria-current="true"], .seg > .is-active { background: #fff; color: var(--ink); box-shadow: var(--shadow-seg); }

/* Cards */
.card { background: var(--sand); border-radius: var(--r-xl); padding: 16px; }
.card-butter { background: var(--butter); }
.card-title { font: 800 15px var(--font-head); margin-bottom: 10px; }
.post { background: var(--sand); border-radius: 20px; padding: 14px; }
.post .media { border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 4/3; }
.post .media img { width: 100%; height: 100%; object-fit: cover; }

/* Avatars */
.avatar { border-radius: 50%; background: var(--placeholder); object-fit: cover; flex: none; }
.avatar-ring { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--amber); }
.avatar-stack { display: flex; } .avatar-stack > * { width: 30px; height: 30px; border: 2px solid #fff; margin-left: -8px; } .avatar-stack > :first-child { margin-left: 0; }

/* App shell */
.app { min-height: 100dvh; }
.app-main { min-width: 0; }
.tabbar { position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid var(--line); padding: 10px 0 calc(22px + env(safe-area-inset-bottom)); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 4px; font: 600 11px var(--font-body); color: var(--muted-2); text-decoration: none; }
.tabbar a[aria-current="page"] { color: var(--ink); } .tabbar a[aria-current="page"] svg { fill: var(--butter); }
.rail, .sidebar, .app-right { display: none; }

@media (max-width: 767px) { .app-main { padding-bottom: 90px; } }

@media (min-width: 768px) {
  .tabbar { display: none; }
  .app { display: grid; grid-template-columns: var(--nav-rail) minmax(0,1fr); }
  .rail { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 0; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100dvh; }
  .rail a { width: 48px; height: 48px; border-radius: var(--r-lg); display: flex; align-items: center; justify-content: center; color: var(--muted); }
  .rail a[aria-current="page"] { background: var(--butter); color: var(--ink); }
  .rail .rail-new { margin-top: auto; border-radius: 50%; background: var(--amber); color: var(--ink); }
}

@media (min-width: 1200px) {
  .rail { display: none; }
  .app { grid-template-columns: var(--nav-sidebar) minmax(0,1fr); }
  .app.has-right { grid-template-columns: var(--nav-sidebar) minmax(0,1fr) var(--col-right); }
  .sidebar { display: flex; flex-direction: column; gap: 4px; padding: 22px 16px; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100dvh; }
  .sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; font: 800 19px var(--font-head); letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
  .sidebar .search { display: flex; align-items: center; gap: 8px; height: 44px; border-radius: var(--r-md); background: var(--stone); padding: 0 12px; margin-bottom: 10px; }
  .sidebar .search input { border: 0; background: none; font: 400 13px var(--font-body); flex: 1; outline: none; }
  .sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r-md); font: 600 14px var(--font-body); color: var(--ink-2); text-decoration: none; }
  .sidebar nav a[aria-current="page"] { background: var(--butter); color: var(--ink); }
  .sidebar .count { margin-left: auto; background: var(--amber); color: var(--ink); font: 700 11px var(--font-body); padding: 2px 7px; border-radius: var(--r-pill); }
  .sidebar .btn-primary { margin-top: 16px; justify-content: flex-start; }
  .app-right { display: flex; flex-direction: column; gap: 16px; padding: 22px 24px; border-left: 1px solid var(--line); position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
}

/* Centre content widths */
.content { margin: 0 auto; padding: 0 14px; }
.content-feed { max-width: 600px; } .content-form { max-width: 560px; } .content-wide { max-width: 680px; }
@media (min-width: 768px) { .content { padding: 0 24px; } }

/* Bottom sheet / modal */
.scrim { position: fixed; inset: 0; background: rgba(22,21,15,.4); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: #fff; border-radius: var(--r-sheet) var(--r-sheet) 0 0; padding: 10px 20px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; max-width: 480px; margin: 0 auto; }
.sheet .grab { width: 40px; height: 4px; border-radius: var(--r-pill); background: var(--placeholder); align-self: center; }
@media (min-width: 1200px) { .sheet { top: 50%; bottom: auto; transform: translateY(-50%); width: 440px; border-radius: var(--r-sheet); padding: 24px; } .sheet .grab { display: none; } }
