/* ===== Works (works.js): the index of sites I built, opened from the "A website like this one" service ===== */
html.works-open { overflow: hidden; }
.works { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--paper); color: var(--ink); overflow-y: auto; overscroll-behavior: contain; font-family: var(--f-sans); }
.works::backdrop { background: rgba(20,21,23,.6); }
.works:focus { outline: none; }

/* bar */
.works-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem; height: 64px; padding-inline: clamp(16px, 3vw, 32px); background: rgba(255,255,255,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.works-eyebrow { margin: 0; margin-inline-end: auto; font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; color: var(--mute); }
.works-eyebrow span { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; margin-inline-start: .4em; border-radius: 999px; background: var(--ink); color: #fff; font-size: .7rem; letter-spacing: 0; }
.works-talk { display: inline-flex; align-items: center; gap: .55rem; padding: .7rem 1.2rem; border-radius: 999px; background: var(--blue); color: #fff; text-decoration: none; font-size: .95rem; white-space: nowrap; transition: background .3s; }
.works-talk:hover, .works-talk:focus-visible { background: var(--blue-2); }
.works-talk svg { width: .8em; height: .8em; }
.works-talk .wa-ico { width: 1.15em; height: 1.15em; }
.works-talk .short { display: none; }
.works-close { position: relative; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: #fff; cursor: pointer; transition: transform .45s var(--ease), border-color .3s; }
.works-close i { position: absolute; left: 50%; top: 50%; width: 18px; height: 1.5px; background: var(--ink); }
.works-close i:first-child { transform: translate(-50%, -50%) rotate(45deg); }
.works-close i:last-child { transform: translate(-50%, -50%) rotate(-45deg); }
.works-close:hover { transform: rotate(90deg); border-color: var(--ink); }

/* grid */
.works-grid { display: grid; grid-template-columns: repeat(6, 1fr); }
.wcell { position: relative; height: max(200px, calc((100svh - 64px) / 3)); display: grid; place-items: center; border: 0; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; color: inherit; font: inherit; padding: 0; }
.works-grid > .wcell:nth-child(6n of .wcell) { border-inline-end: 0; }   /* "of .wcell": the open strip is a grid child too */
/* the last cell: "I want a site like this for my business" → WhatsApp */
.wcell--cta { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: .9rem; padding: clamp(14px, 2vw, 28px); background: var(--blue); color: #fff; text-decoration: none; transition: background .3s; }
.wcell--cta:hover, .wcell--cta:focus-visible { background: var(--blue-2); }
.wcell--cta:focus-visible { outline: 2px solid #fff; outline-offset: -6px; }
.wcta__ico { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: #25D366; color: #fff; transition: transform .45s var(--ease); }
.wcta__ico .wa-ico { width: 1.55rem; height: 1.55rem; }
.wcell--cta:hover .wcta__ico { transform: scale(1.08) rotate(-8deg); }
.wcta__txt { font-family: var(--f-slab-body); font-style: italic; font-size: clamp(1.15rem, 1.75vw, 1.7rem); line-height: 1.15; text-wrap: balance; }
.wcta__go { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; opacity: .85; }
.wcta__go svg { width: .7em; height: .7em; }
.wcell--letter span { font-family: var(--f-slab); font-size: clamp(3rem, 7vw, 6.4rem); line-height: 1; color: var(--ink); user-select: none; }
.wcell--work { cursor: pointer; }
.wcell__art { width: min(48%, 170px); transition: transform .55s var(--ease), filter .45s var(--ease), opacity .45s; }
.wcell__art svg { display: block; width: 100%; height: auto; overflow: visible; }
.wcell__name { position: absolute; left: 0; right: 0; bottom: 9%; text-align: center; font-family: var(--f-slab-body); font-style: italic; font-size: clamp(1.05rem, 1.6vw, 1.5rem); opacity: 0; transform: translateY(8px); transition: opacity .35s, transform .45s var(--ease); }
.wcell__year { position: absolute; top: 0; right: 0; padding: .3rem .55rem; border-inline-start: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: .78rem; opacity: 0; transition: opacity .35s; }
.wcell--work.is-hot .wcell__name, .wcell--work:focus-visible .wcell__name { opacity: 1; transform: none; }
.wcell--work.is-hot .wcell__year, .wcell--work:focus-visible .wcell__year { opacity: 1; }
.wcell--work.is-hot .wcell__art { transform: translateY(-10px) scale(1.04); }
.works-grid.is-peek .wcell--work:not(.is-hot) .wcell__art { filter: blur(7px); opacity: .55; }   /* blur the art, not the grid lines */
.wcell--work:focus-visible { outline: 2px solid var(--wc); outline-offset: -6px; }
/* the open cell becomes the close X */
.wcell--work.is-open .wcell__art, .wcell--work.is-open .wcell__name, .wcell--work.is-open .wcell__year { opacity: 0; }
.wcell--work::before, .wcell--work::after { content: ""; position: absolute; left: 50%; top: 50%; width: 0; height: 1px; background: var(--ink); transition: width .5s var(--ease); }
.wcell--work::before { transform: translate(-50%, -50%) rotate(45deg); }
.wcell--work::after { transform: translate(-50%, -50%) rotate(-45deg); }
.wcell--work.is-open::before, .wcell--work.is-open::after { width: 62%; }

/* emblem motion */
.wcell .spin { transform-origin: 60px 60px; animation: wSpin 14s linear infinite; }
.wcell .swing { transform-origin: 60px 100px; animation: wSwing 2.6s ease-in-out infinite; }
.wcell .bounce { animation: wBounce 1.3s cubic-bezier(.3,0,.7,1) infinite; }
.wcell .notes rect { animation: wNote 3.6s var(--ease) infinite both; }
.wcell .notes .n2 { animation-delay: .25s; } .wcell .notes .n3 { animation-delay: .5s; }
.wcell .pulse { transform-origin: 60px 60px; animation: wPulse 3s ease-in-out infinite; }
.wcell .orbit { transform-origin: 60px 60px; animation: wSpin 5s linear infinite; }
.wcell .arc { animation: wArc 2.4s cubic-bezier(.45,.05,.55,.95) infinite; }
.wcell .blink { transform-origin: 60px 60px; animation: wBlink 4s ease-in-out infinite; }
.wcell .drip { animation: wDrip 1.8s cubic-bezier(.5,0,.9,.6) infinite; }
@keyframes wBlink { 0%, 88%, 100% { transform: scaleY(1); } 92% { transform: scaleY(.08); } 96% { transform: scaleY(1); } }
@keyframes wDrip { 0% { transform: translateY(-4px); opacity: 0; } 15% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(16px); opacity: 1; } 82%, 100% { transform: translateY(18px); opacity: 0; } }
@keyframes wSpin { to { transform: rotate(360deg); } }
@keyframes wArc { 0% { transform: translate(0, 0); opacity: 0; } 8% { opacity: 1; } 50% { transform: translate(30px, -38px); } 88% { opacity: 1; } 100% { transform: translate(58px, -40px); opacity: 0; } }
@keyframes wSwing { 0%, 100% { transform: rotate(-9deg); } 50% { transform: rotate(9deg); } }
@keyframes wBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-26px); } }
@keyframes wNote { 0% { opacity: 0; transform: translateY(10px); } 18%, 78% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-6px); } }
@keyframes wPulse { 0%, 100% { transform: scale(.92); } 50% { transform: scale(1.04); } }

/* the open project: bar, the name band, and the sideways strip of screenshots */
.wpanel { grid-column: 1 / -1; border-bottom: 1px solid var(--line); background: #fff; }
.wp-bar { display: flex; align-items: stretch; min-height: 64px; border-bottom: 1px solid var(--line); }
.wp-nav { width: 64px; flex: none; display: grid; place-items: center; border: 0; border-inline-end: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; transition: background .25s; }
.wp-nav:hover, .wp-nav:focus-visible { background: #F3F3F1; }
.wp-nav svg { width: 22px; height: 22px; }
.wp-txt { flex: 1; margin: 0; align-self: center; padding: .7rem 1.4rem; font-family: var(--f-slab-body); font-size: 1.08rem; line-height: 1.35; color: var(--ink); text-wrap: pretty; }
.wp-tags { margin-inline-start: auto; display: flex; align-items: center; gap: .4rem; margin: 0; padding: 0 1rem; list-style: none; border-inline-start: 1px solid var(--line); flex-wrap: wrap; }
.wp-tags li { padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 999px; font-size: .78rem; white-space: nowrap; }
.wp-tags .wp-year { border-color: transparent; color: var(--mute); }
.wp-wa { flex: none; display: inline-flex; align-items: center; gap: .55rem; padding: 0 1.4rem; background: var(--blue); color: #fff; text-decoration: none; font-size: .95rem; white-space: nowrap; transition: background .3s; }
.wp-wa:hover, .wp-wa:focus-visible { background: var(--blue-2); }
.wp-wa .wa-ico { width: 1.2rem; height: 1.2rem; flex: none; }
.wp-launch { flex: none; display: inline-flex; align-items: center; gap: .6rem; padding: 0 2rem; background: var(--wc); color: var(--wink); font-family: var(--f-slab-body); font-style: italic; font-size: 1.35rem; text-decoration: none; transition: filter .25s; }
.wp-launch svg { width: .7em; height: .7em; }
.wp-launch:hover, .wp-launch:focus-visible { filter: brightness(1.08); }
.wp-launch.is-off { background: #F3F3F1; color: var(--mute); font-size: 1rem; }
.wp-body { display: flex; height: clamp(360px, 62vh, 620px); background: #4A4B4F; }
.wp-name { flex: none; width: 64px; margin: 0; display: grid; place-items: center; background: var(--wc); color: var(--wink); writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--f-slab-body); font-style: italic; font-weight: 400; font-size: clamp(1.4rem, 2.4vw, 2.2rem); white-space: nowrap; overflow: hidden; }
[dir="rtl"] .wp-name { transform: none; }
.wp-strip { flex: 1; min-width: 0; display: flex; gap: 12px; padding: 12px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.35) transparent; cursor: grab; }
.wp-strip.is-drag { cursor: grabbing; scroll-snap-type: none; }
.wp-strip:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.wp-shot { flex: none; height: 100%; margin: 0; scroll-snap-align: start; border-radius: 14px; overflow: hidden; background: #2A2B2E; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.wp-shot img { display: block; height: 100%; width: auto; aspect-ratio: 1200 / 750; object-fit: cover; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.wp-shot--m { border-radius: 22px; border: 6px solid #141518; }
.wp-shot--m img { aspect-ratio: 390 / 844; }

/* Hebrew page */
.works[dir="rtl"] { font-family: "Heebo", var(--f-sans); }
.works[dir="rtl"] .wp-txt, .works[dir="rtl"] .wcell__name, .works[dir="rtl"] .wp-name, .works[dir="rtl"] .wp-launch { font-family: "Frank Ruhl Libre", "Heebo", serif; font-style: normal; }
.works[dir="rtl"] .works-eyebrow { letter-spacing: 0; }
.works[dir="rtl"] .wcta__txt { font-family: "Frank Ruhl Libre", "Heebo", serif; font-style: normal; font-weight: 700; }

@media (max-width: 860px) {
  .works-bar { height: 56px; gap: .6rem; }
  .works-talk { padding: .55rem .9rem; font-size: .85rem; }
  .works-grid { grid-template-columns: repeat(2, 1fr); }
  .works-grid > .wcell:nth-child(6n of .wcell) { border-inline-end: 1px solid var(--line); }
  .works-grid > .wcell:nth-child(2n of .wcell) { border-inline-end: 0; }
  .wcell { height: auto; aspect-ratio: 1; }
  .works-grid > .wcell--letter:last-child:nth-child(odd of .wcell) { grid-column: 1 / -1; aspect-ratio: 2; border-inline-end: 0; }   /* an odd cell count: the closing letter spans the row */
  .wcta__txt { font-size: 1.2rem; }
  .wp-wa { order: 7; flex-basis: 100%; justify-content: center; min-height: 52px; border-bottom: 1px solid var(--line); }
  .wcell__name { opacity: 1; transform: none; bottom: 7%; font-size: 1rem; }   /* no hover on touch: names always show */
  .wcell__art { width: 52%; transform: translateY(-8%); }
  .wp-bar { flex-wrap: wrap; }
  .wp-nav { width: 56px; border-bottom: 1px solid var(--line); }
  .wp-launch { flex: 1; justify-content: center; min-height: 56px; border-bottom: 1px solid var(--line); font-size: 1.15rem; }
  .wp-txt { order: 5; flex-basis: 100%; padding: .9rem 1rem; font-size: 1rem; }
  .wp-tags { order: 6; flex-basis: 100%; margin: 0; border: 0; padding: 0 1rem .9rem; }
  .wp-body { height: 74vw; max-height: 420px; }
  .wp-name { width: 44px; font-size: 1.25rem; }
  .wp-strip { padding: 10px; gap: 10px; }
  .wp-shot:not(.wp-shot--m) img { height: auto; width: 84vw; aspect-ratio: 1200 / 750; }
  .wp-shot:not(.wp-shot--m) { height: auto; align-self: center; border-radius: 10px; }
  .wp-shot--m { border-width: 4px; border-radius: 16px; }
}
@media (max-width: 420px) { .works-talk .long { display: none; } .works-talk .short { display: inline; } .works-eyebrow { font-size: .7rem; } }
@media (prefers-reduced-motion: reduce) {
  .wcell svg * { animation: none !important; }
  .wcell--work, .wcell__art, .wcell__name, .works-close { transition: none; }
}
