/* ===== MOBILE.CSS - For screens 480px and below ===== */

/* Import the same font and use the same CSS variables */
@font-face {
  font-family: "Barriecito-Regular";
  src: url("fonts/Barriecito-Regular.ttf") format("truetype");
}

/* Use the same global variables as desktop */
:root {
  --border-width: 1px;
  --border-color: #288dff;
  --grid-color-rgb: 40, 141, 255;
  --grid-opacity: 0.1;
  --grid-thickness: 1px;
  --grid-scale: 30px;
  --grid-rotation: 0deg;
}

/* Only apply these styles for mobile screens (480px and below) */
@media (max-width: 480px) {
  /* === BASIC MOBILE LAYOUT === */

  /* Reset and basic styles */
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  body {
    font-family: "Space Mono", monospace;
    font-size: 11px;
    background-color: white;
    padding: 10px;
    overflow: hidden;
  }

  .container {
    width: 100%;
    /* Fallback for older browsers */
    height: calc(100vh - 20px);
    max-height: calc(100vh - 20px);
    /* Use CSS custom property set by JavaScript */
    height: calc(var(--vh, 1vh) * 100 - 20px);
    max-height: calc(var(--vh, 1vh) * 100 - 20px);
    /* Modern browsers with dynamic viewport height support */
    height: calc(100dvh - 20px);
    max-height: calc(100dvh - 20px);
    background-color: white;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  }

  /* === MOBILE LAYOUT STRUCTURE === */

  .container {
    display: flex;
    flex-direction: column;
    height: 100vh;
  }

  /* === NAME CONTAINER === */

  .name-container {
    height: 68px;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border: var(--border-width) solid var(--border-color);
    border-bottom: none;
    cursor: pointer;
  }

  .name-container h1 {
    font-family: "Barriecito-Regular", sans-serif;
    font-size: 36px;
    font-weight: 400;
    color: #288dff;
    line-height: 0.8;
    text-align: center;
    margin: 0;
    padding: 0;
  }

  /* === MENU TOP === */

  .menu-top {
    height: 38px;
    min-height: 38px;
    display: flex;
    border: var(--border-width) solid var(--border-color);
    border-bottom: none;
    width: 100%;
    box-sizing: border-box;
    gap: 0;
    font-size: 0; /* Remove whitespace between inline elements */
  }

  .menu-top .menu-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border: none;
    border-right: var(--border-width) solid var(--border-color);
    cursor: pointer;
    font-family: "Space Mono", monospace;
    font-size: 14px;
    color: black;
    transition: background-color 0.3s ease;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    outline: none;
  }

  .menu-top .menu-button:first-child {
    flex: 4;
  }

  .menu-top .menu-button:nth-child(2) {
    flex: 2;
  }

  .menu-top .menu-button:nth-child(3) {
    flex: 4;
    border-right: none;
  }

  .menu-top .menu-button:hover,
  .menu-top .menu-button.active,
  .menu-top .menu-button.project-active {
    background-color: #eaf4ff;
  }

  /* === MAIN CONTENT BODY === */

  .main-content-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    border: var(--border-width) solid var(--border-color);
    border-bottom: none;
    background-color: white;
  }

  /* === PREVENT HORIZONTAL SCROLLING === */

  body {
    overflow-x: hidden !important;
  }

  .container {
    overflow-x: hidden !important;
  }

  .main-content-body {
    overflow-x: hidden !important;
  }

  /* Ensure project content doesn't overflow horizontally */
  .container.mobile-project-view
    .project-detail-content
    > *:not(ul):not(li):not(.content-index-box) {
    max-width: 100% !important;
    overflow-x: hidden !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
  }

  /* Handle images and media */
  .container.mobile-project-view img,
  .container.mobile-project-view video,
  .container.mobile-project-view iframe {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Handle tables if any */
  .container.mobile-project-view table {
    width: 100% !important;
    table-layout: fixed !important;
  }

  /* Handle pre and code blocks */
  .container.mobile-project-view pre,
  .container.mobile-project-view code {
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow-x: hidden !important;
  }

  /* === MENU BOTTOM === */

  .menu-bottom {
    height: 38px;
    min-height: 38px;
    display: flex;
    border: var(--border-width) solid var(--border-color);
  }

  .menu-bottom .menu-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border: none;
    border-right: var(--border-width) solid var(--border-color);
    cursor: pointer;
    font-family: "Space Mono", monospace;
    font-size: 14px;
    color: black;
    transition: background-color 0.3s ease;
  }

  .menu-bottom .menu-button:last-child {
    border-right: none;
  }

  .menu-bottom .menu-button:hover,
  .menu-bottom .menu-button.active {
    background-color: #eaf4ff;
  }

  /* === HIDE DESKTOP ELEMENTS === */

  .header {
    display: none !important;
  }

  .titles-section {
    display: none !important;
  }

  .main-body {
    display: none !important;
  }

  .footer {
    display: none !important;
  }

  /* === SHOW DESKTOP CONTENT IN MOBILE LAYOUT === */

  /* Move the desktop content into mobile main-content-body */
  .main-content-body .project-detail-content {
    display: block;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 0;
  }

  /* Hide the original desktop center column */
  .center-column {
    display: none !important;
  }

  /* === REUSE DESKTOP HOMEPAGE COMPONENTS FOR MOBILE === */

  .home-content-container {
    padding: 15px !important;
    gap: 10px !important;
    min-height: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    box-sizing: border-box !important;
  }

  .home-greeting {
    display: none !important;
  }

  .home-text {
    font-size: 14px !important;
    line-height: 1.5 !important;
    margin-bottom: 0 !important;
    text-align: center !important;
    padding: 0 !important;
  }

  /* Rearrange home-boxes-container for mobile layout */
  .home-boxes-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    order: 2 !important;
    flex: 1 !important;
    gap: 10px !important;
  }

  /* Style stats box as horizontal row and put it first */
  .stats-box {
    order: 1 !important;
    flex: none !important;
    padding: 0 !important;
    margin: 15px 0 10px 0 !important;
    background: none !important;
    border: none !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .stat-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 1 !important;
    min-width: 60px !important;
    /* Preserve desktop animations */
    opacity: 0; /* Initially hidden for entrance animation */
  }

  .stat-item.visible {
    animation: fadeInUp 0.5s ease-out forwards !important;
    animation-delay: var(--animation-delay, 0s) !important;
  }

  .stat-circle {
    width: 45px !important;
    height: 45px !important;
    font-size: 13px !important;
    font-weight: bold !important;
    border: 2px dashed var(--border-color) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: white !important;
    color: var(--border-color) !important;
  }

  .stat-circle.spinning {
    animation-name: spin !important;
    animation-timing-function: linear !important;
  }

  .stat-label {
    font-size: 12px !important;
    color: var(--border-color) !important;
    text-align: center !important;
    line-height: 1.2 !important;
  }

  /* Move 3D model to bottom and stretch to fill remaining space */
  #home-model-box {
    order: 2 !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    flex: 1 !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
  }

  #home-model-box model-viewer {
    width: 100% !important;
    height: 100% !important;
    background-color: transparent !important;
  }

  /* Hide CTA button for now to match reference */
  .cta-button {
    display: none !important;
  }

  /* Paper link button - visible on mobile */
  .paper-link-button {
    background-color: var(--border-color) !important;
    color: white !important;
    border: none !important;
    padding: 12px 24px !important;
    font-family: "Space Mono", monospace !important;
    font-size: 0.9rem !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
    transform: translateZ(0) !important;
    backface-visibility: hidden !important;
    display: inline-block !important;
    text-decoration: none !important;
  }

  .paper-link-button:hover {
    background-color: #3d7bc6 !important;
  }

  /* === MOBILE PROJECT VIEW STATE === */

  /* Hide bottom buttons when in project view */
  .container.mobile-project-view .menu-bottom {
    display: none !important;
  }

  /* Hide homepage content when in project view */
  .container.mobile-project-view .home-content-container {
    display: none !important;
  }

  /* Show project content when in project view */
  .container.mobile-project-view .main-content-body {
    display: block !important;
    flex: 1 !important;
    overflow: hidden !important;
    border: var(--border-width) solid var(--border-color) !important;
    border-bottom: var(--border-width) solid var(--border-color) !important;
  }

  /* Style project content for mobile */
  .container.mobile-project-view .project-detail-content {
    width: 100% !important;
    max-width: none !important;
    padding: 15px !important; /* Add 15px padding all around */
    font-size: 14px !important;
    line-height: 1.6 !important;
    height: 100% !important;
    overflow-y: auto !important;
    /* overflow-x: hidden !important; <-- REMOVED */
  }

  .container.mobile-project-view .project-detail-content h1 {
    display: none !important;
  }

  .container.mobile-project-view .project-detail-content h1 + p {
    font-size: 14px !important;
    margin-bottom: 20px !important;
    font-weight: bold !important;
    color: #666 !important;
    text-align: center !important;
  }

  .container.mobile-project-view .project-detail-content h2 {
    font-size: 24px !important;
    margin-bottom: 15px !important;
  }

  .container.mobile-project-view .project-detail-content h3 {
    font-size: 18px !important;
    margin: 20px 0 10px 0 !important;
  }

  .container.mobile-project-view .project-detail-content p {
    font-size: 14px !important;
    line-height: 1.6 !important;
    margin-bottom: 15px !important;
  }

  .container.mobile-project-view .project-detail-content img {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    display: block !important;
    border: var(--border-width) solid var(--border-color) !important;
  }

  .container.mobile-project-view .project-detail-content figure {
    margin: 20px 0 !important;
  }

  .container.mobile-project-view .project-detail-content figcaption {
    font-size: 12px !important;
    color: #666 !important;
    margin-top: 8px !important;
    text-align: center !important;
  }

  /* === MOBILE PROJECT DETAIL CONTENT LIST STYLING === */
  .container.mobile-project-view .project-detail-content ul:not(.content-index-box *) {
    margin: 12px 0 !important;
    padding-left: 0 !important;
    list-style: none !important;
  }

  .container.mobile-project-view .project-detail-content ul:not(.content-index-box *) li {
    margin-bottom: 6px !important;
    padding-left: 15px !important;
    position: relative !important;
    line-height: 1.4 !important;
  }

  .container.mobile-project-view .project-detail-content ul:not(.content-index-box *) li:before {
    content: "•" !important;
    color: var(--border-color) !important;
    font-weight: bold !important;
    position: absolute !important;
    left: 0 !important;
  }

  /* === DESKTOP-IDENTICAL CONTENT INDEX BOX FOR MOBILE === */

  .container.mobile-project-view .content-index-box {
    background-color: #e8f4fd !important;
    padding: 20px 15px !important; /* Adjust padding to align text */
    margin: 0 -15px 10px -15px !important; /* Use negative margins to break out of padding */
  }

  .container.mobile-project-view .content-index-box p {
    margin-top: 0 !important;
    margin-bottom: 12px !important;
    color: var(--border-color) !important;
    font-weight: normal !important;
    font-size: 24px !important;
    padding-left: 0 !important; /* Remove specific padding, now handled by parent */
    font-family: "Barriecito-Regular", sans-serif !important;
  }

  .container.mobile-project-view .content-index-box ul {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 0 !important;
  }

  .container.mobile-project-view .content-index-box ul li a {
    display: block !important;
    padding: 0 0 0 25px !important; /* Adjust padding to align with title */
    color: #288dff !important;
    text-decoration: underline !important;
    transition: color 0.2s !important;
    font-size: 16px !important;
    line-height: auto !important;
  }

  .container.mobile-project-view .content-index-box ul li a:hover {
    color: #2d6bb5 !important;
    text-decoration: underline !important;
  }

  /* Style for indented items in the content index box */
  .container.mobile-project-view .content-index-box li.indented {
    padding-left: 20px !important;
    position: relative !important;
  }

  .container.mobile-project-view .content-index-box li.indented::before {
    content: "•" !important;
    color: var(--border-color) !important;
    position: absolute !important;
    left: 40px !important;
  }

  .container.mobile-project-view .content-index-box li.indented a {
    padding-left: 35px !important;
  }

  /* === MOBILE PROJECT PAGE H2 SPACING === */

  .container.mobile-project-view h2 {
    margin-bottom: 20px !important;
  }

  /* === DESKTOP-IDENTICAL DETAIL COMPONENTS FOR MOBILE === */

  .container.mobile-project-view .detail-component {
    width: 90% !important;
    margin: 0 auto 20px auto !important;
    border: 1px solid #c7ddf5 !important;
    border-radius: 0px !important;
    overflow: hidden !important;
    background-color: white !important;
  }

  .container.mobile-project-view .detail-header {
    background-color: #eaf2fa !important;
    min-height: 40px !important;
    padding: 10px 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-bottom: 1px solid #c7ddf5 !important;
  }

  .container.mobile-project-view .detail-header.closable {
    cursor: pointer !important;
  }

  .container.mobile-project-view .toggle-icon {
    font-size: 24px !important;
    font-weight: bold !important;
    color: #288dff !important;
  }

  .container.mobile-project-view .detail-header h4 {
    margin: 0 !important;
    font-weight: 500 !important;
    font-size: 1rem !important;
    color: #333 !important;
    line-height: 1.3 !important;
    word-wrap: break-word !important;
  }

  .container.mobile-project-view .detail-content {
    padding: 20px !important;
    overflow: hidden !important;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out !important;
    max-height: 1000px !important;
  }

  .container.mobile-project-view .detail-content.collapsed {
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-top: none !important;
  }

  .container.mobile-project-view .detail-image-wrapper {
    overflow: hidden !important;
    transition: max-height 0.3s ease-out !important;
    max-height: 1000px !important;
  }

  .container.mobile-project-view .detail-image-wrapper.collapsed {
    max-height: 0 !important;
    border-top: none !important;
  }

  .container.mobile-project-view .detail-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
  }

  .container.mobile-project-view .detail-table-wrapper {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    max-height: 1000px; /* Arbitrary large value */
    padding: 0;
  }

  .container.mobile-project-view .detail-table-wrapper.collapsed {
    max-height: 0;
    border-top: none;
  }

  .container.mobile-project-view .detail-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 12px;
  }

  .container.mobile-project-view .detail-table th,
  .container.mobile-project-view .detail-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
  }

  .container.mobile-project-view .detail-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #c7ddf5;
    font-size: 11px;
  }



  .container.mobile-project-view .detail-table tbody tr:last-child td {
    border-bottom: none;
  }

  /* === MOBILE WORKFLOW COMPONENT === */
  .container.mobile-project-view .workflow-component {
    width: 90%;
    margin: 0 auto 20px auto;
  }

  .container.mobile-project-view .workflow-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 6px;
  }

  .container.mobile-project-view .workflow-step {
    background-color: #f9fcff;
    padding: 16px 12px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    border: 1px solid #c7ddf5;
    border-radius: 4px;
  }

  .container.mobile-project-view .workflow-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: none;
  }

  .container.mobile-project-view .workflow-bottom {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
  }

  .container.mobile-project-view .workflow-icon {
    font-size: 1.4rem;
    width: 1.4rem;
    height: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
    margin-bottom: 6px;
  }

  .container.mobile-project-view .workflow-icon svg {
    width: 100%;
    height: 100%;
    color: #288dff;
    stroke: #288dff;
    stroke-width: 2.5;
  }

  .container.mobile-project-view .workflow-label {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    color: #288dff;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: center;
    max-width: 90px;
    margin-bottom: 4px;
  }

  .container.mobile-project-view .workflow-text {
    font-size: 0.82rem;
    line-height: 1.3;
    max-width: 140px;
    text-align: center;
  }

  /* === MOBILE FLOW COMPONENT === */
  .container.mobile-project-view .flow-component {
    width: 90%;
    margin: 0 auto 20px auto;
  }

  .container.mobile-project-view .flow-container {
    display: flex;
    flex-direction: column; /* Stack vertically on mobile */
    gap: 12px;
    align-items: stretch;
  }

  .container.mobile-project-view .flow-step {
    flex: none;
    background-color: #f9fcff;
    border: 1px solid #c7ddf5;
    border-radius: 4px;
    padding: 16px 12px;
    min-height: 120px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
  }

  .container.mobile-project-view .flow-step-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    max-width: 100%;
  }

  .container.mobile-project-view .flow-icon {
    font-size: 1.4rem;
    width: 1.4rem;
    height: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
  }

  .container.mobile-project-view .flow-icon svg {
    width: 100%;
    height: 100%;
    color: #288dff;
    stroke: #288dff;
    stroke-width: 2.5;
  }

  .container.mobile-project-view .flow-header {
    font-weight: 600;
    color: #288dff;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.2;
  }

  .container.mobile-project-view .flow-text {
    font-size: 0.82rem;
    color: #555;
    line-height: 1.3;
  }

  .container.mobile-project-view .flow-arrow {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    padding: 8px;
    transform: rotate(90deg); /* Rotate arrow to point down */
  }

  .container.mobile-project-view .flow-arrow svg {
    width: 20px;
    height: 20px;
    color: #288dff;
    stroke: #288dff;
  }

  /* === MOBILE PROJECT INFO SECTION === */

  .mobile-project-info {
    margin-bottom: 20px !important;
    padding-bottom: 15px !important;
  }

  /* Style for the newly moved H2 */
  .mobile-project-info h2 {
    text-align: left !important;
    font-size: 22px !important; /* Slightly smaller than original h2 */
    margin-bottom: 15px !important;
    padding: 0 !important; /* Padding now handled by parent */
  }

  .mobile-description,
  .mobile-details {
    margin-bottom: 15px !important;
  }

  .mobile-description:last-child,
  .mobile-details:last-child {
    margin-bottom: 0 !important;
  }

  .mobile-description {
    margin-bottom: 0 !important;
  }

  .mobile-description p:first-child,
  .mobile-details p:first-child {
    margin: 0 0 8px 0 !important;
    font-size: 14px !important;
    color: black !important;
    font-weight: normal !important;
  }

  .mobile-description p:first-child strong,
  .mobile-details p:first-child strong {
    background-color: #e8f4fd !important;
    color: black !important;
    padding: 2px 0 !important;
    font-weight: bold !important;
    display: inline !important;
    font-size: 14px !important;
  }

  .mobile-description p:not(:first-child) {
    font-size: 14px !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    font-style: italic !important;
  }

  .mobile-details div {
    font-size: 14px !important;
    line-height: 1.4 !important;
  }

  .mobile-details p {
    margin: 0 0 3px 0 !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
  }

  .mobile-details p:last-child {
    margin-bottom: 0 !important;
  }

  .mobile-details ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
  }

  .mobile-details li {
    margin: 0 0 8px 0 !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    padding: 0 !important;
  }

  .mobile-details li:last-child {
    margin-bottom: 0 !important;
  }

  .mobile-details .details-link {
    color: var(--border-color) !important;
    text-decoration: underline !important;
  }

  /* === MOBILE DETAIL COMPONENTS (COLLAPSIBLE) === */

  .mobile-detail-component {
    margin-bottom: 15px !important;
    border: var(--border-width) solid var(--border-color) !important;
    border-radius: 0px !important;
    overflow: hidden !important;
    background-color: white !important;
  }

  .mobile-detail-header {
    background-color: #eaf2fa !important;
    padding: 10px 15px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    cursor: pointer !important;
    font-family: "Space Mono", monospace !important;
    font-size: 14px !important;
    font-weight: bold !important;
    color: #333 !important;
    border-bottom: var(--border-width) solid var(--border-color) !important;
  }

  .mobile-toggle-icon {
    font-size: 14px !important;
    font-weight: bold !important;
    color: #288dff !important;
    line-height: 1 !important;
  }

  .mobile-detail-content {
    padding: 15px !important;
    overflow: hidden !important;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out !important;
    max-height: 1000px !important;
  }

  .mobile-detail-content.collapsed {
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-top: none !important;
  }

  .mobile-detail-content ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
  }

  .mobile-detail-content li {
    margin: 0 0 8px 0 !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    padding: 0 !important;
  }

  .mobile-detail-content li:last-child {
    margin-bottom: 0 !important;
  }

  .mobile-detail-content .details-link {
    color: var(--border-color) !important;
    text-decoration: underline !important;
  }

  /* Mobile details labels background (match desktop) */
  .mobile-details strong,
  .mobile-details b {
    background-color: #e8f4fd !important;
    color: black !important;
    padding: 2px 0 !important;
    font-weight: bold !important;
    display: inline !important;
  }

  /* === MOBILE CONTACT PAGE STYLES === */

  /* Mobile contact form */
  .mobile-contact-form {
    margin-bottom: 30px !important;
  }

  .mobile-contact-form h3 {
    font-size: 18px !important;
    margin-bottom: 15px !important;
    text-align: left !important;
  }

  .container.mobile-project-view .contact-form {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }

  .container.mobile-project-view .form-group {
    display: flex !important;
    flex-direction: column !important;
  }

  .container.mobile-project-view .form-group label {
    margin-bottom: 8px !important;
    font-weight: bold !important;
    color: #333 !important;
    font-size: 14px !important;
  }

  .container.mobile-project-view .form-group input,
  .container.mobile-project-view .form-group textarea {
    padding: 12px !important;
    border: var(--border-width) solid var(--border-color) !important;
    background-color: #f8f9fa !important;
    font-family: "Space Mono", monospace !important;
    font-size: 16px !important;
    transition: box-shadow 0.2s ease, border-color 0.2s ease !important;
  }

  .container.mobile-project-view .form-group input:focus,
  .container.mobile-project-view .form-group textarea:focus {
    outline: none !important;
    border-color: #3d7bc6 !important;
    box-shadow: 0 0 0 3px rgba(40, 141, 255, 0.2) !important;
  }

  .container.mobile-project-view .submit-button {
    padding: 15px !important;
    background-color: var(--border-color) !important;
    color: white !important;
    border: none !important;
    font-family: "Space Mono", monospace !important;
    font-size: 14px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
  }

  .container.mobile-project-view .submit-button:hover {
    background-color: #3d7bc6 !important;
  }

  .container.mobile-project-view .submit-button:disabled {
    background-color: #ccc !important;
    cursor: not-allowed !important;
  }

  .container.mobile-project-view .submit-button:disabled:hover {
    background-color: #ccc !important;
  }

  .container.mobile-project-view .form-status {
    margin-top: 15px !important;
  }

  .container.mobile-project-view .success-message {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 15px !important;
    background-color: #d4edda !important;
    color: #155724 !important;
    border: 1px solid #c3e6cb !important;
    border-radius: 4px !important;
    font-family: "Space Mono", monospace !important;
    font-size: 12px !important;
  }

  .container.mobile-project-view .error-message {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 15px !important;
    background-color: #f8d7da !important;
    color: #721c24 !important;
    border: 1px solid #f5c6cb !important;
    border-radius: 4px !important;
    font-family: "Space Mono", monospace !important;
    font-size: 12px !important;
  }

  .container.mobile-project-view .success-icon,
  .container.mobile-project-view .error-icon {
    flex-shrink: 0 !important;
  }

  .container.mobile-project-view .button-loading {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .container.mobile-project-view .button-loading::after {
    content: "" !important;
    width: 16px !important;
    height: 16px !important;
    border: 2px solid transparent !important;
    border-top: 2px solid currentColor !important;
    border-radius: 50% !important;
    animation: spin 1s linear infinite !important;
  }

  /* Ensure button text/loading states are properly controlled */
  .container.mobile-project-view .button-text {
    display: inline !important;
  }

  .container.mobile-project-view .submit-button .button-text[style*="display: none"] {
    display: none !important;
  }

  .container.mobile-project-view .submit-button .button-loading[style*="display: none"] {
    display: none !important;
  }

  .container.mobile-project-view .submit-button .button-loading[style*="display: inline"] {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  /* Mobile social links */
  .mobile-social-links {
    margin-bottom: 20px !important;
  }

  .mobile-social-links h3 {
    font-size: 18px !important;
    margin-bottom: 15px !important;
    text-align: left !important;
  }

  .container.mobile-project-view .social-item {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    padding: 15px !important;
    border-bottom: var(--border-width) solid #eee !important;
    text-decoration: none !important;
    color: inherit !important;
    transition: background-color 0.2s ease !important;
  }

  .container.mobile-project-view .social-item:hover {
    background-color: #f8f9fa !important;
  }

  .container.mobile-project-view .social-item:hover .social-icon {
    fill: var(--border-color) !important;
  }

  .container.mobile-project-view .social-icon {
    width: 32px !important;
    height: 32px !important;
    fill: #333 !important;
    transition: fill 0.2s ease !important;
  }

  .container.mobile-project-view .social-platform {
    font-weight: bold !important;
    font-size: 14px !important;
  }

  .container.mobile-project-view .social-handle {
    color: #555 !important;
    font-size: 12px !important;
  }

  /* === MOBILE PROJECT DROPDOWN === */

  .mobile-project-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border-bottom: var(--border-width) solid var(--border-color);
    border-top: var(--border-width) solid var(--border-color);
    z-index: 1000;
    display: none;
  }

  .mobile-project-dropdown.active {
    display: block;
  }

  .mobile-project-item {
    padding: 12px 15px;
    border-bottom: var(--border-width) solid var(--border-color);
    background-color: white;
    cursor: pointer;
    font-family: "Space Mono", monospace;
    font-size: 14px;
    color: black;
    transition: background-color 0.3s ease;
    text-align: left;
  }

  .mobile-project-item:last-child {
    border-bottom: none;
  }

  .mobile-project-item:hover {
    background-color: #eaf4ff;
  }

  /* Make menu top relative for dropdown positioning */
  .menu-top {
    position: relative;
  }

  /* Active state for the clicked button */
  .menu-top .menu-button.dropdown-active {
    background-color: var(--border-color) !important;
    color: white !important;
  }

  /* === ULTRA-SMALL SCREENS (360px and below) === */
}

