/* ==========================================================================
   TasteLog website - layout and components

   Every value here comes from tokens.css. Adding a page should mean writing
   markup, not writing CSS.
   ========================================================================== */

/* ----- Base ----- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background-color: var(--tl-black);
    background-image: var(--tl-glow);
    background-repeat: no-repeat;
    color: var(--tl-text);
    font-family: var(--tl-font-body);
    font-size: var(--tl-text-base);
    line-height: var(--tl-leading-normal);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
    margin: 0;
    color: var(--tl-heading);
    font-family: var(--tl-font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: var(--tl-leading-tight);
    text-wrap: balance;
}

p {
    margin: 0;
    text-wrap: pretty;
}

a {
    color: var(--tl-accent-text);
    text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
    text-underline-offset: 0.2em;
}

a:hover {
    text-decoration-color: currentColor;
}

img,
svg {
    display: block;
    max-width: 100%;
}

/* One visible focus style for everything, so a keyboard is never lost on the
   page. Ringed in the page background first so it reads on any surface. */
:focus-visible {
    outline: 2px solid var(--tl-accent-text);
    outline-offset: 2px;
    border-radius: var(--tl-radius-sm);
}

/* ----- Layout ----- */

.page {
    width: 100%;
    max-width: var(--tl-page-max);
    margin-inline: auto;
    padding-inline: var(--tl-page-gutter);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Lands a keyboard visitor on the form without tabbing through the header. */
.skip-link {
    position: absolute;
    left: var(--tl-space-md);
    top: var(--tl-space-md);
    z-index: 10;
    padding: var(--tl-space-xs) var(--tl-space-md);
    border-radius: var(--tl-radius-sm);
    background-color: var(--tl-surface);
    color: var(--tl-text);
    font-weight: 600;
    text-decoration: none;
    transform: translateY(-200%);
}

.skip-link:focus-visible {
    transform: translateY(0);
}

/* ----- Header ----- */

.site-header {
    padding-block: var(--tl-space-lg);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--tl-space-md);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--tl-space-sm);
    color: var(--tl-heading);
    font-family: var(--tl-font-display);
    font-size: var(--tl-text-xl);
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
}

.brand__mark {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--tl-radius-sm);
}

.site-header__note {
    color: var(--tl-text-muted);
    font-size: var(--tl-text-base);
}

/* Quiet by default: it credits the maker, it is not a call to action. */
.site-header__note a {
    color: inherit;
    text-decoration: none;
}

.site-header__note a:hover {
    color: var(--tl-text);
}

/* ----- Hero ----- */

.hero {
    padding-block: clamp(var(--tl-space-xl), 8vw, var(--tl-space-3xl));
}

.hero__inner {
    display: grid;
    gap: var(--tl-space-2xl);
    align-items: center;
}

@media (min-width: 60rem) {
    .hero__inner {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
        gap: var(--tl-space-3xl);
    }
}

.hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--tl-space-xs);
    margin-bottom: var(--tl-space-lg);
    padding: var(--tl-space-2xs) var(--tl-space-sm);
    border: 1px solid var(--tl-border);
    border-radius: var(--tl-radius-pill);
    background-color: var(--tl-surface);
    color: var(--tl-text-muted);
    font-size: var(--tl-text-sm);
    font-weight: 500;
}

.hero__eyebrow::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background-color: var(--tl-accent);
}

.hero h1 {
    font-size: var(--tl-text-3xl);
    /* Greedy wrapping rather than the balanced default: it fills the first line
       and lands "you liked." on its own, which is the half worth emphasising. */
    text-wrap: pretty;
}

.hero__lede {
    max-width: var(--tl-measure);
    margin-top: var(--tl-space-lg);
    color: var(--tl-text-muted);
    font-size: var(--tl-text-lg);
}

/* ----- Waitlist form ----- */

.signup {
    max-width: 30rem;
    margin-top: var(--tl-space-xl);
}

.signup__fields {
    display: flex;
    flex-wrap: wrap;
    gap: var(--tl-space-sm);
}

.signup__input {
    flex: 1 1 14rem;
    min-width: 0;
    padding: 0.9rem var(--tl-space-md);
    border: 1px solid var(--tl-border);
    border-radius: var(--tl-radius-md);
    background-color: var(--tl-surface);
    color: var(--tl-text);
    font-family: inherit;
    font-size: var(--tl-text-base);
    transition: border-color var(--tl-transition), background-color var(--tl-transition);
}

.signup__input::placeholder {
    color: var(--tl-text-muted);
}

.signup__input:hover {
    border-color: color-mix(in srgb, var(--tl-border) 60%, var(--tl-accent));
}

.signup__input[aria-invalid="true"] {
    border-color: var(--tl-danger);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--tl-space-xs);
    padding: 0.9rem var(--tl-space-lg);
    border: 1px solid transparent;
    border-radius: var(--tl-radius-md);
    background-color: var(--tl-accent);
    color: var(--tl-on-accent);
    font-family: inherit;
    /* White on the brand orange is 3.6:1, which only clears the bar as large
       text: 18.66px and bold. Do not shrink this without darkening the fill. */
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--tl-transition), transform var(--tl-transition);
}

