/* Cianjur Arabic landing page.
   The page is a sheet of kitab kuning (the yellow paper of pesantren books): green-black ink,
   red rubric ink for the one thing to act on, and meanings hung under Arabic words the way
   pesantren students write makna gandul. The app's own screens, set in cards, carry the features. */

/* Light: the paper itself. Dark: the same kitab read by an oil lamp: warm charcoal page and
   parchment ink kept around 9:1 (not glaring white-on-black). Theme follows the system unless the
   visitor picks one with the toggle (data-theme on <html>). */
:root {
    color-scheme: light;
    --paper: #F4E3A1;
    --paper-deep: #EAD27E;
    --paper-edge: #D9BE63;
    --card: #F9EDC0;
    --card-well: #EAD27E;
    --ink: #14281F;
    --ink-soft: #4C4A26;
    --rubric: #A8231B;          /* fills: buttons */
    --rubric-deep: #861A14;
    --rubric-hover: #B8291F;
    --rubric-ink: #A8231B;      /* text and lines in rubric: glosses, numbers, focus ring */
    --on-rubric: #FFF6DC;
    --device: #14281F;
    --shadow: 0 1px 0 rgba(20, 40, 31, 0.06), 0 18px 40px -18px rgba(76, 60, 10, 0.45);
    --bar-bg: rgba(244, 227, 161, 0.86);

    --ar: "Amiri", "Noto Naskh Arabic", serif;
    --sans: "Schibsted Grotesk", system-ui, sans-serif;

    --gutter: clamp(16px, 4vw, 56px);
    --max: 1200px;
    --measure: 34rem;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --paper: #24211C;
        --paper-deep: #2C2822;
        --paper-edge: #3A352D;
        --card: #2C2822;
        --card-well: #1D1B17;
        --ink: #CFC5AB;
        --ink-soft: #ABA28B;
        --rubric: #9E4436;
        --rubric-deep: #6A2C23;
        --rubric-hover: #AA4C3D;
        --rubric-ink: #DB8E7C;
        --on-rubric: #F3E6CF;
        --device: #0F0E0C;
        --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 18px 40px -18px rgba(0, 0, 0, 0.7);
        --bar-bg: rgba(36, 33, 28, 0.86);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #24211C;
    --paper-deep: #2C2822;
    --paper-edge: #3A352D;
    --card: #2C2822;
    --card-well: #1D1B17;
    --ink: #CFC5AB;
    --ink-soft: #ABA28B;
    --rubric: #9E4436;
    --rubric-deep: #6A2C23;
    --rubric-hover: #AA4C3D;
    --rubric-ink: #DB8E7C;
    --on-rubric: #F3E6CF;
    --device: #0F0E0C;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 18px 40px -18px rgba(0, 0, 0, 0.7);
    --bar-bg: rgba(36, 33, 28, 0.86);
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 84px; /* anchors land below the sticky header */
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.55;
    overflow-x: hidden;
}

a { color: inherit; }

img { display: block; max-width: 100%; height: auto; }

:focus-visible {
    outline: 3px solid var(--rubric-ink);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Each screenshot ships in both themes; only the current theme's is shown (and, lazily, fetched). */
.v-dark { display: none; }
:root[data-theme="dark"] .v-light { display: none; }
:root[data-theme="dark"] .v-dark { display: block; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .v-light { display: none; }
    :root:not([data-theme="light"]) .v-dark { display: block; }
}

/* Sticky header */

.bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bar-bg);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.bar.is-scrolled {
    border-bottom-color: var(--paper-edge);
    box-shadow: 0 10px 24px -20px rgba(0, 0, 0, 0.5);
}

.bar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: calc(var(--max) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 14px var(--gutter);
    transition: padding 160ms ease;
}

.bar.is-scrolled .bar-inner {
    padding-top: 10px;
    padding-bottom: 10px;
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: -0.01em;
    text-decoration: none;
    white-space: nowrap;
}

