/* ==========================================================
   OSKR17th Anniversary — Internal Demo (demo.html) ONLY.
   ห้าม import ไฟล์นี้ในหน้าเว็บ production ใด ๆ ทั้งสิ้น
   ========================================================== */

* { box-sizing: border-box; }

body {
  font-family: 'Kanit', sans-serif;
  background: linear-gradient(180deg, #CFE9FB 0%, #E9F5FD 45%, #FFFDF8 100%);
  min-height: 100vh;
  margin: 0;
}

.demo-page {
  min-height: 100vh;
  padding: 1.5rem 1rem 4rem;
}

.demo-topbar {
  max-width: 1100px;
  margin: 0 auto 2rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: #1B2130;
  color: #FFFDF8;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
}
.demo-topbar-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0 0 0.15rem;
}
.demo-topbar-sub {
  font-size: 0.78rem;
  color: rgba(255, 253, 248, 0.6);
  margin: 0;
}
.demo-reset-btn {
  font-family: 'Kanit', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  background: #EF4F98;
  color: #FFFDF8;
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.25rem;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
  flex-shrink: 0;
}
.demo-reset-btn:hover { background: #d63d84; transform: translateY(-1px); }
.demo-reset-btn:focus-visible { outline: 2px solid #2E7FE0; outline-offset: 2px; }

.demo-stage {
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

/* ---------- Caption strip ---------- */
.demo-caption-strip {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
  max-width: 640px;
}
.demo-caption-strip li {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: #FFFDF8;
  border: 1.5px solid rgba(33, 64, 125, 0.15);
  color: rgba(27, 33, 48, 0.45);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.demo-caption-strip li.is-current {
  background: #EF4F98;
  border-color: #EF4F98;
  color: #FFFDF8;
  font-weight: 600;
}
.demo-caption-strip li.is-done {
  color: #2E7FE0;
  border-color: rgba(46, 127, 224, 0.35);
}

/* ---------- iPhone frame ---------- */
.iphone-frame {
  position: relative;
  width: 340px;
  height: 700px;
  background: #0d0d12;
  border-radius: 3rem;
  padding: 14px;
  box-shadow: 0 30px 70px rgba(33, 64, 125, 0.35), 0 0 0 2px rgba(255, 255, 255, 0.06) inset;
  flex-shrink: 0;
}
.iphone-notch {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 130px;
  height: 24px;
  background: #0d0d12;
  border-radius: 0 0 16px 16px;
  z-index: 10;
}
.iphone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: #FFFDF8;
  border-radius: 2.25rem;
  overflow: hidden;
}

/* ---------- Generic phone scene ---------- */
.phone-scene {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: #FFFDF8;
}
.phone-scene.is-active {
  display: flex;
}

.phone-nav {
  flex-shrink: 0;
  padding: 2.75rem 1.25rem 0.85rem;
  font-family: 'Kanit', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
  color: #1B2130;
  border-bottom: 1px solid rgba(33, 64, 125, 0.1);
}

.phone-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.25rem 2rem;
}
.phone-body-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 3rem;
}

.phone-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #EF4F98;
  margin: 0 0 0.35rem;
}
.phone-h1 {
  font-family: 'Kanit', sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  color: #1B2130;
  margin: 0 0 0.75rem;
}
.phone-p {
  font-size: 0.8rem;
  line-height: 1.6;
  color: rgba(27, 33, 48, 0.6);
  margin: 0 0 1rem;
}
.phone-hint-p {
  font-size: 0.72rem;
  color: #2E7FE0;
  background: rgba(46, 127, 224, 0.08);
  border-radius: 0.6rem;
  padding: 0.65rem 0.85rem;
  margin-top: 0.5rem;
}
.text-center { text-align: center; }

