/*
 * Rivo website. Plain CSS, no remote assets: the fonts are the same files the
 * extension ships. Logical properties only, so the Persian page mirrors itself.
 */

@font-face {
    font-family: "Noto Sans";
    src: url("../fonts/noto-sans/NotoSans-wght-latin.woff2") format("woff2");
    font-weight: 300 700;
    font-display: swap;
}

@font-face {
    font-family: "Estedad";
    src: url("../fonts/estedad/Estedad-wght.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

/* ---- Tokens
 *
 * Neutral greys. Body text sits at about 13:1, not 16:1 or more. The page is a
 * soft grey, not pure white, and dark mode uses a deep grey, not black. This gives less glare and less eye strain, and
 * all text stays above WCAG AA.
 */

:root {
    --paper: #f5f5f5;
    --surface: #fbfbfb;
    --ink: #2a2a2a;
    --muted: #5e5e5e;
    --rule: #e4e4e4;
    --wash: #efefef;
    --check-border: #b0b0b0;
    --primary: #00a693;
    --primary-light: #66c9be;
    --primary-dark: #006358;
    --link: var(--primary-dark);
    --button-bg: var(--primary-dark);
    --button-ink: #ffffff;
    --strike: var(--primary);
    --shadow-card:
        0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px -10px rgb(0 0 0 / 0.1),
        0 36px 72px -36px rgb(0 0 0 / 0.14);
    --highlight: inset 0 1px 0 rgb(255 255 255 / 0.14);
    --button-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 6px 16px -8px rgb(0 99 88 / 0.5);

    /* G2 corners: with corner-shape support, every rounded box is a squircle.
     * A squircle reads smaller than a circular arc of the same radius, so the
     * radius scale goes up with it. */
    --r-scale: 1;
    --r-sm: calc(6px * var(--r-scale));
    --r-md: calc(10px * var(--r-scale));
    --r-lg: calc(16px * var(--r-scale));

    --display: "Estedad", "Noto Sans", system-ui, sans-serif;
    --body: "Noto Sans", "Estedad", system-ui, sans-serif;
    --measure: 34rem;
    --page: 70rem;
    --gutter: clamp(1.25rem, 5vw, 3rem);
    color-scheme: light;
}

:root:lang(fa) {
    --body: "Estedad", "Noto Sans", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #161616;
        --surface: #1d1d1d;
        --ink: #dcdcdc;
        --muted: #9b9b9b;
        --rule: #2c2c2c;
        --wash: #212121;
        --check-border: #575757;
        --link: var(--primary-light);
        --button-bg: var(--primary-light);
        --button-ink: #0d2a25;
        --strike: var(--primary-light);
        --shadow-card:
            0 1px 2px rgb(0 0 0 / 0.2), 0 24px 48px -24px rgb(0 0 0 / 0.45),
            inset 0 1px 0 rgb(255 255 255 / 0.04);
        --highlight: inset 0 1px 0 rgb(255 255 255 / 0.25);
        --button-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
        color-scheme: dark;
    }
}

@supports (corner-shape: squircle) {
    :root {
        --r-scale: 1.6;
    }

    .demo,
    .demo-tab,
    .demo-input,
    .demo-list input,
    .button,
    .skip-link,
    :focus-visible {
        corner-shape: squircle;
    }
}

/* ---- Base */

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

html {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--body);
    font-size: 100%;
    line-height: 1.6;
    font-kerning: normal;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
}

a {
    color: var(--link);
    text-underline-offset: 0.22em;
    text-decoration-thickness: 1px;
    text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
    transition: text-decoration-color 160ms ease;
}

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

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: var(--r-sm);
}

::selection {
    background: var(--primary-light);
    color: #062b26;
}

.skip-link {
    position: absolute;
    inset-inline-start: 1rem;
    inset-block-start: -3rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--r-sm);
    background: var(--surface);
}

.skip-link:focus {
    inset-block-start: 1rem;
}

.wrap {
    inline-size: min(100% - 2 * var(--gutter), var(--page));
    margin-inline: auto;
}

/* ---- Header */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 1.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--ink);
    font-family: var(--display);
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
}

