/* Shared mobile layout for the published page and its local preview. */
@media (max-width: 700px) {
  :root { --mobile-header-size: 14px; }
  html { scroll-padding-top: var(--ph-height, 110px); }
  body { overflow-x: clip; }

  /* Fixed header: greeting on row one, navigation + language on row two. */
  .portfolio-header {
    position: sticky !important;
    top: 0 !important;
    right: 0;
    bottom: auto;
    left: 0;
    grid-template-columns: 1fr;
    width: 100%;
    background: #69b4e7;
  }
  .portfolio-header .ph-clock {
    position: absolute;
    top: 1px;
    right: 12px;
    display: flex;
    visibility: visible;
    justify-content: flex-end;
    min-height: 21px;
    color: #0c7fa6;
    font-size: var(--mobile-header-size);
    font-weight: 500;
  }
  .portfolio-header .ph-clock span,
  .portfolio-header .ph-clock time {
    color: #0c7fa6;
    background: none;
    -webkit-text-fill-color: #0c7fa6;
  }
  .portfolio-header .ph-bar {
    display: grid;
    grid-template-columns: auto auto auto minmax(0, 1fr) auto;
    grid-template-rows: 21px 21px;
    align-items: center;
    column-gap: 12px;
    row-gap: 0;
    padding: 1px 12px 1px;
  }
  .portfolio-header .ph-tools { display: contents; }
  .portfolio-header .ph-intro {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-content: flex-start;
    min-height: 21px;
    line-height: 1.2;
  }
  .portfolio-header .ph-language {
    grid-column: 5;
    grid-row: 2;
    justify-self: end;
    align-items: center;
    gap: 8px;
  }
  .portfolio-header .ph-nav {
    grid-column: 1 / 5;
    grid-row: 2;
    justify-content: flex-start;
    gap: clamp(10px, 3.5vw, 16px);
    min-height: 21px;
  }
  .portfolio-header .ph-nav a {
    min-height: 21px;
    text-transform: uppercase;
  }
  .portfolio-header .ph-star {
    width: 18px;
    height: 21px;
    margin-left: 0;
    flex-shrink: 0;
    align-self: center;
    transform: translateY(.077em);
  }
  .portfolio-header .ph-star svg { width: 12px; height: 12px; }
  .mobile-contact-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 21px;
    margin-top: -1px;
    padding: 0 12px;
    background: #69b4e7;
    color: #0c7fa6;
    font: 500 var(--mobile-header-size) / 1.2 Aeroport, sans-serif;
    letter-spacing: normal;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .mobile-contact-strip a {
    display: flex;
    align-items: center;
    height: 100%;
    font: inherit;
    color: inherit;
    text-decoration: none;
  }
  .mobile-contact-strip .ph-label {
    display: block;
    font: inherit;
    line-height: 1.2;
    transform: translateY(.077em);
  }
  .portfolio-header .ph-language button {
    min-height: 21px;
    padding-inline: 0;
    white-space: nowrap;
  }
  .portfolio-header .ph-intro,
  .portfolio-header .ph-nav a,
  .portfolio-header .ph-tools > [data-contact],
  .portfolio-header .ph-language button {
    font-family: inherit;
    font-size: var(--mobile-header-size);
    font-weight: 500;
    letter-spacing: normal;
    text-transform: none;
  }
  .portfolio-header .ph-label { line-height: 1.2; }
  .portfolio-header .ph-nav a { text-transform: uppercase; }
  body.ph-enabled .case-title { top: var(--ph-height, 110px); }
  body.ph-enabled .project,
  body.ph-enabled [data-ph-section] {
    scroll-margin-top: calc(var(--ph-height, 110px) + 12px);
  }

  .hero {
    min-height: 100svh;
    padding: 24px 16px 36px;
  }
  .hero-avatar { width: 112px; margin-bottom: 18px; }
  .hero-tags {
    display: block;
    font-size: 0;
    text-align: center;
    color: #7f878d;
    margin-top: 24px;
  }
  .hero-tag-row {
    display: inline;
    margin: 0;
    padding: 0;
  }
  .hero-tag-row + .hero-tag-row::before,
  .hero-tag-row li + li::before {
    content: ', ';
    color: inherit;
  }
  .hero-tag-row + .hero-tag-row::before { font-size: var(--font-body); }
  .hero-tag-row li {
    display: inline;
    width: auto;
    max-width: none;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-size: var(--font-body);
    white-space: normal;
    text-align: center;
  }

  .section-heading { padding: 12px 16px; }
  #selected-projects > .section-title {
    padding-left: 16px;
    text-align: left;
  }
  #selected-projects > .section-title > span { text-align: left; }
  .project { padding-bottom: 40px; overflow-x: clip; }
  #selected-projects > .project:last-of-type { padding-bottom: 64px; }
  .case-title {
    position: sticky;
    z-index: 50;
    margin-inline: 0;
    padding: var(--bar-padding-block, 1px) 16px;
  }
  .case-title h2 {
    font-size: 18px;
    line-height: var(--bar-line-height, 23px);
    overflow-wrap: anywhere;
  }
  .case-description {
    display: block;
    width: auto;
    margin: 24px 16px 28px;
    font-size: 14px;
    line-height: 1.45;
  }
  .year { display: inline-block; margin: 0 16px 0 0; }
  .case-meta { display: inline-block; vertical-align: top; }
  .disciplines, .credits { font-size: 12px; line-height: 1.4; }
  .credits { margin-top: 6px; }
  .details { margin-top: 24px; }
  .details section + section { margin-top: 24px; }
  .details h3 { margin: 0; padding-bottom: 6px; }
  .details p { margin: 10px 0 0; padding: 0; }
  .role-list { margin: 10px 0 0; padding: 0; }
  .role-list li + li { margin-top: .65em; }

  /* One-column bento keeps each card large and preserves its media ratio. */
  .bento {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    width: auto;
    margin-inline: 12px;
    aspect-ratio: auto !important;
    container-type: inline-size;
  }
  .bento .card {
    position: relative;
    inset: auto;
    grid-column: 1 / -1;
    width: 100%;
    height: auto;
    aspect-ratio: var(--mobile-ratio);
  }

  .gallery-content[data-gallery-mount] {
    width: auto;
    margin-inline: 12px;
    padding-top: 24px;
  }
  .gallery-canvas {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 18px 10px;
    aspect-ratio: auto !important;
  }
  .gallery-item { position: static; width: auto; min-width: 0; }
  .gallery-frame { aspect-ratio: var(--gallery-ratio); }
  .gallery-caption {
    width: auto;
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.35;
  }
  .gallery-dot { width: 32px; height: 32px; }

  #fortune {
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
  #fortune .stage { min-height: 360px; padding-block: 56px; }
}

@media (min-width: 430px) and (max-width: 700px) {
  .bento { gap: 14px; margin-inline: 16px; }
  .gallery-content[data-gallery-mount] { margin-inline: 16px; }
  .gallery-canvas { gap: 22px 12px; }
}
