@import "@welshman/editor/index.css";

@tailwind base;
@tailwind components;
@tailwind utilities;

/* Fonts */

@font-face {
  font-family: "Satoshis";
  font-style: normal;
  font-weight: 400;
  src:
    local(""),
    url("/fonts/Satoshi Symbol.ttf") format("truetype");
}

@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 400;
  src:
    local(""),
    url("/fonts/Lato-Regular.ttf") format("truetype");
}

@font-face {
  font-family: "Lato";
  font-style: bold;
  font-weight: 600;
  src:
    local(""),
    url("/fonts/Lato-Bold.ttf") format("truetype");
}

@font-face {
  font-family: "Lato";
  font-style: italic;
  font-weight: 400;
  src:
    local(""),
    url("/fonts/Italic.ttf") format("truetype");
}

/* root */

:root {
  font-family: Lato;
  --sait: env(safe-area-inset-top);
  --saib: env(safe-area-inset-bottom);
  --sail: env(safe-area-inset-left);
  --sair: env(safe-area-inset-right);
}

[data-theme] {
  @apply bg-base-300;
  --base-100: oklch(var(--b1));
  --base-200: oklch(var(--b2));
  --base-300: oklch(var(--b3));
  --base-content: oklch(var(--bc));
  --primary: oklch(var(--p));
  --primary-content: oklch(var(--pc));
  --secondary: oklch(var(--s));
  --secondary-content: oklch(var(--sc));
}

/* safe area insets */

@layer components {
  .pt-sai {
    padding-top: var(--sait);
  }

  .pr-sai {
    padding-right: var(--sair);
  }

  .pb-sai {
    padding-bottom: var(--saib);
  }

  .pl-sai {
    padding-left: var(--sail);
  }

  .px-sai {
    @apply pl-sai pr-sai;
  }

  .py-sai {
    @apply pt-sai pb-sai;
  }

  .p-sai {
    @apply py-sai px-sai;
  }

  .mt-sai {
    padding-top: var(--sait);
  }

  .mr-sai {
    padding-right: var(--sair);
  }

  .mb-sai {
    padding-bottom: var(--saib);
  }

  .ml-sai {
    padding-left: var(--sail);
  }

  .mx-sai {
    @apply ml-sai mr-sai;
  }

  .my-sai {
    @apply mt-sai mb-sai;
  }

  .m-sai {
    @apply my-sai mx-sai;
  }

  .top-sai {
    top: var(--sait);
  }

  .right-sai {
    right: var(--sair);
  }

  .bottom-sai {
    bottom: var(--saib);
  }

  .left-sai {
    left: var(--sail);
  }
}

/* utilities */

.bg-alt,
.bg-alt .bg-alt .bg-alt,
.hover\:bg-alt:hover,
.bg-alt .bg-alt .hover\:bg-alt:hover,
.bg-alt .bg-alt.hover\:bg-alt:hover {
  @apply bg-base-100 text-base-content transition-colors;
}

.bg-alt .bg-alt,
.bg-alt .bg-alt .bg-alt .bg-alt,
.bg-alt .hover\:bg-alt:hover,
.bg-alt .bg-alt .bg-alt .hover\:bg-alt:hover,
.bg-alt.hover\:bg-alt:hover,
.bg-alt .bg-alt .bg-alt.hover\:bg-alt:hover {
  @apply bg-base-300 text-base-content transition-colors;
}

.card2 {
  @apply rounded-box p-6 text-base-content;
}

.card2.card2-sm {
  @apply p-4 text-base-content;
}

.column {
  @apply flex flex-col;
}

.center {
  @apply flex items-center justify-center;
}

.row-2 {
  @apply flex items-center gap-2;
}

.row-3 {
  @apply flex items-center gap-3;
}

.row-4 {
  @apply flex items-center gap-4;
}

.col-2 {
  @apply flex flex-col gap-2;
}

.col-3 {
  @apply flex flex-col gap-3;
}

.col-4 {
  @apply flex flex-col gap-4;
}

.col-8 {
  @apply flex flex-col gap-8;
}

.badge {
  @apply justify-start overflow-hidden text-ellipsis whitespace-nowrap;
}

.ellipsize {
  @apply overflow-hidden text-ellipsis;
}

[data-tip]::before {
  @apply ellipsize;
}