.brand img {
    inline-size: 1.75rem;
    block-size: 1.75rem;
}

.site-nav {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9375rem;
}

.site-nav a {
    color: var(--muted);
    text-decoration: none;
}

.site-nav a:hover {
    color: var(--ink);
}

/* ---- Hero */

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(2.5rem, 6vw, 5rem);
    padding-block: clamp(3rem, 10vw, 7rem) clamp(4rem, 10vw, 8rem);
}

.hero h1 {
    margin: 0;
    font-family: var(--display);
    font-size: clamp(2.5rem, 6vw, 4.25rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.025em;
    text-wrap: balance;
}

:lang(fa) .hero h1 {
    letter-spacing: 0;
    line-height: 1.3;
}

.lede {
    max-inline-size: var(--measure);
    margin: 1.5rem 0 2.25rem;
    color: var(--muted);
    font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
}

.button {
    display: inline-block;
    padding: 0.85rem 1.5rem;
    border-radius: var(--r-md);
    background: var(--button-bg);
    box-shadow: var(--highlight), var(--button-shadow);
    color: var(--button-ink);
    font-weight: 600;
    letter-spacing: 0.005em;
    text-decoration: none;
    transition:
        background-color 160ms ease,
        transform 120ms ease;
}

.button:hover {
    background: color-mix(in srgb, var(--button-bg) 88%, var(--ink));
}

.button:active {
    transform: translateY(1px);
}

/* ---- Demo: a working miniature of the New Tab page */

.demo {
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.demo-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    border-block-end: 1px solid var(--rule);
    background: var(--wash);
}

.demo-dots {
    display: flex;
    gap: 0.375rem;
}

.demo-dots span {
    inline-size: 0.625rem;
    block-size: 0.625rem;
    border-radius: 50%;
    background: var(--check-border);
    opacity: 0.45;
}

.demo-tab {
    margin-inline-start: 0.5rem;
    padding: 0.2rem 0.75rem;
    border-radius: var(--r-sm);
    background: var(--surface);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.06);
    color: var(--muted);
    font-size: 0.8125rem;
}

.demo-body {
    padding: clamp(1.25rem, 3vw, 2rem);
}

.demo-mark {
    margin: 0 0 1rem;
    color: var(--muted);
    font-family: var(--display);
    font-weight: 700;
}

.demo-input {
    inline-size: 100%;
    margin-block-end: 0.75rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--rule);
    border-radius: var(--r-md);
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    unicode-bidi: plaintext;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease;
}

.demo-input:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

.demo-input::placeholder {
    color: var(--muted);
}

.demo-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.demo-list li + li {
    border-block-start: 1px solid var(--rule);
}

.demo-list label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding-block: 0.6rem;
    cursor: pointer;
}

/* A drawn checkbox: a soft squircle that fills with the primary color. */
.demo-list input {
    appearance: none;
    flex: none;
    display: grid;
    place-content: center;
    inline-size: 1.125rem;
    block-size: 1.125rem;
    margin: 0.2rem 0 0;
    border: 1.5px solid var(--check-border);
    border-radius: calc(5px * var(--r-scale));
    background: var(--surface);
    cursor: pointer;
    transition:
        background-color 160ms ease,
        border-color 160ms ease;
}

.demo-list input::before {
    content: "";
    inline-size: 0.7rem;
    block-size: 0.7rem;
    background: var(--surface);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6 9.6 3.6' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
        center / contain no-repeat;
    transform: scale(0);
    transition: transform 180ms cubic-bezier(0.2, 0.7, 0.2, 1.3);
}

.demo-list input:hover {
    border-color: var(--primary);
}

.demo-list input:checked {
    border-color: var(--primary);
    background: var(--primary);
}

.demo-list input:checked::before {
    transform: scale(1);
}

.demo-list .text {
    position: relative;
    unicode-bidi: plaintext;
    transition: color 200ms ease;
}

/* The strike is a drawn line, so crossing off feels like a pen stroke. */
.demo-list .text::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    inset-block-start: 52%;
    block-size: 2px;
    border-radius: 2px;
    background: var(--strike);
    transform: scaleX(0);
    transform-origin: var(--strike-origin, left);
    transition: transform 320ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

