/* More handy box model */
*,
*::after,
*::before {
  box-sizing: border-box;
}

*,
::after,
::before,
::backdrop,
::file-selector-button {
  margin: 0;
  padding: 0;
}

/* Improve focus styles */
:focus-visible {
  outline-offset: 3px;
}

/* Avoid overflow caused by embedded content */
:where(audio, iframe, img, svg, video, canvas) {
  display: block;
  max-block-size: 100%;
  max-inline-size: 100%;
}

/* Prevent fieldsets from causing overflow */
:where(fieldset) {
  min-inline-size: 0;
}

/* Increase the block-size of textareas */
:where(textarea:not([rows])) {
  min-block-size: 6em;
}

/* Inherit font styling in form elements */
:where(button, input, select, textarea) {
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  color: currentColor;
}

/* Improve table styling */
:where(table) {
  border-collapse: collapse;
  border: 1px solid;
}

:where(th, td) {
  border: 1px solid;
  padding: 0.25em 0.5em;
}

/* Impove text rendering defaults */
:where(html) {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

:where(body) {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/** Other helpful defaults **/
/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
:where(html, body, #root) {
  padding: 0;
  margin: 0;
}

:where(#root) {
  isolation: isolate;
}

:where(ul[role="list"]),
:wherer(ol[role="list"]) {
  list-style: none;
}

/* Balance text wrapping on headings */
:where(h1, h2, h3, h4, h5, h6) {
  text-wrap: balance;
}

/* Balance text wrapping on paragraphs */
:where(p) {
  text-wrap: pretty;
}

/* Avoid text overflows */
:where(p, h1, h2, h3, h4, h5, h6) {
  overflow-wrap: break-word;
}

:root {
  /* Primary Colors */
  --color-brand-blue: #60a5fa;
  --color-brand-purple: #a78bfa;
  --color-danger: #f87171;

  /* Background Colors */
  --color-bg-body: #16213e;
  --color-bg-container: #1e293b;
  --color-bg-dark: #0f172a;

  /* Text Colors */
  --color-text-primary: #e2e8f0;
  --color-text-secondary: #cbd5e1;
  --color-text-muted: #94a3b8;
  --color-text-light: #f1f5f9;
  --color-text-placeholder: #64748b;

  /* Border Colors */
  --color-border-primary: #334155;
  --color-border-secondary: #475569;
  --color-border-hover: #6d7b8e;

  /* Shadow Colors */
  --color-shadow-primary: rgba(0, 0, 0, 0.3);
  --color-shadow-hover-strong: rgba(96, 165, 250, 0.4);
  --color-shadow-dark: rgba(0, 0, 0, 0.3);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas,
    "Courier New", monospace;

  --font-size-xs: 0.875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.1rem;
  --font-size-xl: 1.3rem;
  --font-size-2xl: 2rem;
  --font-size-3xl: 3rem;

  --font-weight-normal: 400;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --leading-tight: 1.5;
  --leading-relaxed: 1.8;
  --letter-spacing-wide: 0.5px;

  /* Sizes */
  --size-xs: 0.75rem;
  --size-sm: 1rem;
  --size-md: 1.5rem;
  --size-lg: 2rem;
  --size-xl: 3rem;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Gradients */
  --gradient-primary: linear-gradient(
    135deg,
    var(--color-brand-blue),
    var(--color-brand-purple)
  );
  --gradient-background: linear-gradient(
    135deg,
    #1a1a2e 0%,
    #16213e 50%,
    #0f3460 100%
  );
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-secondary) transparent;
}

[x-cloak] {
  display: none !important;
}

html,
body {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  background: var(--color-bg-body) var(--gradient-background);
  color: var(--color-text-primary);
  overflow-y: auto;
}

.button {
  align-self: flex-start;
  padding: 0.375rem 0.75rem;
  background: var(--gradient-primary);
  color: var(--color-text-light);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-md);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.button_square {
  padding: 0.375rem;
}

.button_rounded {
  padding: 0.375rem;
  border-radius: 50%;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px var(--color-shadow-hover);
}

.button:active {
  transform: translateY(0);
}

.select {
  appearance: none;
  padding: var(--size-xs);
  border: 2px solid var(--color-border-secondary);
  background-color: var(--color-bg-container);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='%23fff' viewBox='0 0 256 256'%3E%3Cpath d='m216.49 104.49-80 80a12 12 0 0 1-17 0l-80-80a12 12 0 0 1 17-17L128 159l71.51-71.52a12 12 0 0 1 17 17Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--size-xs) top 50%;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-md);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.select:focus {
  outline: none;
  border-color: var(--color-brand-blue);
}

.select:hover {
  border-color: var(--color-border-hover);
}

.app {
  display: flex;
  flex-direction: column;
  gap: var(--size-lg);
  min-height: 100vh;
  padding: var(--size-xl) var(--size-sm);

  @media (min-width: 921px) and (min-height: 920px) {
    height: 100vh;
  }
}

.header {
  text-align: center;
}

.header__heading {
  color: var(--color-text-light);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--size-sm);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header__description {
  color: var(--color-text-secondary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.socials {
  position: fixed;
  top: var(--size-md);
  right: var(--size-md);
  display: flex;
  flex-direction: column;
  gap: var(--size-xs);
  z-index: 10;

  @media (max-width: 1560px) {
    position: absolute;
  }

  @media (max-width: 600px) {
    position: static;
    flex-direction: row;
    justify-content: center;
    align-items: center;
  }
}

.width-container {
  display: flex;
  min-height: 0;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.offline-indicator {
  align-items: center;
  justify-content: center;
  gap: var(--size-xs);
  padding: var(--size-xs) var(--size-sm);
  background: color-mix(in srgb, var(--color-danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-danger) 30%, transparent);
  border-radius: var(--radius-md);
  color: oklch(from var(--color-danger) calc(l + 0.5) c h);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

.offline-indicator__icon {
  flex-shrink: 0;
  color: oklch(from var(--color-danger) calc(l + 0.5) c h / 0.4);
}

.container {
  flex-direction: column;
  flex-grow: 1;
  gap: var(--size-lg);
  align-self: center;
  background: var(--color-bg-container);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px var(--color-shadow-primary);
  padding: var(--size-md);
  border: 1px solid var(--color-border-primary);
}

.inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--size-md);
  padding: var(--size-md);
  background: var(--color-bg-dark);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-primary);
  box-shadow: 0 5px 15px var(--color-shadow-primary);

  @media (max-width: 600px) {
    grid-template-columns: minmax(0, 1fr);
  }
}

.control-group {
  display: flex;
  gap: var(--size-xs);
  flex-direction: column;
}

.control-group__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.css-size {
  font-family: var(--font-mono);
  font-weight: var(--font-weight-bold);
  color: var(--color-brand-blue);
}

.label {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-text-light);
  text-transform: uppercase;
}

.code-blocks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--size-md);
  flex-grow: 1;
  min-height: 0;

  @media (max-width: 600px) {
    grid-template-columns: minmax(0, 1fr);
  }
}

