/* Mobile keeps the dimensional scenes inside a calm, aligned page. */
.main-nav { margin-left: auto; }
.site-header > .theme-toggle { flex: 0 0 auto; }
.header-actions { display: flex; align-items: center; flex: 0 0 auto; gap: 12px; }
.language-switch { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 3px; padding: 2px; }
.language-switch > a { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 6px 8px; font-size: 12px; line-height: 1; color: var(--secondary); border-radius: 2px; }
.language-switch > a[aria-current="true"] { background: var(--ink); color: var(--paper); }
.language-switch > a:hover:not([aria-current]) { background: var(--panel); color: var(--ink); }
.theme-mode-label::after { content: none !important; }

@media (max-width: 1000px) {
  .header-actions { gap: 8px; }
  .header-actions .theme-mode-label { display: none; }
  .header-actions .theme-toggle { width: 44px; padding: 8px; }
}

@media (max-width: 700px) {
  :root { --gutter: 20px; }
  .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 52px 44px;
    height: auto;
    gap: 0;
    padding-top: 4px;
    padding-bottom: 4px;
  }
  .wordmark { grid-column: 1; grid-row: 1; width: fit-content; font-size: 25px; }
  .brand-x { width: 23px; height: 27px; }
  .site-header > .theme-toggle { grid-column: 2; grid-row: 1; width: 44px; min-height: 44px; }
  .site-header > .header-actions { grid-column: 2; grid-row: 1; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; width: 100%; margin: 0; gap: 16px; font-size: 13px; }
  .main-nav > a, .main-nav > a:first-child, .main-nav > a:nth-child(2) {
    display: inline-flex;
    flex: 1 1 0;
    justify-content: center;
    min-height: 44px;
  }
  .main-nav > a:first-child { justify-content: flex-start; }
  .main-nav > a:last-child { justify-content: flex-end; }
  .main-nav a > span { display: inline; margin-inline-start: 4px; font-size: 10px; color: var(--secondary); }
  .main-nav .nav-contact { padding: 0; }
  .hero { padding-top: 26px; padding-bottom: 20px; }
  .hero h1.hero-brand { font-size: clamp(64px, 22vw, 148px); }
  .hero-meta { margin-top: 22px; }
  .hero-meta p { font-size: 18px; line-height: 1.5; max-width: 520px; }
  .section-pad { padding: 52px var(--gutter) 56px; }
  .work-section { padding-top: 20px; padding-bottom: 44px; }
  .work-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; align-items: center; padding-bottom: 14px; }
  .work-heading h2 { grid-column: 1; grid-row: 1; font-size: 17px; line-height: 1.4; }
  .work-tools { display: contents; }
  .work-tools .drag-instruction { grid-column: 2; grid-row: 1; min-height: 30px; font-size: 11px; gap: 5px; }
  .work-tools .drag-instruction > .ax-icon { width: 12px; height: 12px; }
  .work-tools .work-shuffle { grid-column: 1; grid-row: 2; justify-self: start; font-size: 12px; padding-inline: 11px; }
  .work-tools .work-reset { grid-column: 2; grid-row: 2; justify-self: end; margin: 0; font-size: 12px; }
  .worktable { gap: 24px; padding: 24px 0 12px; }
  .worktable .project-card[data-slot] { --rotation: 0deg; border-radius: 6px; box-shadow: 0 2px 2px rgba(19,25,21,.06), 0 8px 22px rgba(19,25,21,.07); }
  .worktable .card-browser { padding-inline: 14px 4px; gap: 10px; font-size: 11px; }
  .card-browser > span:nth-child(2) { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .worktable .card-index { font-size: 10px; padding-right: 10px; }
  .worktable .card-caption { min-height: 96px; padding: 18px; gap: 14px; }
  .worktable .card-title { font-size: clamp(23px, 7cqi, 30px); line-height: 1.12; letter-spacing: -.045em; text-wrap: pretty; }
  .worktable .card-kind { margin-top: 9px; font-size: 11px; line-height: 1.5; letter-spacing: .035em; }
  .card-arrow-wrap { width: 36px; height: 36px; }
  .worktable .card-caption > .card-arrow-wrap { flex-basis: 36px; }
  .maker-copy h2 { font-size: 44px; margin-bottom: 22px; }
  .maker-copy > p, .contact-copy > p { font-size: 16px; line-height: 1.75; }
  .maker-principles { gap: 10px 18px; line-height: 1.6; }
  .contact-copy h2 { font-size: 52px; margin-bottom: 22px; }
  .contact-form { padding-top: 28px; }
  .form-field { margin-bottom: 24px; }
  .form-field input { min-height: 48px; }
  .form-field input, .form-field textarea { font-size: 16px; line-height: 1.5; scroll-margin-block: 100px; }
  .submit-button { min-height: 54px; }
  .site-footer { padding: 30px var(--gutter) 24px; }
  .footer-bottom { font-size: 12px; gap: 12px 20px; }
  .footer-bottom > a { min-height: 44px; }

}