.button:hover {
    background-color: var(--tl-accent-hover);
}

.button:active {
    background-color: var(--tl-accent-active);
    transform: translateY(1px);
}

.button[aria-disabled="true"] {
    cursor: progress;
    opacity: 0.7;
}

/* Below this width the field and the button cannot sit side by side, so they
   stack properly rather than leaving a half-width button stranded. */
@media (max-width: 30rem) {
    .signup__fields {
        flex-direction: column;
    }

    /* The field's flex-basis is a width when these sit side by side, but the main
       axis is now vertical, so it would become a 14rem tall input if left alone. */
    .signup__fields .signup__input {
        flex: 0 0 auto;
    }

    .signup__fields .button {
        width: 100%;
    }
}

.signup__note {
    margin-top: var(--tl-space-sm);
    color: var(--tl-text-muted);
    font-size: var(--tl-text-sm);
}

.signup__privacy {
    margin-top: var(--tl-space-xs);
    color: var(--tl-text-muted);
    font-size: var(--tl-text-sm);
}

.signup__error {
    display: none;
    margin-top: var(--tl-space-sm);
    color: var(--tl-danger);
    font-size: var(--tl-text-sm);
    font-weight: 500;
}

.signup__error:not(:empty) {
    display: block;
}

/* ----- Success state (replaces the form in place, no page reload) ----- */

.signup-done {
    max-width: 30rem;
    margin-top: var(--tl-space-xl);
    padding: var(--tl-space-lg);
    border: 1px solid color-mix(in srgb, var(--tl-success) 45%, var(--tl-border));
    border-radius: var(--tl-radius-lg);
    background-color: var(--tl-surface);
}

/* Focus lands here so the outcome is announced, not because the visitor
   navigated to it. The box is not reachable by tab, so it needs no ring. */
.signup-done:focus {
    outline: none;
}

.signup-done__title {
    display: flex;
    align-items: center;
    gap: var(--tl-space-xs);
    color: var(--tl-heading);
    font-family: var(--tl-font-display);
    font-size: var(--tl-text-xl);
    font-weight: 700;
}

.signup-done__check {
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    color: var(--tl-success);
}

.signup-done p {
    margin-top: var(--tl-space-xs);
    color: var(--tl-text-muted);
    font-size: var(--tl-text-sm);
}

.signup-done strong {
    color: var(--tl-text);
    font-weight: 600;
    overflow-wrap: anywhere;
}

[hidden] {
    display: none !important;
}

/* ----- The entry card: what the product is, without a feature list ----- */

/* A second card peeking out behind the first, so the hero reads as a log with
   things already in it rather than as a single lonely product. */
.entry-stack {
    position: relative;
    isolation: isolate;
}

.entry-card--behind {
    position: absolute;
    inset: auto 0 100% 0;
    z-index: -1;
    margin-bottom: -3.5rem;
    rotate: 2deg;
    opacity: 0.55;
}

/* One card is decoration; two overlapping ones on a narrow screen are clutter. */
@media (max-width: 59.999rem) {
    .entry-card--behind {
        display: none;
    }
}

.entry-card {
    position: relative;
    padding: var(--tl-space-lg);
    border: 1px solid var(--tl-border);
    border-radius: var(--tl-radius-lg);
    background-color: var(--tl-surface);
    box-shadow: var(--tl-shadow);
    rotate: -1.25deg;
}

.entry-card__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--tl-space-md);
}

.entry-card__name {
    color: var(--tl-heading);
    font-family: var(--tl-font-display);
    font-size: var(--tl-text-xl);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: var(--tl-leading-snug);
}

.entry-card__date {
    flex: none;
    color: var(--tl-text-muted);
    font-size: var(--tl-text-sm);
}

.entry-card__brand {
    margin-top: var(--tl-space-2xs);
    color: var(--tl-text-muted);
    font-size: var(--tl-text-sm);
}

.entry-card__rating {
    display: flex;
    align-items: center;
    gap: var(--tl-space-xs);
    margin-top: var(--tl-space-md);
}

.entry-card__stars {
    display: flex;
    gap: 0.15rem;
    color: var(--tl-accent);
}

.entry-card__star {
    width: 1.15rem;
    height: 1.15rem;
    fill: currentColor;
}

.entry-card__star--empty {
    color: var(--tl-border);
}

.entry-card__score {
    color: var(--tl-text-muted);
    font-size: var(--tl-text-sm);
    font-weight: 500;
}

.entry-card__note {
    margin-top: var(--tl-space-md);
    padding-top: var(--tl-space-md);
    border-top: 1px solid var(--tl-border);
    color: var(--tl-text);
    line-height: var(--tl-leading-snug);
}

