/* Kongu Sudar — design system ("Turmeric & Teal", spec §3).
   All sizing in rem/em so the A / A+ control (root font-size) scales everything. */

:root {
  --bg: #FCF6E3;
  --surface: #FFFDF6;
  --header: #F6EFD4;
  --primary: #3E8A89;
  --primary-dark: #2C5E5D;
  --teal-bg: #DCEDEA;
  --teal-border: #BEDDD6;
  --amber: #9A6A12;
  --amber-bg: #F6E8C8;
  --neutral-bg: #EDEED2;
  --neutral-text: #5E6B6A;
  --text: #2C3E3D;
  --text-muted: #7E857F;
  --border: #DDDFB8;
  --border-soft: #EFE4BF;
  --danger: #A32D2D;
  --verified: #1D9E75;
  --verified-bg: #E1F5EE;
  --silhouette-bg: #EDEED2;
  --silhouette-icon: #A8A06A;

  font-size: 100%; /* A = 100%, A+ = 150% (set on <html>) */
}
html.text-lg { font-size: 150%; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Noto Sans Tamil', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* ---- App bar ---- */
.appbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--header);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 1rem; gap: 0.5rem;
}
.appbar .brand { font-weight: 500; color: var(--primary-dark); font-size: 1.15rem; }
.appbar .controls { display: flex; gap: 0.4rem; }
.ctrl {
  font-family: inherit; font-size: 0.85rem;
  background: var(--surface); color: var(--primary-dark);
  border: 1px solid var(--teal-border); border-radius: 0.5rem;
  padding: 0.3rem 0.6rem; cursor: pointer;
}
.ctrl[aria-pressed="true"] { background: var(--teal-bg); }

/* ---- Layout ---- */
#app { max-width: 30rem; margin: 0 auto; padding: 1rem; padding-bottom: 6rem; }
.view-title { color: var(--primary-dark); font-weight: 500; font-size: 1.4rem; margin: 0.25rem 0 1rem; }
/* Every grouping box carries the thick teal top edge (client rule — applies to
   every group on every screen; new screens get it automatically via .card). */
.card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-top: 4px solid var(--primary);
  border-radius: 0.85rem; padding: 1.1rem; margin-bottom: 1rem;
}
.muted { color: var(--text-muted); font-size: 0.9rem; }
.center { text-align: center; }
.stack > * + * { margin-top: 0.85rem; }

/* ---- Fields ---- */
.field { display: block; margin-bottom: 0.9rem; }
.field > label { display: block; font-size: 0.9rem; color: var(--primary-dark); margin-bottom: 0.3rem; }
.field .req { color: var(--danger); margin-left: 0.15rem; }
.req-tag { font-size: 0.72rem; color: var(--text-muted); font-weight: 400; }
.field .hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }
input, select, textarea {
  font-family: inherit; font-size: 1rem; width: 100%;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 0.6rem;
  padding: 0.6rem 0.7rem;
}
textarea { min-height: 5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal-border); border-color: var(--primary); }
.field-row { display: flex; gap: 0.5rem; align-items: flex-start; }
.field-row > .field { flex: 1; }
.input-with-mic { display: flex; gap: 0.4rem; align-items: stretch; }
.input-with-mic > input, .input-with-mic > textarea { flex: 1; }

/* checkbox / radio groups */
.check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; font-size: 0.95rem; }
.check input { width: auto; }
.radio-list { display: flex; flex-direction: column; gap: 0.4rem; }

/* ---- Buttons ---- */
.btn {
  font-family: inherit; font-size: 1rem; cursor: pointer;
  border-radius: 0.6rem; padding: 0.7rem 1rem; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-bg); }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--primary-dark); text-decoration: underline; cursor: pointer; padding: 0; font-size: 0.9rem; }
.mic { flex: 0 0 auto; width: 2.6rem; border-radius: 0.6rem; border: 1px solid var(--teal-border); background: var(--teal-bg); cursor: pointer; }
.mic.recording { background: var(--danger); color: #fff; border-color: var(--danger); }
.mic.transcribing { opacity: 0.6; cursor: progress; }
.mic-status { font-size: 0.78rem; color: var(--muted); margin-top: 0.25rem; min-height: 1em; }

/* ---- Sticky action bar ---- */
.sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--header); border-top: 1px solid var(--border-soft);
  display: flex; gap: 0.6rem; padding: 0.7rem 1rem;
  max-width: 30rem; margin: 0 auto;
}
.sticky-bar .btn { flex: 1; }

/* ---- Stepper ---- */
.stepper { display: flex; gap: 0.3rem; margin-bottom: 1rem; }
.stepper .dot { flex: 1; height: 0.35rem; border-radius: 999px; background: var(--neutral-bg); }
.stepper .dot.active { background: var(--primary); }
.stepper .dot.done { background: var(--teal-border); }
.step-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; }
/* Each form section sits in its own card; a thick teal top edge separates them. */
.group-card { border-top: 4px solid var(--primary); }
.group-card .sec-title { margin-top: 0.25rem; }

/* ---- Badges / tags (spec §3 tag system) ---- */
.badge { display: inline-block; font-size: 0.78rem; border-radius: 999px; padding: 0.2rem 0.6rem; }
.badge-trust { background: var(--teal-bg); color: var(--primary-dark); }
.badge-recency { background: var(--neutral-bg); color: var(--neutral-text); }
.badge-status { background: var(--amber-bg); color: var(--amber); }
.badge-verified { background: var(--verified-bg); color: var(--verified); }

