#ifndef HUSH_THEME_H
#define HUSH_THEME_H

#include "clay.h"

/* bg/text/cursor are runtime-configurable (see Theme below, populated from the user's config
   file); these three macros are only their built-in defaults. Every other color here stays a
   compile-time constant -- intentionally out of config-file scope. */
#define DEFAULT_COL_BG     (Clay_Color){253, 253, 251, 255}
#define DEFAULT_COL_TEXT   (Clay_Color){31, 35, 40, 255}
#define DEFAULT_COL_CURSOR (Clay_Color){31, 35, 40, 255}

typedef struct {
    Clay_Color bg;
    Clay_Color text;
    Clay_Color cursor;
    float zoom; /* multiplies document content font sizes (headings/body/code); 1.0 = 100% */
} Theme;

extern Theme g_theme;
void theme_init_defaults(void);

#define ZOOM_DEFAULT 1.0f
#define ZOOM_MIN 0.5f
#define ZOOM_MAX 3.0f
#define ZOOM_STEP 0.1f

void theme_zoom_in(void);
void theme_zoom_out(void);
void theme_zoom_reset(void);

/* Scales `baseSize` by the current zoom level, rounded, floored at 6px so extreme zoom-out
   never produces an unreadable-or-degenerate font size. Used only for document content
   (headings/body/code) -- status bar, modals, and the code-block language label stay fixed. */
int theme_scaled_font_size(int baseSize);

#define COL_TEXT_QUOTE  (Clay_Color){90, 97, 105, 255}
#define COL_MARKER      (Clay_Color){178, 178, 172, 255}
#define COL_LINK        (Clay_Color){37, 99, 235, 255}
#define COL_CODE_BG     (Clay_Color){240, 240, 236, 255}
#define COL_CODE_TEXT   (Clay_Color){160, 40, 90, 255}
#define COL_CODEBLOCK_BG (Clay_Color){247, 247, 244, 255}
#define COL_CODEBLOCK_TEXT (Clay_Color){55, 55, 60, 255}
#define COL_QUOTE_BORDER (Clay_Color){206, 206, 200, 255}
#define COL_SCROLLBAR   (Clay_Color){210, 210, 205, 180}
#define COL_SELECTION   (Clay_Color){96, 165, 250, 90}
#define COL_STATUSBAR_BG   (Clay_Color){241, 241, 237, 255}
#define COL_STATUSBAR_TEXT (Clay_Color){120, 126, 133, 255}
#define COL_MODAL_SCRIM (Clay_Color){0, 0, 0, 120}
#define COL_MODAL_BORDER (Clay_Color){206, 206, 200, 255}
#define COL_BUTTON_HOVER (Clay_Color){235, 235, 231, 255}
#define COL_HR          (Clay_Color){222, 222, 216, 255}
#define COL_HIGHLIGHT_BG (Clay_Color){255, 240, 130, 130}
#define COL_H6_TEXT     (Clay_Color){110, 116, 122, 255}

#define FS_H1 28
#define FS_H2 23
#define FS_H3 19
#define FS_H4 16
#define FS_H5 14
#define FS_H6 13
#define FS_BODY 16
#define FS_CODE 15
#define FS_CODE_LANG 11
#define FS_STATUSBAR 12
#define FS_MODAL 15

#define LINE_HEIGHT_MULT 1.5f

#define CONTENT_MAX_WIDTH 760.0f
#define CONTENT_SIDE_PADDING 32.0f
#define BLOCK_GAP 4
#define LIST_INDENT 26
#define QUOTE_INDENT 14

#define STATUSBAR_HEIGHT 24
#define STATUSBAR_PADDING 10

#define HR_THICKNESS 1
#define HR_TOP_PAD 14

#define TURN_INTO_ICON_SIZE 22
#define TURN_INTO_ICON_GAP 6
#define TURN_INTO_MENU_WIDTH 190
#define BLOCK_TYPE_MENU_ROW_HEIGHT 32
#define BLOCK_TYPE_MENU_GAP 4
#define QUICK_INSERT_MENU_WIDTH 220

#define IMAGE_MAX_HEIGHT 480.0f
#define IMAGE_FALLBACK_HEIGHT 80.0f

#endif