@media (max-width: 639px) {
  [data-tip]::before {
    display: none;
  }
}

.content-padding-x {
  @apply px-4 sm:px-8 md:px-12;
}

.content-padding-t {
  @apply pt-4 sm:pt-8 md:pt-12;
}

.content-padding-b {
  @apply pb-4 sm:pb-8 md:pb-12;
}

.content-padding-y {
  @apply content-padding-t content-padding-b;
}

.content-sizing {
  @apply m-auto w-full max-w-3xl;
}

.content {
  @apply content-sizing content-padding-x content-padding-y;
}

.heading {
  @apply text-center text-2xl;
}

.subheading {
  @apply text-center text-xl;
}

.superheading {
  @apply text-center text-4xl;
}

.link {
  @apply cursor-pointer text-primary underline;
}

.input input::placeholder {
  opacity: 0.5;
}

.shadow-top-xl {
  @apply shadow-[0_20px_25px_-5px_rgb(0,0,0,0.1)_0_8px_10px_-6px_rgb(0,0,0,0.1)];
}

/* tiptap */

.input-editor,
.chat-editor,
.note-editor {
  @apply -m-1 min-h-12 p-1;
}

.tiptap {
  --tiptap-object-bg: var(--base-100);
  --tiptap-object-fg: var(--base-content);
  --tiptap-active-bg: var(--primary);
  --tiptap-active-fg: var(--primary-content);
}

.tiptap-suggestions {
  --tiptap-object-bg: var(--base-100);
  --tiptap-object-fg: var(--base-content);
  --tiptap-active-bg: var(--base-300);
  --tiptap-active-fg: var(--base-content);
}

.tiptap-suggestions__item {
  @apply border-l-2 border-solid border-base-100;
}

.tiptap-suggestions__selected {
  @apply border-primary;
}

.tiptap {
  @apply max-h-[350px] overflow-y-auto p-2 px-4;
}

.tiptap p.is-editor-empty:first-child::before {
  opacity: 40%;
}

.chat-editor .tiptap {
  @apply rounded-box bg-base-300 pr-12;
}

.note-editor .tiptap {
  --tiptap-object-bg: var(--base-200);
  @apply input input-bordered h-auto min-h-32 rounded-box p-[.65rem] pb-6;
}

.input-editor .tiptap {
  --tiptap-object-bg: var(--base-200);
  @apply input input-bordered h-auto p-[.65rem];
}

/* link-content, based on tiptap */

.link-content {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 3px;
  padding: 0 0.25rem;
  background-color: var(--base-100);
  color: var(--base-content);
}

/* content rendered by welshman/content */

.welshman-content a {
  @apply link;
}

.welshman-content-error a {
  @apply underline;
}

/* date input */

.picker {
  --date-picker-foreground: var(--base-content);
  --date-picker-background: var(--base-300);
  --date-picker-highlight-border: var(--primary);
  --date-picker-selected-color: var(--primary-content);
  --date-picker-selected-background: var(--primary);
}

.date-time-field {
  @apply input input-bordered rounded-lg px-0;
}

.date-time-field input {
  @apply !h-full !w-full !rounded-lg !border-none !bg-inherit !px-4 !text-inherit;
}

/* emoji picker */

emoji-picker {
  --background: var(--base-100);
  --border-color: var(--base-100);
  --border-radius: var(--rounded-box);
  --button-active-background: var(--base-content);
  --button-hover-background: var(--base-content);
  --indicator-color: var(--base-content);
  --input-border-color: var(--base-100);
  --input-font-color: var(--base-content);
  --outline-color: var(--base-100);
}

/* progress */

progress[value]::-webkit-progress-value {
  transition: width 0.5s;
}

/* content width for fixed elements */

.cw {
  @apply w-full md:left-[18.5rem] md:w-[calc(100%-18.5rem-var(--sair))];
}

.cw-full {
  @apply w-full md:left-[4rem] md:w-[calc(100%-4rem-var(--sair))];
}

.cb {
  @apply md:bottom-sai bottom-[calc(var(--saib)+3.5rem)];
}

/* chat view */

.chat__compose {
  @apply cb cw fixed;
}

.chat__scroll-down {
  @apply fixed bottom-28 right-4 md:bottom-16;
}