.wordmark-ar {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--ar);
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    padding-bottom: 4px;
}

.bar-nav {
    display: flex;
    gap: 4px;
    margin-left: 12px;
}

.bar-nav a {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--ink-soft);
    text-decoration: none;
}

.bar-nav a:hover {
    color: var(--ink);
    background: var(--paper-deep);
}

.bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.lang {
    display: inline-flex;
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    padding: 2px;
}

.lang button {
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 999px;
    padding: 4px 10px;
    cursor: pointer;
}

.lang button[aria-pressed="true"] {
    background: var(--ink);
    color: var(--paper);
}

.theme-toggle {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.theme-toggle svg { width: 18px; height: 18px; }

/* Shows what a click switches to: the moon in light mode, the sun in dark mode. */
.theme-toggle .sun { display: none; }

:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
    :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}

.signin {
    font-weight: 700;
    font-size: 0.9375rem;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 4px;
    white-space: nowrap;
}

/* Buttons */

.cta {
    display: inline-block;
    padding: 15px 28px;
    border-radius: 12px;
    background: var(--rubric);
    color: var(--on-rubric);
    font-weight: 700;
    font-size: 1.0625rem;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 4px 0 var(--rubric-deep);
    transition: transform 80ms ease, box-shadow 80ms ease, background-color 120ms ease;
}

.cta:hover { background: var(--rubric-hover); }

.cta:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--rubric-deep);
}

.cta-sm {
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 0.9375rem;
    box-shadow: 0 3px 0 var(--rubric-deep);
}

.cta-ghost {
    display: inline-block;
    padding: 13px 22px;
    border: 1.5px solid var(--ink);
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
}

.cta-ghost:hover { background: var(--paper-deep); }

/* Shared section rhythm */

.hero,
.part,
.steps,
.faq {
    max-width: calc(var(--max) + 2 * var(--gutter));
    margin: 0 auto;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
}

h1 {
    margin: 0;
    font-size: clamp(2.5rem, 5.6vw, 4.5rem);
    font-weight: 800;
    line-height: 0.98;
    letter-spacing: -0.035em;
    text-wrap: balance;
}

h2 {
    margin: 0;
    font-size: clamp(1.75rem, 3.2vw, 2.5rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.025em;
    text-wrap: balance;
}

h3 {
    margin: 0;
    font-size: 1.1875rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

/* Hero */

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(40px, 6vw, 64px);
    padding-top: clamp(28px, 5vw, 72px);
    padding-bottom: clamp(56px, 8vw, 112px);
}

.eyebrow {
    margin: 0 0 16px;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--rubric-ink);
}

.lede {
    max-width: var(--measure);
    margin: 22px 0 0;
    font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
    color: var(--ink-soft);
}

.cta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 30px;
}

.ticks {
    display: grid;
    gap: 6px;
    margin: 26px 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.9375rem;
    color: var(--ink-soft);
}

.ticks li {
    position: relative;
    padding-left: 26px;
}

.ticks li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 0.42em;
    width: 12px;
    height: 7px;
    border-left: 2px solid var(--rubric-ink);
    border-bottom: 2px solid var(--rubric-ink);
    transform: rotate(-45deg);
}

/* Hero screenshots: the typing lesson in a browser window, a phone with a dialogue in front of it. */

.hero-shots {
    position: relative;
    padding-bottom: 12%;
    padding-left: 14%;
}

.window {
    margin: 0;
    border-radius: 14px;
    overflow: hidden;
    background: var(--card-well);
    box-shadow: 0 0 0 1px var(--paper-edge), var(--shadow);
}

.window-bar {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    background: var(--card);
    border-bottom: 1px solid var(--paper-edge);
}

.window-bar i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--paper-edge);
}

.phone {
    margin: 0;
    padding: 7px;
    border-radius: 30px;
    background: var(--device);
    box-shadow: var(--shadow);
}

.phone img { border-radius: 23px; }

.phone-hero {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 32%;
    transform: rotate(-3deg);
}

