/* =========================================================
   META-STUDIO — GLOBAL FOUNDATION
   Version: 12.0
   Purpose:
   - Reset
   - Typography
   - Accessibility
   - Form normalization
   - Scrollbar
   - Selection
   - Background ambience
   - Theme hooks
   - Motion safety
   - Responsive foundation
========================================================= */

/* =========================================================
   01. GLOBAL RESET
========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
  min-width: 0;
}

html,
body {
  min-height: 100%;
}

html {
  background: var(--cream);
  color-scheme: light;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;

  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--cream) 98%, transparent),
      var(--cream)
    );

  color: var(--ink);

  font-family: var(--font);
  font-size: 14px;
  font-style: normal;
  font-weight: 400;
  line-height: 1.5;

  letter-spacing: -0.005em;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  text-rendering: optimizeLegibility;

  overflow-x: hidden;
  overflow-y: auto;

  isolation: isolate;
}

body,
button,
input,
textarea,
select {
  font-family: var(--font);
}

/* =========================================================
   02. ROOT APP LAYER
========================================================= */

#app,
.app,
.app-shell {
  position: relative;
  z-index: 1;
}

#app {
  min-height: 100vh;
}

/* =========================================================
   03. TYPOGRAPHY NORMALIZATION
========================================================= */

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;

  color: inherit;

  font-family: inherit;
  font-weight: 700;
  line-height: 1.15;

  letter-spacing: -0.025em;

  text-wrap: balance;
}

p {
  line-height: 1.65;
  text-wrap: pretty;
}

strong,
b {
  font-weight: 700;
}

small {
  font-size: 0.875em;
}

sub,
sup {
  position: relative;
  vertical-align: baseline;
  font-size: 0.75em;
  line-height: 0;
}

sup {
  top: -0.5em;
}

sub {
  bottom: -0.25em;
}

abbr[title] {
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: help;
}

blockquote,
q {
  quotes: none;
}

blockquote::before,
blockquote::after,
q::before,
q::after {
  content: "";
}

/* =========================================================
   04. LINKS
========================================================= */

