/* base.css — reset, shell layout, navigation, shared components.
   Centering avoids `transform: translateX(-50%)` (unreliable on some Android
   Chrome builds); uses inset + margin auto. Press feedback uses filter, not
   transform, for the same reason. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  font-size: var(--t-body);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  transition: background .3s, color .3s;
}
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; }

/* app frame, centered without translateX */
#app {
  max-width: var(--maxw);
  margin-inline: auto;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
  position: relative;
}

/* ── header ── */
.app-header { display: flex; align-items: center; gap: 12px; padding: 18px var(--sp) 12px; }
.app-header img { width: 38px; height: 38px; border-radius: 11px; box-shadow: var(--shadow-sm); }
.app-header .titles { flex: 1; min-width: 0; }
.app-header h1 { font-family: var(--font-display); font-size: 1.3rem; margin: 0; line-height: 1; letter-spacing: .01em; }
.app-header .sub { font-size: var(--t-small); color: var(--ink-3); margin-top: 2px; }
.icon-btn {
  border: none; background: var(--surface-2); color: var(--ink);
  width: 38px; height: 38px; border-radius: 50%; font-size: 1.05rem;
  display: grid; place-items: center; transition: filter .15s;
}
.icon-btn:active { filter: brightness(.95); }

/* ── method switch (segmented) ── */
.method-switch {
  display: flex; gap: 4px; background: var(--surface-2);
  padding: 4px; border-radius: var(--r-sm); margin: 0 var(--sp) var(--sp);
}
.method-switch button {
  flex: 1; border: none; background: transparent; color: var(--ink-2);
  padding: 9px 6px; border-radius: 8px; font-weight: 700; font-size: var(--t-small); transition: .2s;
}
.method-switch button[aria-pressed='true'] { background: var(--surface); color: var(--emerald-deep); box-shadow: var(--shadow-sm); }
:root[data-theme='dark'] .method-switch button[aria-pressed='true'] { color: #4fd6a6; }

/* ── views ── */
.view { display: none; padding: 0 var(--sp); animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .view, #app * { animation: none !important; } }

/* ── cards ── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-sm);
  padding: 18px var(--sp); margin-bottom: var(--sp);
}

/* ── eyebrow: a gold hairline (the horizon) leads every section label ── */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-ui); font-size: var(--t-eyebrow); font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px;
}
.eyebrow::before { content: ''; width: 14px; height: 2px; border-radius: 2px; background: var(--gold); flex: none; }

/* field label (distinct from section eyebrow: tighter, no gold rule) */
.lbl { display: block; font-size: var(--t-eyebrow); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 5px; }
.field-grp { flex: 1; min-width: 0; }

/* ── bottom nav (centered via inset+margin, no translateX) ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; margin-inline: auto;
  max-width: var(--maxw); height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; align-items: stretch; z-index: 50;
}
.bottom-nav button {
  flex: 1; border: none; background: none; color: var(--ink-3); position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 0.6rem; font-weight: 700; transition: color .2s;
}
.bottom-nav button .ico {
  font-size: 1.05rem; line-height: 1; width: 46px; height: 28px;
  display: grid; place-items: center; border-radius: 999px; transition: background .2s;
}
.bottom-nav button[aria-current='page'] { color: var(--emerald); }
.bottom-nav button[aria-current='page'] .ico { background: var(--emerald-tint); }
:root[data-theme='dark'] .bottom-nav button[aria-current='page'] { color: #4fd6a6; }

/* ── controls ── */
.field {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink);
  font-size: var(--t-body); font-weight: 600;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field:focus { outline: none; border-color: var(--emerald); background: var(--surface); box-shadow: 0 0 0 3px var(--emerald-tint); }
select.field {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2016%2016%27%3E%3Cpath%20d%3D%27M4%206l4%204%204-4%27%20fill%3D%27none%27%20stroke%3D%27%238995a6%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px;
}
.btn {
  border: none; border-radius: var(--r-sm); padding: 13px 16px; font-weight: 800;
  color: #fff; font-size: var(--t-body);
  background: linear-gradient(180deg, var(--emerald) 0%, var(--emerald-deep) 150%);
  box-shadow: 0 6px 16px rgba(15, 157, 110, 0.26);
  transition: filter .15s, box-shadow .15s;
}
.btn:active { filter: brightness(.93); box-shadow: 0 3px 10px rgba(15, 157, 110, 0.22); }
.btn.secondary { background: var(--surface-2); color: var(--ink); box-shadow: none; }
.btn.secondary:active { filter: brightness(.96); }
.btn[disabled] { opacity: .6; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* ── confidence chip (a dot in the chip's own colour) ── */
.chip { display: inline-flex; align-items: center; gap: 7px; font-size: var(--t-small); font-weight: 700; padding: 5px 11px; border-radius: 999px; }
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; flex: none; }
.chip.tinggi { background: var(--emerald-tint); color: var(--emerald-deep); }
.chip.sedang, .chip.rendah { background: var(--soft-warn-bg); color: var(--warn); }
:root[data-theme='dark'] .chip.tinggi { color: #4fd6a6; }

/* ── horizon divider (optional) ── */
.divider { height: 1px; border: none; margin: 18px 0; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .5; }

/* ── prayer schedule (sholat) ── */
.sched { margin-top: 8px; }
.pr { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border-radius: 12px; }
.pr + .pr { margin-top: 4px; }
.pr .nm { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pr .nm .g { font-size: 1.05rem; width: 22px; text-align: center; flex: none; }
.pr .nm .lb { font-weight: 600; }
.pr .nm .sub { font-size: var(--t-eyebrow); color: var(--ink-3); font-weight: 600; }
.pr .tm { font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; flex: none; }
.pr.next { background: var(--emerald-tint); }
.pr.next .lb { font-weight: 800; color: var(--emerald-deep); }
.pr.next .tm { color: var(--emerald-deep); }
.pr .tag { font-size: var(--t-eyebrow); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #fff; background: var(--emerald); padding: 3px 9px; border-radius: 999px; }
:root[data-theme='dark'] .pr.next .lb, :root[data-theme='dark'] .pr.next .tm { color: #5fe0b0; }

/* ── qibla readout ── */
.qibla-read { text-align: center; margin-top: 6px; }
.qibla-read b { font-family: var(--font-display); font-size: 1.7rem; color: var(--ink); }
.qibla-read span { display: block; color: var(--ink-3); font-weight: 600; font-size: var(--t-small); margin-top: 2px; }

/* ── stat rows (zakat results, hilal readout) ── */
.stat-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.stat-row:last-child { border-bottom: none; }
.stat-row .k { color: var(--ink-2); font-size: var(--t-small); }
.stat-row .v { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.stat-row .v.muted { color: var(--ink-3); font-weight: 600; }
.result-figure { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.result-figure .k { font-weight: 800; }
.result-figure .v { font-family: var(--font-display); font-size: 1.55rem; color: var(--emerald-deep); line-height: 1; }
:root[data-theme='dark'] .result-figure .v { color: #5fe0b0; }

/* ── stub ── */
.stub { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.stub .ico { font-size: 2.4rem; }
.stub h2 { font-family: var(--font-display); color: var(--ink-2); margin: 12px 0 6px; }
.stub .tag { display: inline-block; margin-top: 12px; font-size: var(--t-small); background: var(--surface-2); padding: 6px 12px; border-radius: 999px; }

/* ── modern display weights (sans display font) ── */
.app-header h1, .stub h2 { font-weight: 800; letter-spacing: -0.01em; }
.qibla-read b { font-weight: 800; }
.result-figure .v { font-weight: 800; letter-spacing: -0.01em; }
