/* =========================================================
   Base styles for the M. Nawaz Sulaiman card
   1. Page basics
   2. Card frame (mobile first)
   3. Centred profile layout
   4. Tablet  (card 600px+)
   5. Desktop (card 900px+)
   6. Share dialog + toast
   7. Reduced motion

   The card uses a container query: it reacts to the width of
   .stage, so the layout adapts on phone, tablet and desktop.
   Colours and fonts are set in card.css.
   ========================================================= */

/* ---------- 1. Page basics ---------- */
:root {
  --page-bg: #eceef3;
  --page-surface: #ffffff;
  --page-text: #14161f;
  --page-muted: #646a7c;
  --page-line: #dcdfe8;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--page-bg);
  color: var(--page-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }
.ic { width: 1.15em; height: 1.15em; flex-shrink: 0; }
:focus-visible { outline: 3px solid #a8532c; outline-offset: 3px; }

/* The stage holds the card; its width decides the card layout */
.stage {
  container: card / inline-size;
  margin: 0 auto;
  width: 100%;
}

/* ---------- 2. Card frame (mobile first) ---------- */
.card {
  /* defaults; card.css sets the real palette */
  --bg: #ffffff;
  --text: #16181d;
  --muted: #8d919b;
  --primary: #1d2733;
  --line: #e7e8ec;
  --btn-bg: var(--primary);
  --btn-fg: #fff;
  --btn-radius: 12px;
  --font: 'IBM Plex Sans', sans-serif;
  --font-display: var(--font);

  position: relative;
  border-radius: 26px;
  overflow: clip;            /* clip (not hidden) so the sticky button still works */
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

.card-side, .card-main { position: relative; }

.card .name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1.15;
  font-weight: 500;
  color: var(--primary);
  letter-spacing: -.01em;
}
.card .role { margin: 10px 0 0; color: var(--primary); font-size: .95rem; }

.avatar { overflow: hidden; }

/* Action bar: sticks to the bottom of the screen on phones */
.card-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  gap: 10px;
  padding: 24px 20px 20px;
  background: linear-gradient(to bottom, transparent, var(--bg) 40%);
}
.btn-save, .btn-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 54px;
  border: 0;
  border-radius: var(--btn-radius);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font);
  font-size: 1.08rem;
  font-weight: 500;
}
.btn-save { flex: 1; }
.btn-share { width: 54px; flex-shrink: 0; }
.btn-share .ic { width: 22px; height: 22px; }
.btn-save:active, .btn-share:active { transform: scale(.98); }

/* ---------- 3. Centred profile layout ---------- */
.hero--center { position: relative; padding-bottom: 6px; }
.cover { position: relative; height: 150px; overflow: hidden; background: var(--hero-bg); }
.skyline { position: absolute; left: 0; bottom: 0; width: 100%; height: 60px; }
.avatar--center {
  position: relative;
  width: 124px;
  height: 124px;
  margin: -64px auto 0;
  border-radius: 50%;
  border: 5px solid var(--bg);
  z-index: 2;
}
.layout-center .identity { padding: 12px 26px 0; text-align: center; }
.layout-center .card-main { padding-top: 12px; }

/* ---------- 4. Tablet (card 600px+) ---------- */
@container card (min-width: 600px) {
  .card .name { font-size: 2.1rem; }
  .card-actions { padding: 28px 34px; }
  .cover { height: 210px; }
  .avatar--center { width: 150px; height: 150px; margin-top: -80px; }
}

/* ---------- 5. Desktop (card 900px+): two columns ---------- */
@container card (min-width: 900px) {
  .card {
    display: grid;
    grid-template-columns: minmax(360px, 42%) 1fr;
    min-height: 600px;
    border-radius: 28px;
  }
  .card-main { display: flex; flex-direction: column; padding: 48px 52px 40px; }
  .card-actions { position: static; padding: 28px 0 0; background: none; }

  .layout-center .card-side { padding-bottom: 40px; border-right: 1px solid var(--line); background: #fff; }
  .layout-center .card-main { justify-content: center; padding-top: 48px; }
}

/* ---------- 6. Share dialog + toast ---------- */
.sheet {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: var(--page-surface);
  color: var(--page-text);
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .45);
}
.sheet::backdrop { background: rgba(8, 10, 18, .55); backdrop-filter: blur(4px); }
.sheet[open] { animation: pop .3s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.97); } }

.sheet-inner { position: relative; padding: 28px 24px 24px; text-align: center; }
.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--page-line);
  border-radius: 12px;
  background: var(--page-surface);
  color: var(--page-text);
}
.sheet h2 { margin: 4px 0; font-size: 1.35rem; }
.sheet-sub { margin: 0 0 18px; color: var(--page-muted); font-size: .95rem; }

.seg {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--page-bg);
  border: 1px solid var(--page-line);
}
.seg button { padding: 8px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--page-muted); font-weight: 500; font-size: .9rem; }
.seg button[aria-selected="true"] { background: var(--page-surface); color: var(--page-text); box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }

.qr-wrap { display: grid; place-items: center; margin: 20px auto 10px; padding: 16px; width: fit-content; border-radius: 20px; background: #fff; border: 1px solid var(--page-line); }
.qr { width: 220px; min-height: 220px; display: grid; place-items: center; }
.qr img, .qr canvas { width: 220px !important; height: 220px !important; }
.qr-error { color: #6b7280; font-size: .9rem; padding: 20px; }
.qr-hint { margin: 0 0 18px; color: var(--page-muted); font-size: .88rem; }

.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 500;
  font-size: .92rem;
}
.btn-ghost { border: 1px solid var(--page-line); background: var(--page-bg); color: var(--page-text); }
.btn-solid { grid-column: 1 / -1; border: 0; background: var(--page-text); color: #fff; }
.btn[hidden] { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 14px;
  background: #14161f;
  color: #fff;
  font-size: .92rem;
  font-weight: 500;
  box-shadow: 0 16px 30px -12px rgba(0, 0, 0, .5);
  transform: translate(-50%, 140%);
  opacity: 0;
  transition: transform .35s var(--ease), opacity .35s;
  pointer-events: none;
}
.toast .ic { color: #4ade80; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- 7. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