/* Feature parts */

.part {
    padding-top: clamp(56px, 8vw, 104px);
    padding-bottom: clamp(24px, 4vw, 40px);
}

.part-head {
    display: grid;
    gap: 6px 32px;
    align-items: end;
    margin-bottom: clamp(28px, 4vw, 44px);
    padding-top: clamp(28px, 4vw, 40px);
    border-top: 2px solid var(--ink);
}

.part-head p:not(.part-ar) {
    max-width: var(--measure);
    margin: 12px 0 0;
    color: var(--ink-soft);
}

.part-ar,
.closing-ar {
    display: inline-grid;
    justify-items: start;
    margin: 0;
    font-family: var(--ar);
    font-weight: 700;
    line-height: 1.3;
}

.part-ar {
    justify-self: left;
    font-size: clamp(3rem, 5vw, 4.25rem);
}

/* Makna gandul: the meaning hangs slanted under the Arabic word, in rubric ink. */
.gandul {
    margin-top: -0.55em;
    font-family: var(--sans);
    font-size: 1.0625rem;
    font-weight: 500;
    font-style: italic;
    color: var(--rubric-ink);
    white-space: nowrap;
    transform: rotate(-9deg);
    transform-origin: left top;
    justify-self: start;
}

/* Cards */

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(16px, 2vw, 24px);
}

.card {
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    background: var(--card);
    box-shadow: 0 0 0 1px var(--paper-edge), var(--shadow);
}

.card-shot {
    position: relative;
    display: flex;
    justify-content: center;
    height: clamp(260px, 26vw, 330px);
    padding-top: 28px;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 120%, var(--paper-edge), transparent 70%),
        var(--card-well);
}

/* A phone rising out of the card: only its top shows. */
.card-shot picture {
    width: min(64%, 236px);
    flex: none;
}

.card-shot img {
    width: 100%;
    padding: 6px 6px 0;
    border-radius: 26px 26px 0 0;
    background: var(--device);
    box-shadow: var(--shadow);
}

/* Desktop screenshots sit in from the top-left and run off the card's edges. */
.card-shot-wide {
    justify-content: flex-start;
    padding: 28px 0 0 28px;
}

.card-shot-wide picture {
    width: 140%;
}

.card-shot-wide img {
    padding: 0;
    border-radius: 12px 0 0 0;
    box-shadow: 0 0 0 1px var(--paper-edge), var(--shadow);
}

.card-text {
    padding: 22px 24px 26px;
}

.card-num {
    margin: 0 0 6px;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--rubric-ink);
}

.card-text p:not(.card-num) {
    margin: 8px 0 0;
    font-size: 0.9875rem;
    color: var(--ink-soft);
}

.card-text .note {
    margin-top: 16px;
    padding-left: 12px;
    border-left: 2px solid var(--rubric-ink);
    font-size: 0.9375rem;
}

/* Typing: one wide card with the lesson, then two cards side by side. */

.bento {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(16px, 2vw, 24px);
}

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

.card-wide .card-shot { order: -1; }

/* Steps */

.steps {
    padding-top: clamp(64px, 8vw, 104px);
}

.steps ol {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(20px, 3vw, 40px);
    margin: clamp(24px, 3vw, 36px) 0 0;
    padding: 0;
    list-style: none;
}

.steps li {
    padding-top: 18px;
    border-top: 1px solid var(--paper-edge);
}

.step-num {
    display: block;
    font-family: var(--ar);
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--rubric-ink);
}

.steps h3 { margin-top: 8px; }

.steps p {
    margin: 6px 0 0;
    color: var(--ink-soft);
}

/* FAQ */

.faq {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding-top: clamp(64px, 8vw, 104px);
}

.faq h2 { margin-bottom: 18px; }

.faq details {
    border-bottom: 1px solid var(--paper-edge);
}

.faq details:first-of-type { border-top: 1px solid var(--paper-edge); }

