
/* ── Font Faces ── */

@font-face {
    font-family: Nunito;
    src: url('/_static/font/Nunito-VariableFont_wght.ttf') format('truetype');
    font-style: normal;
    font-weight: 200 1000;
}

@font-face {
    font-family: Nunito;
    src: url('/_static/font/Nunito-Italic-VariableFont_wght.ttf') format('truetype');
    font-style: italic;
    font-weight: 200 1000;
}

/* ── Base Element Styles ── */

a {
    border: 0;
    color: var(--color-link-primary);
    cursor: pointer;
    font-style: normal;
    text-decoration: none;
}

a img,
button img,
/* TODO (nate) this is a temporary bypass so we dont apply this to all label buttons */
.item-row-icons-right > button.label {
    opacity: var(--opacity-muted);
}

a:hover img,
button:hover img,
button.label:hover {
    opacity: var(--opacity-full);
}

body {
    background: var(--color-background-primary);
    color: var(--color-text-primary);
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    line-height: 1.57rem; /* TODO (nate) this will change to 1.5 unitless */
    margin: var(--space-lg);
    padding: 0;
    text-rendering: optimizeLegibility;
    word-wrap: break-word;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

@media (max-width: 48rem) {
    body {
        margin-left: 0;
        margin-right: 0;
    }
}

button {
    background: none;
    border: none;
    color: var(--color-text-primary);
    cursor: pointer;
    font-family: var(--font-family-base);
    font-size: inherit;
    padding: 0;
}

hr {
    border: none;
    border-top: 1px solid var(--color-border-secondary);
}

html {
    height: auto;
    max-width: 100%;
    position: relative;
}

/* ── Base Element Overrides ── */

img.svg {
    height: var(--font-size-base);
    vertical-align: baseline;
    width: var(--font-size-base);
}

/* ── Scrollbars ── */

@supports not selector(::-webkit-scrollbar) {
    * {
        scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
        scrollbar-width: auto;
    }
}

*::-webkit-scrollbar {
    height: var(--scrollbar-size);
    width: var(--scrollbar-size);
}

*::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-xs);
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

*::-webkit-scrollbar-thumb:active {
    background: var(--scrollbar-thumb-active);
}

*::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: var(--radius-xs);
}

*::-webkit-scrollbar-button {
    display: none;
    height: 0;
    width: 0;
}

/* ── Layout ── */

/* TODO (nate) the only place this isnt used is calendar so I think it makes sense in here.
With the calendar ui re-write we may even use main in the same way - we'll see */
#main {
    max-width: 60rem;
    margin: 3rem auto 0;
    padding-top: 0.625rem;
    min-height: 75vh;
    /* Performance optimizations */
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

@media (max-width: 48rem) {
    #main {
        margin: 3rem 0 0;
        padding: 0 var(--space-lg);
        padding-top: 0.625rem;
        min-height: calc(100vh - 5.7rem);
    }
}

.column {
    display: flex;
    flex-direction: column;
}

.column .label {
    column-gap: var(--space-xs);
    margin-bottom: var(--space-xs);
}

.column.red .label {
    color: var(--color-error) !important;
}

/* TODO (nate) this will become much more relevant if we wrap an entire detail
page content in a column div to apply child spacing. This specifically fixs one of the
email address rules listing for now */
.column .row .label {
    margin-bottom: 0;
}

.column .label img.svg {
    position: unset;
}

.column a,
.column button,
.column span {
    align-items: center;
    display: inline-flex;
    gap: var(--space-2xs);
}

.column > :last-child,
.column > div.content > :last-child {
    margin-bottom: 0;
}

.detail {
    padding-left: .5rem;
}

.detail > :first-child {
    margin-left: -.5rem;
}

.row {
    align-items: center;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-sm);
    row-gap: var(--space-xs);
}

/* TODO (marty) override for old css */
.row .label img.svg {
    position: unset;
}

.row > span.separator {
    margin: 0 -.125rem;
    position: unset;
}

.row a,
.row button,
.row span {
    align-items: center;
    display: inline-flex;
    gap: var(--space-2xs);
}

.row.hide {
    display: none;
}

.row.left-margin {
    margin-left: var(--space-lg);
}

.row.no-margin {
    margin: 0rem;
}

.row .label {
    gap: var(--space-xs);
}

.gap-xs {
    gap: var(--space-xs) !important;
    row-gap: 0;
}

.gap-lg {
    gap: var(--space-lg) !important;
    row-gap: 0;
}

.gap-2xl {
    gap: var(--space-2xl) !important;
    row-gap: 0;
}

.large-icons img.svg {
    height: var(--font-size-2xl);
    width: var(--font-size-2xl);
}

@media (max-width: 48rem) {
    .large-icons img.svg {
        height: var(--font-size-xl);
        width: var(--font-size-xl);
    }
}

.loading-page {
    display: flex;
    justify-content: center;
}

.margin-bottom-none {
    margin-bottom: 0;
}

