/* Mansaty Template Studio — gallery (namespace: mg-). Cairo, local. */
@font-face {
  font-family: "Cairo";
  src: url("../fonts/cairo-arabic.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Cairo";
  src: url("../fonts/cairo-latin-ext.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Cairo";
  src: url("../fonts/cairo-latin.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

.mg {
  --mg-bg: #f5f5f2;
  --mg-surface: #ffffff;
  --mg-ink: #15171c;
  --mg-muted: #5a606c;
  --mg-line: #dcdcd5;
  --mg-accent: #3446c8;
  --mg-accent-soft: #e5e8fb;
  --mg-ok: #17794b;
  --mg-ok-soft: #dcf0e5;
  --mg-wip: #85560a;
  --mg-wip-soft: #fbefd0;
  --mg-font: "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --mg-pad: 20px;

  margin: 0;
  background: var(--mg-bg);
  color: var(--mg-ink);
  font-family: var(--mg-font);
  font-size: 1.0625rem;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}
.mg *,
.mg *::before,
.mg *::after {
  box-sizing: border-box;
}
.mg button {
  font-family: inherit;
}
.mg a {
  color: inherit;
}
.mg :focus-visible {
  outline: 3px solid var(--mg-accent);
  outline-offset: 3px;
  border-radius: 6px;
}
.mg-wrap {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--mg-pad);
}
.mg-skip {
  position: absolute;
  inset-inline-start: 12px;
  top: -90px;
  background: var(--mg-ink);
  color: #fff !important;
  padding: 10px 18px;
  border-radius: 8px;
  z-index: 100;
}
.mg-skip:focus {
  top: 10px;
}

/* ---------- Header / hero ---------- */
.mg-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 18px;
}
.mg-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.2;
}
.mg-brand svg {
  width: 34px;
  height: 34px;
}
.mg-top__tag {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--mg-muted);
  border: 1px solid var(--mg-line);
  border-radius: 999px;
  padding: 2px 12px;
  background: var(--mg-surface);
}
.mg-hero {
  padding-block: 28px 44px;
}
.mg-hero h1 {
  margin: 0;
  font-size: clamp(2.1rem, 8vw, 4rem);
  line-height: 1.25;
  font-weight: 900;
  max-width: 14em;
  text-wrap: balance;
}
.mg-hero p {
  margin: 18px 0 0;
  max-width: 38em;
  color: var(--mg-muted);
  font-size: clamp(1.05rem, 3vw, 1.22rem);
  line-height: 1.95;
}
.mg-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}
.mg-nav a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  padding: 10px 18px;
  min-height: 46px;
  border-radius: 999px;
  background: var(--mg-surface);
  border: 1px solid var(--mg-line);
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.mg-nav a:hover {
  border-color: var(--mg-ink);
}
.mg-nav b {
  min-width: 26px;
  height: 26px;
  padding-inline: 8px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--mg-ink);
  color: #fff;
  font-size: 0.82rem;
  line-height: 1;
}

/* ---------- Category sections ---------- */
.mg-cat {
  padding-block: 44px 20px;
  border-top: 1px solid var(--mg-line);
  scroll-margin-top: 8px;
}
.mg-cat__head {
  display: grid;
  gap: 6px;
  margin-bottom: 24px;
  max-width: 40rem;
}
.mg-cat__head h2 {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  line-height: 1.35;
  font-weight: 800;
}
.mg-cat__head p {
  margin: 0;
  color: var(--mg-muted);
}
.mg-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}

