/* COLORS */
:root {
    --bg: #FDFDFD;
    --surface: #FDFDFD;
    --text: #262626;
    --text-muted: #737373;
    --line: #E5E5E5;
    --hover: #F5F5F5;
    --scrim: rgba(38, 38, 38, 0.4);
    --danger: #C4271C;
    --column: 48rem;
    --speed: 200ms;
    --ease: cubic-bezier(.2, .8, .2, 1)
}

/* DARK MODE */
:root[data-theme="dark"] {
    --bg: #121212;
    --surface: #262626;
    --text: #FDFDFD;
    --text-muted: #A3A3A3;
    --line: #363636;
    --hover: #363636;
    --scrim: rgba(0, 0, 0, 0.6);
    --danger: #FF8A80;
    color-scheme: dark
}

* {
    margin: 0;
    padding: 0;
    list-style: none;
    text-decoration: none
}

/* ONE CENTERED COLUMN, WIDTH-LIMITED ON DESKTOP */
body {
    max-width: var(--column);
    margin: 0 auto;
    font-family: "Inter", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
    font-weight: 400;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale
}

/* HEADER */
header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.25rem 1rem
}

.brand {
    display: flex;
    align-items: center;
    gap: .625rem;
    font-size: 1.375rem;
    letter-spacing: -.01em;
    color: var(--text)
}

.logo {
    width: auto;
    height: 1.25rem
}

.theme-toggle {
    display: flex;
    margin-left: auto;
    padding: .75rem;
    color: var(--text)
}

.icon-sun,
[data-theme="dark"] .icon-moon {
    display: none
}

[data-theme="dark"] .icon-sun {
    display: block
}

.nav-toggle {
    display: flex;
    margin-right: -1rem;
    padding: .75rem;
    color: var(--text)
}

/* MENU */
nav {
    visibility: hidden;
    opacity: 0;
    transform: translateY(-.25rem);
    transition: opacity var(--speed) var(--ease), transform var(--speed) var(--ease), visibility var(--speed);
    position: absolute;
    z-index: 10;
    top: 4rem;
    right: 1.25rem;
    min-width: 12rem;
    padding: .5rem 0;
    border: 1px solid var(--line);
    border-radius: .75rem;
    background-color: var(--surface);
    box-shadow: 0 .5rem 1.5rem rgba(38, 38, 38, .12)
}

nav.open {
    visibility: visible;
    opacity: 1;
    transform: none
}

nav .danger {
    color: var(--danger)
}

nav a,
nav button {
    display: flex;
    box-sizing: border-box;
    width: 100%;
    align-items: center;
    gap: .375rem;
    padding: .625rem 1.25rem;
    font-size: .9375rem;
    color: var(--text)
}

nav hr {
    margin: .5rem 1.25rem;
    border: none;
    border-top: 1px solid var(--line)
}

/* LIST */
ul#list {
    margin: 0 1.25rem 10rem
}

#list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.125rem 0;
    font-size: 1rem;
    overflow-wrap: anywhere;
    cursor: pointer;
    color: var(--text);
    border-bottom: 1px solid var(--line)
}

#list li:after {
    content: "";
    flex: none;
    width: 1rem;
    height: 1rem;
    background-color: var(--text-muted);
    transition: background-color var(--speed);
    -webkit-mask: url("../../imgs/icons/check.svg") center / contain no-repeat;
    mask: url("../../imgs/icons/check.svg") center / contain no-repeat
}

#list li.is-new {
    animation: rise var(--speed) var(--ease)
}

.emptyState {
    margin: 5rem 1.25rem 0;
    font-size: 1rem;
    text-align: center;
    color: var(--text)
}

/* UNDO AND HOME SCREEN BANNER (SAME SPOT ABOVE ADD ITEM) */
.undo,
.banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: absolute;
    right: 1.25rem;
    bottom: 100%;
    left: 1.25rem;
    padding: .875rem 1.25rem;
    font-size: .9375rem;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: .5rem;
    background-color: var(--surface);
    box-shadow: 0 .5rem 1.5rem rgba(38, 38, 38, .12);
    animation: rise var(--speed) var(--ease)
}

.undo__text {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis
}

.banner {
    justify-content: flex-start;
    gap: .75rem;
    padding: .625rem .75rem .625rem 1rem
}

.banner__text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis
}

.banner__btn {
    padding: .375rem .875rem;
    font-size: .875rem;
    font-weight: 600;
    border-radius: 999px;
    background-color: var(--hover)
}

.banner__close {
    display: flex;
    padding: .25rem;
    color: var(--text-muted)
}

.undo__btn {
    text-decoration: underline;
    text-underline-offset: .25rem
}

/* ADD ITEM */
.toolbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    box-sizing: border-box;
    max-width: var(--column);
    margin: 0 auto;
    padding: 1rem 1.25rem 1.25rem;
    background-color: var(--bg)
}

