/* iOS full-screen apps (<= 760px): nav bar, large title, lists, Work space. Scoped to body.ios-mode. */

.ios-back, .ios-large, .ios-edge, .ios-body-ghost { display: none; }

body.ios-mode .window-layer { inset: 0; z-index: 600; }
body.ios-mode .app-window, body.ios-mode .app-window.maximized, body.ios-mode .app-window.tile-left, body.ios-mode .app-window.tile-right {
  left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; max-width: none !important; max-height: none !important;
  border-radius: 0 !important; background: var(--ios-bg) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  box-shadow: none !important; border: 0; color: var(--ios-label); font-family: var(--ios-font); font-size: 15px; overflow: hidden;
}
body.ios-mode #window-game { --ios-bg: #faf8f2; --ios-label: #284d3d; --lg-text: #284d3d; --lg-text-2: #5d7566; --lg-text-3: #8a9d8f; }
body.ios-mode .app-window .window-statusbar, body.ios-mode .app-window .traffic-lights, body.ios-mode .app-window .window-subtitle,
body.ios-mode .app-window .window-sidebar, body.ios-mode .os-resize { display: none !important; }

/* Navigation bar: the original titlebar, overlaid with translucent glass once content scrolls under it */
body.ios-mode .app-window .window-titlebar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 6; height: calc(var(--ios-sb) + 44px); box-sizing: border-box; padding: var(--ios-sb) 8px 0; gap: 0;
  display: flex; align-items: center; justify-content: center; cursor: default; touch-action: auto; border: 0;
  background: rgba(242, 242, 247, calc(var(--p, 1) * .86)); -webkit-backdrop-filter: blur(calc(var(--p, 1) * 24px)) saturate(1.8); backdrop-filter: blur(calc(var(--p, 1) * 24px)) saturate(1.8);
  box-shadow: 0 .5px 0 rgba(60, 60, 67, calc(var(--p, 1) * .22));
}
body.ios-mode.dark-desktop .app-window .window-titlebar { background: rgba(0, 0, 0, calc(var(--p, 1) * .8)); box-shadow: 0 .5px 0 rgba(84, 84, 88, calc(var(--p, 1) * .7)); }
body.ios-mode #window-game .window-titlebar { background: rgba(250, 248, 242, .9); }
body.ios-mode .app-window .window-titlebar h2 {
  position: absolute; top: var(--ios-sb); left: 92px; right: 92px; height: 44px; margin: 0; text-align: center; font: 600 17px/44px var(--ios-font); letter-spacing: -.01em;
  color: var(--ios-label); opacity: var(--p, 1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: none;
}
body.ios-mode .ios-back {
  display: flex; position: absolute; left: 4px; top: var(--ios-sb); height: 44px; min-width: 44px; padding: 0 12px 0 10px; align-items: center; gap: 5px;
  border: 0; background: none; color: var(--ios-tint); font: 400 17px/1 var(--ios-font); letter-spacing: -.01em; border-radius: 22px;
}
body.ios-mode .ios-back svg { width: 12px; height: 20px; }
body.ios-mode .ios-back:active { opacity: .45; }
body.ios-mode .ios-back:focus-visible { outline: 2px solid var(--ios-tint); }
body.ios-mode .ios-large-on .ios-large {
  display: block; position: absolute; left: 20px; right: 20px; top: calc(var(--ios-sb) + 44px); z-index: 1; font: 700 34px/41px var(--ios-font); letter-spacing: .01em; color: var(--ios-label);
  transform: translateY(calc(var(--st, 0) * -1px)); opacity: max(0, calc(1 - var(--st, 0) / 26)); pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.ios-mode .ios-pushed .ios-edge { display: block; position: absolute; left: 0; top: calc(var(--ios-sb) + 44px); bottom: 40px; width: 22px; z-index: 7; touch-action: none; }

/* Content */
body.ios-mode .app-window .window-body { position: relative; flex: 1; display: block; background: var(--ios-bg); }
body.ios-mode .ios-body-ghost { display: block; position: absolute; inset: 0; background: var(--ios-bg); box-shadow: -8px 0 24px rgba(0, 0, 0, .12); pointer-events: none; }
body.ios-mode .app-window .window-body > .window-main { position: absolute; inset: 0; }
body.ios-mode .app-window .window-main {
  box-sizing: border-box; padding: calc(var(--ios-sb) + 44px + 10px) 20px calc(var(--ios-bot) + 44px) !important; background: transparent !important; overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; scrollbar-width: none; color: var(--ios-label);
}
body.ios-mode .app-window .window-main::-webkit-scrollbar { display: none; }
body.ios-mode .ios-large-on .window-main { padding-top: calc(var(--ios-sb) + 44px + 52px) !important; }
body.ios-mode .app-window .window-main p { font-size: 15px; line-height: 1.45; }
body.ios-mode .app-window .window-main h1 { font-size: 28px; line-height: 1.12; }
body.ios-mode .app-window .window-main h2 { font-size: 20px; }
body.ios-mode .app-window .window-main .section-kicker { font-size: 11px; }
body.ios-mode .app-window .soft-button { min-height: 44px; font-size: 15px; }
body.ios-mode .app-window .project-views button { min-height: 44px; font-size: 13px; }
body.ios-mode #window-game .snake-main { background: transparent !important; }

/* Projects list */
.ios-footnote { margin: 0 16px 8px; font: 400 13px/1.3 var(--ios-font); color: var(--ios-label2); text-transform: uppercase; letter-spacing: .02em; }
body.ios-mode .app-window .window-main p.ios-footnote { font-size: 13px; }
.ios-group { list-style: none; margin: 0; padding: 0; background: var(--ios-card); border-radius: 22px; overflow: hidden; box-shadow: 0 0 0 .5px rgba(60, 60, 67, .08); }
.ios-group li { position: relative; }
.ios-group li + li::before { content: ""; position: absolute; top: 0; left: 66px; right: 0; height: .5px; background: var(--ios-sep); }
.ios-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; box-sizing: border-box; padding: 9px 16px 9px 14px; border: 0; background: none; color: var(--ios-label); text-align: left; font-family: var(--ios-font); }
.ios-row:active { background: var(--ios-fill); }
.ios-row:focus-visible { outline: 2px solid var(--ios-tint); outline-offset: -2px; }
.ios-row-icon { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: #fff; box-shadow: inset 0 0 0 .5px rgba(60, 60, 67, .18); }
.ios-row-icon img { max-width: 68%; max-height: 68%; }
.ios-row-icon.is-glyph { background: linear-gradient(160deg, #6a5bd8, #3b2fa0); } .ios-row-icon.is-glyph img { filter: invert(1); max-width: 56%; }
.ios-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ios-row-text b { font: 600 16px/1.25 var(--ios-font); }
.ios-row-text small { font: 400 13px/1.3 var(--ios-font); color: var(--ios-label2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ios-chev { flex: none; width: 8px; height: 14px; color: rgba(60, 60, 67, .3); }
body.dark-desktop .ios-chev { color: rgba(235, 235, 245, .3); }

/* Certificates */
body.ios-mode .cert-main > .section-kicker, body.ios-mode .cert-main > h1 { display: none; }
body.ios-mode .cert-main > p:first-of-type { color: var(--ios-label2); margin-top: 0; }
body.ios-mode .cert-toolbar { flex-direction: column; align-items: stretch; }
body.ios-mode .cert-toolbar input, body.ios-mode .cert-toolbar select { height: 44px; min-height: 44px; font-size: 16px; border-radius: 12px; background-color: var(--ios-fill); box-shadow: none; }
body.ios-mode .cert-grid { grid-template-columns: repeat(2, 1fr); gap: 16px 14px; }
body.ios-mode .cert-thumb { height: 120px; border-radius: 14px; box-shadow: 0 0 0 .5px rgba(60, 60, 67, .12), 0 6px 16px rgba(0, 12, 40, .12); }
body.ios-mode .cert-card strong { font-size: 13px; }
body.ios-mode .cert-card small { font-size: 11px; color: var(--ios-label2); }
body.ios-mode .certificate-viewer .viewer-toolbar { flex-wrap: wrap; gap: 8px; }
body.ios-mode .certificate-viewer [data-cert-back] { display: none; }
body.ios-mode .viewer-toolbar button, body.ios-mode .viewer-toolbar a { min-height: 44px; min-width: 44px; font-size: 14px; border-radius: 22px; }
body.ios-mode .certificate-sheet { touch-action: pan-y pinch-zoom; border-radius: 16px; }
body.ios-mode .certificate-caption h3 { font-size: 17px; } body.ios-mode .certificate-caption p { font-size: 14px; }

/* Coffee Break */
body.ios-mode #window-game .snake-main h1 { font-size: 28px; }
body.ios-mode #window-game .snake-touch { grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(2, 56px); gap: 8px; }
body.ios-mode #window-game #snake-board { touch-action: none; }

/* Work space: a dark full-screen app with the same nav bar */
body.ios-mode .work-space { inset: 0; max-width: none; margin: 0; animation: none; z-index: 500; font-family: var(--ios-font); background: #0d1424; }
body.ios-mode .work-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 6; height: calc(var(--ios-sb) + 44px); box-sizing: border-box; margin: 0; padding: var(--ios-sb) 8px 0;
  display: flex; align-items: center; justify-content: center; background: rgba(13, 20, 36, .86); -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6); box-shadow: 0 .5px 0 rgba(255, 255, 255, .12);
}
body.ios-mode .work-topbar > span { font: 600 15px/44px var(--ios-font); letter-spacing: -.01em; color: #fff; text-transform: none; }
body.ios-mode .return-desktop {
  position: absolute; left: 4px; top: var(--ios-sb); height: 44px; min-height: 44px; min-width: 44px; padding: 0 12px 0 10px; display: flex; align-items: center; gap: 5px;
  border: 0; border-radius: 22px; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--ios-tint); font-size: 0;
}
body.ios-mode .return-desktop img { display: none; }
body.ios-mode .return-desktop::before { content: ""; width: 12px; height: 20px; background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 20' fill='none' stroke='%230a84ff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 2 2 10l8 8'/%3E%3C/svg%3E"); }
body.ios-mode .return-desktop::after { content: "Home"; font: 400 17px/1 var(--ios-font); }
body.ios-mode .work-shell { position: absolute; inset: 0; height: auto; padding: calc(var(--ios-sb) + 44px + 6px) 10px calc(var(--ios-bot) + 36px); gap: 8px; border: 0; border-radius: 0; background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
body.ios-mode .work-shell .window-sidebar { display: flex; flex: none; }
body.ios-mode .work-shell .window-sidebar button { min-height: 44px; font-size: 14px; }
body.ios-mode .work-page { border-radius: 20px; padding: 24px 18px 40px; overflow-y: auto; touch-action: pan-y; overscroll-behavior: contain; }
body.ios-mode .work-page p { font-size: 15px; line-height: 1.45; }

/* Dark app surface for sheets that inherit macOS tints */
body.ios-mode.dark-desktop .app-window .cert-card strong { color: #fff; }

@media (prefers-reduced-transparency: reduce) {
  body.ios-mode .app-window .window-titlebar, body.ios-mode .work-topbar { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--ios-bg); }
  body.ios-mode .work-topbar { background: #0d1424; }
}

/* Fixes: no programmatic scroll of the desktop box; long pushed titles; Coffee Break pad layout */
body.ios-mode #desktop { overflow: clip; }
body.ios-mode .app-window.ios-pushed .window-titlebar h2 { left: 124px; right: 124px; }
body.ios-mode .work-topbar > span { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
body.ios-mode #window-game .snake-help { display: block; }
body.ios-mode #window-game .snake-touch { grid-column: auto; grid-row: auto; margin: 18px auto 8px; justify-content: center; }
body.ios-mode .app-window .window-main.snake-main { margin: 0; border-radius: 0; box-shadow: none; }
body.ios-mode .certificate-sheet img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }

/* ---------- Minutechbuilds app windows (osApps): embedded demos, previews, private notes ---------- */
body.ios-mode .app-window .window-main.osa-main { display: flex; flex-direction: column; gap: 14px; }
body.ios-mode .osa-head { display: flex; flex-direction: column; gap: 12px; }
body.ios-mode .osa-head .osapp-icon { --sz: 64px; }
body.ios-mode .osa-titles h1 { margin: 2px 0 4px; }
body.ios-mode .osa-tag { margin: 0; color: var(--ios-label2); }
body.ios-mode .osa-aud { margin: 4px 0 0; font-size: 13px; color: var(--ios-label2); }
body.ios-mode .osa-side { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
body.ios-mode .osa-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 0 12px; border-radius: 14px; background: var(--ios-fill); color: var(--ios-label2); font: 500 13px/1 var(--ios-font); }
body.ios-mode .osa-chip.is-live { color: #1c8f43; background: rgba(48, 209, 88, .16); }
body.dark-desktop.ios-mode .osa-chip.is-live { color: #30d158; }
body.ios-mode .osa-actions { display: flex; gap: 8px; flex-wrap: wrap; }
body.ios-mode .osa-actions .soft-button { display: inline-flex; align-items: center; justify-content: center; border-radius: 22px; padding: 0 16px; min-height: 44px; }
body.ios-mode .osa-copy { color: var(--ios-label); }
body.ios-mode .osa-note, body.ios-mode .capture-caption, body.ios-mode .case-study-note { color: var(--ios-label2); font-size: 13px; }
body.ios-mode .osa-scroll { display: block; }
body.ios-mode .osa-private { padding: 18px; border-radius: 22px; background: var(--ios-card); }
body.ios-mode .osa-private strong { display: block; margin-bottom: 6px; font-size: 17px; }
body.ios-mode .osa-private p { margin: 0; color: var(--ios-label2); }
body.ios-mode .project-image img, body.ios-mode .case-study img { max-width: 100%; height: auto; border-radius: 16px; }
body.ios-mode .osa-tabs { display: flex; gap: 2px; padding: 2px; border-radius: 12px; background: var(--ios-fill); }
body.ios-mode .osa-tabs button { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: none; color: var(--ios-label); font: 500 14px/1 var(--ios-font); }
body.ios-mode .osa-tabs button[aria-selected="true"] { background: var(--ios-card); box-shadow: 0 1px 4px rgba(0, 0, 0, .14); }

/* Embedded live app: a compact action row, then the iframe fills the rest of the screen and scrolls inside */
body.ios-mode .app-window .window-main.osa-main.is-frame {
  padding: calc(var(--ios-sb) + 44px) 0 0 !important; gap: 0; overflow: hidden; touch-action: auto;
}
body.ios-mode .is-frame > .osa-head { flex: none; padding: 6px 14px 8px; gap: 0; }
body.ios-mode .is-frame > .osa-head > .osapp-icon, body.ios-mode .is-frame > .osa-head .osa-titles { display: none; }
body.ios-mode .is-frame .osa-side { flex-wrap: nowrap; }
body.ios-mode .is-frame .osa-actions .soft-button { min-height: 36px; padding: 0 14px; font-size: 14px; }
body.ios-mode .is-frame > .osa-tabs { flex: none; margin: 0 14px 8px; }
body.ios-mode .is-frame > .osa-panel:not([hidden]) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.ios-mode .is-frame > .osa-panel.osa-scroll:not([hidden]) { display: block; overflow-y: auto; padding: 4px 20px calc(var(--ios-bot) + 44px); touch-action: pan-y; }
body.ios-mode .osa-frame { position: relative; flex: 1; min-height: 0; background: #fff; border-radius: 22px 22px 0 0; overflow: hidden; }
body.ios-mode .osa-iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; touch-action: auto; }
body.ios-mode .osa-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; color: #3c3c43; font: 500 15px/1.3 var(--ios-font); background: #f7f7fa; }
body.ios-mode .osa-loading p { margin: 0; } body.ios-mode .osa-loading small { font-size: 12px; opacity: .7; }
body.ios-mode .osa-frame:not([data-loading]) .osa-loading { display: none; }
body.ios-mode .osa-spinner { width: 26px; height: 26px; border: 3px solid rgba(60, 60, 67, .2); border-top-color: var(--ios-tint); border-radius: 50%; animation: ios-spin .8s linear infinite; }
@keyframes ios-spin { to { transform: rotate(360deg); } }
body.motion-reduced .osa-spinner { animation-duration: 3s; }
body.ios-mode .osa-chip, body.ios-mode .osa-actions .soft-button { white-space: nowrap; }
body.ios-mode .is-frame .osa-actions { flex-wrap: nowrap; }
body.ios-mode .is-frame .osa-actions .soft-button { padding: 0 12px; font-size: 13px; }
@media (max-width: 360px) { body.ios-mode .is-frame .osa-chip { display: none; } body.ios-mode .is-frame .osa-side { justify-content: flex-end; } }

/* Business Diagnostic: keep the short intro above the form */
body.ios-mode #window-diagnostic .is-frame > .osa-head .osa-titles { display: block; padding-bottom: 8px; }
body.ios-mode #window-diagnostic .osa-titles .section-kicker, body.ios-mode #window-diagnostic .osa-titles h1 { display: none; }
body.ios-mode #window-diagnostic .osa-tag { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Notes: list screen with a large title, tap a note to push the editor */
body.ios-mode #window-notes .window-body > .window-sidebar.nt-list { display: none !important; }
body.ios-mode #window-notes:not(.ios-nt-edit) .window-body > .window-sidebar.nt-list {
  display: flex !important; flex-direction: column; gap: 12px; position: absolute; inset: 0; box-sizing: border-box; width: auto; padding: calc(var(--ios-sb) + 44px + 10px) 20px calc(var(--ios-bot) + 44px);
  background: transparent; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: none; border: 0; border-radius: 0; box-shadow: none; max-width: none; min-width: 0;
}
body.ios-mode #window-notes.ios-large-on:not(.ios-nt-edit) .window-body > .window-sidebar.nt-list { padding-top: calc(var(--ios-sb) + 44px + 52px); }
body.ios-mode #window-notes:not(.ios-nt-edit) .window-body > .nt-editor { display: none; }
body.ios-mode .nt-new { order: 2; min-height: 48px; border: 0; border-radius: 16px; background: var(--ios-card); color: var(--ios-tint); font: 600 16px/1 var(--ios-font); }
body.ios-mode .nt-items { order: 1; list-style: none; margin: 0; padding: 0; background: var(--ios-card); border-radius: 22px; overflow: hidden; }
body.ios-mode .nt-items li + li { border-top: .5px solid var(--ios-sep); }
body.ios-mode .nt-item { display: flex; flex-direction: column; gap: 3px; width: 100%; min-height: 58px; padding: 11px 16px; border: 0; background: none; text-align: left; align-items: flex-start; color: var(--ios-label); font-family: var(--ios-font); }
body.ios-mode .nt-item:active { background: var(--ios-fill); }
body.ios-mode .nt-item strong { font: 600 16px/1.25 var(--ios-font); } 
body.ios-mode .nt-item small { font: 400 13px/1.3 var(--ios-font); color: var(--ios-label2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.ios-mode #window-notes .nt-editor { display: flex; flex-direction: column; gap: 10px; }
body.ios-mode .nt-title { width: 100%; box-sizing: border-box; min-height: 44px; padding: 0 2px; border: 0; background: none; outline: none; color: var(--ios-label); font: 700 24px/1.2 var(--ios-font); }
body.ios-mode .nt-body { flex: 1; width: 100%; box-sizing: border-box; min-height: 160px; padding: 2px; border: 0; background: none; outline: none; resize: none; color: var(--ios-label); font: 400 17px/1.45 var(--ios-font); }
body.ios-mode .nt-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
body.ios-mode .nt-meta { margin: 0; font-size: 13px; color: var(--ios-label2); }

/* Labour Calculator: grouped fields, 16px+ inputs so iOS never zooms */
body.ios-mode .lc-main { display: flex; flex-direction: column; gap: 14px; }
body.ios-mode .lc-main > .section-kicker, body.ios-mode .lc-main > h1 { display: none; }
body.ios-mode .lc-intro { margin: 0; color: var(--ios-label2); font-size: 14px; }
body.ios-mode .lc-form { display: grid; gap: 10px; }
body.ios-mode .lc-field { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 2px; padding: 10px 14px; border-radius: 16px; background: var(--ios-card); font: 500 13px/1.2 var(--ios-font); color: var(--ios-label2); }
body.ios-mode .lc-field input, body.ios-mode .lc-field select { width: 100%; box-sizing: border-box; min-height: 30px; height: auto; padding: 0; border: 0; background: none; outline: none; color: var(--ios-label); font: 500 18px/1.2 var(--ios-font); -webkit-appearance: none; appearance: none; }
body.ios-mode .lc-field small { font-size: 12px; color: var(--ios-label2); }
body.ios-mode .lc-results { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
body.ios-mode .lc-card { display: grid; gap: 4px; padding: 12px 14px; border-radius: 18px; background: var(--ios-card); }
body.ios-mode .lc-label { font-size: 12px; color: var(--ios-label2); } body.ios-mode .lc-value { font: 600 22px/1.15 var(--ios-font); color: var(--ios-label); }
body.ios-mode .app-window input, body.ios-mode .app-window textarea, body.ios-mode .app-window select { font-size: max(16px, 1em); }
body.ios-mode .nt-item strong, body.ios-mode .nt-item small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.ios-mode .lc-results { margin-top: 6px; }
body.ios-mode #window-diagnostic .is-frame > .osa-head { padding-top: 10px; }

/* iOS overrides for desktop-styled built-ins */
body.ios-mode .lc-form, body.ios-mode .lc-results { background: none !important; box-shadow: none !important; border: 0 !important; padding: 0 !important; }
body.ios-mode .lc-field input, body.ios-mode .lc-field select { background: none !important; border: 0 !important; box-shadow: none !important; border-radius: 0 !important; }
body.ios-mode .lc-value { font-size: 20px; white-space: nowrap; }
@media (max-width: 350px) { body.ios-mode .lc-results { grid-template-columns: 1fr; } }
body.ios-mode .osa-loading, body.ios-mode .osa-loading p, body.ios-mode .osa-loading small { color: #3c3c43 !important; }
body.ios-mode .osa-loading { background: #f7f7fa !important; }