@media (max-width: 360px) {
  .home-content-container {
    gap: 3px;
    padding: 0 8px;
  }

  .home-box {
    min-height: 120px;
    padding: 6px;
  }

  .stat-circle {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }

  .stat-label {
    font-size: 10px;
  }

  .cta-button {
    padding: 3px 6px;
    font-size: 0.6rem;
  }

  .paper-link-button {
    padding: 3px 6px;
    font-size: 0.6rem;
  }

  .home-box model-viewer {
    transform: scale(0.6);
  }
}

/* === ANIMATIONS FOR MOBILE === */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* === LOADING SCREEN === */

.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  /* Safari mobile viewport fix */
  height: 100dvh; /* Dynamic viewport height - modern browsers */
  min-height: -webkit-fill-available; /* Safari fallback */
  background-color: white;
  background-image: repeating-linear-gradient(
      0deg,
      rgba(var(--grid-color-rgb), var(--grid-opacity)),
      rgba(var(--grid-color-rgb), var(--grid-opacity)) var(--grid-thickness),
      transparent var(--grid-thickness),
      transparent var(--grid-scale)
    ),
    repeating-linear-gradient(
      90deg,
      rgba(var(--grid-color-rgb), var(--grid-opacity)),
      rgba(var(--grid-color-rgb), var(--grid-opacity)) var(--grid-thickness),
      transparent var(--grid-thickness),
      transparent var(--grid-scale)
    );
  background-size: var(--grid-scale) var(--grid-scale);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 1.5s ease-in-out;
}

.loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  text-align: center;
}

.loading-circle-container {
  position: relative;
  display: inline-block;
}

.loading-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 180px;
  height: 180px;
  margin-top: -90px;
  margin-left: -90px;
  border: 2px solid transparent;
  border-top: 2px solid #288dff;
  border-radius: 50%;
  animation: spin 2s linear infinite;
  z-index: 1;
}

.loading-content h1 {
  font-size: 2rem;
  color: #288dff;
  margin: 0;
  font-family: "Barriecito-Regular", sans-serif;
  font-weight: 400;
  line-height: 0.8;
  position: relative;
  z-index: 2;
}

/* === VIDEO PLAYER STYLES === */
video {
  border: var(--border-width) solid var(--border-color);
  background-color: #000;
  width: 100%;
  max-width: 800px;
  aspect-ratio: 16/9; /* Fixed aspect ratio */
  object-fit: cover; /* Ensures both poster and video fit properly */
}

/* Mobile-specific video adjustments */
video {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* Video poster/thumbnail styling */
video::-webkit-media-controls-start-playback-button {
  background-color: rgba(40, 141, 255, 0.8);
  border-radius: 50%;
  color: white;
}

/* Style the video controls overlay */
video::-webkit-media-controls-panel {
  background-color: rgba(40, 141, 255, 0.1) !important;
  background-image: none !important;
}

video::-webkit-media-controls-timeline {
  border-radius: 2px;
}

video::-webkit-media-controls-timeline::-webkit-slider-thumb {
  border-radius: 50%;
}

/* Firefox video controls */
video::-moz-media-controls {
  background-color: rgba(40, 141, 255, 0.1) !important;
}

/* Ensure video figures maintain proper spacing */
figure video {
  margin-bottom: 0;
}

/* === MOBILE CAROUSEL STYLING === */
.container.mobile-project-view .image-carousel-figure {
  margin: 20px 0 !important;
}

.container.mobile-project-view .carousel-figcaption {
  font-size: 12px !important;
  color: #666 !important;
  margin-top: 8px !important;
  text-align: center !important;
}

/* Ensure carousel functionality works on mobile */
.container.mobile-project-view .carousel-slide {
  display: none !important;
}

.container.mobile-project-view .carousel-slide.active {
  display: block !important;
}

.container.mobile-project-view .carousel-slide img {
  width: 100% !important;
  height: auto !important;
  display: block !important;
}

.container.mobile-project-view .image-carousel {
  position: relative !important;
}

.container.mobile-project-view .carousel-container {
  position: relative !important;
}

/* Mobile carousel navigation */
.container.mobile-project-view .carousel-nav {
  position: absolute !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background-color: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid #c7ddf5 !important;
  border-radius: 50% !important;
  width: 29px !important;
  height: 29px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  z-index: 2 !important;
}

.container.mobile-project-view .carousel-prev {
  left: 8px !important;
}

.container.mobile-project-view .carousel-next {
  right: 8px !important;
}

.container.mobile-project-view .carousel-nav svg {
  width: 14px !important;
  height: 14px !important;
  stroke: #288dff !important;
}

.container.mobile-project-view .carousel-indicators {
  position: absolute !important;
  bottom: 12px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  display: flex !important;
  justify-content: center !important;
  gap: 6px !important;
  background-color: rgba(255, 255, 255, 0.3) !important;
  border: 1px solid rgba(199, 221, 245, 0.5) !important;
  padding: 5px 8px !important;
  border-radius: 20px !important;
  backdrop-filter: blur(4px) !important;
  z-index: 3 !important;
}

.container.mobile-project-view .carousel-dot {
  width: 6px !important;
  height: 6px !important;
  border-radius: 50% !important;
  border: none !important;
  background-color: #c7ddf5 !important;
  cursor: pointer !important;
}

.container.mobile-project-view .carousel-dot.active {
  background-color: #288dff !important;
}
