/* Shared component styles. Each version sets these variables in its own style.css. */
:root {
  --c-bg: #fff; --c-fg: #111; --c-muted: #888; --c-line: #e6e6e6;
  --c-phone-bg: #111; --c-radius: 0px; --c-font: system-ui, sans-serif;
}
* { box-sizing: border-box; }
img, video { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }

/* phone mockup */
.c-phone { margin: 0; width: min(100%, 340px); }
.c-phone__frame { position: relative; background: var(--c-phone-bg); border-radius: 38px; padding: 12px; box-shadow: 0 18px 40px rgba(0,0,0,.18); }
.c-phone__bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 10px; color: #fff; font: 600 12px/1 var(--c-font); }
.c-phone__avatar { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af); }
.c-phone__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 22px; scrollbar-width: none; background: #000; }
.c-phone__track::-webkit-scrollbar { display: none; }
.c-phone__slide { flex: 0 0 100%; scroll-snap-align: center; }
.c-phone__slide img, .c-phone__slide video { width: 100%; height: auto; }
.c-phone__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); color: #111; font-size: 20px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .2s; }
.c-phone:hover .c-phone__nav { opacity: 1; }
.c-phone__nav.prev { left: 2px; } .c-phone__nav.next { right: 2px; }
.c-phone__dots { display: flex; justify-content: center; gap: 5px; padding: 10px 0 4px; }
.c-phone__dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.35); }
.c-phone__dots i.on { background: #fff; }
@media (hover: none) { .c-phone__nav { display: none; } }

/* browser frame */
.c-browser { margin: 0; border: 1px solid var(--c-line); border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 14px 34px rgba(0,0,0,.12); }
.c-browser__bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: #f1f1f1; border-bottom: 1px solid var(--c-line); font: 11px/1 var(--c-font); color: #777; }
.c-browser__bar i { width: 9px; height: 9px; border-radius: 50%; background: #d4d4d4; }
.c-browser__bar span { margin-left: 10px; padding: 4px 10px; background: #fff; border-radius: 6px; flex: 1; max-width: 260px; }
figcaption { font: 13px/1.4 var(--c-font); color: var(--c-muted); margin-top: 10px; }
figcaption a { color: inherit; }

/* type tester */
.c-tester { border-top: 1px solid var(--c-line); border-bottom: 1px solid var(--c-line); padding: 18px 0 8px; }
.c-tester__controls { display: flex; justify-content: space-between; align-items: center; gap: 16px; font: 13px/1 var(--c-font); color: var(--c-muted); }
.c-tester__controls input { vertical-align: middle; width: 140px; }
.c-tester__input { width: 100%; border: 0; outline: 0; resize: vertical; background: transparent; color: var(--c-fg); line-height: 1.05; padding: 16px 0; min-height: 1.4em; }
.c-tester__input::placeholder { color: #c4c4c4; }

/* record */
.c-record { display: inline-flex; flex-direction: column; gap: 10px; color: inherit; text-decoration: none; }
.c-record video, .c-record img { width: 160px; height: 160px; object-fit: cover; border-radius: 8px; }
.c-record span { font: 12px/1.3 var(--c-font); letter-spacing: .06em; text-transform: uppercase; }

/* lightbox */
.c-lightbox { position: fixed; inset: 0; background: rgba(10,10,10,.92); display: none; align-items: center; justify-content: center; z-index: 100; cursor: zoom-out; padding: 4vmin; }
.c-lightbox.open { display: flex; }
.c-lightbox img { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.c-lightbox button { position: absolute; top: 14px; right: 18px; background: none; border: 0; color: #fff; font-size: 34px; cursor: pointer; }

/* figma embed */
.c-figma { width: 100%; aspect-ratio: 16/10; border: 0; border-radius: var(--c-radius); background: #f2f2f2; }
@media (max-width: 700px) { .c-figma { aspect-ratio: 9/16; } }

/* project body — baseline layout (versions restyle) */
.b-text { max-width: 640px; }
.b-text h3, .b-title { margin: 0 0 12px; }
.b-media, .b-sub { margin: 64px 0; }
.b-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--b-gap, 16px); }
.b-cell { min-width: 0; background: var(--b-cell-bg, transparent); border-radius: var(--c-radius); overflow: hidden; }
.b-cell.wide { grid-column: 1 / -1; }
.b-cell img, .b-cell video { width: 100%; height: auto; }
.b-grid.process { grid-template-columns: repeat(3, 1fr); }
.b-grid.pg { grid-template-columns: repeat(3, 1fr); }
.b-grid.spreads { grid-template-columns: 1fr; }
.b-desc { max-width: 640px; color: var(--c-muted); margin: 0 0 20px; }
.b-more { margin-top: 14px; }
.b-spreads { display: grid; gap: 28px; }
.b-spread { display: grid; grid-template-columns: 1fr 1fr; gap: 0; max-width: 900px; margin: 0 auto; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.b-spread.single { grid-template-columns: 1fr; max-width: 450px; }
.b-pair { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 40px; align-items: center; margin: 0 0 56px; }
.b-phones { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 36px 28px; justify-items: center; }
.b-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px; }
.b-cards.web { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.b-cards.illo { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.b-cards figure { margin: 0; }
.b-cards img { width: 100%; border-radius: var(--c-radius); }
.b-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px 28px; margin: 0; }
.b-meta dt { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted); }
.b-meta dd { margin: 4px 0 0; }
.pg-group { margin: 0 0 80px; }
.pg-head { max-width: 640px; margin-bottom: 18px; }
@media (max-width: 700px) {
  .b-grid, .b-grid.process, .b-grid.pg { grid-template-columns: 1fr 1fr; }
  .b-pair { grid-template-columns: 1fr; justify-items: center; }
  .b-spread { grid-template-columns: 1fr 1fr; }
}
/* SVGs have no intrinsic size in the data — keep them contained */
.b-cell img[src$=".svg"], .thumb img[src$=".svg"] { max-height: 420px; width: 100%; object-fit: contain; padding: 8%; background: #f2f2f2; }
.b-desc p { margin: 0 0 10px; }
/* big galleries go 3-up so long sets (manuals, dielines) stay compact */
@media (min-width: 701px) { .b-gallery .b-grid:has(> .b-cell:nth-child(7)) { grid-template-columns: repeat(3, 1fr); } }

/* justified rows (replaces the fixed 2-column grid) */
.b-grid.jr { display: flex; flex-direction: column; gap: var(--b-gap, 12px); }
.b-row { display: flex; gap: var(--b-gap, 12px); width: 100%; }
.b-row .b-cell { min-width: 0; }
.b-row .b-cell img, .b-row .b-cell video { width: 100%; height: auto; }
@media (max-width: 560px) {
  /* on phones, rows of 3+ get too small — let them wrap two by two */
  .b-row { flex-wrap: wrap; }
  .b-row .b-cell { flex-basis: calc(50% - var(--b-gap, 12px)) !important; }
  .b-row:has(> .b-cell:only-child) .b-cell { flex-basis: 100% !important; }
}

/* ---- iPhone + Instagram mockup ---- */
.c-phone { width: min(100%, 300px); margin: 0; }
.c-phone__frame { background: #1c1c1e; border-radius: 46px; padding: 9px; box-shadow: 0 0 0 1.5px #3a3a3c inset, 0 20px 40px rgba(0,0,0,.16); }
.c-phone__screen { position: relative; background: #fff; border-radius: 38px; overflow: hidden; padding-bottom: 18px; font: 12px/1.35 -apple-system, "Helvetica Neue", Arial, sans-serif; color: #111; }
.c-phone__status { display: flex; justify-content: space-between; align-items: center; padding: 11px 22px 4px; font-weight: 600; font-size: 12px; }
.c-phone__sys { font-size: 7px; letter-spacing: 1px; }
.c-phone__island { position: absolute; left: 50%; top: 9px; transform: translateX(-50%); width: 80px; height: 22px; border-radius: 12px; background: #000; }
.c-phone__bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px; color: #111; font: 600 12px/1 -apple-system, "Helvetica Neue", Arial, sans-serif; }
.c-phone__avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 700 9px/1 -apple-system, Arial, sans-serif; box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #d62976; }
.c-phone__more { margin-left: auto; letter-spacing: 1px; font-weight: 700; }
.c-phone__media { position: relative; }
.c-phone__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 0; background: #000; }
.c-phone__count { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 10px; }
.c-phone__nav { opacity: 0; width: 24px; height: 24px; font-size: 18px; background: rgba(255,255,255,.85); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.c-phone__nav.prev { left: 6px; } .c-phone__nav.next { right: 6px; }
.c-phone__actions { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 9px 12px 4px; }
.c-phone__icons { display: flex; gap: 12px; }
.c-phone__actions svg { width: 20px; height: 20px; fill: none; stroke: #111; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.c-phone__save { justify-self: end; }
.c-phone__dots { display: flex; gap: 4px; padding: 0; }
.c-phone__dots i { width: 5px; height: 5px; background: #c7c7cc; }
.c-phone__dots i.on { background: #0095f6; }
.c-phone__cap { margin: 4px 12px 0; font-size: 11.5px; line-height: 1.35; color: #111; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.c-phone__home { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); width: 34%; height: 4px; border-radius: 3px; background: #111; }
.c-phone__cap { -webkit-line-clamp: 3; }
.c-browser-wrap { margin: 0; }
.c-browser-wrap figcaption { margin-top: 14px; }

/* real iPhone proportions (71.6 × 147.6 mm) */
.c-phone__frame { aspect-ratio: 71.6 / 147.6; border-radius: 54px / 26px; display: flex; padding: 8px; }
.c-phone__screen { flex: 1; display: flex; flex-direction: column; border-radius: 46px / 22px; padding-bottom: 0; }
.c-phone__status { padding-top: 13px; }
.c-phone__island { top: 10px; width: 32%; height: 24px; }
.c-phone__media { flex: none; }
.c-phone__next { flex: 1 1 0; min-height: 0; overflow: hidden; display: flex; align-items: flex-start; gap: 8px; padding: 14px 12px 0; font: 600 12px/28px -apple-system, "Helvetica Neue", Arial, sans-serif; color: #111; opacity: .9; }
.c-phone__tabs { flex: none; display: flex; justify-content: space-around; align-items: center; height: 46px; padding-bottom: 14px; border-top: 1px solid #eee; }
.c-phone__tabs i { width: 18px; height: 18px; border: 2px solid #111; border-radius: 4px; }
.c-phone__tabs .t-home { border-radius: 3px 3px 2px 2px; }
.c-phone__tabs .t-search { border-radius: 50%; }
.c-phone__tabs .t-me { border-radius: 50%; border: 0; }
.c-phone__home { bottom: 7px; }
.c-phone__dots { max-width: 84px; overflow: hidden; justify-content: center; }
.c-phone__actions { grid-template-columns: auto 1fr auto; gap: 8px; }
.c-phone__dots { justify-self: center; }
.c-phone__cap { -webkit-line-clamp: 2; flex: none; }
.c-phone__screen { min-height: 0; }
/* Instagram-style carousel dots: centered under the post */
.c-phone__actions { position: relative; display: flex; justify-content: space-between; }
.c-phone__actions > span:empty { display: none; }
.c-phone__dots { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: none; gap: 4px; align-items: center; }
.c-phone__dots i { width: 6px; height: 6px; transition: width .15s, height .15s; }
.c-phone__dots i.sm { width: 4px; height: 4px; }
.c-phone__dots i.hide { display: none; }
.b-grid.small { max-width: 720px; margin-left: auto; margin-right: auto; }

/* ===== Phone v3: Instagram "Posts" view, matches the reference mockup ===== */
.c-phone { width: min(100%, 290px); }
.c-phone__frame { position: relative; aspect-ratio: 71.6 / 147.6; background: #fff; border: 5px solid #111; border-radius: 40px; padding: 0; box-shadow: 0 0 0 2px #444, 0 22px 44px rgba(0,0,0,.16); display: flex; overflow: visible; }
.c-phone__frame::before, .c-phone__frame::after { content: ""; position: absolute; right: -9px; width: 4px; background: #222; border-radius: 2px; }
.c-phone__frame::before { top: 22%; height: 9%; } .c-phone__frame::after { top: 34%; height: 14%; }
.c-phone__btn { position: absolute; left: -9px; top: 20%; width: 4px; height: 7%; background: #222; border-radius: 2px; }
.c-phone__screen { flex: 1; display: flex; flex-direction: column; border-radius: 35px; overflow: hidden; background: #fff; padding: 0; font: 12px/1.35 -apple-system, "Helvetica Neue", Arial, sans-serif; color: #111; min-height: 0; }
.c-phone__status { display: flex; justify-content: space-between; align-items: center; padding: 11px 22px 0; font-size: 11px; font-weight: 600; color: #333; }
.c-phone__sys { font-size: 9px; letter-spacing: 2px; }
.c-phone__island { position: absolute; left: 50%; top: 13px; transform: translateX(-50%); width: 30%; height: 21px; background: #000; border-radius: 12px; }
.c-phone__island::after { content: ""; position: absolute; right: 9px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: #1d2a4a; }
.c-phone__top { display: flex; align-items: center; gap: 12px; padding: 14px 14px 6px; font-size: 16px; }
.c-phone__top svg { width: 18px; height: 18px; fill: none; stroke: #111; stroke-width: 2.2; stroke-linecap: round; }
.c-phone__bar { display: flex; align-items: center; gap: 7px; padding: 6px 12px 9px; font: 600 12px/1 -apple-system, "Helvetica Neue", Arial, sans-serif; color: #111; }
.c-phone__avatar { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; display: block; background: none; box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #d62976; }
.c-phone__avatar svg { width: 100%; height: 100%; display: block; }
.c-phone__ver { width: 12px; height: 12px; border-radius: 50%; background: #0095f6; display: grid; place-items: center; }
.c-phone__ver::after { content: ""; width: 4px; height: 2.5px; border: solid #fff; border-width: 0 0 1.5px 1.5px; transform: rotate(-45deg) translate(0, -1px); }
.c-phone__more { margin-left: auto; font-weight: 700; }
.c-phone__media { flex: none; position: relative; }
.c-phone__dotrow { display: flex; justify-content: center; min-height: 18px; align-items: center; }
.c-phone__dotrow .c-phone__dots { position: static; transform: none; display: flex; gap: 4px; align-items: center; }
.c-phone__actions { display: flex; align-items: center; gap: 12px; padding: 2px 12px 4px; position: static; }
.c-phone__actions > span { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.c-phone__actions svg { width: 19px; height: 19px; fill: none; stroke: #111; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.c-phone__like.on svg { fill: #ff3040; stroke: #ff3040; }
.c-phone__save { margin-left: auto; justify-self: auto; }
.c-phone__cap { margin: 2px 12px 0; font-size: 11.5px; -webkit-line-clamp: 3; }
.c-phone__fill { flex: 1 1 0; min-height: 0; }
.c-phone__andnav { flex: none; display: flex; justify-content: space-around; align-items: center; height: 40px; }
.c-phone__andnav .n1 { width: 12px; height: 11px; border-left: 2px solid #777; border-right: 2px solid #777; position: relative; }
.c-phone__andnav .n1::after { content: ""; position: absolute; left: 3px; top: 0; width: 2px; height: 11px; background: #777; }
.c-phone__andnav .n2 { width: 13px; height: 13px; border: 2px solid #777; border-radius: 4px; }
.c-phone__andnav .n3 { width: 8px; height: 8px; border: solid #777; border-width: 0 0 2px 2px; transform: rotate(45deg); }
.c-phone__next, .c-phone__tabs, .c-phone__home { display: none; }
.c-phone__top { padding: 10px 14px 4px; font-size: 15px; }
.c-phone__bar { padding: 4px 12px 7px; }
.c-phone__cap { -webkit-line-clamp: 2; }
.c-phone__andnav { height: 34px; }
.c-phone__dotrow { min-height: 15px; }
/* nav bar sits on top of the feed (like a real phone), so tall 4:5 posts never push it off-screen */
.c-phone__screen { position: relative; }
.c-phone__andnav { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; z-index: 2; }
.c-phone__fill { min-height: 34px; }
