/* Yomu Originals: the store page (/yomu-originals/) and the shelf on the home page. Linked from those two
   pages only (partials/head.php); the site's tokens (styles.css) are reused and everything here is scoped by
   the os- prefix. Logical properties throughout, so right-to-left needs only the few mirrored glyphs. */

.os, .os-home { --os-gutter: 24px; --os-w: clamp(116px, 31vw, 164px); }
@media (min-width: 768px) { .os, .os-home { --os-gutter: 40px; } }
@media (min-width: 1024px) { .os, .os-home { --os-w: 164px; } }

.os-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The nav link of the page you are on, and the ghost button the home shelf ends with */
.nav__links > a[aria-current="page"] { color: var(--text); }
.btn--ghost { padding: 12px 24px; border-color: var(--border-strong); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--text); }
.btn--ghost::after { content: "→"; color: var(--accent); }
[dir="rtl"] .btn--ghost::after { content: "←"; }

/* ─── Store header ───────────────────────────────────────────────── */
.os-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; padding-block: 28px 20px; }
.os-head__title { font-size: clamp(26px, 3.4vw, 36px); font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }
.os-head__tag { color: var(--text-muted); font-size: 16px; }

/* ─── Hero: the first series of the hero shelf, on a blurred copy of its own cover ─── */
.os-hero { position: relative; isolation: isolate; overflow: hidden; border-block: 1px solid var(--border); background: var(--bg-elev); }
.os-hero__bg { position: absolute; z-index: -2; top: -48px; inset-inline-start: -48px; width: calc(100% + 96px); height: calc(100% + 96px); max-width: none; object-fit: cover; filter: blur(44px) saturate(1.4) brightness(.5); }
.os-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10, 10, 15, .15), rgba(10, 10, 15, .72) 78%, var(--bg)); }
.os-hero__inner { display: grid; justify-items: center; gap: 22px; padding-block: 26px 36px; text-align: center; }
.os-hero__cover { width: min(58vw, 236px); }
.os-hero__cover img { width: 100%; height: auto; aspect-ratio: 480 / 715; object-fit: cover; border-radius: 14px; background: var(--bg-elev-2); box-shadow: 0 28px 64px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .14); }
.os-hero__copy { display: grid; align-content: center; justify-items: center; gap: 14px; max-width: 640px; }
.os-kicker { font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.os-kicker:lang(ar) { letter-spacing: 0; }
.os-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; }
.os-tag { padding: 7px 12px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: 13px; line-height: 1; color: var(--text); }
.os-hero__title { font-size: clamp(28px, 4.4vw, 52px); font-weight: 700; letter-spacing: -0.025em; line-height: 1.08; text-wrap: balance; }
.os-hero__summary { max-width: 56ch; color: rgba(255, 255, 255, .8); font-size: 17px; line-height: 1.55; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.os-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 6px 0 0; }
@media (min-width: 820px) {
  .os-hero__inner { grid-template-columns: 300px minmax(0, 1fr); justify-items: start; gap: 56px; padding-block: 48px; text-align: start; }
  .os-hero__cover { width: 300px; }
  .os-hero__copy { justify-items: start; }
  .os-hero__copy .os-tags, .os-hero__copy .os-actions { justify-content: flex-start; }
}