a {
  color: inherit;
  text-decoration: none;

  -webkit-tap-highlight-color: transparent;

  transition:
    color 160ms ease,
    opacity 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

a:hover {
  text-decoration: none;
}

a[href] {
  cursor: pointer;
}

/* =========================================================
   05. LISTS
========================================================= */

ul,
ol {
  list-style: none;
}

menu {
  list-style: none;
}

/* =========================================================
   06. MEDIA NORMALIZATION
========================================================= */

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

img {
  object-fit: cover;
  font-style: italic;
}

svg {
  flex-shrink: 0;
}

svg:not(:root) {
  overflow: hidden;
}

iframe {
  display: block;
  max-width: 100%;
  border: 0;
}

/* =========================================================
   07. TABLES
========================================================= */

table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

th {
  text-align: left;
}

caption {
  text-align: left;
}

/* =========================================================
   08. FORM RESET
========================================================= */

button,
input,
select,
textarea {
  margin: 0;

  border: 0;

  background: none;
  color: inherit;

  font: inherit;
  line-height: inherit;

  letter-spacing: inherit;
}

button,
select {
  text-transform: none;
}

button {
  cursor: pointer;

  appearance: none;
  -webkit-appearance: none;

  -webkit-tap-highlight-color: transparent;

  user-select: none;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
textarea,
select {
  width: 100%;
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.72;
}

input[type="search"] {
  appearance: none;
  -webkit-appearance: none;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  appearance: none;
}

input[type="number"] {
  appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

/* =========================================================
   09. FIELDSET
========================================================= */

fieldset {
  min-width: 0;
  border: 0;
}

legend {
  padding: 0;
}

/* =========================================================
   10. SELECTION
========================================================= */

::selection {
  background: var(--ink);
  color: var(--cream-2);
}

::-moz-selection {
  background: var(--ink);
  color: var(--cream-2);
}

/* =========================================================
   11. FOCUS SYSTEM
========================================================= */

:focus {
  outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
[tabindex]:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 0;

  box-shadow:
    0 0 0 3px rgba(59, 130, 246, 0.22),
    var(--focus);
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  box-shadow: none;
}

/* =========================================================
   12. ACCESSIBILITY HELPERS
========================================================= */

.visually-hidden,
.sr-only {
  position: absolute !important;

  width: 1px !important;
  height: 1px !important;

  padding: 0 !important;
  margin: -1px !important;

  overflow: hidden !important;

  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;

  white-space: nowrap !important;

  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 99999;

  top: 12px;
  left: 12px;

  padding: 10px 14px;

  background: var(--ink);
  color: var(--cream-2);

  border-radius: var(--radius-standard);

  font-size: 13px;
  font-weight: 700;

  transform: translateY(-180%);
  transition: transform 160ms ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* =========================================================
   13. SCROLLBAR SYSTEM
========================================================= */

* {
  scrollbar-width: thin;
  scrollbar-color:
    rgba(28, 28, 28, 0.2)
    transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  min-height: 30px;

  background:
    rgba(28, 28, 28, 0.18);

  border: 2px solid transparent;

  background-clip: padding-box;

  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background:
    rgba(28, 28, 28, 0.28);

  border: 2px solid transparent;

  background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

/* =========================================================
   14. APP BACKGROUND
========================================================= */

.app-bg {
  position: fixed;
  z-index: 0;

  inset: 0;

  pointer-events: none;

  overflow: hidden;

  contain: strict;

  isolation: isolate;
}

.app-bg::before {
  content: "";

  position: absolute;
  inset: 0;

  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.12),
      transparent 28%,
      transparent 72%,
      rgba(0, 0, 0, 0.015)
    );

  pointer-events: none;
}

.app-bg::after {
  content: "";

  position: absolute;
  inset: 0;

  opacity: 0.24;

  background-image:
    radial-gradient(
      circle at center,
      rgba(28, 28, 28, 0.035) 0.6px,
      transparent 0.7px
    );

  background-size: 18px 18px;

  mask-image:
    linear-gradient(
      to bottom,
      transparent,
      black 14%,
      black 86%,
      transparent
    );

  pointer-events: none;
}

/* =========================================================
   15. BACKGROUND BLOBS
========================================================= */

.app-bg i {
  position: absolute;

  display: block;

  border-radius: 50%;

  opacity: 0.22;

  filter: blur(3px);

  transform: translate3d(0, 0, 0);

  will-change: transform;

  pointer-events: none;

  contain: layout paint style;

  transition:
    opacity 400ms ease,
    transform 600ms ease;
}

.app-bg i:nth-child(1) {
  width: clamp(340px, 34vw, 680px);
  height: clamp(340px, 34vw, 680px);

  top: min(-20vw, -160px);
  right: 10vw;

  background:
    radial-gradient(
      circle at 50% 50%,
      var(--lilac) 0%,
      color-mix(in srgb, var(--lilac) 65%, transparent) 46%,
      transparent 76%
    );
}

.app-bg i:nth-child(2) {
  width: clamp(280px, 28vw, 560px);
  height: clamp(280px, 28vw, 560px);

  bottom: min(-18vw, -140px);
  left: 22vw;

  background:
    radial-gradient(
      circle at 50% 50%,
      var(--coral) 0%,
      color-mix(in srgb, var(--coral) 64%, transparent) 48%,
      transparent 76%
    );
}

.app-bg i:nth-child(3) {
  width: clamp(240px, 24vw, 500px);
  height: clamp(240px, 24vw, 500px);

  top: 42vh;
  right: min(-14vw, -110px);

  background:
    radial-gradient(
      circle at 50% 50%,
      var(--mint) 0%,
      color-mix(in srgb, var(--mint) 64%, transparent) 48%,
      transparent 76%
    );
}

.app-bg i:nth-child(4) {
  width: clamp(200px, 20vw, 420px);
  height: clamp(200px, 20vw, 420px);

  top: 18vh;
  left: -10vw;

  background:
    radial-gradient(
      circle at center,
      var(--sky, #dbeafe),
      transparent 72%
    );

  opacity: 0.15;
}

.app-bg i:nth-child(5) {
  width: clamp(220px, 22vw, 460px);
  height: clamp(220px, 22vw, 460px);

  right: 18vw;
  bottom: 12vh;

  background:
    radial-gradient(
      circle at center,
      var(--peach, #fed7aa),
      transparent 72%
    );

  opacity: 0.12;
}

/* =========================================================
   16. SURFACE FOUNDATION
========================================================= */

.surface {
  background:
    color-mix(
      in srgb,
      var(--cream-2) 94%,
      transparent
    );

  border:
    1px solid
    var(--border);

  border-radius:
    var(--radius-card);

  box-shadow:
    0 1px 2px rgba(28, 28, 28, 0.025),
    0 8px 28px rgba(28, 28, 28, 0.035);
}

.surface-soft {
  background:
    color-mix(
      in srgb,
      var(--cream-2) 76%,
      transparent
    );

  border:
    1px solid
    color-mix(
      in srgb,
      var(--border) 80%,
      transparent
    );

  border-radius:
    var(--radius-card);
}

.surface-flat {
  background: var(--cream-2);

  border:
    1px solid
    var(--border);

  border-radius:
    var(--radius-card);
}

/* =========================================================
   17. INTERACTION FOUNDATION
========================================================= */

.interactive {
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.interactive:hover {
  transform: translateY(-1px);
}

.interactive:active {
  transform: translateY(0);
}

/* =========================================================
   18. GLOBAL STATUS STATES
========================================================= */

.is-hidden {
  display: none !important;
}

.is-invisible {
  visibility: hidden !important;
}

.is-disabled {
  pointer-events: none !important;
  opacity: 0.5 !important;
}

.is-loading {
  pointer-events: none;
  cursor: progress;
}

.is-scroll-locked {
  overflow: hidden !important;
}

.is-muted {
  color: var(--muted);
}

.is-truncated {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.break-word {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* =========================================================
   19. TEXT UTILITIES
========================================================= */

.text-balance {
  text-wrap: balance;
}

.text-pretty {
  text-wrap: pretty;
}

.text-muted {
  color: var(--muted);
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

/* =========================================================
   20. FLEX / GRID SAFETY
========================================================= */

.flex,
.inline-flex,
.grid {
  min-width: 0;
}

.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.grid {
  display: grid;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* =========================================================
   21. SAFE CONTAINER FOUNDATION
========================================================= */

.container {
  width: min(
    calc(100% - 32px),
    var(--container-max, 1440px)
  );

  margin-inline: auto;
}

.container-wide {
  width: min(
    calc(100% - 24px),
    var(--container-wide, 1680px)
  );

  margin-inline: auto;
}

/* =========================================================
   22. CODE / PRE
========================================================= */

code,
kbd,
samp,
pre {
  font-family:
    var(
      --font-mono,
      "SFMono-Regular",
      Consolas,
      "Liberation Mono",
      monospace
    );
}

pre {
  overflow: auto;
  white-space: pre;
}

code {
  overflow-wrap: anywhere;
}

/* =========================================================
   23. DIALOG / POPOVER
========================================================= */

dialog {
  margin: auto;
  border: 0;
  padding: 0;
  color: inherit;
}

dialog::backdrop {
  background: rgba(15, 15, 15, 0.28);
  backdrop-filter: blur(3px);
}

[popover] {
  border: 0;
  padding: 0;
  color: inherit;
}

/* =========================================================
   24. DETAILS / SUMMARY
========================================================= */

details {
  display: block;
}

summary {
  cursor: pointer;
  user-select: none;
}

summary::-webkit-details-marker {
  display: none;
}

/* =========================================================
   25. DRAG / USER SELECT HELPERS
========================================================= */

.no-select {
  user-select: none;
  -webkit-user-select: none;
}

.no-drag {
  -webkit-user-drag: none;
  user-drag: none;
}

/* =========================================================
   26. THEME TRANSITIONS
========================================================= */

html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition:
    background-color 280ms ease,
    color 280ms ease,
    border-color 280ms ease,
    box-shadow 280ms ease,
    fill 280ms ease,
    stroke 280ms ease !important;
}

/* =========================================================
   27. DARK / NIGHT THEME HOOKS
========================================================= */

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="dark"] body {
  background: var(--cream);
  color: var(--ink);
}

html[data-theme="dark"] * {
  scrollbar-color:
    rgba(255, 255, 255, 0.18)
    transparent;
}

html[data-theme="dark"] *::-webkit-scrollbar-thumb {
  background:
    rgba(255, 255, 255, 0.16);

  border: 2px solid transparent;

  background-clip: padding-box;
}

html[data-theme="dark"] *::-webkit-scrollbar-thumb:hover {
  background:
    rgba(255, 255, 255, 0.24);

  border: 2px solid transparent;

  background-clip: padding-box;
}

/* =========================================================
   28. HIGH CONTRAST
========================================================= */

@media (prefers-contrast: more) {
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  a:focus-visible,
  [tabindex]:focus-visible {
    outline:
      2px solid
      currentColor;

    outline-offset: 3px;

    box-shadow: none;
  }

  .surface,
  .surface-soft,
  .surface-flat {
    border-width: 2px;
  }
}

/* =========================================================
   29. REDUCED TRANSPARENCY
========================================================= */

@media (prefers-reduced-transparency: reduce) {
  .surface,
  .surface-soft {
    background: var(--cream-2);
  }

  dialog::backdrop {
    backdrop-filter: none;
  }

  .app-bg i {
    opacity: 0.08;
  }
}

/* =========================================================
   30. REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;

    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;

    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .interactive:hover,
  .interactive:active {
    transform: none;
  }

  .app-bg i {
    will-change: auto;
  }
}

/* =========================================================
   31. TOUCH DEVICES
========================================================= */

@media (hover: none) {
  .interactive:hover {
    transform: none;
  }

  button,
  a {
    -webkit-tap-highlight-color:
      rgba(28, 28, 28, 0.06);
  }
}

/* =========================================================
   32. TABLET RESPONSIVE
========================================================= */

@media (max-width: 1024px) {
  .app-bg i:nth-child(1) {
    right: -4vw;
  }

  .app-bg i:nth-child(2) {
    left: 8vw;
  }

  .app-bg i:nth-child(4),
  .app-bg i:nth-child(5) {
    opacity: 0.08;
  }
}

/* =========================================================
   33. MOBILE RESPONSIVE
========================================================= */

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .container {
    width: min(
      calc(100% - 24px),
      var(--container-max, 1440px)
    );
  }

  .container-wide {
    width: calc(100% - 20px);
  }

  .app-bg i {
    filter: blur(10px);
  }

  .app-bg i:nth-child(1) {
    width: 70vw;
    height: 70vw;

    top: -30vw;
    right: -20vw;
  }

  .app-bg i:nth-child(2) {
    width: 66vw;
    height: 66vw;

    left: -20vw;
    bottom: -24vw;
  }

  .app-bg i:nth-child(3) {
    width: 56vw;
    height: 56vw;

    right: -28vw;
  }

  .app-bg i:nth-child(4),
  .app-bg i:nth-child(5) {
    display: none;
  }
}

/* =========================================================
   34. SMALL MOBILE
========================================================= */

@media (max-width: 480px) {
  body {
    line-height: 1.45;
  }

  .container {
    width: calc(100% - 20px);
  }

  .surface,
  .surface-soft,
  .surface-flat {
    border-radius:
      var(--radius-compact, 10px);
  }
}

/* =========================================================
   35. PRINT
========================================================= */

@media print {
  html,
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .app-bg,
  .skip-link,
  [data-print="hide"] {
    display: none !important;
  }

  *,
  *::before,
  *::after {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}

/* =========================================================
   36. FEATURE FALLBACKS
========================================================= */

@supports not (
  background:
    color-mix(in srgb, white 50%, black)
) {
  .surface {
    background: var(--cream-2);
  }

  .surface-soft {
    background: var(--cream);
  }

  .app-bg i:nth-child(1) {
    background: var(--lilac);
  }

  .app-bg i:nth-child(2) {
    background: var(--coral);
  }

  .app-bg i:nth-child(3) {
    background: var(--mint);
  }
}