@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&display=swap");

:root {
    --font-size: 20px;
    --line-height: 30px;
    --letter-spacing: -3px;
    --padding: 32px;
    --icon-size: 48px;
    --list-indent: 68px;
    --border-light: 1px solid rgba(255, 255, 255, 0.2);
    --border-dark: 1px solid rgba(0, 0, 0, 0.15);
    --color-bg: #050505;
    --color-text-light: #f7f7f7;
    --color-text-dark: #202020;
    --color-accent: #ff6f59;
    --color-muted: rgba(255, 255, 255, 0.62);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text-light);
    font-family: "DM Sans", system-ui, sans-serif;
    font-size: var(--font-size);
    line-height: var(--line-height);
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

h1,
h2,
h3 {
    font-weight: 300;
}

h1 {
    font-size: 1.5em;
}
.status {
    position: fixed;
    left: var(--padding);
    bottom: var(--padding);
    z-index: 20;
    max-width: min(520px, calc(100vw - var(--padding) * 2));
    color: var(--color-muted);
    font-size: 0.85rem;
}

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

body.loading #main {
    opacity: 0;
}

body.loading #loader {
    display: block;
}

#loader {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 40px;
    margin: -20px 0 -1px 0;
    background: var(--color-text-light);
    -webkit-animation: spin 0.7s ease-in-out 0s infinite;
    -moz-animation: spin 0.7s ease-in-out 0s infinite;
    animation: spin 0.7s ease-in-out 0s infinite;
}

#main {
    min-height: 100dvh;
    overflow-x: hidden;
}

#button-close {
    pointer-events: none;
    opacity: 0;
    position: fixed;
    z-index: 100;
    right: calc(var(--padding) / 2);
    top: calc(var(--padding) / 2);
    width: var(--icon-size);
    height: var(--icon-size);
    border: 0;
    background: transparent;
    transition: opacity 0.2s;
}

#button-close::before,
#button-close::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 10%;
    width: 2px;
    height: 80%;
    background: var(--color-text-dark);
}

#button-close::before {
    transform: rotate(45deg);
}

#button-close::after {
    transform: rotate(-45deg);
}

#main.detailview #button-close {
    opacity: 0.8;
    pointer-events: auto;
}

#recipes {
    font-size: 1.4em;
    line-height: 1em;
    overflow-x: hidden;
}

.recipe-link {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    border: 0;
    border-bottom: var(--border-light);
    background: transparent;
    color: var(--color-text-light);
    text-align: left;
    /*white-space: nowrap;*/
}

.recipe-dot {
    position: absolute;
    left: 20px;
    top: 50%;
    width: calc(var(--font-size) * 1.4);
    height: calc(var(--font-size) * 1.4);
    margin-top: calc(var(--font-size) * -0.7);
    border-radius: 999px;
    background: white;
    opacity: 0;
    transform: scale(0);
    transition:
        transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
        opacity 0.16s ease;
}

.recipe-title-text {
    display: block;
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.recipe-link[aria-current="true"] .recipe-dot {
    opacity: 1;
    transform: scale(1);
}

.recipe-link[aria-current="true"] .recipe-title-text {
    transform: translateX(calc(var(--list-indent) - 16px));
}

#recipe {
    position: fixed;
    right: -50%;
    top: 0;
    bottom: 0;
    z-index: 10;
    width: 50%;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    color: var(--color-text-dark);
    transition: right 0.25s;
}

#main.detailview #recipe {
    right: 0;
}

#recipe .wrapper {
    padding: var(--padding);
}

#recipe-title {
    margin: 0 20% var(--padding) -4px;
    padding-bottom: calc(var(--padding) * 1.6);
    font-size: 4em;
    line-height: 1em;
    letter-spacing: var(--letter-spacing);
    font-weight: 300;
}

#recipe-yield {
    padding-bottom: calc(var(--padding) / 2);
    border-bottom: var(--border-dark);
    text-align: right;
}

.ingredients {
    padding: calc(var(--padding) / 2.5) 0;
    border-bottom: var(--border-dark);
}

.home-component-tabs {
    display: flex;
    gap: 24px;
}

.home-component-tab {
    border: 0;
    border-top: 1px solid transparent;
    margin-top: -1px;
    padding: calc(var(--padding) / 2) 0;
    background: transparent;
    color: var(--color-text-dark);
    font-weight: 500;
}

.home-component-tab[aria-current="true"] {
    border-top-color: var(--color-accent);
    color: var(--color-accent);
}

.ingredients > div,
#steps .step {
    display: flex;
    padding: calc(var(--padding) / 2) 0;
}

#steps {
    padding: calc(var(--padding) / 2) 0;
}

.flex {
    flex: 1;
}

#recipe .weight,
#recipe .index {
    width: calc(var(--padding) * 3);
    font-weight: 500;
}

#recipe .note,
#recipe .volume {
    margin-left: 0.35em;
    opacity: 0.45;
}