/* ---- Media ---- */
.thumbs { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.thumb { position: relative; width: 5.5rem; height: 5.5rem; border-radius: 0.6rem; overflow: hidden; border: 1px solid var(--border-soft); background: var(--silhouette-bg); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .pin { position: absolute; top: 2px; left: 2px; font-size: 0.65rem; background: var(--teal-bg); color: var(--primary-dark); padding: 0 0.3rem; border-radius: 0.4rem; }
.thumb .x { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,0.5); color:#fff; border:none; border-radius: 0.4rem; cursor:pointer; font-size:0.7rem; padding: 0 0.3rem; }

/* ---- Banners ---- */
.banner { border-radius: 0.6rem; padding: 0.6rem 0.8rem; font-size: 0.9rem; margin-bottom: 0.8rem; }
.banner-info { background: var(--teal-bg); color: var(--primary-dark); }
.banner-warn { background: var(--amber-bg); color: var(--amber); }
.banner-error { background: var(--danger); color: #fff; font-weight: 500; border: 2px solid #7d1f1f; }
/* Highlight required fields that failed validation. */
.field-error > label { color: var(--danger); font-weight: 500; }
.field-error input, .field-error select, .field-error textarea {
  border: 2px solid var(--danger);
  background: #FBE9E9;
}
.vis-name { font-weight: 600; color: var(--primary-dark); }
.selected-box { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; padding: 0.5rem 0.6rem; background: var(--surface); border: 1px dashed var(--border); border-radius: 0.5rem; }
.chip-sel { background: var(--teal-bg); color: var(--primary-dark); border: 1px solid var(--teal-border); border-radius: 999px; padding: 0.1rem 0.5rem; font-size: 0.8rem; }
select[multiple] { padding: 0.3rem; }
.divider { border: none; border-top: 1px solid var(--border-soft); margin: 0.4rem 0; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.stat { background: var(--teal-bg); border-radius: 0.6rem; padding: 0.7rem; text-align: center; }
.stat-btn { font-family: inherit; border: 1px solid var(--teal-border); cursor: pointer; }
.stat-n { font-size: 1.6rem; font-weight: 600; color: var(--primary-dark); }
.stat-l { font-size: 0.8rem; color: var(--neutral-text); }
/* Mini list rows (reciprocity + activity lists): photo thumbnail + name + open. */
.mini-row { align-items: center; }
.mini-main { flex: 1; }
.mini-name { font-weight: 500; }
.mini-date { font-size: 0.75rem; }
/* Greyed-out "who can see me" for unlisted/private profiles (filter doesn't apply). */
.rfilter-disabled { opacity: 0.6; }
.mini-thumb { width: 2.6rem; height: 2.6rem; border-radius: 0.5rem; object-fit: cover;
  background: var(--silhouette-bg); flex: 0 0 auto; }
.mini-silhouette { display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.banner-confirm { background: var(--verified-bg); color: var(--verified); }

.completeness { height: 0.5rem; background: var(--neutral-bg); border-radius: 999px; overflow: hidden; }
.completeness > span { display: block; height: 100%; background: var(--primary); }

/* ---- Search results (minimal cards, spec §14) ---- */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.s-card {
  display: flex; flex-direction: column; text-align: left;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 0.85rem; overflow: hidden; padding: 0; cursor: pointer;
  font-family: inherit; color: var(--text);
}
.s-card .carousel-main { aspect-ratio: 1 / 1; border-radius: 0; }
.s-card-body { padding: 0.6rem 0.7rem; display: flex; flex-direction: column; gap: 0.25rem; }
.s-card-name { font-weight: 500; color: var(--primary-dark); font-size: 1rem; }
.s-card .badge-row { margin-top: 0.2rem; }

.hidden { display: none !important; }
.spinner { text-align: center; color: var(--text-muted); padding: 2rem 0; }

/* ---- Profile view ---- */
.sec-title { color: var(--primary-dark); font-weight: 500; font-size: 1.05rem; margin: 0 0 0.6rem; }
.badge-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.dl { display: flex; flex-direction: column; gap: 0.4rem; }
.drow { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.95rem; }
.drow .dk { color: var(--text-muted); }
.drow .dv { color: var(--text); text-align: right; font-weight: 500; }
.row-gap { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.carousel { position: relative; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 0.85rem; overflow: hidden; }
.carousel-main { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; background: var(--silhouette-bg); }
.carousel-main .photo { width: 100%; height: 100%; object-fit: cover; }
.photo-locked { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; padding: 2rem; text-align: center; filter: blur(0.5px); }
.lock-icon { font-size: 2rem; }
.silhouette { font-size: 4rem; color: var(--silhouette-icon); }
.carousel-arrow { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,253,246,0.85); border: 1px solid var(--border-soft); border-radius: 999px; width: 2.2rem; height: 2.2rem; font-size: 1.4rem; cursor: pointer; color: var(--primary-dark); }
.carousel-arrow.left { left: 0.5rem; }
.carousel-arrow.right { right: 0.5rem; }
.dots { position: absolute; bottom: 0.5rem; left: 0; right: 0; display: flex; justify-content: center; gap: 0.3rem; }
.dot-i { width: 0.5rem; height: 0.5rem; border-radius: 999px; background: rgba(255,255,255,0.6); }
.dot-i.on { background: var(--primary); }
.video { width: 100%; border-radius: 0.6rem; }
.share-link { font-family: monospace; font-size: 0.85rem; word-break: break-all; background: var(--teal-bg); color: var(--primary-dark); padding: 0.5rem 0.7rem; border-radius: 0.5rem; }
