/* =========================================================
   4HE / BASE
   Core tokens, reset, typography, media, icons and form base
   ========================================================= */

/* =========================
   ROOT TOKENS
   ========================= */

:root {
  /* fonts */
  --font-sans: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-main: var(--font-sans);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* brand */
  --brand-blue: #2d7bff;
  --brand-blue-hover: #1f6ef5;
  --brand-blue-soft: #eaf2ff;

  --brand-lime: #9bea3c;
  --brand-lime-hover: #8ed92f;
  --brand-lime-soft: #f1ffd9;

  --brand-orange: #ff8a1f;
  --brand-orange-hover: #f27c10;
  --brand-orange-soft: #fff0e2;

  /* backgrounds / surfaces */
  --bg: #f4f6f8;
  --bg-soft: #f8fafc;

  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef2f6;

  /* text */
  --text: #111318;
  --title: var(--text);
  --text-soft: #505050;
  --text-fade: #98a0ad;

  /* borders */
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);

  /* shadows */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.035);
  --shadow-sm: 0 6px 18px rgba(16, 24, 40, 0.055);
  --shadow-md: 0 14px 34px rgba(16, 24, 40, 0.085);

  /* accents */
  --accent-main: var(--brand-blue);
  --accent-main-hover: var(--brand-blue-hover);
  --accent-main-soft: var(--brand-blue-soft);

  --accent-hot: var(--brand-lime);
  --accent-hot-hover: var(--brand-lime-hover);
  --accent-hot-soft: var(--brand-lime-soft);

  --accent-fire: var(--brand-orange);
  --accent-fire-hover: var(--brand-orange-hover);
  --accent-fire-soft: var(--brand-orange-soft);

  --success: #20b15a;
  --success-soft: #eafbf1;

  --danger: #ef4444;
  --danger-soft: #feeceb;

  --warning: var(--brand-orange);
  --warning-soft: var(--brand-orange-soft);

  /* overlays */
  --overlay-soft: rgba(12, 18, 23, 0.46);
  --overlay-strong: rgba(12, 18, 23, 0.58);

  /* radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-2xl: 26px;
  --radius-full: 999px;
  --radius-pill: 999px;

  /* motion */
  --ease-main: cubic-bezier(0.22, 1, 0.36, 1);

  /* layout */
  --header-h: 68px;
  --header-bg: rgba(255, 255, 255, 0.82);
  --header-border: rgba(0, 0, 0, 0.06);
  --header-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
  --header-icon-bg-hover: rgba(0, 0, 0, 0.05);

  --scrollbar-comp: 0px;
  --feed-media-max-h: 560px;

  /* spacing */
  --space-4: 4px;
  --space-5: 5px;
  --space-6: 6px;
  --space-8: 8px;
  --space-10: 10px;
  --space-12: 12px;
  --space-14: 14px;
  --space-16: 16px;
  --space-18: 18px;
  --space-20: 20px;
  --space-24: 24px;
}

.theme-dark {
  --bg: #16181d;
  --bg-soft: #1b1e24;

  --surface: #20242b;
  --surface-2: #262b33;
  --surface-3: #2d333d;

  --text: #f3f6fb;
  --title: var(--text);
  --text-soft: #e3e3e3;
  --text-fade: #7f8896;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.18);
  --shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 16px 36px rgba(0, 0, 0, 0.28);

  --accent-main-soft: rgba(45, 123, 255, 0.14);
  --accent-hot-soft: rgba(155, 234, 60, 0.14);
  --accent-fire-soft: rgba(255, 138, 31, 0.14);
  --success-soft: rgba(32, 177, 90, 0.14);
  --danger-soft: rgba(239, 68, 68, 0.14);
  --warning-soft: rgba(255, 138, 31, 0.14);

  --overlay-soft: rgba(5, 8, 12, 0.62);
  --overlay-strong: rgba(5, 8, 12, 0.74);

  --header-bg: rgba(22, 24, 29, 0.86);
  --header-border: rgba(255, 255, 255, 0.06);
  --header-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  --header-icon-bg-hover: rgba(255, 255, 255, 0.06);
}

/* =========================
   RESET / BASE
   ========================= */