/* ---------- Cards ---------- */
.mg-card {
  display: flex;
  flex-direction: column;
  background: var(--mg-surface);
  border: 1px solid var(--mg-line);
  border-radius: 20px;
  overflow: hidden;
}
.mg-card__media {
  position: relative;
  padding: 16px 16px 0;
  background: #e9e9e3;
}
.mg-frame {
  background: #fff;
  border: 1px solid var(--mg-line);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  aspect-ratio: 1000 / 625;
  position: relative;
}
.mg-frame::before {
  content: "";
  display: block;
  height: 22px;
  background: #f1f1ec
    radial-gradient(circle at 14px 11px, #c9c9c2 3px, transparent 3.5px),
    radial-gradient(circle at 28px 11px, #c9c9c2 3px, transparent 3.5px),
    radial-gradient(circle at 42px 11px, #c9c9c2 3px, transparent 3.5px);
  border-bottom: 1px solid var(--mg-line);
}
.mg-frame img {
  display: block;
  width: 100%;
  height: calc(100% - 22px);
  object-fit: cover;
  object-position: top;
}
.mg-phone {
  position: absolute;
  inset-inline-end: 26px;
  bottom: 0;
  width: 21%;
  aspect-ratio: 300 / 650;
  border: 4px solid var(--mg-ink);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 24px rgba(21, 23, 28, 0.25);
}
.mg-phone img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}
.mg-card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 20px 22px;
  flex: 1;
}
.mg-card__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}
.mg-card__title h3 {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.5;
  font-weight: 800;
}
.mg-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.9;
  white-space: nowrap;
}
.mg-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.mg-chip--ok {
  background: var(--mg-ok-soft);
  color: var(--mg-ok);
}
.mg-chip--ref {
  background: var(--mg-accent-soft);
  color: var(--mg-accent);
}
.mg-chip--wip {
  background: var(--mg-wip-soft);
  color: var(--mg-wip);
}
.mg-card p {
  margin: 0;
  color: var(--mg-muted);
  font-size: 0.98rem;
  line-height: 1.8;
}
.mg-tags {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mg-tags li {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0 10px;
  line-height: 1.9;
  border: 1px solid var(--mg-line);
  border-radius: 8px;
  color: var(--mg-muted);
}
.mg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
}
.mg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 20px;
  border-radius: 12px;
  border: 2px solid var(--mg-ink);
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  background: var(--mg-ink);
  color: #fff !important;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.mg-btn:hover {
  background: var(--mg-accent);
  border-color: var(--mg-accent);
}
.mg-btn--ghost {
  background: transparent;
  color: var(--mg-ink) !important;
}
.mg-btn--ghost:hover {
  background: var(--mg-ink);
  color: #fff !important;
  border-color: var(--mg-ink);
}
.mg-btn[aria-disabled="true"] {
  background: transparent;
  color: #858a94 !important;
  border-color: var(--mg-line);
  border-style: dashed;
  cursor: not-allowed;
  pointer-events: none;
}
.mg-ico {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* in-development card */
.mg-card--wip {
  background: transparent;
  border-style: dashed;
}
.mg-blueprint {
  aspect-ratio: 1000 / 625;
  border-radius: 12px 12px 0 0;
  border: 1px dashed #b8b8b0;
  border-bottom: 0;
  background-color: #f1f1ec;
  background-image:
    linear-gradient(rgba(52, 70, 200, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52, 70, 200, 0.09) 1px, transparent 1px);
  background-size: 24px 24px;
  display: grid;
  place-items: center;
  color: var(--mg-muted);
  font-weight: 700;
  text-align: center;
  padding: 16px;
}
.mg-blueprint span {
  background: var(--mg-bg);
  padding: 4px 14px;
  border-radius: 999px;
  border: 1px solid var(--mg-line);
}

/* ---------- Footer ---------- */
.mg-foot {
  margin-top: 56px;
  background: var(--mg-ink);
  color: #c4c8d2;
  padding-block: 36px;
  font-size: 0.95rem;
  line-height: 1.9;
}
.mg-foot strong {
  color: #fff;
}
.mg-foot p {
  margin: 6px 0 0;
  max-width: 46em;
}

/* ---------- Quick preview dialog ---------- */
.mg-dialog {
  width: min(1180px, 100vw);
  height: min(860px, 100dvh);
  max-width: 100vw;
  max-height: 100dvh;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--mg-surface);
  color: var(--mg-ink);
  overflow: hidden;
}
.mg-dialog[open] {
  display: flex;
  flex-direction: column;
}
.mg-dialog::backdrop {
  background: rgba(21, 23, 28, 0.62);
}
.mg-dialog__bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--mg-line);
  background: var(--mg-bg);
}
.mg-dialog__title {
  font-weight: 800;
  margin-inline-end: auto;
  line-height: 1.4;
}
.mg-seg {
  display: none;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--mg-line);
  border-radius: 12px;
  background: var(--mg-surface);
}
.mg-seg button {
  border: 0;
  background: transparent;
  padding: 4px 14px;
  min-height: 36px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  color: var(--mg-muted);
}
.mg-seg button[aria-pressed="true"] {
  background: var(--mg-ink);
  color: #fff;
}
.mg-dialog__open,
.mg-dialog__close {
  min-height: 40px;
  padding: 4px 14px;
  font-size: 0.92rem;
  border-radius: 10px;
}
.mg-dialog__stage {
  flex: 1;
  min-height: 0;
  background: #d9d9d2;
  display: flex;
  justify-content: center;
  overflow: auto;
}
.mg-dialog iframe {
  border: 0;
  background: #fff;
  width: 100%;
  height: 100%;
  max-width: var(--mg-frame-w, 100%);
  transition: max-width 0.25s ease;
}

/* ---------- Breakpoints ---------- */
@media (min-width: 768px) {
  .mg {
    --mg-pad: 32px;
  }
  .mg-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
  .mg-hero {
    padding-block: 56px 64px;
  }
  .mg-cat {
    padding-block: 60px 28px;
  }
  .mg-seg {
    display: flex;
  }
}
@media (max-width: 767.98px) {
  .mg-dialog {
    border-radius: 0;
    width: 100vw;
    height: 100dvh;
  }
  .mg-actions .mg-btn {
    flex: 1;
    padding-inline: 12px;
    white-space: nowrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  .mg *,
  .mg *::before,
  .mg *::after {
    transition: none !important;
  }
}