.phone-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 1.1rem;
  font-size: 0.75rem;
  color: rgba(27, 33, 48, 0.75);
  line-height: 1.5;
  cursor: pointer;
}
.phone-checkbox-row input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}
.phone-required { color: #EF4F98; }
.phone-optional { color: rgba(27, 33, 48, 0.4); font-weight: 400; }

#reg-cm-fields {
  border-left: 2px solid rgba(239, 79, 152, 0.25);
  padding-left: 0.85rem;
  margin-left: 0.15rem;
}

.phone-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(27, 33, 48, 0.7);
  margin: 0.85rem 0 0.35rem;
}
.phone-input {
  width: 100%;
  font-family: 'Kanit', sans-serif;
  font-size: 0.85rem;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid rgba(33, 64, 125, 0.18);
  border-radius: 0.65rem;
  background: #fff;
  color: #1B2130;
}
.phone-input:focus {
  outline: none;
  border-color: #2E7FE0;
}

.phone-upload-mock {
  margin-top: 1rem;
  padding: 1rem;
  border: 1.5px dashed rgba(33, 64, 125, 0.3);
  border-radius: 0.75rem;
  text-align: center;
  font-size: 0.75rem;
  color: rgba(27, 33, 48, 0.5);
  background: rgba(33, 64, 125, 0.03);
}

.phone-btn-primary {
  display: block;
  width: 100%;
  font-family: 'Kanit', sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
  color: #FFFDF8;
  background: linear-gradient(90deg, #ff5ca8, #58c8ff);
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1rem;
  margin-top: 1.5rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.phone-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(239, 79, 152, 0.35);
}
.phone-btn-primary:focus-visible {
  outline: 2px solid #21407D;
  outline-offset: 2px;
}

.phone-btn-secondary {
  display: block;
  width: 100%;
  font-family: 'Kanit', sans-serif;
  font-weight: 600;
  font-size: 0.82rem;
  color: #EF4F98;
  background: #fff;
  border: 1.5px solid rgba(239, 79, 152, 0.5);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  margin-top: 0.75rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.phone-btn-secondary:hover {
  background: #EF4F98;
  color: #fff;
}
.phone-btn-secondary:focus-visible {
  outline: 2px solid #21407D;
  outline-offset: 2px;
}

.phone-nav-row {
  flex-shrink: 0;
  padding: 2.75rem 1.1rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Kanit', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: #1B2130;
  border-bottom: 1px solid rgba(33, 64, 125, 0.1);
}
.phone-nav-link {
  font-family: 'Kanit', sans-serif;
  font-weight: 500;
  font-size: 0.66rem;
  color: #2E7FE0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.phone-check-badge {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: rgba(46, 127, 224, 0.12);
  color: #2E7FE0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 1.25rem;
}

.phone-divider {
  width: 100%;
  height: 1px;
  background: rgba(33, 64, 125, 0.1);
  margin: 1.5rem 0;
}

.phone-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 3px solid rgba(46, 127, 224, 0.2);
  border-top-color: #2E7FE0;
  animation: demo-spin 0.8s linear infinite;
}
@keyframes demo-spin {
  to { transform: rotate(360deg); }
}

.hidden { display: none !important; }

/* ---------- Mail app mockup ---------- */
.mail-nav {
  flex-shrink: 0;
  padding: 2.75rem 1.1rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #2E7FE0;
  border-bottom: 1px solid rgba(33, 64, 125, 0.1);
}
.mail-nav-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1B2130;
}

.mail-list-item {
  position: relative;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid rgba(33, 64, 125, 0.08);
  cursor: pointer;
}
.mail-avatar {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff5ca8, #58c8ff);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mail-avatar-lg {
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.05rem;
}
.mail-list-text { flex: 1; min-width: 0; }
.mail-list-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.mail-sender {
  font-weight: 600;
  font-size: 0.82rem;
  color: #1B2130;
}
.mail-time {
  font-size: 0.68rem;
  color: rgba(27, 33, 48, 0.4);
  flex-shrink: 0;
}
.mail-subject-preview {
  font-size: 0.78rem;
  font-weight: 600;
  color: #1B2130;
  margin: 0.15rem 0 0.1rem;
}
.mail-snippet {
  font-size: 0.72rem;
  color: rgba(27, 33, 48, 0.5);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2E7FE0;
  flex-shrink: 0;
  margin-top: 0.4rem;
}