.margin-top-lg {
    margin-top: var(--space-lg);
}

/* ── Follow Styling ── */

[name="quick-follow-tools"] {
  margin-bottom: 0.75rem;
}

[name="quick-follow-tools"] .content {
  border-left: 1px solid var(--color-border-primary);
  padding-left: var(--space-md);
}

/* ── List Tools ── */

/* TODO (nate) a list tool will go away once all show X tools us buttons instead of anchors */
a.list-tool,
button.list-tool {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    gap: 0rem;
    position: relative;
    text-decoration: none;
}

/* TODO (nate) same as above */
a.list-tool > img,
button.list-tool > img {
    height: var(--font-size-base) !important;
    width: var(--font-size-base) !important;
}

/* ── Page titles ── */

.titles {
    margin-bottom: var(--space-lg);
}

.titles + .row-separator > *:first-child {
    border-top: none;
}

.sub-title {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
}

.title1, .title2 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-sm);
}

.title2 {
  margin-top: calc(var(--space-xs) * -1);
}

.title1:has(~ .title2) span:not(.sub-title) {
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
    font-style: italic;
    line-height: 1.25rem; /* TODO (nate) this will change to 1.25 unitless */
}

.title1 img.svg, .title2 img.svg {
    height: var(--font-size-xl);
    position: relative;
    top: 0.125rem;
    vertical-align: baseline;
    width: var(--font-size-xl);
}

.title1 .announcement, .title2 .announcement,
.title1 .conversation, .title2 .conversation,
.title1 .group, .title2 .group,
.title1 .organization, .title2 .organization {
    border-width: 4px;
}

.title1 .conversation, .title2 .conversation {
    border-radius: 22px 22px 22px 0;
}

/* ── Page Labels ── */

.label {
    color: var(--color-text-label);
    font-style: italic;
    font-size: 0.8rem; /* 12.8px */
    font-weight: var(--font-weight-semi-bold);
    /* TODO (nate) temp solution until we apply full caps manually */
    text-transform: capitalize;
    white-space: nowrap;
}

.label img { opacity: var(--opacity-faint); }

/* ── Container/Object Labels ── */

.announcement,
.conversation,
.group,
.organization {
    align-items: center;
    background: var(--color-background-primary);
    /* do not change this w/o good reason - if changed tag padding must be updated */
    border: 3px solid;
    border-radius: 2px;
    color: var(--color-text-primary);
    display: inline-flex;
    gap: var(--space-xs);
    line-height: var(--line-height-tight);
    padding: 0.0625rem 0.625rem;
    white-space: pre;
}

.announcement > a,
.conversation > a,
.group > a,
.organization > a {
    color: var(--color-text-primary);
}

.announcement { border-color: var(--color-announcement); }
.announcement:is(a, :has(a), a *):hover { border-color: var(--color-announcement-dark); }

.conversation {
    border-color: var(--color-conversation);
    border-radius: 14px 14px 14px 0;
}

.conversation:is(a, :has(a), a *):hover { border-color: var(--color-conversation-dark); }

.group { border-color: var(--color-group); }
.group:is(a, :has(a), a *):hover { border-color: var(--color-group-dark); }

.organization { border-color: var(--color-organization); }
.organization:is(a, :has(a), a *):hover { border-color: var(--color-organization-dark); }

/* ── Tags ── */

.group-tag > a { color: var(--color-text-primary); }

.group-tag, .group-tag-split,
.identity-tag, .identity-tag-split,
.standard-tag, .standard-tag-split {
    align-items: center;
    border-radius: 14px;
    color: var(--color-text-primary);
    display: inline-flex;
    font-size: var(--font-size-base);
    line-height: var(--line-height-tight);
    white-space: pre;
}

.group-tag,
.identity-tag,
.standard-tag {
    border: 2px solid;
    gap: var(--space-sm) !important;
    padding: 0.125rem 0.5rem 0.125rem 0.625rem;
}

.group-tag-split,
.identity-tag-split,
.standard-tag-split {
    gap: 0 !important;
}

.group-tag, .group-tag-split {
    background-color: var(--color-group);
    border-color: var(--color-group);
}

.identity-tag, .identity-tag-split {
    background-color: var(--color-conversation);
    border-color: var(--color-conversation);
}

.standard-tag, .standard-tag-split {
    background-color: var(--color-standard-tag);
    border-color: var(--color-standard-tag);
}

.group-tag-split > a:first-child,
.identity-tag-split > a:first-child,
.standard-tag-split > a:first-child {
    border: 2px solid;
    border-radius: 14px 0 0 14px;
    border-right: none;
    gap: var(--space-sm) !important;
    padding: 0.125rem 0.5rem 0.125rem 0.625rem;
}

.group-tag-split > a:first-child { border-color: var(--color-group); }
.identity-tag-split > a:first-child { border-color: var(--color-conversation); }
.standard-tag-split > a:first-child { border-color: var(--color-standard-tag); }

