/* ============================================================
   theme.css  -  OWNER: UI lead only
   Design tokens for NSBM Ncircle (StudyCircle), taken from the
   Figma "Ncircle" landing + sign-in frames.
   Change a value HERE and the whole site follows. Never hardcode
   a hex color, font or radius anywhere else.

   Load order:
   bootstrap -> theme.css -> layout.css -> components.css -> motion.css -> pages/*.css
   ============================================================ */

/* ---------- Fonts (self-hosted, so the demo works offline) ----------
   Download the .woff2 files into public/assets/fonts/ :
   - DM Sans (variable)  : headings, buttons, nav
   - Inter (variable)    : body text, labels, small UI text
   - Carattere (regular) : script accent, ONE word per heading
   Until the files exist, the fallbacks below are used. */
@font-face {
    font-family: "DM Sans";
    src: url("../fonts/dm-sans-variable.woff2") format("woff2");
    font-weight: 100 1000;
    font-display: swap;
}
@font-face {
    font-family: "Inter";
    src: url("../fonts/inter-variable.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}
@font-face {
    font-family: "Carattere";
    src: url("../fonts/carattere-regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}

:root {
    /* ---------- Brand palette (official) ---------- */
    --sc-teal: #1d3934; /* primary brand */
    --sc-lime: #c9f46a; /* highlights, CTAs, accents */
    --sc-offwhite: #eeecea; /* secondary backgrounds */
    --sc-black: #000000; /* strong text and icons */
    --sc-white: #ffffff; /* cards, forms, content areas */

    /* ---------- Palette extensions (read from Figma) ---------- */
    --sc-lime-light: #d9f78e; /* avatar fill, lighter lime */
    --sc-lime-soft: rgba(
        201,
        244,
        106,
        0.3
    ); /* icon circles, soft highlights */
    --sc-teal-border: rgba(29, 57, 52, 0.2); /* card borders */
    --sc-text-muted: #5f6b68; /* secondary text on light */
    --sc-border-subtle: #e4e2df; /* dividers inside cards */
    --sc-on-dark: rgba(255, 255, 255, 0.85); /* body text on teal */
    --sc-on-dark-muted: rgba(255, 255, 255, 0.8);
    --sc-on-dark-surface: rgba(255, 255, 255, 0.1); /* chips on teal */
    --sc-on-dark-border: rgba(
        255,
        255,
        255,
        0.3
    ); /* ghost button border on teal */

    /* ---------- App screens (read from the Dashboard, Browse and auth frames) ---------- */
    --sc-ink: #131e1c; /* darkest text and auth background */
    --sc-teal-deep: #132623; /* auth page gradient start */
    --sc-teal-mid: #29443e; /* auth page gradient glow */
    --sc-teal-soft: rgba(29, 57, 52, 0.1); /* quiet pills on white */
    --sc-grey-mid: #5f6b68; /* grey avatar */
    --sc-olive: #4c6700; /* password rules, success text */
    --sc-lime-pale: #e6f9b8; /* progress track tint, soft CTA hover */
    --sc-lime-button: #dbf78e; /* soft lime button */
    --sc-coral: #f26d6d; /* negative trend chip, "Be first" */
    --sc-coral-soft: #fde3e3; /* error banner */
    --sc-error: #ba1a1a; /* error text */
    --sc-star: #e8a317; /* filled rating star on note cards */
    --sc-input-fill: #f5f5f4; /* filled inputs on sign in */
    --sc-mint: #e6f4ef; /* check-your-inbox panel */
    --sc-control-border: rgba(0, 0, 0, 0.38); /* round icon buttons, search pill */
    --sc-hatch: repeating-linear-gradient(
        135deg,
        var(--sc-lime) 0 4px,
        var(--sc-lime-button) 4px 8px
    ); /* the diagonal bars in charts and progress */

    /* ---------- Added for the dark theme: these change with it ---------- */
    --sc-on-lime: #1d3934; /* dark text on lime. The same in both themes */
    --sc-chart-b: var(--sc-teal); /* the solid chart segment */
    --sc-star-off: rgba(29, 57, 52, 0.25);
    --sc-glass: rgba(255, 255, 255, 0.95); /* floating bars */

    /* ---------- Semantic aliases (use these in components) ---------- */
    --sc-primary: var(--sc-teal);
    --sc-accent: var(--sc-lime);
    --sc-bg: var(--sc-white);
    --sc-bg-alt: var(--sc-offwhite);
    --sc-surface: var(--sc-white);
    --sc-text: var(--sc-black);
    --sc-heading: var(--sc-teal);
    --sc-border: var(--sc-border-subtle);

    /* Status colors. Teal/lime cover success; confirm the exact
     red/amber values with the design team (error banner, negative badge). */
    --sc-success: var(--sc-lime);
    --sc-danger: #c0392b;
    --sc-danger-soft: #fdecea;
    --sc-warning: #b7791f;
    --sc-warning-soft: #fdf3dc;

    /* ---------- Typography ---------- */
    --sc-font-heading:
        "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --sc-font-body:
        "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --sc-font-script: "Carattere", "Brush Script MT", cursive;
    --sc-font-mono:
        "Liberation Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

    --sc-fs-hero: clamp(2.5rem, 6vw, 3.75rem); /* 60px / line-height 60px */
    --sc-fs-script: clamp(3.75rem, 9vw, 6.25rem); /* 100px / line-height 96px */
    --sc-fs-h2: clamp(1.75rem, 3.5vw, 2.25rem);
    --sc-fs-stat: 2.25rem; /* 36px / 40px, tracking -0.025em */
    --sc-fs-lead: 1.125rem; /* 18px / 28px */
    --sc-fs-body: 1rem; /* 16px / 24px */
    --sc-fs-sm: 0.875rem; /* 14px / 20px */
    --sc-fs-xs: 0.75rem; /* 12px / 16px */

    /* ---------- Shape ---------- */
    --sc-radius-pill: 999px; /* buttons, tags, avatars */
    --sc-radius-nav: 24px; /* floating navbar */
    --sc-radius-card: 20px; /* cards */
    --sc-radius-chip: 6px; /* module-code chips */
    --sc-radius-input: 12px; /* form inputs (confirm on the sign-in frame) */

    /* ---------- Shadows ---------- */
    --sc-shadow-card: 0 8px 15px rgba(29, 57, 52, 0.08);
    --sc-shadow-nav: 0 39px 39.8px rgba(29, 57, 52, 0.08);
    --sc-shadow-btn: 0 1px 1px rgba(0, 0, 0, 0.05);

    /* ---------- Layout ---------- */
    --sc-container: 1216px; /* content width inside a 1280 frame (32px side gutters) */
    --sc-section-gap: 5rem;

    /* ---------- Map our tokens onto Bootstrap 5.3 variables ---------- */
    --bs-primary: var(--sc-teal);
    --bs-primary-rgb: 29, 57, 52;
    --bs-body-bg: var(--sc-bg);
    --bs-body-color: var(--sc-text);
    --bs-body-font-family: var(--sc-font-body);
    --bs-body-font-size: var(--sc-fs-body);
    --bs-border-color: var(--sc-border);
    --bs-border-radius: var(--sc-radius-input);
    --bs-border-radius-lg: var(--sc-radius-card);
    --bs-border-radius-pill: var(--sc-radius-pill);
    --bs-link-color: var(--sc-teal);
    --bs-link-color-rgb: 29, 57, 52;
    --bs-link-hover-color: var(--sc-black);
    --bs-link-hover-color-rgb: 0, 0, 0;
    --bs-heading-color: var(--sc-heading);
}

/* ---------- Base typography ---------- */
body {
    font-family: var(--sc-font-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
    font-family: var(--sc-font-heading);
    font-weight: 700;
    color: var(--sc-heading);
}

/* Script accent: one highlighted word inside a heading, e.g.
   <h1>Study Smarter, <span class="sc-script">Together.</span></h1>
   Lime on dark sections; set color inline via a modifier class if needed. */
.sc-script {
    font-family: var(--sc-font-script);
    font-weight: 400;
    font-size: var(--sc-fs-script);
    line-height: 0.96;
    letter-spacing: 0.024em;
    color: var(--sc-lime);
}
.sc-script--teal {
    color: var(--sc-heading);
}

/* Module-code chip, e.g. CS204 / SE301 */
.sc-code {
    font-family: var(--sc-font-mono);
    font-weight: 700;
    font-size: var(--sc-fs-sm);
    padding: 2px 8px;
    border-radius: var(--sc-radius-chip);
    background: var(--sc-on-dark-surface);
    color: var(--sc-lime);
}

/* ---------- Bootstrap buttons restyled to the Ncircle design ----------
   Primary CTA   = lime pill, black bold text ("Join the Ncircle")
   Secondary     = white pill with black outline ("Sign in")
   Both use Bootstrap's own --bs-btn-* variables, so no custom button
   classes are needed in page code. */
.btn {
    --bs-btn-border-radius: var(--sc-radius-pill);
    --bs-btn-font-family: var(--sc-font-heading);
    --bs-btn-font-weight: 700;
    --bs-btn-padding-x: 1.75rem;
    --bs-btn-padding-y: 0.875rem;
    --bs-btn-font-size: var(--sc-fs-body);
    --bs-btn-focus-box-shadow: 0 0 0 0.25rem rgba(201, 244, 106, 0.5);
}
.btn-sm {
    --bs-btn-padding-x: 1.5rem;
    --bs-btn-padding-y: 0.625rem;
    --bs-btn-font-size: var(--sc-fs-sm);
}

.btn-primary {
    --bs-btn-color: var(--sc-black);
    --bs-btn-bg: var(--sc-lime);
    --bs-btn-border-color: var(--sc-lime);
    --bs-btn-hover-color: var(--sc-black);
    --bs-btn-hover-bg: var(--sc-lime-light);
    --bs-btn-hover-border-color: var(--sc-lime-light);
    --bs-btn-active-color: var(--sc-black);
    --bs-btn-active-bg: var(--sc-lime-light);
    --bs-btn-active-border-color: var(--sc-lime-light);
    --bs-btn-disabled-color: var(--sc-black);
    --bs-btn-disabled-bg: var(--sc-lime);
    --bs-btn-disabled-border-color: var(--sc-lime);
    box-shadow: var(--sc-shadow-btn);
}

.btn-outline-primary {
    --bs-btn-color: var(--sc-text);
    --bs-btn-bg: var(--sc-surface);
    --bs-btn-border-color: var(--sc-text);
    --bs-btn-hover-color: var(--sc-white);
    --bs-btn-hover-bg: var(--sc-teal);
    --bs-btn-hover-border-color: var(--sc-teal);
    --bs-btn-active-color: var(--sc-white);
    --bs-btn-active-bg: var(--sc-teal);
    --bs-btn-active-border-color: var(--sc-teal);
    --bs-btn-font-weight: 600;
}

/* Solid teal: "Sign in", "Upload note", "Join" */
.btn-dark {
    --bs-btn-color: var(--sc-white);
    --bs-btn-bg: var(--sc-teal);
    --bs-btn-border-color: var(--sc-teal);
    --bs-btn-hover-color: var(--sc-white);
    --bs-btn-hover-bg: var(--sc-teal-deep);
    --bs-btn-hover-border-color: var(--sc-teal-deep);
    --bs-btn-active-color: var(--sc-white);
    --bs-btn-active-bg: var(--sc-teal-deep);
    --bs-btn-active-border-color: var(--sc-teal-deep);
    --bs-btn-disabled-color: var(--sc-white);
    --bs-btn-disabled-bg: var(--sc-teal);
    --bs-btn-disabled-border-color: var(--sc-teal);
}

/* Pale lime: "Join the Ncircle" on the auth card, "Download" */
.btn-soft {
    --bs-btn-color: var(--sc-black);
    --bs-btn-bg: var(--sc-lime-button);
    --bs-btn-border-color: var(--sc-lime-button);
    --bs-btn-hover-color: var(--sc-black);
    --bs-btn-hover-bg: var(--sc-lime);
    --bs-btn-hover-border-color: var(--sc-lime);
    --bs-btn-active-color: var(--sc-black);
    --bs-btn-active-bg: var(--sc-lime);
    --bs-btn-active-border-color: var(--sc-lime);
}

/* Compact pill for cards and filter panels */
.btn-xs {
    --bs-btn-padding-x: 1.125rem;
    --bs-btn-padding-y: 0.5rem;
    --bs-btn-font-size: var(--sc-fs-xs);
}

/* Outline with a grey hairline instead of black */
.sc-btn-quiet {
    --bs-btn-border-color: var(--sc-border);
    --bs-btn-color: var(--sc-heading);
}
.sc-btn-danger-text {
    --bs-btn-color: var(--sc-error);
    --bs-btn-hover-bg: var(--sc-error);
    --bs-btn-hover-border-color: var(--sc-error);
}

/* Ghost button for use ON teal sections (hero "Sign in", CTA banner) */
.btn-outline-light {
    --bs-btn-color: var(--sc-white);
    --bs-btn-border-color: var(--sc-on-dark-border);
    --bs-btn-hover-color: var(--sc-teal);
    --bs-btn-hover-bg: var(--sc-white);
    --bs-btn-hover-border-color: var(--sc-white);
    --bs-btn-font-weight: 600;
}

/* Form focus ring in brand color */
.form-control:focus,
.form-select:focus {
    border-color: var(--sc-heading);
    box-shadow: 0 0 0 0.2rem rgba(201, 244, 106, 0.45);
}

/* ============================================================
   Dark theme. head.php sets data-theme and data-bs-theme on <html>.
   Colours flip here, so components only ever use tokens.
   ============================================================ */
html[data-theme="dark"] {
    color-scheme: dark;

    --sc-bg: #0e1816;
    --sc-surface: #16231f;
    --sc-offwhite: #21312c;
    --sc-text: #eaf2ef;
    --sc-ink: #eaf2ef;
    --sc-heading: #dff0e9;
    --sc-text-muted: #a3b4ae;
    --sc-teal: #1f4339;
    --sc-teal-deep: #0f201b;
    --sc-teal-mid: #24463d;
    --sc-teal-soft: rgba(255, 255, 255, 0.08);
    --sc-teal-border: rgba(255, 255, 255, 0.16);
    --sc-border-subtle: #2b3d37;
    --sc-control-border: rgba(255, 255, 255, 0.28);
    --sc-lime-soft: rgba(201, 244, 106, 0.16);
    --sc-input-fill: #1c2b27;
    --sc-mint: #1c3029;
    --sc-olive: #bfe36a;
    --sc-danger: #ff9a8f;
    --sc-danger-soft: #3a1f1c;
    --sc-error: #ff9a8f;
    --sc-coral-soft: #3a1f1c;
    --sc-warning: #e9b65c;
    --sc-warning-soft: #33290f;
    --sc-chart-b: #86bdb0;
    --sc-star-off: rgba(255, 255, 255, 0.25);
    --sc-glass: rgba(22, 35, 31, 0.92);
    --sc-shadow-card: 0 8px 18px rgba(0, 0, 0, 0.35);
    --sc-shadow-nav: 0 20px 40px rgba(0, 0, 0, 0.4);

    --bs-primary-rgb: 201, 244, 106;
    --bs-body-bg: #0e1816;
    --bs-body-bg-rgb: 14, 24, 22;
    --bs-body-color: #eaf2ef;
    --bs-body-color-rgb: 234, 242, 239;
    --bs-heading-color: #dff0e9;
    --bs-border-color: #2b3d37;
    --bs-secondary-color: #a3b4ae;
    --bs-tertiary-bg: #21312c;
    --bs-link-color: #dff0e9;
    --bs-link-color-rgb: 223, 240, 233;
    --bs-link-hover-color: #c9f46a;
    --bs-link-hover-color-rgb: 201, 244, 106;
}
html[data-theme="dark"] body {
    background: var(--sc-bg);
}
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu {
    --bs-modal-bg: var(--sc-surface);
    --bs-dropdown-bg: var(--sc-surface);
    --bs-dropdown-link-hover-bg: var(--sc-offwhite);
    --bs-dropdown-link-color: var(--sc-text);
    --bs-dropdown-link-hover-color: var(--sc-text);
}

/* The logo has black and teal artwork, so it sits on a small white plate */
html[data-theme="dark"] .sc-nav__brand img,
html[data-theme="dark"] .sc-sidebar__logo img,
html[data-theme="dark"] .sc-footer__logo,
html[data-theme="dark"] .sc-auth__logo img {
    border-radius: 12px;
    background: var(--sc-white);
}

/* These illustrations are drawn for a white background, so they keep one */
html[data-theme="dark"] .dash-hero__card,
html[data-theme="dark"] .sc-feature__media {
    background: var(--sc-white);
}
html[data-theme="dark"] .sc-feature__media {
    border-color: transparent;
}
html[data-theme="dark"] .dash-hero__card strong,
html[data-theme="dark"] .dash-hero__card span {
    color: var(--sc-on-lime);
}
html[data-theme="dark"] .sc-feature__badge--outline {
    background: var(--sc-white);
    border-color: #e5e7eb;
    color: #5f6b68;
}

/* Sections that are text on the page, not on their usual lime */
html[data-theme="dark"] .landing-steps .sc-eyebrow {
    color: var(--sc-heading);
}

/* Light and dark switch: show the icon for the theme you can switch to */
.sc-theme-toggle__sun {
    display: none;
}
html[data-theme="dark"] .sc-theme-toggle__sun {
    display: inline-block;
}
html[data-theme="dark"] .sc-theme-toggle__moon {
    display: none;
}
.sc-round-btn.sc-auth__theme {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}