.mail-detail {
  flex: 1;
  overflow-y: auto;
  padding: 2.75rem 1.25rem 2rem;
}
.mail-back-btn {
  background: none;
  border: none;
  color: #2E7FE0;
  font-family: 'Kanit', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 1rem;
}
.mail-detail-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}
.mail-detail-sender {
  font-weight: 700;
  font-size: 0.85rem;
  color: #1B2130;
  margin: 0;
}
.mail-detail-email {
  font-weight: 400;
  color: rgba(27, 33, 48, 0.4);
  font-size: 0.72rem;
}
.mail-detail-to {
  font-size: 0.72rem;
  color: rgba(27, 33, 48, 0.4);
  margin: 0.1rem 0 0;
}
.mail-detail-subject {
  font-family: 'Kanit', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: #1B2130;
  margin: 0 0 1rem;
}
.mail-detail-body p {
  font-size: 0.82rem;
  line-height: 1.7;
  color: rgba(27, 33, 48, 0.75);
  margin: 0 0 1rem;
}
.mail-detail-footer {
  font-size: 0.68rem !important;
  color: rgba(27, 33, 48, 0.4) !important;
  text-align: center;
  margin-top: 1rem !important;
}
.mail-callout {
  font-size: 0.72rem !important;
  line-height: 1.6;
  color: #21407D !important;
  background: rgba(33, 64, 125, 0.06);
  border-radius: 0.6rem;
  padding: 0.75rem 0.9rem;
  margin-top: 1.25rem !important;
}
.phone-btn-primary:disabled {
  opacity: 0.55;
  cursor: default;
}
.phone-btn-primary:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* ---------- Connection Map graph scene ---------- */
.cm-graph-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 30% 20%, rgba(207, 233, 251, 0.6), transparent 60%);
}
#cm-graph-svg {
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#cm-graph-svg:active {
  cursor: grabbing;
}
.cm-graph-hint {
  position: absolute;
  bottom: 0.75rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.66rem;
  color: rgba(27, 33, 48, 0.4);
  pointer-events: none;
  margin: 0;
}

.cm-node-label {
  font-family: 'Kanit', sans-serif;
  font-size: 10px;
  fill: #1B2130;
  pointer-events: none;
  user-select: none;
}

.cm-detail-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #FFFDF8;
  border-radius: 1.25rem 1.25rem 0 0;
  box-shadow: 0 -10px 30px rgba(33, 64, 125, 0.18);
  padding: 0.6rem 1.25rem 1.5rem;
  transform: translateY(100%);
  transition: transform 0.25s ease;
  z-index: 20;
}
.cm-detail-sheet.is-open {
  transform: translateY(0);
}
.cm-detail-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: rgba(33, 64, 125, 0.2);
  margin: 0 auto 0.85rem;
}

/* ---------- Floating "switch to email / web" buttons ---------- */
.switch-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.5rem;
  z-index: 50;
  font-family: 'Kanit', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: #FFFDF8;
  background: #21407D;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.4rem;
  box-shadow: 0 10px 26px rgba(33, 64, 125, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease;
}
.switch-fab:hover {
  transform: translateY(-2px);
  background: #2E7FE0;
}
.switch-fab:focus-visible {
  outline: 2px solid #EF4F98;
  outline-offset: 2px;
}

@media (max-width: 420px) {
  .iphone-frame { width: 92vw; height: calc(92vw * 2.06); max-height: 78vh; }
}

@media (prefers-reduced-motion: reduce) {
  .phone-spinner { animation: none; }
  .cm-detail-sheet, .switch-fab, .demo-reset-btn, .phone-btn-primary {
    transition: none !important;
  }
}