[dir="rtl"] .demo-list .text::after {
    --strike-origin: right;
}

/* Persian letters sit lower on the line, so the strike sits lower too. */
:lang(fa) .demo-list .text::after {
    inset-block-start: 55%;
}

.demo-list input:checked + .text {
    color: var(--muted);
}

.demo-list input:checked + .text::after {
    transform: scaleX(1);
}

.demo-count {
    margin: 1rem 0 0;
    color: var(--muted);
    font-size: 0.875rem;
}

/* ---- Left out: the crossed-off list */

.left-out {
    padding-block: clamp(4rem, 10vw, 8rem);
    border-block-start: 1px solid var(--rule);
}

.left-out h2,
.facts h2,
.faq h2,
.get h2 {
    margin: 0 0 0.75rem;
    font-family: var(--display);
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

:lang(fa) :is(.left-out, .facts, .faq, .get) h2 {
    letter-spacing: 0;
}

.section-lede {
    max-inline-size: var(--measure);
    margin: 0 0 2.5rem;
    color: var(--muted);
}

.crossed {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 2.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.crossed li {
    position: relative;
    color: var(--muted);
    font-family: var(--display);
    font-size: clamp(2.25rem, 7vw, 5rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.04em;
    opacity: 0.5;
}

:lang(fa) .crossed li {
    letter-spacing: 0;
    line-height: 1.5;
}

:lang(fa) .crossed li::after {
    inset-block-start: 58%;
}

.crossed li::after {
    content: "";
    position: absolute;
    inset-inline: -0.08em;
    inset-block-start: 55%;
    block-size: max(3px, 0.07em);
    border-radius: 99px;
    background: var(--strike);
}

.left-out .after {
    max-inline-size: var(--measure);
    margin: 2.5rem 0 0;
    font-size: clamp(1.125rem, 1.8vw, 1.375rem);
}

/* ---- Facts */

.facts {
    padding-block: clamp(4rem, 10vw, 7rem);
    border-block-start: 1px solid var(--rule);
}

.facts dl {
    display: grid;
    grid-template-columns: minmax(10rem, 16rem) minmax(0, var(--measure));
    gap: 1.75rem 3rem;
    margin: 2.5rem 0 0;
}

.facts dt {
    font-weight: 600;
}

.facts dd {
    margin: 0;
    color: var(--muted);
}

/* ---- Questions */

.faq {
    padding-block: clamp(4rem, 10vw, 7rem);
    border-block-start: 1px solid var(--rule);
}

.faq h3 {
    max-inline-size: var(--measure);
    margin: 2rem 0 0.375rem;
    font-size: 1.0625rem;
    font-weight: 600;
}

.faq h2 + h3 {
    margin-block-start: 2.5rem;
}

.faq p {
    max-inline-size: var(--measure);
    margin: 0;
    color: var(--muted);
}

/* ---- Get */

.get {
    padding-block: clamp(4rem, 10vw, 7rem);
    border-block-start: 1px solid var(--rule);
}

.stores {
    display: grid;
    gap: 0;
    max-inline-size: 40rem;
    margin: 2.5rem 0 0;
    padding: 0;
    list-style: none;
}

.stores li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    padding-block: 1rem;
    border-block-end: 1px solid var(--rule);
}

.stores li:first-child {
    border-block-start: 1px solid var(--rule);
}

.store-name {
    font-family: var(--display);
    font-size: 1.125rem;
    font-weight: 700;
}

.store-state {
    color: var(--muted);
    font-size: 0.9375rem;
}

.get .note {
    max-inline-size: var(--measure);
    margin: 1.5rem 0 0;
    color: var(--muted);
    font-size: 0.9375rem;
}

/* ---- Footer */

.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem 2rem;
    padding-block: 2rem 3rem;
    border-block-start: 1px solid var(--rule);
    color: var(--muted);
    font-size: 0.875rem;
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.site-footer a {
    color: var(--muted);
}

/* ---- Small screens */

@media (max-width: 52rem) {
    .hero {
        grid-template-columns: minmax(0, 1fr);
    }

    .facts dl {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.25rem;
    }

    .facts dd + dt {
        margin-block-start: 1.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
    }
}
