/* ww.css — WildWisdom House design system.
   Warm, luminous, earthy. Cream/gold, serif headlines, contemplative.
   Thai-first. All pages @import this and use these tokens/components only. */

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

:root {
  /* palette — warm cream → gold, earthy ink */
  --cream:      #FBF7EF;
  --cream-2:    #F5EEE0;
  --card:       #FFFFFF;
  --ink:        #3A322A;   /* warm charcoal, never pure black */
  --ink-soft:   #6B6155;
  --ink-faint:  #9A9082;
  --gold:       #C79A3E;   /* primary accent */
  --gold-deep:  #A87C22;
  --gold-glow:  rgba(199,154,62,0.14);
  --olive:      #7C8461;
  --line:       #E8DFCD;   /* hairlines */
  --danger:     #B4552F;
  --ok:         #6E8B4E;

  --r-sm: 8px; --r-md: 14px; --r-lg: 22px; --r-pill: 999px;
  --shadow: 0 1px 2px rgba(58,50,42,.04), 0 8px 30px rgba(58,50,42,.06);
  --shadow-lg: 0 10px 40px rgba(58,50,42,.12);
  --serif: 'Noto Serif Thai', Georgia, serif;
  --sans:  'Sarabun', system-ui, sans-serif;
  --maxw: 680px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 50% -10%, var(--gold-glow), transparent 60%),
    linear-gradient(180deg, var(--cream), var(--cream-2));
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* layout */
.ww-wrap { max-width: var(--maxw); margin: 0 auto; padding: 20px 18px 96px; }
.ww-narrow { max-width: 520px; }

/* typography */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--ink); line-height: 1.3; margin: 0 0 .4em; }
h1 { font-size: 1.7rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.eyebrow { font-family: var(--sans); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-deep); font-weight: 600; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.serif { font-family: var(--serif); }
a { color: var(--gold-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

/* header / brand */
.ww-head { display: flex; align-items: center; gap: 12px; padding: 8px 0 20px; }
.ww-mark { width: 34px; height: 34px; flex: 0 0 auto; }
.ww-head .t { font-family: var(--serif); font-weight: 600; font-size: 1rem; }
.ww-head .s { font-size: .74rem; color: var(--ink-faint); letter-spacing: .04em; }

/* cards */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card.pad-sm { padding: 14px 16px; }
.card.glow { box-shadow: var(--shadow-lg); border-color: #EAD9AE; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--sans); font-size: .95rem; font-weight: 500;
  padding: 12px 20px; border-radius: var(--r-pill); border: 1px solid transparent;
  cursor: pointer; transition: transform .08s ease, box-shadow .15s ease, background .15s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, var(--gold), var(--gold-deep)); color: #fff; box-shadow: 0 4px 14px var(--gold-glow); }
.btn-primary:hover { text-decoration: none; box-shadow: 0 6px 20px rgba(199,154,62,.28); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--cream-2); text-decoration: none; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }

/* inputs */
label.field { display: block; margin: 0 0 14px; }
label.field > span { display: block; font-size: .82rem; color: var(--ink-soft); margin-bottom: 6px; font-weight: 500; }
input[type=text], input[type=email], input[type=tel], input[type=number], select, textarea {
  width: 100%; font-family: var(--sans); font-size: 1rem; color: var(--ink);
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }

/* choice chips (meal, days, etc.) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: var(--r-pill); border: 1px solid var(--line);
  background: #fff; color: var(--ink-soft); cursor: pointer; font-size: .9rem; user-select: none;
  transition: all .12s;
}
.chip[aria-pressed=true], .chip.on { background: var(--gold-glow); border-color: var(--gold); color: var(--gold-deep); font-weight: 500; }

/* pills / tags */
.tag { display: inline-block; font-size: .72rem; padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--cream-2); color: var(--ink-soft); }
.tag.gold { background: var(--gold-glow); color: var(--gold-deep); }
.tag.olive { background: #EEF0E4; color: var(--olive); }

/* schedule blocks */
.blk { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.blk:first-child { border-top: none; }
.blk .time { font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--ink-faint); flex: 0 0 92px; }
.blk.break .title, .blk.meal .title { color: var(--olive); }
.blk.now { background: var(--gold-glow); border-radius: var(--r-md); padding: 10px 12px; }

/* bottom tab nav */
.ww-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around;
  background: rgba(251,247,239,.9); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: 8px max(8px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom));
}
.ww-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--ink-faint); font-size: .68rem; text-decoration: none; padding: 4px 10px; }
.ww-nav a.active { color: var(--gold-deep); }
.ww-nav a svg { width: 22px; height: 22px; }

/* avatars */
.ava { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--cream-2);
  display: inline-flex; align-items: center; justify-content: center; font-family: var(--serif);
  color: var(--gold-deep); font-weight: 600; flex: 0 0 auto; overflow: hidden; }
.ava.lg { width: 64px; height: 64px; font-size: 1.4rem; }

/* chat */
.msg { display: flex; gap: 10px; margin: 10px 0; }
.msg .body { background: #fff; border: 1px solid var(--line); border-radius: 4px 16px 16px 16px;
  padding: 8px 12px; max-width: 78%; box-shadow: var(--shadow); }
.msg.me { flex-direction: row-reverse; }
.msg.me .body { background: var(--gold-glow); border-color: #EAD9AE; border-radius: 16px 4px 16px 16px; }
.msg .who { font-size: .72rem; color: var(--gold-deep); font-weight: 600; margin-bottom: 2px; }
.msg .when { font-size: .64rem; color: var(--ink-faint); margin-top: 2px; }

/* gallery */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px,1fr)); gap: 8px; }
.grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-md); background: var(--cream-2); }

/* toast + states */
.toast { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--r-pill);
  font-size: .88rem; box-shadow: var(--shadow-lg); z-index: 60; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.empty { text-align: center; color: var(--ink-faint); padding: 48px 20px; }
.empty .em-mark { font-size: 2rem; opacity: .5; margin-bottom: 8px; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--gold);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.stat { font-family: var(--serif); font-size: 1.9rem; color: var(--gold-deep); line-height: 1; }
.divider { height: 1px; background: var(--line); margin: 18px 0; border: none; }
.hide { display: none !important; }

/* ---- header login-status identity chip ---- */
.ww-id { margin-left: auto; position: relative; flex: 0 0 auto; }
.ww-id-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--cream-2); border: 1px solid rgba(0,0,0,.07);
  border-radius: 999px; padding: 5px 11px; cursor: pointer;
  font-family: var(--sans); font-size: .8rem; color: var(--ink-soft);
  transition: background .15s, box-shadow .15s;
}
.ww-id-chip:hover { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.ww-id-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #4a9d5b;
  box-shadow: 0 0 0 3px rgba(74,157,91,.16); flex: 0 0 auto;
}
.ww-id-nm { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ww-id-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60;
  background: #fff; border: 1px solid var(--line, rgba(0,0,0,.08));
  border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.14);
  padding: 13px 14px; min-width: 210px;
}
.ww-id-status { display: flex; align-items: center; gap: 7px; font-size: .74rem; color: #4a9d5b; margin-bottom: 8px; }
.ww-id-em { font-size: .84rem; color: var(--ink); word-break: break-all; }
.ww-id-role { font-size: .72rem; color: var(--ink-faint); margin: 2px 0 12px; }
.ww-id-out { margin: 0; }
.ww-id-link { font-size: .8rem; color: var(--gold-deep); }