.add-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    color: var(--bg);
    background-color: var(--text);
    border-radius: .5rem
}

.add-item {
    transition: opacity var(--speed), transform var(--speed)
}

.add-item:active {
    transform: scale(.98)
}

/* TABS */
.tabs {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: .75rem
}

.tabs__list {
    display: flex;
    flex: 1;
    gap: 2rem;
    overflow-x: auto;
    scrollbar-width: none
}

.tabs__list::-webkit-scrollbar {
    display: none
}

.tabs__list button {
    flex: none;
    max-width: 12rem;
    padding: .75rem 0 .5rem;
    overflow: hidden;
    font-size: .75rem;
    letter-spacing: .15em;
    text-transform: uppercase;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: color var(--speed), border-color var(--speed)
}

.tabs__list button.is-active {
    color: var(--text);
    border-bottom-color: var(--text)
}

.tabs__new {
    display: flex;
    margin-right: -.5rem;
    padding: .5rem;
    color: var(--text-muted);
    transition: color var(--speed)
}


/* DIALOG (SITS HIGH SO THE PHONE KEYBOARD NEVER COVERS THE BUTTONS) */
.modal {
    position: fixed;
    z-index: 20;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6rem 1.25rem 1.25rem;
    background-color: var(--scrim)
}

.modal__container {
    box-sizing: border-box;
    width: 100%;
    max-width: 24rem;
    padding: 1.5rem;
    border-radius: .75rem;
    background-color: var(--surface);
    animation: pop var(--speed) var(--ease)
}

.modal__title {
    margin-bottom: 1.25rem;
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    color: var(--text)
}

.modal__text {
    margin-top: -.5rem;
    text-align: center;
    color: var(--text-muted)
}

.modal__steps {
    margin-top: 1rem;
    line-height: 1.5;
    text-align: center
}

.modal__steps svg {
    vertical-align: -.2em
}

.modal__steps strong {
    font-weight: 600
}

.modal input {
    box-sizing: border-box;
    width: 100%;
    padding: .75rem 1rem;
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    border: 1px solid var(--text-muted);
    border-radius: .5rem;
    outline: none;
    background-color: var(--surface);
    -webkit-appearance: none
}

.modal input:focus {
    border-color: var(--text)
}

.modal input::placeholder {
    color: var(--text-muted)
}

.modal__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: 1.25rem
}

.btn-cancel,
.btn-add {
    padding: .625rem 1.25rem;
    font-size: .9375rem;
    border-radius: .5rem
}

.btn-add {
    color: var(--bg);
    background-color: var(--text)
}

.btn-never {
    margin-right: auto;
    padding-left: 0;
    color: var(--text-muted)
}

.btn-danger {
    background-color: var(--danger)
}

input:placeholder-shown ~ .modal__actions .btn-add {
    opacity: .4;
    pointer-events: none
}

/* BUTTONS */
button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    border: none;
    background: none
}

/* HELP & INFO */
.back {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: 1.5rem 1.25rem .5rem;
    font-size: .9375rem;
    color: var(--text)
}

.help {
    margin: 0 1.25rem 3rem
}

.help h1 {
    margin: 1.5rem 0 .5rem;
    font-size: 1.75rem;
    font-weight: 400;
    letter-spacing: -.02em
}

.help section {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--line)
}

.help section:last-child {
    border-bottom: none
}

.help h2 {
    margin-bottom: .5rem;
    font-size: 1.125rem;
    font-weight: 400
}

.help p {
    margin-bottom: 1rem;
    font-size: .9375rem;
    line-height: 1.5
}

.help section > a {
    text-decoration: underline;
    text-underline-offset: .25rem;
    color: var(--text)
}

.help details {
    border-bottom: 1px solid var(--line)
}

.help summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    font-size: 1rem;
    cursor: pointer;
    list-style: none
}

.help summary::-webkit-details-marker {
    display: none
}

.help details[open] summary svg {
    transform: rotate(180deg)
}

.help ol {
    padding: 0 0 1rem 1.25rem
}

.help ol li {
    list-style: decimal;
    line-height: 1.6
}

/* HOVER (DESKTOP ONLY, SO TAPS DON'T LEAVE STICKY STATES ON PHONES) */
@media (hover: hover) {
    nav a:hover,
    nav button:hover {
        background-color: var(--hover)
    }

    #list li:hover:after {
        background-color: var(--text)
    }

    .add-item:hover {
        opacity: .9
    }

    .tabs__list button:hover,
    .tabs__new:hover {
        color: var(--text)
    }
}

/* MOTION */
@keyframes rise {
    from { opacity: 0; transform: translateY(.5rem) }
}

@keyframes pop {
    from { opacity: 0; transform: scale(.96) }
}

/* NO MOTION IF THE DEVICE ASKS FOR REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
    *,
    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) {
        animation: none !important;
        transition: none !important
    }
}
