/* =========================================================
   Carpal Mockup — Reset, base typography, phone frame
   ========================================================= */

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--cp-font-sans);
  font-size: var(--cp-fs-body);
  line-height: 1.4;
  color: var(--cp-text);
  background: var(--frame-bg);
  overflow-x: hidden;
}

html[lang="ar"] body { font-family: var(--cp-font-arabic); }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--cp-cyan); outline-offset: 2px; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
input, textarea, select { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5, h6, p { margin: 0; }

/* =========================================================
   Phone frame — desktop only (>= 600px)
   On phone (<600px): edge-to-edge native feel
   ========================================================= */

.frame {
  position: relative;
  width: 100%;
  min-height: 100vh;
  background: var(--cp-bg);
  overflow: hidden;
}

@media (min-width: 600px) {
  body {
    background: var(--frame-bg);
    background-image:
      radial-gradient(at 30% 20%, rgba(0,174,239,0.06) 0%, transparent 60%),
      radial-gradient(at 70% 80%, rgba(245,166,35,0.05) 0%, transparent 55%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
  }

  .frame {
    width: var(--frame-width);
    height: var(--frame-height);
    min-height: var(--frame-height);
    border-radius: var(--frame-radius);
    box-shadow:
      0 0 0 var(--frame-bezel) #0A1628,
      0 30px 80px rgba(10, 22, 40, 0.3),
      0 12px 30px rgba(10, 22, 40, 0.18);
    overflow: hidden;
    isolation: isolate;
  }

  .frame::before {
    /* Notch / dynamic island pill */
    content: "";
    position: absolute;
    top: 11px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 30px;
    background: #0A1628;
    border-radius: 9999px;
    z-index: 100;
    pointer-events: none;
  }
}

/* =========================================================
   Screen container — viewport-like scroll surface
   ========================================================= */

.screen-stage {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--cp-bg);
}

.screen {
  display: none;
  min-height: 100%;
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: 130px; /* clearance for tab bar */
  background: var(--cp-bg);
}

.screen.is-active { display: block; }

@media (min-width: 600px) {
  .screen { padding-top: 56px; }
}

.screen-no-tabbar { padding-bottom: 32px; }

/* =========================================================
   Status bar (faux iOS, desktop only)
   ========================================================= */

.statusbar {
  display: none;
}

@media (min-width: 600px) {
  .statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    padding: 18px 28px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--cp-text);
    z-index: 50;
    pointer-events: none;
  }
  .statusbar__time { font-variant-numeric: tabular-nums; }
  .statusbar__right { display: flex; gap: 6px; align-items: center; opacity: 0.85; }
}

/* =========================================================
   Common typography classes (reverted Clean Premium)
   ========================================================= */

.t-display    { font-size: var(--cp-fs-display);  font-weight: 700; line-height: 1.18; letter-spacing: -0.02em; }
.t-title1     { font-size: var(--cp-fs-title1);   font-weight: 700; line-height: 1.22; letter-spacing: -0.015em; }
.t-title2     { font-size: var(--cp-fs-title2);   font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.t-title3     { font-size: var(--cp-fs-title3);   font-weight: 600; line-height: 1.3; }
.t-headline   { font-size: var(--cp-fs-headline); font-weight: 600; line-height: 1.35; }
.t-body       { font-size: var(--cp-fs-body);     font-weight: 400; line-height: 1.45; }
.t-callout    { font-size: var(--cp-fs-callout);  font-weight: 400; line-height: 1.4; }
.t-subhead    { font-size: var(--cp-fs-subhead);  font-weight: 400; line-height: 1.4; }
.t-footnote   { font-size: var(--cp-fs-footnote); font-weight: 400; line-height: 1.4; }
.t-caption    { font-size: var(--cp-fs-caption);  font-weight: 400; line-height: 1.35; }
.t-caption2   { font-size: var(--cp-fs-caption2); font-weight: 400; line-height: 1.3; }

.t-secondary  { color: var(--cp-text-secondary); }
.t-tertiary   { color: var(--cp-text-tertiary); }
.t-cyan       { color: var(--cp-cyan); }
.t-amber      { color: var(--cp-amber); }
.t-error      { color: var(--cp-error); }
.t-success    { color: var(--cp-success); }
.t-bold       { font-weight: 600; }
.t-tabular    { font-variant-numeric: tabular-nums; }

/* Visually hidden helper */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
