/* Kohli — foundations: colour tokens, typography, layout primitives.
   Monochrome by design. Colour is only ever used to mean something. */

/* ---------- Light (default) ---------- */
:root {
  --bg:            #F2F2F7;
  --surface:       #FFFFFF;
  --surface-sunk:  #E9E9EF;
  --nav:           rgba(249, 249, 251, 0.82);

  --text:          #000000;
  --text-2:        rgba(60, 60, 67, 0.60);
  --text-3:        rgba(60, 60, 67, 0.30);

  --separator:     rgba(60, 60, 67, 0.20);
  --hairline:      rgba(60, 60, 67, 0.29);

  --accent:        #000000;   /* filled buttons, active states */
  --on-accent:     #FFFFFF;
  --destructive:   #D93025;

  --fill:          rgba(120, 120, 128, 0.12);
  --fill-strong:   rgba(120, 120, 128, 0.20);
  --pressed:       rgba(0, 0, 0, 0.055);

  /* Cards on the home screen sit on their own edge rather than a shadow. */
  --card:          #FFFFFF;
  --card-edge:     rgba(60, 60, 67, 0.10);

  --radius:        12px;
  --radius-lg:     16px;
  --radius-sm:     8px;

  --base:          17px;
  --safe-top:      env(safe-area-inset-top, 0px);
  --safe-bottom:   env(safe-area-inset-bottom, 0px);
  --tabbar-h:      58px;
}

/* ---------- Dark ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}
:root[data-theme="dark"], :root[data-appearance="dark"] { color-scheme: dark; }

:root[data-appearance="dark"] {
  --bg:            #000000;
  --surface:       #1C1C1E;
  --surface-sunk:  #2C2C2E;
  --nav:           rgba(22, 22, 24, 0.80);

  --text:          #FFFFFF;
  --text-2:        rgba(235, 235, 245, 0.60);
  --text-3:        rgba(235, 235, 245, 0.30);

  --separator:     rgba(84, 84, 88, 0.65);
  --hairline:      rgba(84, 84, 88, 0.80);

  --accent:        #FFFFFF;
  --on-accent:     #000000;
  --destructive:   #FF453A;

  --fill:          rgba(118, 118, 128, 0.24);
  --fill-strong:   rgba(118, 118, 128, 0.36);
  --pressed:       rgba(255, 255, 255, 0.08);

  --card:          #0E0E10;
  --card-edge:     rgba(255, 255, 255, 0.09);
}

/* Text size preference (Settings → Appearance) */
:root[data-textsize="large"]  { --base: 19px; }
:root[data-textsize="larger"] { --base: 21px; }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
               "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  font-size: var(--base);
  line-height: 1.35;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  background: none;
  border: none;
  outline: none;
}
button { cursor: pointer; }
input, textarea { -webkit-appearance: none; appearance: none; }

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Shell ---------- */
#root {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 780px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}

.screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }

/* ---------- Typography ---------- */
/* The display face. A serif greeting is what makes the home screen feel
   like something rather than a settings page. */
.serif {
  font-family: ui-serif, "New York", "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.015em;
}

.large-title {
  font-size: 2em;
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.15;
}
.large-title.serif {
  font-weight: 400;
  font-size: 2.25em;
  line-height: 1.08;
}

/* Sentence-case section heading, as opposed to the small uppercase one. */
.section-title {
  font-size: 1.24em;
  font-weight: 600;
  letter-spacing: -0.02em;
  padding: 4px 20px 12px;
}
.title      { font-size: 1.29em; font-weight: 700; letter-spacing: -0.022em; }
.headline   { font-size: 1em;    font-weight: 600; }
.body       { font-size: 1em;    font-weight: 400; }
.subhead    { font-size: 0.88em; color: var(--text-2); }
.footnote   { font-size: 0.78em; color: var(--text-2); }
.caption    { font-size: 0.72em; color: var(--text-2); }

.muted     { color: var(--text-2); }
.faint     { color: var(--text-3); }
.danger    { color: var(--destructive); }
.center    { text-align: center; }
.truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.strike    { text-decoration: line-through; }

.stack     { display: flex; flex-direction: column; }
.row-flex  { display: flex; align-items: center; }
.spacer    { flex: 1; }
.hidden    { display: none !important; }

/* Bottom clearance so content never hides under the tab bar */
.screen-pad {
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 40px);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