.faq summary {
    position: relative;
    padding: 18px 40px 18px 0;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
    content: "";
    position: absolute;
    right: 8px;
    top: 50%;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--rubric-ink);
    border-bottom: 2px solid var(--rubric-ink);
    transform: translateY(-70%) rotate(45deg);
    transition: transform 160ms ease;
}

.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }

.faq details p {
    max-width: 44rem;
    margin: 0 0 20px;
    color: var(--ink-soft);
}

/* Closing call to action */

.closing {
    display: grid;
    justify-items: center;
    padding: clamp(72px, 10vw, 128px) var(--gutter);
    text-align: center;
}

.closing-ar {
    justify-items: center;
    font-size: clamp(4.5rem, 11vw, 8rem);
}

.closing-ar .gandul {
    justify-self: center;
    transform-origin: center top;
    font-size: 1.25rem;
}

.closing h2 { margin-top: 18px; }

.closing > p:not(.closing-ar) {
    max-width: var(--measure);
    margin: 12px 0 0;
    color: var(--ink-soft);
}

.closing .cta { margin-top: 30px; }

.closing .stores { justify-content: center; }

/* Store buttons: black like the stores' own badges, in both themes. */

.stores {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.store {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 150px;
    padding: 7px 16px 7px 12px;
    border-radius: 10px;
    background: #0B0B0A;
    color: #FFFFFF;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
    text-decoration: none;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.01em;
    transition: transform 80ms ease, background-color 120ms ease;
}

.store:hover { background: #262624; }

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

.store svg {
    flex: none;
    width: 26px;
    height: 26px;
}

.store span {
    display: grid;
    text-align: left;
}

.store small {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 24px;
    padding: 22px var(--gutter) 28px;
    border-top: 1px solid var(--paper-edge);
    font-size: 0.875rem;
    color: var(--ink-soft);
}

.foot nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.foot a { text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* Scroll-in */

.rise {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 420ms ease, transform 420ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.rise.is-in {
    opacity: 1;
    transform: none;
}

.cards .card:nth-child(3n + 2).rise { transition-delay: 70ms; }
.cards .card:nth-child(3n + 3).rise { transition-delay: 140ms; }

/* Wide screens */

@media (min-width: 1000px) {
    .hero {
        grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
        align-items: center;
    }

    .part-head { grid-template-columns: auto minmax(0, 1fr); }

    .card-wide {
        flex-direction: row;
        align-items: stretch;
    }

    .card-wide .card-text {
        flex: 0 0 38%;
        align-self: center;
        padding: 40px;
    }

    .card-wide .card-shot {
        order: 0;
        flex: 1;
        height: auto;
        min-height: 380px;
        padding: 40px 0 0 40px;
    }

    .card-wide .card-shot picture { width: 108%; }

    .faq {
        grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
        gap: 40px;
        align-items: start;
    }
}

@media (max-width: 999px) {
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .bar-nav { display: none; }
}

/* Phones: cards become a swipeable row, the bento stacks. */

@media (max-width: 640px) {
    .cards {
        display: flex;
        gap: 14px;
        margin: 0 calc(-1 * var(--gutter));
        padding: 4px var(--gutter) 20px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding: 0 var(--gutter);
        scrollbar-width: none;
    }

    .cards::-webkit-scrollbar { display: none; }

    .cards .card {
        flex: 0 0 80%;
        scroll-snap-align: start;
    }

    .bento { grid-template-columns: minmax(0, 1fr); }

    .card-shot { height: 280px; }

    .steps ol { grid-template-columns: minmax(0, 1fr); }

    .hero-shots { padding-left: 18%; }

    .phone-hero {
        width: 36%;
        padding: 4px;
        border-radius: 18px;
    }

    .phone-hero img { border-radius: 14px; }
}

@media (max-width: 560px) {
    .signin,
    .wordmark-name { display: none; }

    .bar-actions { gap: 8px; }

    .lang button { padding: 4px 8px; }
}

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

    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
