/* ==========================================================================
   Vasily Petrovich Zvezdochkin - Matryoshka WebAR Page Styles
   Pixel-Perfect Match to Historical Reference Mockup
   ========================================================================== */

/* Custom Customer Fonts */
@font-face {
  font-family: 'Posad Neue';
  src: url('Fonts/Posad Neue.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SK Posad Sokolov';
  src: url('Fonts/SK Posad Соколов.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SK Posad Favorsky';
  src: url('Fonts/SK Posad Фаворский.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Color Variables */
:root {
  --bg-parchment: #f9f4ea;
  --bg-card: #f5efe3;
  --bg-card-border: #e6ded0;
  --text-dark: #2d1a1a;
  --text-burgundy: #581818;
  --text-body: #3c322d;
  --text-sub: #665b53;
  --accent-gold: #c4a982;
  --border-frame: #d9cbb2;
  --font-posad: 'Posad Neue', 'SK Posad Sokolov', 'Georgia', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset & Fixed Viewport Lock */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body {
  background-color: #e9e0d1;
  background-image: radial-gradient(#d8ccb8 1px, transparent 1px);
  background-size: 24px 24px;
  font-family: var(--font-sans);
  color: var(--text-body);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: clamp(0px, 1.5vh, 10px) clamp(0px, 2vw, 8px);
}

/* Outer Parchment Card */
.page-wrapper {
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 100dvh;
  background-color: var(--bg-parchment);
  background-image: 
    radial-gradient(ellipse at top left, rgba(255, 255, 255, 0.7), transparent 70%),
    radial-gradient(ellipse at bottom right, rgba(200, 175, 135, 0.2), transparent 70%);
  border-radius: clamp(0px, 1.8vh, 14px);
  box-shadow: 
    0 12px 30px rgba(50, 30, 15, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
  padding: clamp(12px, 1.8vh, 22px) clamp(14px, 3vw, 20px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Fine Double Frame Border */
.frame-border {
  position: absolute;
  top: clamp(5px, 0.8vh, 8px);
  left: clamp(5px, 0.8vw, 8px);
  right: clamp(5px, 0.8vw, 8px);
  bottom: clamp(5px, 0.8vh, 8px);
  border: 1px solid var(--border-frame);
  pointer-events: none;
  border-radius: clamp(4px, 0.8vh, 8px);
  z-index: 2;
}

.frame-border::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  border: 1px dashed var(--accent-gold);
  opacity: 0.5;
  border-radius: clamp(2px, 0.6vh, 6px);
}

/* Corner Flourishes (Top) */
.corner-flourish {
  position: absolute;
  width: clamp(38px, 6vh, 52px);
  height: clamp(38px, 6vh, 52px);
  pointer-events: none;
  opacity: 0.75;
  z-index: 1;
}

.corner-flourish.top-left { top: clamp(6px, 1vh, 10px); left: clamp(6px, 1vw, 10px); }
.corner-flourish.top-right { top: clamp(6px, 1vh, 10px); right: clamp(6px, 1vw, 10px); transform: scaleX(-1); }

/* Large Russian Khokhloma Bottom Corner Floral Ornaments */
.bottom-floral {
  position: absolute;
  width: clamp(75px, 17vw, 130px);
  height: clamp(75px, 17vw, 130px);
  pointer-events: none;
  opacity: 0.85;
  z-index: 1;
}

.bottom-floral.bottom-left {
  bottom: clamp(3px, 0.6vh, 8px);
  left: clamp(3px, 0.6vw, 8px);
}

.bottom-floral.bottom-right {
  bottom: clamp(3px, 0.6vh, 8px);
  right: clamp(3px, 0.6vw, 8px);
  transform: scaleX(-1);
}

/* Center Dividers */
.center-ornament {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  color: var(--accent-gold);
  flex-shrink: 0;
  position: relative;
  z-index: 3;
}

.ornament-line {
  height: 1px;
  width: clamp(35px, 7vw, 50px);
  background: linear-gradient(to right, transparent, var(--accent-gold), transparent);
}

.ornament-dot {
  font-size: 5px;
  opacity: 0.8;
}

.ornament-diamond {
  font-size: 11px;
}

/* Header Grid */
.header-section {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  align-items: center;
  text-align: center;
  gap: clamp(4px, 1vw, 8px);
  flex-shrink: 0;
  margin: clamp(1px, 0.4vh, 4px) 0;
  position: relative;
  z-index: 3;
}

/* Transparent Line Art Illustrations */
.header-illustration {
  width: 100%;
  max-width: clamp(65px, 9.2vh, 90px);
  height: clamp(65px, 9.2vh, 90px);
  object-fit: contain;
  margin: 0 auto;
  border: none;
  background: transparent;
  filter: contrast(1.1) sepia(0.12);
}

/* Center Person Badge */
.person-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.portrait-frame {
  width: clamp(48px, 6.8vh, 64px);
  height: clamp(48px, 6.8vh, 64px);
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid var(--accent-gold);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  margin-bottom: clamp(1px, 0.3vh, 3px);
  background-color: transparent;
}

.portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.2) sepia(0.12);
}

.person-name-top {
  font-family: var(--font-posad);
  font-size: clamp(11.5px, 1.6vh, 13px);
  color: var(--text-dark);
  letter-spacing: 0.3px;
  line-height: 1.1;
}

.person-name-main {
  font-family: var(--font-posad);
  font-size: clamp(17px, 2.4vh, 21px);
  font-weight: 700;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  line-height: 1.05;
}

.person-years {
  font-family: var(--font-posad);
  font-size: clamp(12.5px, 1.7vh, 14px);
  color: var(--text-burgundy);
  margin-top: 1px;
  font-weight: 600;
}

/* Main Title (Two-Tone) */
.main-title {
  font-family: var(--font-posad);
  text-align: center;
  line-height: 1.1;
  flex-shrink: 0;
  margin: clamp(2px, 0.5vh, 5px) 0;
  position: relative;
  z-index: 3;
}

.title-dark {
  display: block;
  font-size: clamp(23px, 3.6vh, 32px);
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: 0.5px;
}

.title-burgundy {
  display: block;
  font-size: clamp(23px, 3.6vh, 32px);
  font-weight: 700;
  color: var(--text-burgundy);
  letter-spacing: 0.5px;
}

/* Title Divider */
.title-divider {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  color: var(--accent-gold);
  margin: clamp(1px, 0.3vh, 4px) 0;
  flex-shrink: 0;
  position: relative;
  z-index: 3;
}

.t-line {
  height: 1px;
  width: clamp(28px, 5vw, 42px);
  background: linear-gradient(to right, transparent, var(--accent-gold), transparent);
}

.t-dot {
  font-size: 4px;
  opacity: 0.7;
}

.t-diamond {
  font-size: 10px;
}

/* Instruction Cards Section */
.steps-container {
  background-color: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: clamp(10px, 1.5vh, 13px);
  padding: clamp(6px, 1.2vh, 12px) clamp(10px, 2.2vw, 16px);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
  flex-shrink: 0;
  margin: clamp(2px, 0.5vh, 5px) 0;
  position: relative;
  z-index: 3;
}

.step-row {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 14px);
  padding: clamp(1px, 0.3vh, 3px) 0;
}

.step-divider {
  height: 1px;
  border-bottom: 1px dashed #d8cfc0;
  margin: clamp(3px, 0.5vh, 5px) 0;
}

.step-number {
  width: clamp(25px, 3.6vh, 30px);
  height: clamp(25px, 3.6vh, 30px);
  min-width: clamp(25px, 3.6vh, 30px);
  background-color: var(--text-burgundy);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-posad);
  font-size: clamp(14px, 2vh, 16px);
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(88,24,24,0.25);
}

.step-icon-wrapper {
  width: clamp(42px, 5.8vh, 52px);
  height: clamp(42px, 5.8vh, 52px);
  min-width: clamp(42px, 5.8vh, 52px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-icon-wrapper svg {
  width: 100%;
  height: 100%;
}

.step-text {
  font-size: clamp(12px, 1.6vh, 14px);
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-dark);
}

/* Primary AR Launch Button */
.action-wrapper {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  margin: clamp(2px, 0.5vh, 5px) 0;
  position: relative;
  z-index: 3;
}

.btn-launch-ar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 390px;
  padding: clamp(11px, 1.6vh, 14px) 20px;
  background-color: var(--text-burgundy);
  color: #ffffff;
  border: none;
  border-radius: clamp(10px, 1.4vh, 12px);
  font-family: var(--font-posad);
  font-size: clamp(18px, 2.5vh, 21px);
  font-weight: 700;
  letter-spacing: 0.8px;
  cursor: pointer;
  box-shadow: 
    0 8px 18px rgba(88, 24, 24, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s, background-color 0.2s;
  user-select: none;
}

.btn-launch-ar:hover {
  background-color: #6a1d1d;
  transform: translateY(-1px);
}

.btn-launch-ar:active {
  transform: translateY(1px);
}

.ar-btn-icon {
  width: clamp(20px, 2.8vh, 24px);
  height: clamp(20px, 2.8vh, 24px);
}

/* Footer Section: 2 Perfectly Centered Browsers */
.footer-section {
  text-align: center;
  flex-shrink: 0;
  position: relative;
  z-index: 3;
  margin-top: clamp(2px, 0.4vh, 4px);
  width: 100%;
}

.footer-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: clamp(4px, 0.6vh, 8px);
}

.f-line {
  height: 1px;
  width: clamp(25px, 6vw, 45px);
  background: linear-gradient(to right, transparent, var(--border-frame), transparent);
}

.f-text {
  font-family: var(--font-posad);
  font-size: clamp(10.5px, 1.4vh, 12px);
  font-weight: 600;
  color: var(--text-dark);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.browser-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(32px, 8vw, 56px);
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.browser-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 60px;
}

.browser-icon {
  width: clamp(24px, 3.2vh, 30px);
  height: clamp(24px, 3.2vh, 30px);
  display: block;
  margin: 0 auto 3px auto;
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
  border-radius: 50%;
}

.browser-name {
  font-size: clamp(10.5px, 1.4vh, 12px);
  color: var(--text-body);
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

/* Hidden Model Viewer for background AR */
model-viewer#ar-viewer {
  position: absolute;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Desktop 3D Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(20, 10, 10, 0.75);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: var(--bg-parchment);
  width: 90%;
  max-width: 440px;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: #e5dac4;
  border: none;
  font-size: 18px;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-title {
  font-family: var(--font-posad);
  font-size: 20px;
  color: var(--text-dark);
  margin-bottom: 8px;
  text-align: center;
}

.modal-3d-wrapper {
  width: 100%;
  height: 250px;
  background-color: #f2e6d0;
  border-radius: 12px;
  border: 1px solid var(--bg-card-border);
  overflow: hidden;
  margin-bottom: 10px;
}

.modal-3d-wrapper model-viewer {
  width: 100%;
  height: 100%;
  display: block !important;
}

.modal-hint {
  font-size: 12px;
  color: var(--text-sub);
  text-align: center;
  line-height: 1.35;
}