/* A stable project sheet, including phones turned sideways. */
@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) {
  .case-dialog {
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    overflow: hidden;
  }
  .case-shell { display: flex; flex-direction: column; height: 100%; min-height: 0; }
  .case-toolbar { position: relative; top: auto; flex: 0 0 auto; padding: calc(6px + env(safe-area-inset-top, 0px)) var(--gutter) 6px; min-height: 56px; gap: 12px; }
  .case-toolbar > span:nth-child(2) { display: none; }
  #case-number { font-size: 12px; letter-spacing: .02em; }
  .case-close { font-size: 13px; padding-inline: 6px 0; }
  .case-dialog .case-content { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; padding: 20px var(--gutter) 28px; gap: 0; }
  .case-text { display: contents; }
  .case-category { grid-row: 1; font-size: 11px; color: var(--secondary); }
  .case-text h2 { grid-row: 2; font-size: clamp(30px, 8.3vw, 42px); line-height: 1.1; margin: 8px 0 16px; text-align: left; text-wrap: pretty; }
  #case-description { grid-row: 3; }
  .case-visual { grid-row: 6; margin-bottom: 0; padding-top: 22px; border-top: 1px solid var(--line); }
  .case-preview-title { display: block; font: 600 16px/1.4 var(--sans); margin: 0 0 14px; letter-spacing: -.02em; }
  .case-text p { font-size: 16px; line-height: 1.65; margin-bottom: 16px; }
  .case-text .case-note { font-size: 14px; line-height: 1.7; }
  .case-extra { grid-row: 4; min-width: 0; margin-bottom: 16px; }
  .case-extra > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 8px 0; cursor: pointer; color: var(--secondary); font: 500 14px/1.5 var(--sans); list-style: none; }
  .case-extra > summary::-webkit-details-marker { display: none; }
  .case-extra > summary > .ax-icon { width: 16px; height: 16px; flex: 0 0 auto; }
  .case-extra[open] > summary { margin-bottom: 10px; color: var(--ink); }
  .case-extra[open] > summary > .ax-icon { transform: rotate(45deg); }
  .case-keywords { margin-top: 0; }
  .case-keywords > span { font-size: 11px; padding: 5px 10px; }
  .case-visit { grid-row: 5; min-height: 50px; font-size: 14px; width: 100%; max-width: none; margin: 2px 0 26px; }
  .case-device-controls { margin-bottom: 12px; }
  .case-device-controls > button { font-size: 12px; min-height: 46px; }
  .case-preview-stage { padding: 12px; }
  .case-preview-stage[data-device="mobile"] .case-device-frame { width: min(320px, calc(100% - 10px)); }
  .case-preview-stage[data-device="tablet"] .case-device-frame { width: min(380px, calc(100% - 10px)); }
  .case-preview-caption { font-size: 11px; }
  .case-preview-modes > button { font-size: 12px; }
  .case-preview-help { font-size: 11px; gap: 2px 12px; }
  .case-preview-help > a { display: none; }
  .case-bottom { position: relative; bottom: auto; z-index: 2; flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); padding: 8px var(--gutter) calc(8px + env(safe-area-inset-bottom, 0px)); gap: 12px; }
  .case-bottom #case-prev { justify-self: start; padding-inline: 0; }
  .case-bottom #case-next { justify-self: end; padding-inline: 0; }
  .case-bottom button, #case-pagination { font-size: 12px; white-space: nowrap; }
}

@media (max-width: 359px) {
  :root { --gutter: 18px; }
  .work-heading h2 { font-size: 16px; }
  .work-tools .drag-instruction { font-size: 10px; gap: 4px; }
  .worktable .card-caption { padding: 16px; }
  .case-bottom { gap: 8px; }
  .case-bottom button { font-size: 11px; gap: 5px; }
}
