/* ───────────────────────────────────────────────────────────
   One Question — design system
   Motif: the dot. One filled ink dot = one answered day.
   Type: Source Serif 4 (questions + the writer's own words)
         IBM Plex Mono (labels, dates, counters)
   ─────────────────────────────────────────────────────────── */

:root {
  /* paper & ink — warm, low-chroma */
  --paper:    oklch(0.973 0.008 83);
  --paper-2:  oklch(0.948 0.011 80);
  --paper-3:  oklch(0.918 0.013 78);
  --paper-card: oklch(0.988 0.006 85);

  --ink:      oklch(0.265 0.014 62);
  --ink-2:    oklch(0.445 0.012 62);
  --ink-3:    oklch(0.605 0.010 66);
  --ink-4:    oklch(0.715 0.008 70);

  --line:        oklch(0.30 0.01 62 / 0.13);
  --line-2:      oklch(0.30 0.01 62 / 0.22);
  --line-strong: oklch(0.30 0.01 62 / 0.34);

  /* accent — dusk clay (the signature warm) */
  --accent:      oklch(0.585 0.094 42);
  --accent-deep: oklch(0.490 0.085 40);
  --accent-soft: oklch(0.585 0.094 42 / 0.12);

  /* night — for onboarding / the closing "dusk" moment */
  --night:    oklch(0.255 0.018 64);
  --night-2:  oklch(0.315 0.020 64);
  --night-ink:   oklch(0.93 0.010 84);
  --night-ink-2: oklch(0.74 0.012 80);
  --night-line:  oklch(0.92 0.01 84 / 0.16);

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* evening tone (premium) swaps the accent toward twilight */
[data-tone="evening"] {
  --accent:      oklch(0.560 0.072 268);
  --accent-deep: oklch(0.470 0.068 268);
  --accent-soft: oklch(0.560 0.072 268 / 0.13);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: oklch(0.93 0.006 84);
}

button { font-family: inherit; -webkit-tap-highlight-color: transparent; }
textarea, input { font-family: inherit; }

/* ── the app shell inside the device ───────────────────────── */
.oq {
  position: relative;
  height: 100%;
  width: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.oq.is-night { background: var(--night); color: var(--night-ink); }

/* paper grain overlay */
.oq::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
}
.oq.is-night::before { mix-blend-mode: screen; opacity: 0.35; }

/* the scrolling screen body */
.screen {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.screen-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.screen-scroll::-webkit-scrollbar { display: none; }

/* top padding clears the dynamic island / status bar */
.pt-status { padding-top: 64px; }

/* ── typography helpers ────────────────────────────────────── */
.mono {
  font-family: var(--mono);
  font-variant-ligatures: none;
}
.label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.label-accent { color: var(--accent); }
.serif { font-family: var(--serif); }

.q-display {
  font-family: var(--serif);
  font-weight: 380;
  letter-spacing: -0.012em;
  line-height: 1.22;
  text-wrap: pretty;
}

/* ── dot motif ─────────────────────────────────────────────── */
.dot {
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ── hairline rule ─────────────────────────────────────────── */
.rule { height: 1px; background: var(--line); border: 0; width: 100%; }
.rule-2 { height: 1px; background: var(--line-2); border: 0; width: 100%; }

/* ── buttons ───────────────────────────────────────────────── */
.btn {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: transform 0.18s var(--ease), background 0.2s var(--ease), opacity 0.2s;
  user-select: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: 16px 28px;
  font-size: 14px;
  letter-spacing: 0.06em;
}
.btn-primary.is-night { background: var(--night-ink); color: var(--night); }

.btn-accent {
  background: var(--accent);
  color: oklch(0.99 0.005 85);
  border-radius: 999px;
  padding: 16px 28px;
  font-size: 14px;
  letter-spacing: 0.06em;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 13px 22px;
}
.btn-ghost:active { background: var(--paper-2); }

.btn-text {
  background: transparent;
  color: var(--ink-3);
  padding: 10px 6px;
}

/* tappable feedback util */
.tap { cursor: pointer; transition: transform 0.16s var(--ease), opacity 0.16s; }
.tap:active { transform: scale(0.97); opacity: 0.7; }

/* ── tab bar ───────────────────────────────────────────────── */
.tabbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  padding: 10px 14px calc(env(safe-area-inset-bottom, 0px) + 26px);
  background: linear-gradient(to top, var(--paper) 64%, transparent);
  border-top: 1px solid var(--line);
}
.is-night .tabbar {
  background: linear-gradient(to top, var(--night) 64%, transparent);
  border-top: 1px solid var(--night-line);
}
.tab {
  flex: 1;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 6px 0 2px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
  transition: color 0.2s;
}
.tab.is-active { color: var(--ink); }
.tab .tab-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  opacity: 0.32;
  transition: opacity 0.2s, transform 0.2s var(--ease);
}
.tab.is-active .tab-dot { opacity: 1; background: var(--accent); transform: scale(1.15); }

/* ── sheets / modals ───────────────────────────────────────── */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: oklch(0.2 0.02 60 / 0.34);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  animation: fade-in 0.28s var(--ease);
}
.sheet {
  background: var(--paper);
  border-radius: 28px 28px 0 0;
  max-height: 88%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -20px 60px oklch(0.2 0.02 60 / 0.22);
  animation: sheet-up 0.4s var(--ease-out);
}
.sheet-grip {
  width: 38px; height: 5px; border-radius: 99px;
  background: var(--line-strong);
  margin: 10px auto 4px;
  flex-shrink: 0;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ── generic screen transitions ────────────────────────────── */
@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-in { animation: screen-in 0.42s var(--ease-out) both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.rise { animation: rise 0.6s var(--ease-out) both; }

@keyframes dot-seal {
  0%   { transform: scale(0); opacity: 0; }
  55%  { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes draw-line {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

@keyframes notif-in {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; }
}

/* ── inputs ────────────────────────────────────────────────── */
.answer-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.55;
  letter-spacing: -0.004em;
}
.answer-input::placeholder { color: var(--ink-4); font-style: italic; }
.is-night .answer-input { color: var(--night-ink); }

/* utility */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.center { align-items: center; justify-content: center; }
.grow { flex: 1; }
.wrap-balance { text-wrap: balance; }