.os-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 26px; border: 1px solid transparent; border-radius: 12px; font-size: 16px; font-weight: 600; line-height: 1.2; text-align: center; cursor: pointer; transition: transform .15s, filter .15s, background .15s, border-color .15s; }
.os-btn:hover { transform: translateY(-1px); }
.os-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.os-btn--primary { background: #E02D24; color: #fff; }
.os-btn--primary:hover { color: #fff; filter: brightness(1.1); }
.os-btn--ghost { border-color: var(--border-strong); background: rgba(255, 255, 255, .08); color: var(--text); }
.os-btn--ghost:hover { background: rgba(255, 255, 255, .14); color: var(--text); }

/* ─── Shelves: a title, scroll buttons, a row of covers ─────────── */
.os-shelf { padding-top: 40px; }
.os-shelf__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-height: 36px; margin-bottom: 12px; }
.os-shelf__title { font-size: clamp(20px, 2.4vw, 26px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.os-shelf__sub { order: 3; flex-basis: 100%; color: var(--text-muted); font-size: 14px; }
.os-shelf__nav { display: flex; gap: 8px; margin-inline-start: auto; }
.os-shelf__nav[hidden] { display: none; }

.os-arrow { position: relative; width: 36px; height: 36px; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--bg-elev); color: var(--text); transition: border-color .15s, opacity .15s; }
.os-arrow::before { content: ""; position: absolute; top: 50%; left: 50%; width: 8px; height: 8px; border: solid currentColor; border-width: 2px 2px 0 0; }
.os-arrow--prev::before { transform: translate(-70%, -50%) rotate(-135deg); }
.os-arrow--next::before { transform: translate(-30%, -50%) rotate(45deg); }
[dir="rtl"] .os-arrow--prev::before { transform: translate(-30%, -50%) rotate(45deg); }
[dir="rtl"] .os-arrow--next::before { transform: translate(-70%, -50%) rotate(-135deg); }
.os-arrow:hover:not(:disabled) { border-color: var(--accent); }
.os-arrow:disabled { opacity: .35; cursor: default; }
.os-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* A row bleeds to the window's edge and scrolls sideways; arrows, touch, wheel, scrollbar and Tab all move it */
.os-row { display: flex; gap: 14px; list-style: none; margin-inline: calc(var(--os-gutter) * -1); padding: 8px var(--os-gutter) 20px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-inline: var(--os-gutter); scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.os-item { flex: 0 0 var(--os-w); min-width: 0; scroll-snap-align: start; }
.os-row--shorts .os-item { flex-basis: calc(var(--os-w) * .9); }
.os-row--shorts .os-tile__cover { aspect-ratio: 9 / 16; }          /* Shorts show the middle 9:16 of the cover, as in the app */
.os-shelf--home { padding-top: 0; }
.os-shelf--home .os-shelf__head { justify-content: flex-end; margin-bottom: 4px; }

/* Ranking: the number sits beside the cover, half behind it */
.os-rank { position: relative; flex-basis: calc(var(--os-w) + 52px); padding-inline-start: 52px; }
.os-rank__n { position: absolute; inset-inline-start: 0; bottom: 52px; z-index: 0; font-size: 84px; font-weight: 800; line-height: .75; letter-spacing: -0.06em; color: transparent; -webkit-text-stroke: 2px rgba(255, 255, 255, .45); font-variant-numeric: lining-nums; pointer-events: none; }
.os-rank .os-tile { position: relative; z-index: 1; }

/* ─── A cover: a button that opens the series (a link on the home shelf) ─── */
.os-tile { display: block; width: 100%; padding: 0; border: 0; border-radius: 12px; background: none; font: inherit; color: var(--text); text-align: start; cursor: pointer; }
.os-tile:hover { color: var(--text); }
.os-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.os-tile__cover { position: relative; display: block; aspect-ratio: 480 / 715; border-radius: 12px; overflow: hidden; background: var(--bg-elev-2); box-shadow: 0 0 0 1px var(--border-strong), 0 10px 26px rgba(0, 0, 0, .4); transition: transform .2s, box-shadow .2s; }
.os-tile__cover img { width: 100%; height: 100%; object-fit: cover; }
.os-tile:hover .os-tile__cover, .os-tile:focus-visible .os-tile__cover { transform: translateY(-4px); box-shadow: 0 0 0 1px var(--border-strong), 0 18px 36px rgba(0, 0, 0, .5); }
/* The format sits at the bottom of the cover (the covers print their own mark at the top left), Free at the top corner */
.os-badge { position: absolute; inset-inline-start: 7px; bottom: 7px; max-width: calc(100% - 14px); padding: 3px 8px; border-radius: 999px; background: rgba(10, 10, 15, .8); color: #fff; font-size: 11px; font-weight: 600; line-height: 1.3; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.os-badge--free { inset-inline: auto 7px; top: 7px; bottom: auto; background: #E02D24; }
.os-tile__title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-top: 10px; font-size: 14.5px; font-weight: 600; line-height: 1.3; letter-spacing: -0.005em; overflow-wrap: anywhere; }
/* Scripts with tall marks need the room, or the second line of a clamped title loses them */
:lang(th) .os-tile__title, :lang(hi) .os-tile__title, :lang(vi) .os-tile__title { line-height: 1.5; }

/* ─── Every series: format tabs, genre chips, the grid. The filters are radio buttons; the rules that
   act on them are in the page (per option) and need :has, so a browser without it hides the filters ─── */
.os-all { padding-block: 56px 16px; scroll-margin-top: 72px; }
.os-filter { display: grid; gap: 14px; margin: 16px 0 28px; }
.os-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.os-filter__label { display: block; width: 100%; margin-bottom: 2px; padding: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.os-filter__label:lang(ar) { letter-spacing: 0; }
.os-opt { position: relative; display: inline-flex; }
.os-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.os-opt label { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--bg-elev); font-size: 14px; font-weight: 500; line-height: 1.2; color: var(--text-muted); transition: color .15s, border-color .15s, background .15s; }
.os-opt input:hover + label { border-color: rgba(255, 255, 255, .32); color: var(--text); }
.os-opt input:checked + label { border-color: var(--text); background: var(--text); color: #0A0A0F; }
.os-opt input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 3px; }
.os-opt__n { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .65; }
.os-chips .os-opt label { padding: 7px 14px; font-size: 13px; }
@supports not selector(:has(a)) { .os-filter { display: none; } }

.os-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 26px 14px; list-style: none; }
@media (min-width: 640px) { .os-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
@media (min-width: 1024px) { .os-grid { grid-template-columns: repeat(auto-fill, minmax(164px, 1fr)); } }
.os-grid .os-item { scroll-margin-top: 96px; }
.os-grid .os-item:target .os-tile__cover { box-shadow: 0 0 0 2px var(--accent), 0 14px 30px rgba(0, 0, 0, .5); }

/* ─── What Yomu Originals are ───────────────────────────────────── */
.os-info { padding-block: 64px 24px; }
.os-info__grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.os-info__card { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
.os-info__icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 16px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.os-info__card h2 { margin-bottom: 6px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.os-info__card p { color: var(--text-muted); font-size: 15px; line-height: 1.55; }
.os-info__card p + p { margin-top: 10px; }

/* ─── The series dialog: a native <dialog>; a sheet from the bottom on a phone ─── */
.os-dialog { width: min(760px, calc(100vw - 32px)); max-width: none; max-height: min(88vh, 760px); margin: auto; padding: 0; border: 0; background: transparent; color: var(--text); overflow: visible; }
.os-dialog::backdrop { background: rgba(5, 5, 10, .74); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.os-dialog[open] { animation: os-pop .18s ease-out; }
@keyframes os-pop { from { opacity: 0; transform: translateY(10px); } }
.os-dialog__body { position: relative; display: grid; gap: 20px; max-height: min(88vh, 760px); padding: 26px; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--border-strong); border-radius: 22px; background: var(--bg-elev); box-shadow: 0 40px 100px rgba(0, 0, 0, .7); }
.os-dialog__cover { justify-self: center; width: 148px; height: auto; aspect-ratio: 480 / 715; object-fit: cover; border-radius: 12px; box-shadow: 0 14px 34px rgba(0, 0, 0, .5), 0 0 0 1px var(--border-strong); }
.os-dialog__main { display: grid; align-content: start; gap: 14px; min-width: 0; }
.os-dialog .os-tags { justify-content: flex-start; }
.os-dialog__title { padding-inline-end: 44px; font-size: clamp(24px, 3vw, 32px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.12; }
.os-dialog__summary { color: rgba(255, 255, 255, .82); font-size: 16px; line-height: 1.6; }
.os-dialog__note { color: var(--text-muted); font-size: 14px; line-height: 1.5; }
.os-dialog .os-actions { justify-content: flex-start; }
.os-facts { display: flex; flex-wrap: wrap; gap: 10px; margin: 2px 0 0; }
.os-facts > div { min-width: 104px; padding: 10px 16px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255, 255, 255, .04); }
.os-facts dt { color: var(--text-muted); font-size: 12px; letter-spacing: .02em; }
.os-facts dd { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.os-dialog__close { position: absolute; z-index: 2; inset-block-start: 12px; inset-inline-end: 12px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.os-dialog__close::before, .os-dialog__close::after { content: ""; position: absolute; top: 50%; left: 50%; width: 16px; height: 2px; border-radius: 1px; background: currentColor; }
.os-dialog__close::before { transform: translate(-50%, -50%) rotate(45deg); }
.os-dialog__close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.os-dialog__close:hover { background: rgba(255, 255, 255, .16); }
.os-dialog__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body:has(.os-dialog[open]) { overflow: hidden; }
@media (min-width: 640px) {
  .os-dialog__body { grid-template-columns: 200px minmax(0, 1fr); gap: 30px; padding: 30px; }
  .os-dialog__cover { justify-self: start; width: 200px; }
}
@media (max-width: 639px) {
  .os-dialog { width: 100%; max-height: 92vh; margin-block-end: 0; }
  .os-dialog__body { max-height: 92vh; padding: 24px 20px 0; border-bottom: 0; border-radius: 22px 22px 0 0; }
  .os-dialog[open] { animation-name: os-sheet; }
  /* The button stays in reach while a long summary scrolls under it */
  .os-dialog .os-actions { position: sticky; bottom: 0; z-index: 1; margin: 0 -20px; padding: 18px 20px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(20, 20, 28, 0), var(--bg-elev) 32%); }
}
@keyframes os-sheet { from { transform: translateY(40px); opacity: .6; } }

/* ─── The home page's shelf ──────────────────────────────────────── */
.os-home { padding: 24px 0 90px; }
.os-home .eyebrow:lang(ar) { letter-spacing: 0; }
.os-home__lede { max-width: 640px; margin: -30px auto 32px; color: var(--text-muted); font-size: 18px; line-height: 1.55; text-align: center; }
.os-home__more { margin-top: 20px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .os-tile__cover, .os-btn, .os-arrow, .os-opt label { transition: none; }
  .os-tile:hover .os-tile__cover, .os-tile:focus-visible .os-tile__cover, .os-btn:hover { transform: none; }
  .os-dialog[open] { animation: none; }
}