html {
  scrollbar-gutter: stable;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  min-width: 320px;
  overflow-x: clip;
}

@supports not (overflow: clip) {
  html,
  body {
    overflow-x: hidden;
  }
}

body {
  margin: 0;
  padding: 0;
  border: 0;
  background-color: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--font-sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

* {
  margin: 0;
  padding: 0;
}

::selection {
  background: var(--accent-main-soft);
  color: var(--text);
}

[hidden] {
  display: none !important;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent-main);
  outline-offset: 3px;
}

/* =========================
   TYPOGRAPHY
   ========================= */

a {
  color: var(--accent-main);
  text-decoration: none;
}

a:hover {
  color: var(--accent-main-hover);
  text-decoration: none;
}

p {
  margin: 12px 0;
}

hr {
  height: 0;
  margin: 18px 0;
  border: 0;
  border-bottom: 1px solid var(--border);
}

ul[class],
ol[class] {
  list-style: none;
}

ul:not([class]),
ol:not([class]) {
  padding-left: 1.4em;
}

li:not([class]) + li:not([class]) {
  margin-top: 4px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--title);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  font-weight: 700;
  font-size: 26px;
  line-height: 1.16;
}

h2 {
  font-weight: 600;
  font-size: 21px;
  line-height: 1.24;
}

h3 {
  font-weight: 600;
  font-size: 18px;
  line-height: 1.28;
}

h4 {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.35;
}

h5 {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.4;
}

h6 {
  color: var(--text-fade);
  font-weight: 600;
  font-size: 12px;
  line-height: 1.45;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

blockquote,
.quote {
  margin: 16px 0;
  padding: 18px 20px 18px 22px;
  background: var(--surface-2);
  border-left: 4px solid var(--accent-main);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.55;
}

code {
  padding: 3px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.92em;
}

pre {
  margin: 16px 0;
  padding: 14px 16px;
  overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
}

pre code {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

/* =========================
   MEDIA
   ========================= */

img,
svg,
video,
canvas,
picture {
  max-width: 100%;
}

img,
picture {
  display: block;
}

img {
  height: auto;
  border-style: none;
}

svg {
  flex: 0 0 auto;
}

/* =========================
   ICON SYSTEM
   ========================= */

.icon,
.ui-icon,
.i-svg {
  width: 22px;
  height: 22px;
  display: inline-block;
  flex: 0 0 auto;
  color: currentColor;
  fill: none;
  stroke: currentColor;
  vertical-align: -0.18em;
  pointer-events: none;
  overflow: visible;
  shape-rendering: geometricPrecision;
}

.icon *,
.ui-icon *,
.i-svg * {
  vector-effect: non-scaling-stroke;
}

.i-fill,
.icon .i-fill,
.ui-icon .i-fill,
.i-svg .i-fill {
  fill: currentColor;
  stroke: none;
}

.i-stroke,
.icon .i-stroke,
.ui-icon .i-stroke,
.i-svg .i-stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--fill {
  fill: currentColor;
  stroke: none;
}

button .icon,
button .ui-icon,
button .i-svg,
a .icon,
a .ui-icon,
a .i-svg,
span .icon,
span .ui-icon,
span .i-svg {
  pointer-events: none;
}

/* =========================
   FORM BASE
   ========================= */

button,
input,
textarea,
select {
  font: inherit;
  font-family: var(--font-sans);
}

button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

button::-moz-focus-inner {
  padding: 0;
  border: 0;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

input,
textarea,
select {
  color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-fade);
}

input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
}

textarea {
  width: 100%;
  min-height: 80px;
  padding: 11px;
  background-color: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  appearance: none;
  -webkit-appearance: none;
  font-size: 15px;
  line-height: 1.65;
  resize: vertical;
}

textarea:hover,
textarea:focus {
  border-color: var(--accent-main);
}

textarea:focus {
  box-shadow: 0 0 0 3px var(--accent-main-soft);
}

input[type="radio"],
input[type="checkbox"] {
  margin-right: 6px;
}

/* =========================
   MOBILE BASE
   ========================= */

@media screen and (max-width: 768px) {
  body {
    font-size: 15px;
  }
}

@media screen and (max-width: 640px) {
  :root {
    --header-h: 62px;
  }
}