#source {
    margin-top: var(--padding);
    font-size: 0.9rem;
}

.admin-body {
    background: #f6f4ef;
    color: #191919;
}

.admin-shell {
    display: grid;
    grid-template-columns: minmax(360px, 460px) 1fr;
    min-height: 100dvh;
}

.admin-sidebar {
    border-right: var(--border-dark);
    background: #ffffff;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 8px 0 20px;
    border-bottom: var(--border-dark);
}

.admin-tools {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 5;
}

.account-menu {
    position: relative;
}

.avatar-button {
    display: block;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    padding: 0;
    overflow: hidden;
    background: #191919;
}

.avatar-button img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-popover {
    position: absolute;
    right: 0;
    top: 100%;
    display: none;
    padding: 4px;
    border: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

.account-popover::before {
    content: "";
    position: absolute;
    right: 0;
    bottom: 100%;
    width: 100%;
    height: 8px;
}

.account-popover .button {
    border: 0;
    white-space: nowrap;
}

.account-menu:hover .account-popover,
.account-menu:focus-within .account-popover {
    display: block;
}

.admin-add-recipe {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: #191919;
}

.admin-list {
    display: grid;
}

.admin-recipe-row {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 64px;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 64px;
    padding: 12px 16px;
    border-bottom: var(--border-dark);
    background: transparent;
    color: #191919;
}

.admin-recipe-row[aria-current="true"] {
    background: #f0eee8;
}

.admin-recipe-row.is-dragging {
    opacity: 0.45;
}

.admin-recipe-drag {
    display: grid;
    place-items: center;
    width: 32px;
    height: 40px;
    border: 0;
    background: transparent;
    color: #222;
    cursor: grab;
}

.admin-recipe-drag:active {
    cursor: grabbing;
}

.admin-recipe-title {
    min-width: 0;
    border: 0;
    background: transparent;
    color: #191919;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.admin-publish-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    cursor: pointer;
}

.admin-publish-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.admin-toggle-icon {
    color: #9d9d9d;
    font-size: 36px;
}

.admin-publish-toggle input:checked + .admin-toggle-icon {
    color: #0b8cff;
}

.admin-publish-toggle input:focus-visible + .admin-toggle-icon {
    outline: 2px solid #191919;
    outline-offset: 3px;
}

.admin-main {
    padding: 24px;
}

.auth-panel,
.editor-panel {
    max-width: 980px;
}

.auth-panel {
    padding: 24px;
}

.recipe-form {
    display: grid;
    gap: 18px;
}

.form-grid {
    display: grid;
    row-gap: 24px;
    /*grid-template-columns: repeat(2, minmax(0, 1fr));*/
    /*gap: 18px;*/
}

.field {
    display: grid;
    gap: 8px;
}
.field.row {
    grid-template-columns: 1fr 4fr;
    align-items: center;
}

.field > span,
.field-header span,
.checkbox,
.toggle-field > span:last-child {
    /*font-size: 0.78rem;*/
    /*font-weight: 700;*/
    text-transform: lowercase;
}

.field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.field input,
.field textarea {
    width: 100%;
    border: none;
    border-radius: 0;
    padding: 10px 12px;
    background: #fff;
    color: #191919;
}

.field textarea {
    min-height: 180px;
    resize: vertical;
}

.field-wide {
    grid-column: 1 / -1;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-field {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: fit-content;
    cursor: pointer;
}

.toggle-field input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-track {
    position: relative;
    display: inline-flex;
    width: 48px;
    height: 28px;
    border: 1px solid #9ca3af;
    border-radius: 999px;
    background: #d9dce2;
    transition:
        background 0.18s,
        border-color 0.18s;
}

.toggle-thumb {
    position: absolute;
    left: 3px;
    top: 3px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
    transition: transform 0.18s;
}

.toggle-field input:checked + .toggle-track {
    border-color: #1769d1;
    background: #1769d1;
}

.toggle-field input:checked + .toggle-track .toggle-thumb {
    transform: translateX(20px);
}

.toggle-field input:focus-visible + .toggle-track {
    outline: 2px solid #191919;
    outline-offset: 3px;
}

.button-row {
    display: flex;
    gap: 10px;
}

.button {
    border: none;
    padding: 9px 14px;
    background: #191919;
    color: #fff;
}

.button-small {
    padding: 5px 9px;
    font-size: 0.78rem;
}

.button-secondary {
    background: transparent;
    color: #191919;
}

.button-danger {
    border: none;
    background: #f65058;
}

.button:disabled {
    cursor: default;
    opacity: 0.45;
}

.steps-editor,
.ingredient-list {
    display: grid;
    gap: 16px;
}

.ingredient-row,
.step-editor-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding-right: 12px;
    padding-top: 6px;
    padding-bottom: 6px;
    background-color: white;
}

.step-editor-row.is-dragging {
    opacity: 0.45;
}

.step-drag,
.step-actions button {
    width: 32px;
    height: 40px;
    border: 0;
    background: transparent;
    color: #6e7480;
    line-height: 1;
}

.step-drag {
    cursor: grab;
}

.step-drag:active {
    cursor: grabbing;
}

.step-editor-row textarea {
    min-height: 34px;
    max-height: 180px;
    padding: 5px 10px;
    overflow: hidden;
    resize: none;
    line-height: 22px;
}

.step-actions {
    display: flex;
    gap: 2px;
}

.step-actions button {
    display: grid;
    place-items: center;
}

.step-editor-row .step-actions {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease;
}

.step-editor-row:hover .step-actions,
.step-editor-row:focus-within .step-actions {
    opacity: 1;
    pointer-events: auto;
}

.material-symbols-outlined {
    font-family: "Material Symbols Outlined";
    font-weight: normal;
    font-style: normal;
    font-size: 32px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    direction: ltr;
    font-feature-settings: "liga";
    -webkit-font-feature-settings: "liga";
    -webkit-font-smoothing: antialiased;
}

.step-delete {
    width: 44px;
    height: 44px;
    color: #5e6571;
}

.components-editor {
    display: grid;
    gap: 14px;
}

.component-tabs {
    display: flex;
    align-items: center;
    border-bottom: var(--border-dark);
    overflow-x: auto;
}

.component-tab-wrap {
    display: inline-flex;
    align-items: center;
    min-width: 180px;
    border-bottom: 2px solid transparent;
}

.component-tab-wrap[aria-current="true"] {
    border-bottom-color: #191919;
}

.component-tab,
.component-tab-input {
    flex: 1;
    min-width: 0;
    border: 0;
    padding: 14px 18px;
    background: transparent;
    color: #85827a;
    text-align: center;
}

.component-tab-input {
    font: inherit;
    font-size: 1rem;
    background: transparent;
}

.field .component-tab-input {
    width: auto;
    border: 0;
    padding: 14px 18px;
    background: transparent;
}

.component-tab-input:focus {
    outline: 0;
    color: #191919;
}

.component-tab-wrap[aria-current="true"] .component-tab,
.component-tab-wrap[aria-current="true"] .component-tab-input {
    color: #191919;
}

.component-delete {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: #4b4f58;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease;
}

.component-delete .material-symbols-outlined {
    font-size: 28px;
}

.component-tab-wrap:hover .component-delete,
.component-tab-wrap:focus-within .component-delete {
    opacity: 1;
    pointer-events: auto;
}

/*.ingredient-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 12px;
}*/

.ingredient-row.is-dragging {
    opacity: 0.45;
}

.ingredient-card {
    display: grid;
    align-items: center;
    border: 0;
    background: transparent;
    color: #2f3240;
    text-align: left;
}

.ingredient-delete {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: #5e6571;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease;
}

.ingredient-row:hover .ingredient-delete,
.ingredient-row:focus-within .ingredient-delete {
    opacity: 1;
    pointer-events: auto;
}

.add-item-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    border: none;
    background: #fff;
    /*color: #626b85;*/
}