.entry-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--tl-space-xs);
    margin-top: var(--tl-space-md);
    padding: 0;
    list-style: none;
}

.entry-card__tag {
    padding: 0.1rem var(--tl-space-sm);
    border: 1px solid var(--tl-border);
    border-radius: var(--tl-radius-pill);
    background-color: var(--tl-surface-light);
    color: var(--tl-text-muted);
    font-size: var(--tl-text-sm);
}

/* ----- Features ----- */

.features {
    padding-block: clamp(var(--tl-space-xl), 6vw, var(--tl-space-2xl));
}

.features h2 {
    max-width: 24ch;
    font-size: var(--tl-text-2xl);
}

.features__grid {
    display: grid;
    gap: var(--tl-space-xl) var(--tl-space-lg);
    margin: var(--tl-space-xl) 0 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 40rem) {
    .features__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 64rem) {
    .features__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--tl-space-2xl) var(--tl-space-xl);
    }
}

.feature h3 {
    margin-top: var(--tl-space-md);
    font-size: var(--tl-text-lg);
    letter-spacing: -0.01em;
    line-height: var(--tl-leading-snug);
}

.feature p {
    margin-top: var(--tl-space-xs);
    color: var(--tl-text-muted);
}

.feature__icon {
    width: 2rem;
    height: 2rem;
    color: var(--tl-accent-text);
}

/* The brand star reads as a rating mark, so it stays filled while the rest of the
   set is drawn in line. */
.feature__icon--filled {
    fill: currentColor;
    color: var(--tl-accent);
}

/* ----- Closing ----- */

.closing {
    padding-block: clamp(var(--tl-space-xl), 6vw, var(--tl-space-2xl));
}

.closing__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--tl-space-lg);
    padding: var(--tl-space-xl);
    border: 1px solid var(--tl-border);
    border-radius: var(--tl-radius-lg);
    background-color: var(--tl-surface);
}

.closing h2 {
    font-size: var(--tl-text-2xl);
}

.closing p {
    max-width: var(--tl-measure);
    margin-top: var(--tl-space-xs);
    color: var(--tl-text-muted);
}

.button--ghost {
    background-color: transparent;
    border-color: var(--tl-border);
    color: var(--tl-heading);
}

.button--ghost:hover {
    background-color: var(--tl-surface-light);
    border-color: var(--tl-accent);
}

.button--ghost:active {
    background-color: var(--tl-surface-light);
}

/* ----- Footer ----- */

.site-footer {
    margin-top: var(--tl-space-xl);
    padding-block: var(--tl-space-lg) var(--tl-space-xl);
    border-top: 1px solid var(--tl-border);
    color: var(--tl-text-muted);
    font-size: var(--tl-text-sm);
}

.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--tl-space-sm) var(--tl-space-lg);
}

.site-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--tl-space-lg);
    margin: 0;
    padding: 0;
    list-style: none;
}

/* ----- Not found ----- */

.notfound {
    padding-block: var(--tl-space-3xl);
}

.notfound h1 {
    font-size: var(--tl-text-2xl);
}

.notfound p {
    max-width: var(--tl-measure);
    margin-top: var(--tl-space-md);
    color: var(--tl-text-muted);
    font-size: var(--tl-text-lg);
}

.notfound .button {
    margin-top: var(--tl-space-xl);
}

/* ----- Legal pages ----- */

/* Long-form prose, which the rest of the site has none of: the base rules zero
   every margin, so spacing has to be declared here rather than inherited. */
.legal {
    padding-block: var(--tl-space-3xl);
}

.legal__inner {
    max-width: var(--tl-measure);
}

.legal h1 {
    font-size: var(--tl-text-2xl);
}

.legal h2 {
    margin-top: var(--tl-space-2xl);
    font-size: var(--tl-text-lg);
}

.legal p,
.legal ul,
.legal dl {
    margin-top: var(--tl-space-md);
    color: var(--tl-text-muted);
}

.legal__lede {
    font-size: var(--tl-text-lg);
}

.legal ul,
.legal dl {
    padding-left: 0;
}

.legal__list {
    list-style-position: outside;
    padding-left: var(--tl-space-lg);
}

.legal dl.legal__list {
    padding-left: 0;
}

.legal dt {
    margin-top: var(--tl-space-md);
    color: var(--tl-heading);
    font-weight: 600;
}

.legal dd {
    margin-left: 0;
    margin-top: var(--tl-space-2xs);
}

/* Identity block: one fact per line, no bullets - it reads as a letterhead
   rather than a list of claims. */
.legal__facts {
    list-style: none;
    padding-left: 0;
}

.legal__facts li + li {
    margin-top: var(--tl-space-2xs);
}

.legal__updated {
    color: var(--tl-text-muted);
    font-size: var(--tl-text-sm);
}

.legal .button {
    margin-top: var(--tl-space-2xl);
}

/* ----- Motion ----- */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