.code-blocks__column {
  flex-grow: 1;
  flex-shrink: 0;
  min-width: 0;
  min-height: 0;
}

.code-blocks__header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.code-blocks__label {
  display: flex;
  align-items: center;
  gap: var(--size-xs);
}

.code-blocks__label::before {
  content: "";
  width: 4px;
  height: 30px;
  background: var(--gradient-primary);
  border-radius: 2px;
}

.code-blocks__content {
  flex-grow: 1;
}

.code-blocks__processing-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.code-blocks__actions {
  display: flex;
  gap: var(--size-xs);
  margin-left: auto;
}

.code-blocks__copy-html {
  width: 7.5rem;
}

.textarea,
.preview {
  width: 100%;
  min-height: 200px;
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  line-height: var(--leading-tight);
  color: var(--color-text-primary);
  box-shadow: 0 5px 15px var(--color-shadow-primary);

  transition: all 0.2s ease;
  overflow-y: auto;

  @media (max-height: 920px) or (max-width: 920px) {
    height: 400px;
  }
}

.textarea {
  resize: none;
  padding: var(--size-xs);
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border-secondary);
  background: var(--color-bg-dark);
}

.textarea:focus {
  outline: none;
  border-color: var(--color-brand-blue);
}

.textarea::placeholder {
  color: var(--color-text-placeholder);
}

.preview pre {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
  min-height: 100%;
  margin: 0 !important;
}

.preview code {
  width: 100%;
}

.preview_fallback::before {
  display: block;
  height: 100%;
  content: attr(data-fallback-message);
  padding: var(--size-xs);
  background: var(--color-bg-dark);
  color: var(--color-text-placeholder);
}

.instructions {
  display: flex;
  flex-direction: column;
  gap: var(--size-xs);
}

.instructions__heading {
  color: var(--color-brand-blue);
  font-size: var(--font-size-xl);
}

/* Night owl highlight.js theme */
.instructions__code-container {
  position: relative;
}

.instructions__code {
  display: block;
  background: var(--color-bg-container);
  border-radius: var(--radius-md);
  padding: var(--size-xs);
  padding-right: var(--size-xl);
  word-break: break-word;

  :where(.attr, .name, .tag) {
    font-weight: var(--font-weight-semibold);
    color: var(--color-brand-blue);
  }

  .string {
    color: var(--color-brand-purple);
  }
}

.instructions__copy-button {
  position: absolute;
  top: 6px;
  right: 6px;
}
