viewport-base.css 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /* ===========================================
  2. VIEWPORT FITTING: MANDATORY BASE STYLES
  3. Include this ENTIRE file in every presentation.
  4. These styles ensure slides fit exactly in the viewport.
  5. =========================================== */
  6. /* 1. Lock html/body to viewport */
  7. html, body {
  8. height: 100%;
  9. overflow-x: hidden;
  10. }
  11. html {
  12. scroll-snap-type: y mandatory;
  13. scroll-behavior: smooth;
  14. }
  15. /* 2. Each slide = exact viewport height */
  16. .slide {
  17. width: 100vw;
  18. height: 100vh;
  19. height: 100dvh; /* Dynamic viewport height for mobile browsers */
  20. overflow: hidden; /* CRITICAL: Prevent ANY overflow */
  21. scroll-snap-align: start;
  22. display: flex;
  23. flex-direction: column;
  24. position: relative;
  25. }
  26. /* 3. Content container with flex for centering */
  27. .slide-content {
  28. flex: 1;
  29. display: flex;
  30. flex-direction: column;
  31. justify-content: center;
  32. max-height: 100%;
  33. overflow: hidden; /* Double-protection against overflow */
  34. padding: var(--slide-padding);
  35. }
  36. /* 4. ALL typography uses clamp() for responsive scaling */
  37. :root {
  38. /* Titles scale from mobile to desktop */
  39. --title-size: clamp(1.5rem, 5vw, 4rem);
  40. --h2-size: clamp(1.25rem, 3.5vw, 2.5rem);
  41. --h3-size: clamp(1rem, 2.5vw, 1.75rem);
  42. /* Body text */
  43. --body-size: clamp(0.75rem, 1.5vw, 1.125rem);
  44. --small-size: clamp(0.65rem, 1vw, 0.875rem);
  45. /* Spacing scales with viewport */
  46. --slide-padding: clamp(1rem, 4vw, 4rem);
  47. --content-gap: clamp(0.5rem, 2vw, 2rem);
  48. --element-gap: clamp(0.25rem, 1vw, 1rem);
  49. }
  50. /* 5. Cards/containers use viewport-relative max sizes */
  51. .card, .container, .content-box {
  52. max-width: min(90vw, 1000px);
  53. max-height: min(80vh, 700px);
  54. }
  55. /* 6. Lists auto-scale with viewport */
  56. .feature-list, .bullet-list {
  57. gap: clamp(0.4rem, 1vh, 1rem);
  58. }
  59. .feature-list li, .bullet-list li {
  60. font-size: var(--body-size);
  61. line-height: 1.4;
  62. }
  63. /* 7. Grids adapt to available space */
  64. .grid {
  65. display: grid;
  66. grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  67. gap: clamp(0.5rem, 1.5vw, 1rem);
  68. }
  69. /* 8. Images constrained to viewport */
  70. img, .image-container {
  71. max-width: 100%;
  72. max-height: min(50vh, 400px);
  73. object-fit: contain;
  74. }
  75. /* ===========================================
  76. RESPONSIVE BREAKPOINTS
  77. Aggressive scaling for smaller viewports
  78. =========================================== */
  79. /* Short viewports (< 700px height) */
  80. @media (max-height: 700px) {
  81. :root {
  82. --slide-padding: clamp(0.75rem, 3vw, 2rem);
  83. --content-gap: clamp(0.4rem, 1.5vw, 1rem);
  84. --title-size: clamp(1.25rem, 4.5vw, 2.5rem);
  85. --h2-size: clamp(1rem, 3vw, 1.75rem);
  86. }
  87. }
  88. /* Very short viewports (< 600px height) */
  89. @media (max-height: 600px) {
  90. :root {
  91. --slide-padding: clamp(0.5rem, 2.5vw, 1.5rem);
  92. --content-gap: clamp(0.3rem, 1vw, 0.75rem);
  93. --title-size: clamp(1.1rem, 4vw, 2rem);
  94. --body-size: clamp(0.7rem, 1.2vw, 0.95rem);
  95. }
  96. /* Hide non-essential elements */
  97. .nav-dots, .keyboard-hint, .decorative {
  98. display: none;
  99. }
  100. }
  101. /* Extremely short (landscape phones, < 500px height) */
  102. @media (max-height: 500px) {
  103. :root {
  104. --slide-padding: clamp(0.4rem, 2vw, 1rem);
  105. --title-size: clamp(1rem, 3.5vw, 1.5rem);
  106. --h2-size: clamp(0.9rem, 2.5vw, 1.25rem);
  107. --body-size: clamp(0.65rem, 1vw, 0.85rem);
  108. }
  109. }
  110. /* Narrow viewports (< 600px width) */
  111. @media (max-width: 600px) {
  112. :root {
  113. --title-size: clamp(1.25rem, 7vw, 2.5rem);
  114. }
  115. /* Stack grids vertically */
  116. .grid {
  117. grid-template-columns: 1fr;
  118. }
  119. }
  120. /* ===========================================
  121. REDUCED MOTION
  122. Respect user preferences
  123. =========================================== */
  124. @media (prefers-reduced-motion: reduce) {
  125. *, *::before, *::after {
  126. animation-duration: 0.01ms !important;
  127. transition-duration: 0.2s !important;
  128. }
  129. html {
  130. scroll-behavior: auto;
  131. }
  132. }