/* CreatorHQ — base resets, fonts, typography, app shell.
   Breakpoint rule: the SIDE menu shows only on a real desktop
   (min-width:1024px + mouse). Phones and iPads always get the bottom bar, and
   every rule that keeps content clear of the bar uses that same query. */

@font-face {
  font-family: 'DM Sans'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('../assets/fonts/dm-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('../assets/fonts/dm-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'DM Serif Display'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../assets/fonts/dm-serif-display-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Serif Display'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../assets/fonts/dm-serif-display-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 4.5rem;
}
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  font-size: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }

[hidden] { display: none !important; }

h1, h2, h3, h4, h5, h6 {
  font-family: 'DM Serif Display', Georgia, serif;
  color: var(--heading);
  font-weight: 400;
  line-height: 1.2;
  margin: 0;
  overflow-wrap: anywhere;
}
h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.25rem); }
h2 { font-size: clamp(1.2rem, 1.1rem + 0.6vw, 1.5rem); }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

p { margin: 0; }

a { color: var(--link); text-decoration: none; }
a:not(.btn):not(.nav-item):not(.bottom-nav-item):not(.stat-card):not(.kanban-card):not(.plain-link) { text-decoration: underline; text-underline-offset: 2px; }

img, svg { display: block; max-width: 100%; }

input, textarea, select, button { font: inherit; color: inherit; }

button { background: none; border: 0; cursor: pointer; padding: 0; touch-action: manipulation; }
a, button, [role="button"], label { touch-action: manipulation; }

/* Long pasted URLs and titles wrap instead of pushing the page sideways. */
.card, .crud-card, .kanban-card, td, li, p, .pill { overflow-wrap: anywhere; }

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

/* ---------- App shell ---------- */
#app-root { display: flex; min-height: 100vh; min-height: 100dvh; }

#sidebar { display: none; }

#main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* clears the bottom bar + iOS home indicator */
  padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

#top-bar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
  position: sticky;
  top: 0;
  z-index: 10;
}

#page-container {
  flex: 1;
  padding: 1rem 0.875rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}
#page-container:focus { outline: none; }

#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(4rem + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--nav-bg);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 40;
  -webkit-touch-callout: none;
  user-select: none;
}
body.sheet-open #bottom-nav { visibility: hidden; }

@media (min-width: 641px) {
  #page-container { padding: 1.5rem 1.25rem; }
  #top-bar { padding: 1rem 1.25rem; padding-top: calc(1rem + env(safe-area-inset-top, 0px)); }
}

/* Real desktop: side menu, no bottom bar. */
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  #sidebar {
    display: flex;
    flex-direction: column;
    width: 248px;
    flex-shrink: 0;
    background: var(--nav-bg);
    color: var(--nav-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 20;
  }
  #main-area { margin-left: 248px; padding-bottom: 0; }
  #bottom-nav { display: none; }
  #page-container { padding: 1.75rem 2rem; }
}

/* ---------- Update banner ---------- */
#update-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--callout-bg);
  border-bottom: 1.5px solid var(--callout-border);
  color: var(--text);
  padding: 0.75rem 1rem;
  padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
  z-index: 1000;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  font-weight: 500;
  text-align: center;
}
#update-banner.visible { display: flex; }
body.has-update-banner #app-root { padding-top: 3.75rem; }
.update-banner-actions { display: inline-flex; gap: 0.5rem; }
#update-banner button {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  padding: 0.5rem 1rem;
  min-height: 44px;
  border-radius: 10px;
  font-weight: 600;
}
#update-banner button.update-banner-later {
  background: transparent;
  color: var(--btn-ghost-text);
  border: 1px solid var(--btn-ghost-border);
}

.db-blocked-notice {
  position: fixed;
  left: 1rem; right: 1rem; top: 1rem;
  z-index: 1100;
  background: var(--warning-bg);
  color: var(--warning-text);
  border-radius: 12px;
  padding: 1rem;
  font-weight: 600;
  text-align: center;
}

/* Skip link for keyboard users. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.75rem 1rem;
  background: var(--text);
  color: var(--surface);
  z-index: 9999;
}
.skip-link:focus { left: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--surface-alt); }
::-webkit-scrollbar-thumb { background: var(--border-accent); border-radius: 5px; }
