/* ফর্দ tokens.
   Layout concept: a hand-bound Bengali red ledger (লাল খাতা). Cloth is the chrome, ruled paper holds the data,
   blue-black ink is the text. Marigold and rubber-stamp purple mark the moments that matter. */
:root {
  /* cloth + foil */
  --cloth: #a4122b;
  --cloth-hi: #bd1b36;
  --cloth-lo: #7c0c20;
  --cloth-deep: #4e0612;
  --on-cloth: #fff1d6;
  --on-cloth-2: #f7d3ab;
  --foil-1: #ffedb0;
  --foil-2: #e9bc57;
  --foil-3: #b8862a;
  --foil-ink: #5a0a18;

  /* paper */
  --paper: #fdfcf7;
  --paper-2: #f3f1e7;
  --paper-3: #e6e2d2;
  --rule: #ccdaf0;
  --margin: #ec9aa4;
  --tint-y: #fdf3c9;
  --tint-p: #fbdfe2;
  --tint-b: #dcebf9;

  /* ink */
  --ink: #131c55;
  --ink-2: #434c86;
  --ink-3: #636b95;
  --edge: rgba(19, 28, 85, 0.2);

  /* accents */
  --alta: #c4122f;
  --alta-lo: #8a0c20;
  --on-alta: #fff8ec;
  --marigold: #f59e0b;
  --marigold-lo: #b96f03;
  --on-marigold: #2a1600;
  --leaf: #0f7346;
  --stamp: #6b2bb0;
  --wa: #128c4a;
  --wa-lo: #0b6535;
  --pan: #f2d487;
  --focus: #0f6fa8;
  --scrim: rgba(40, 6, 14, 0.55);
  --veil: rgba(30, 6, 14, 0.74);
  --shadow: 0 10px 34px rgba(50, 10, 20, 0.28);

  /* type */
  --f-ui: 'Anek Bangla', 'Noto Sans Bengali', 'Nirmala UI', 'Hind Siliguri', system-ui, sans-serif;
  --f-sign: 'Galada', 'Anek Bangla', 'Noto Sans Bengali', 'Nirmala UI', serif;
  --f-hand: 'Atma', 'Anek Bangla', 'Noto Sans Bengali', 'Nirmala UI', cursive;

  /* layout */
  --gl: max(8px, env(safe-area-inset-left, 0px));
  --gr: max(16px, env(safe-area-inset-right, 0px));
  --pad-l: max(16px, env(safe-area-inset-left, 0px));
  --pad-r: max(16px, env(safe-area-inset-right, 0px));
  --line: 58px;
  --tickw: 44px;
  --amtw: 84px;

  /* motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.2, 1.25, 0.35, 1);

  --weave: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.075) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 3px);

  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@supports (animation-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%, 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%, 1.003 76.9%, 1.004 83.8%, 1);
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --cloth: #84101f;
    --cloth-hi: #9a152b;
    --cloth-lo: #5e0a18;
    --cloth-deep: #38050d;
    --paper: #14172a;
    --paper-2: #1c2038;
    --paper-3: #2a2f4e;
    --rule: rgba(148, 170, 225, 0.17);
    --margin: rgba(240, 110, 130, 0.42);
    --tint-y: #2c2a1c;
    --tint-p: #33202a;
    --tint-b: #1c2b3f;
    --ink: #eeeadb;
    --ink-2: #bcbdd2;
    --ink-3: #9799b6;
    --edge: rgba(238, 234, 219, 0.2);
    --alta: #d92342;
    --alta-lo: #8f1026;
    --leaf: #4ccb8f;
    --stamp: #bb90ff;
    --pan: #a8853a;
    --focus: #6ec4f5;
    --scrim: rgba(4, 3, 10, 0.68);
    --shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --cloth: #84101f;
  --cloth-hi: #9a152b;
  --cloth-lo: #5e0a18;
  --cloth-deep: #38050d;
  --paper: #14172a;
  --paper-2: #1c2038;
  --paper-3: #2a2f4e;
  --rule: rgba(148, 170, 225, 0.17);
  --margin: rgba(240, 110, 130, 0.42);
  --tint-y: #2c2a1c;
  --tint-p: #33202a;
  --tint-b: #1c2b3f;
  --ink: #eeeadb;
  --ink-2: #bcbdd2;
  --ink-3: #9799b6;
  --edge: rgba(238, 234, 219, 0.2);
  --alta: #d92342;
  --alta-lo: #8f1026;
  --leaf: #4ccb8f;
  --stamp: #bb90ff;
  --pan: #a8853a;
  --focus: #6ec4f5;
  --scrim: rgba(4, 3, 10, 0.68);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  height: 100%;
  background: var(--cloth);
  -webkit-text-size-adjust: 100%;
}
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--cloth);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
#root {
  height: 100%;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  text-wrap: balance;
  line-height: 1.25;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
}
a {
  color: inherit;
}
input,
textarea {
  font: inherit;
  color: inherit;
}
ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.sheet:focus-visible,
.sheet:focus {
  outline: none;
}
.i {
  width: 22px;
  height: 22px;
  flex: none;
}
.glyph {
  width: 30px;
  height: 30px;
  flex: none;
  color: var(--ink);
}

/* Foil lettering */
.foil {
  background: linear-gradient(105deg, var(--foil-3) 0%, var(--foil-1) 22%, var(--foil-2) 40%, #fff8dc 50%, var(--foil-2) 60%, var(--foil-3) 80%, var(--foil-1) 100%);
  background-size: 240% 100%;
  background-position: var(--glint, 30%) 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1.5px 0 rgba(50, 0, 10, 0.55));
  transition: background-position 0.5s var(--ease);
}

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 16.5px;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  border-radius: 8px 7px 9px 6px;
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), background-color 0.2s, opacity 0.2s;
  user-select: none;
}
.btn:disabled {
  opacity: 0.45;
}
.btn.pri {
  background: var(--alta);
  color: var(--on-alta);
  box-shadow: 0 3px 0 var(--alta-lo);
}
.btn.pri::after,
.btn.go::after,
.btn.wa::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1.5px dashed currentColor;
  border-radius: 5px;
  opacity: 0.38;
  pointer-events: none;
}
.btn.pri:not(:disabled):active {
  transform: translateY(3px);
  box-shadow: 0 0 0 var(--alta-lo);
}
.btn.go {
  background: var(--marigold);
  color: var(--on-marigold);
  box-shadow: 0 3px 0 var(--marigold-lo);
}
.btn.go:not(:disabled):active {
  transform: translateY(3px);
  box-shadow: 0 0 0 var(--marigold-lo);
}
.btn.go .i {
  transition: transform 0.25s var(--ease);
}
.btn.go:hover .i {
  transform: translateX(4px);
}
.btn.ghost {
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--edge);
}
.btn.ghost:active {
  transform: translateY(2px);
}
.btn.danger {
  background: var(--alta);
  color: var(--on-alta);
  box-shadow: 0 3px 0 var(--alta-lo);
}
.btn.danger-t {
  color: var(--alta);
}
.btn.wa {
  background: var(--wa);
  color: #fff;
  box-shadow: 0 3px 0 var(--wa-lo);
}
.btn.wa:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 var(--wa-lo);
}
.btn.foil {
  -webkit-background-clip: border-box;
  background-clip: border-box;
  background-image: linear-gradient(105deg, var(--foil-2), var(--foil-1) 50%, var(--foil-2));
  background-size: auto;
  color: var(--foil-ink);
  filter: none;
  box-shadow: 0 2px 0 var(--cloth-deep);
  min-height: 42px;
  padding: 7px 14px;
}
.btn.foil:active {
  transform: translateY(2px);
  box-shadow: none;
}
.btn.wide {
  width: 100%;
}
.ibtn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: var(--ink-2);
  transition: background-color 0.15s, transform 0.12s;
}
.ibtn:hover {
  background: var(--paper-2);
}
.ibtn:active {
  transform: scale(0.92);
}
.ibtn:disabled {
  opacity: 0.3;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 5px 12px 5px 8px;
  white-space: nowrap;
  font-weight: 500;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper-2);
  border-radius: 7px 6px 8px 5px;
  box-shadow: inset 0 0 0 1px var(--edge);
  transition: transform 0.12s var(--ease), background-color 0.15s;
}
.chip .glyph {
  width: 22px;
  height: 22px;
}
.chip:hover {
  background: var(--paper-3);
}
.chip:active {
  transform: scale(0.95);
}
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--paper-3);
  border-radius: 8px;
}
.seg button {
  min-height: 38px;
  padding: 4px 12px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-2);
  border-radius: 6px;
  white-space: nowrap;
  transition: background-color 0.18s, color 0.18s;
}
.seg button.on {
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.txt {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  background: var(--paper);
  border: 0;
  border-bottom: 2px solid var(--ink-3);
  border-radius: 6px 6px 0 0;
  box-shadow: inset 0 0 0 1px var(--edge);
  font-size: 17px;
  transition: border-color 0.15s;
}
.txt:focus {
  outline: none;
  border-bottom-color: var(--alta);
}
.txt.area {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}
:root[data-motion='off'] *,
:root[data-motion='off'] *::before,
:root[data-motion='off'] *::after {
  animation-duration: 0.01ms !important;
  animation-delay: 0s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}