.ingredient-dialog {
    width: min(960px, calc(100vw - 48px));
    max-height: calc(100dvh - 48px);
    border: var(--border-dark);
    border-radius: 12px;
    padding: 0;
}

.ingredient-dialog::backdrop {
    background: rgba(0, 0, 0, 0.28);
}

.ingredient-form {
    display: grid;
    gap: 34px;
    padding: 28px;
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.dialog-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: #5e6571;
}

.inline-add-button {
    width: 36px;
    height: 36px;
}

.inline-add-button .material-symbols-outlined {
    font-size: 32px;
}

.ingredient-form select {
    width: 100%;
    border: var(--border-dark);
    border-radius: 0;
    padding: 10px 12px;
    background: #fff;
    color: #191919;
    font: inherit;
}

@media only screen and (max-width: 720px) {
    :root {
        --font-size: 18px;
        --line-height: 30px;
        --letter-spacing: -2px;
        --padding: 20px;
        --icon-size: 36px;
        --list-indent: 56px;
    }

    #recipes {
        height: 100dvh;
        overflow-y: auto;
    }

    #recipe {
        width: 100%;
        right: 0;
        top: 100%;
        transition: top 0.25s;
    }

    #main.detailview #recipe {
        top: 0;
    }

    #recipe-title {
        font-size: 3.4em;
    }

    .recipe-link {
        padding: 14px 12px;
    }

    .admin-shell,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        border-right: 0;
    }

    .step-editor-row {
        grid-template-columns: 24px minmax(0, 1fr);
    }

    .step-actions {
        grid-column: 2;
    }

    .ingredient-row {
        grid-template-columns: 24px minmax(0, 1fr) 44px;
    }

    .component-tab,
    .component-tab-input {
        min-width: 0;
    }

    .component-tab-wrap {
        min-width: 150px;
    }
}