.group-tag-split > a:last-child,
.identity-tag-split > a:last-child,
.standard-tag-split > a:last-child {
    border: 2px solid;
    border-radius: 0 14px 14px 0;
    padding: 0.125rem 0.5rem;
}

.group-tag-split > a:last-child {
    background-color: var(--color-group-dark);
    border-color: var(--color-group-dark);
}

.identity-tag-split > a:last-child {
    background-color: var(--color-conversation-dark);
    border-color: var(--color-conversation-dark);
}

.standard-tag-split > a:last-child {
    background-color: var(--color-standard-tag-dark);
    border-color: var(--color-standard-tag-dark);
}

.group-tag:is(a, button, :has(a, button), a *, button *):hover { border-color: var(--color-group-dark); }
.identity-tag:is(a, button, :has(a, button), a *, button *):hover { border-color: var(--color-conversation-dark); }
.standard-tag:is(a, button, :has(a, button), a *, button *):hover { border-color: var(--color-standard-tag-dark); }

.group-tag-split:has(a:hover) > a { border-color: var(--color-group-dark); }
.identity-tag-split:has(a:hover) > a { border-color: var(--color-conversation-dark); }
.standard-tag-split:has(a:hover) > a { border-color: var(--color-standard-tag-dark); }

.group-tag-split > a:last-child:hover {
    background-color: var(--color-group-darker);
    border-color: var(--color-group-darker);
}

.identity-tag-split > a:last-child:hover {
    background-color: var(--color-conversation-darker);
    border-color: var(--color-conversation-darker);
}

.standard-tag-split > a:last-child:hover {
    background-color: var(--color-standard-tag-darker);
    border-color: var(--color-standard-tag-darker);
}

/* ── Toggles ── */

.toggle, .toggle-selected, .toggle-split {
    border: 1px solid var(--color-border-primary);
    border-radius: var(--radius-sm);
    color: var(--color-text-primary);
    text-decoration: none;
    white-space: nowrap;
}

.toggle, .toggle-selected {
    line-height: var(--line-height-tight);
    gap: var(--space-xs) !important;
    padding: 0.125rem 0.75rem;
}

.toggle-split {
    align-items: center;
    display: inline-flex;
    gap: 0 !important;
    padding: 0.175rem;
}

.toggle,
.toggle-split-inactive {
    background-color: var(--color-background-primary);
}

.toggle-selected,
.toggle-split-selected {
    background-color: var(--color-background-tertiary);
}

.toggle > img, .toggle-selected > img {
    align-self: center;
}

.toggle-split > span {
    border-radius: var(--radius-sm);
    line-height: 1.15;
    padding: 0 0.375rem;
    text-align: center;
}

.toggle:hover, .toggle-selected:hover, .toggle-split:hover {
    box-shadow: inset 0 0 1px 1px var(--color-shadow-sm);
}

/* ── Utility ── */

#attendees_external > span > img,
#attendees_internal > span > img {
    margin-right: 0.15rem
}

body.is-dragging, body.is-dragging * { cursor: grabbing !important; }

.drag-handle {
    cursor: grab;
    touch-action: none;
}

.drag-handle > img.svg {
    height: var(--font-size-xl);
    width: var(--font-size-xl);
}

.error-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semi-bold);
}

.hidden { display: none !important; }

.nowrap { white-space: nowrap; }

.red { color: var(--color-error) !important; }

.row-separator .row {
    width: 100%;
    border-top: 1px solid var(--color-border-secondary);
    padding: var(--space-md) var(--space-sm) var(--space-md) var(--space-sm);
    margin-bottom: 0;
}

.disabled,
::placeholder,
.button.disabled,
select:disabled,
input:disabled,
textarea:disabled {
    color: var(--color-text-disabled) !important;
    opacity: var(--opacity-full);
}

.semi-bold { font-weight: var(--font-weight-semi-bold); }

.separator {
    color: var(--color-text-secondary) !important;
    font-size: 0.714rem;
    /* TODO (nate) this needs to die when we convert to flex rows as its causing the
    the separator to be too high up now that we've switched from baseline to center */
    top: -0.071rem;
    position: relative;
}

/* ── Animations ── */

div.locate:target {
    animation-duration: 3s;
    animation-name: highlight;
    scroll-margin-top: 80vh;
}

@keyframes highlight {
    from {
        background-color: var(--color-background-secondary);
    }
    to {
        background-color: var(--color-background-primary);
    }
}


.spinner-sm,
.spinner-md,
.spinner-lg {
    animation: spin 0.8s linear infinite;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    border-top-color: #3c89eb;
    display: inline-block;
    flex-shrink: 0;
}

.spinner-sm {
    height: var(--font-size-base);
    width: var(--font-size-base);
}

.spinner-md {
    height: var(--font-size-2xl);
    width: var(--font-size-2xl);
}

.spinner-lg {
    height: var(--font-size-4xl);
    width: var(--font-size-4xl);
}

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