/* PilotCB Homepage Day V1 — aviation-blue workspace, white data, silver structure */
:root {
  --home-focal-x: 50%;
  --home-focal-y: 50%;
  --home-text: #ffffff;
  --home-muted: rgba(239, 248, 255, 0.84);
  --home-focus: var(--theme-focus);
  --home-radius: clamp(8px, 0.55vw, 18px);
  --home-transition: 220ms ease;
  --home-font: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  width: 100%;
  margin: 0;
  scroll-behavior: smooth;
  background: var(--pilotcb-navy);
}

body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  color: var(--public-ink);
  background: var(--theme-canvas);
  font-family: var(--home-font);
  font-size: 16px;
  line-height: 1.55;
}

button, input { font: inherit; }
a, button, label { touch-action: manipulation; }
a { color: inherit; }

.home-skip {
  position: fixed;
  top: -7rem;
  left: 0.5rem;
  z-index: 200;
  padding: 0.7rem 1rem;
  color: #fff;
  background: #062845;
  text-decoration: none;
  transition: top var(--home-transition);
}

.home-skip:focus { top: 0.5rem; }

.home-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(0.8rem, 3vw, 5rem);
  min-height: clamp(60px, 7.4dvh, 96px);
  padding: max(0.7rem, env(safe-area-inset-top)) clamp(1rem, 3.4vw, 7.5rem) 0.7rem;
  color: var(--pilotcb-white);
  background: rgba(0, 9, 27, 0.94);
  border-bottom: 1px solid rgba(193, 199, 210, 0.24);
  box-shadow: 0 12px 38px rgba(0, 9, 27, 0.22);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: color var(--home-transition), background var(--home-transition), box-shadow var(--home-transition), min-height var(--home-transition);
}

.home-header.is-scrolled {
  min-height: 64px;
  color: var(--pilotcb-white);
  background: rgba(0, 9, 27, 0.98);
  box-shadow: 0 1px 0 rgba(193, 199, 210, 0.18), 0 12px 34px rgba(0, 9, 27, 0.3);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.home-brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 44px;
  color: inherit;
  text-decoration: none;
}

.home-brand-logo { display: block; width: clamp(178px, 13vw, 290px); height: auto; }

.home-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(0.15rem, 1.45vw, 2.25rem);
  min-width: 0;
}

.home-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding-inline: clamp(0.2rem, 0.4vw, 0.65rem);
  color: inherit;
  font-size: clamp(0.72rem, 0.64vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.105em;
  text-decoration: none;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0, 9, 27, 0.62);
  transition: opacity var(--home-transition);
  white-space: nowrap;
}

.home-header.is-scrolled .home-nav a { text-shadow: none; }
.home-nav a:hover { opacity: 0.68; }

.home-brand:focus-visible,
.home-nav a:focus-visible,
.home-portal:focus-visible,
.home-theme-item:focus-visible,
.home-theme-upload-label:focus-within,
.home-theme-reset-btn:focus-visible,
.home-focal-confirm:focus-visible,
.home-focal-back-btn:focus-visible {
  outline: 3px solid var(--home-focus);
  outline-offset: 3px;
}

/* Exactly one deliberate first viewport */
.home-shell {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  color: var(--home-text);
  background: var(--pilotcb-blue);
}

.home-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: var(--pilotcb-blue);
}

.home-bg::before,
.home-bg::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  z-index: 3;
  pointer-events: none;
}

.home-bg::before {
  top: 0;
  height: 100%;
  background:
    linear-gradient(90deg, rgba(0, 9, 27, 0.98) 0%, rgba(5, 39, 108, 0.78) 30%, rgba(1, 76, 210, 0.22) 56%, transparent 78%),
    linear-gradient(180deg, rgba(0, 9, 27, 0.5), transparent 32%);
}

.home-bg::after {
  bottom: 0;
  height: 54%;
  background: linear-gradient(180deg, transparent 0%, rgba(5, 39, 108, 0.18) 18%, rgba(1, 16, 42, 0.72) 60%, rgba(0, 9, 27, 0.98) 100%);
}

.home-aircraft-stage,
.home-bg-picture {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.home-bg-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--home-focal-x) var(--home-focal-y);
  transition: opacity 280ms ease;
}

.home-bg-img.is-fading { opacity: 0; }
.home-main { position: absolute; inset: 0; z-index: 5; }

.home-portal-stack {
  position: absolute;
  left: 50%;
  bottom: clamp(2rem, 6dvh, 6rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(calc(100% - clamp(1.5rem, 5vw, 8rem)), 104rem);
  transform: translateX(-50%);
  text-align: center;
}

.home-hero-lockup {
  display: block;
  width: min(100%, clamp(290px, 29vw, 560px));
  height: auto;
  margin-bottom: clamp(0.55rem, 1.2dvh, 1.15rem);
  filter: drop-shadow(0 18px 34px rgba(0, 9, 27, 0.34));
}

.home-statement {
  margin: 0 0 clamp(0.65rem, 1.3dvh, 1.5rem);
  color: #fff;
  font-size: clamp(1.45rem, 1.9vw, 4.6rem);
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: 0.012em;
  text-shadow: 0 2px 24px rgba(0, 36, 70, 0.76);
}

.home-statement span { display: block; }
.home-portals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(0.75rem, 1.6vw, 2.5rem); }

.home-portal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: clamp(230px, 19vw, 760px);
  min-height: clamp(108px, 12.5dvh, 270px);
  padding: clamp(0.7rem, 1.4dvh, 1.8rem) clamp(1rem, 1.5vw, 2.8rem);
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: var(--home-radius);
  color: #fff;
  box-shadow: 0 18px 54px rgba(2, 34, 61, 0.22);
  backdrop-filter: blur(11px);
  -webkit-backdrop-filter: blur(11px);
  text-decoration: none;
  transition: transform var(--home-transition), background var(--home-transition), border-color var(--home-transition), box-shadow var(--home-transition);
}

.home-portal-dashboard { background: linear-gradient(145deg, rgba(1, 97, 238, 0.92), rgba(5, 39, 108, 0.96)); }
.home-portal-pro { background: linear-gradient(145deg, rgba(11, 60, 134, 0.94), rgba(0, 9, 27, 0.97)); }
.home-portal:hover { transform: translateY(-4px); border-color: rgba(255, 255, 255, 0.76); box-shadow: 0 22px 64px rgba(1, 28, 53, 0.4); }
.home-portal-dashboard:hover { background: linear-gradient(145deg, rgba(5, 85, 143, 0.95), rgba(2, 37, 70, 0.99)); }
.home-portal-pro:hover { background: linear-gradient(145deg, rgba(27, 96, 132, 0.95), rgba(25, 42, 94, 0.99)); }
.home-portal:active { transform: translateY(-1px); }
.home-portal-icon { width: clamp(34px, 2.35vw, 86px); height: clamp(34px, 2.35vw, 86px); margin-bottom: clamp(0.1rem, 0.35dvh, 0.55rem); }
.home-portal-name { font-size: clamp(1rem, 1.25vw, 3.25rem); font-weight: 700; line-height: 1.2; letter-spacing: 0.025em; }
.home-portal-desc { margin-top: clamp(0.1rem, 0.3dvh, 0.45rem); color: var(--home-muted); font-size: clamp(0.7rem, 0.68vw, 1.65rem); }
.home-portal-arrow { margin-top: clamp(0.1rem, 0.4dvh, 0.6rem); font-size: clamp(1rem, 1vw, 2.4rem); line-height: 1; transition: transform var(--home-transition); }
.home-portal:hover .home-portal-arrow { transform: translateX(5px); }

.home-theme-strip {
  position: relative;
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: clamp(0.32rem, 0.5vw, 0.85rem);
  min-height: clamp(48px, 5dvh, 82px);
  margin-top: clamp(0.65rem, 1.2dvh, 1.5rem);
  padding: clamp(0.22rem, 0.32dvh, 0.48rem) clamp(0.35rem, 0.65vw, 1rem);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(5, 48, 83, 0.82), rgba(3, 35, 68, 0.9));
  box-shadow: 0 14px 38px rgba(1, 31, 56, 0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.home-theme-label { display: flex; align-items: center; gap: clamp(0.35rem, 0.45vw, 0.75rem); padding-inline: clamp(0.3rem, 0.35vw, 0.65rem); font-size: clamp(0.6875rem, 0.58vw, 1.4rem); font-weight: 700; letter-spacing: 0.1em; white-space: nowrap; }
.home-theme-label svg { width: clamp(22px, 1.2vw, 40px); height: clamp(22px, 1.2vw, 40px); }
.home-theme-list { display: flex; align-items: center; gap: clamp(0.25rem, 0.35vw, 0.6rem); }

.home-theme-item,
.home-theme-upload-label,
.home-theme-reset-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(48px, 3.1vw, 100px);
  height: clamp(42px, 3dvh, 56px);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: clamp(5px, 0.35vw, 10px);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--home-transition), background var(--home-transition);
}

.home-theme-item:hover,
.home-theme-upload-label:hover,
.home-theme-reset-btn:hover { border-color: #fff; background-color: rgba(255, 255, 255, 0.16); }
.home-theme-item[aria-selected="true"] { border-color: #fff; box-shadow: 0 0 0 2px rgba(80, 193, 255, 0.92); }
.home-theme-item-preview { display: block; position: relative; width: 100%; height: 100%; overflow: hidden; }
.home-theme-item-preview--photo picture,
.home-theme-item-preview--photo img { display: block; width: 100%; height: 100%; }
.home-theme-item-preview--photo img { object-fit: cover; object-position: center; }
.home-theme-item-label,
.home-theme-item-check { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.home-theme-upload-label,
.home-theme-reset-btn { width: clamp(44px, 2.4vw, 58px); flex: 0 0 auto; }
.home-theme-upload-label svg,
.home-theme-reset-btn svg { width: clamp(20px, 1vw, 30px); height: clamp(20px, 1vw, 30px); }
.home-theme-upload-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.home-theme-error { position: absolute; right: 0; bottom: calc(100% + 0.5rem); max-width: min(26rem, 80vw); padding: 0.55rem 0.8rem; border: 1px solid rgba(255, 177, 177, 0.7); border-radius: 6px; color: #fff; background: rgba(110, 21, 31, 0.94); font-size: 0.75rem; }
.home-theme-privacy { position: absolute; top: calc(100% + 0.32rem); right: 0.7rem; color: rgba(239, 248, 255, 0.78); font-size: clamp(0.6875rem, 0.55vw, 0.78rem); letter-spacing: 0.02em; text-shadow: 0 1px 8px rgba(0, 26, 51, 0.9); white-space: nowrap; }

/* Local image focal-point editor */
.home-focal-panel { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom)); color: #fff; background: rgba(1, 17, 31, 0.78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.home-focal-panel[hidden] { display: none !important; }
.home-focal-panel-inner { width: min(780px, 100%); max-height: 94dvh; overflow: auto; padding: clamp(1rem, 2vw, 1.75rem); border: 1px solid rgba(255, 255, 255, 0.26); border-radius: 14px; background: #062b4d; box-shadow: 0 28px 80px rgba(0, 17, 34, 0.55); }
.home-focal-panel-title { margin: 0; font-size: clamp(1.15rem, 2vw, 1.55rem); }
.home-focal-panel-sub { margin: 0.35rem 0 1rem; color: var(--home-muted); font-size: 0.92rem; }
.home-focal-image-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 210px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.24); border-radius: 9px; background: #031c32; cursor: crosshair; }
.home-focal-preview { display: block; width: 100%; height: 100%; object-fit: cover; }
.home-focal-confirm,
.home-focal-back-btn { min-height: 44px; padding: 0.65rem 1rem; border-radius: 7px; color: #fff; cursor: pointer; }
.home-focal-confirm { position: absolute; right: 0.75rem; bottom: 0.75rem; border: 1px solid rgba(255, 255, 255, 0.58); background: #087cc6; }
.home-focal-actions { display: flex; justify-content: flex-end; margin-top: 0.75rem; }
.home-focal-back-btn { border: 1px solid rgba(255, 255, 255, 0.28); background: transparent; }
.home-focal-dot { position: absolute; width: 20px; height: 20px; border: 2px solid #fff; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.45); }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 900px) {
  .home-header { gap: 0.55rem; min-height: 60px; padding-inline: 0.9rem; }
  .home-brand-logo { width: clamp(145px, 24vw, 184px); }
  .home-nav { flex: 0 1 auto; gap: 0.1rem; }
  .home-nav a { padding-inline: 0.3rem; font-size: 0.63rem; }
  .home-portal-stack { left: 50%; bottom: clamp(2rem, 4.5dvh, 3rem); align-items: center; width: calc(100% - 1.5rem); transform: translateX(-50%); text-align: center; }
  .home-hero-lockup { width: min(72vw, 420px); }
  .home-statement { margin-bottom: 0.65rem; font-size: clamp(1.35rem, 4.5vw, 2.15rem); }
  .home-portals { width: min(100%, 620px); gap: 0.65rem; }
  .home-portal { width: 100%; min-height: clamp(102px, 12dvh, 136px); padding: 0.55rem; }
  .home-portal-icon { width: clamp(30px, 6vw, 44px); height: clamp(30px, 6vw, 44px); }
  .home-portal-name { font-size: clamp(0.9rem, 2.7vw, 1.25rem); }
  .home-portal-desc { font-size: clamp(0.62rem, 1.8vw, 0.78rem); }
  .home-theme-strip { align-self: center; width: min(100%, 520px); justify-content: center; min-height: 46px; margin-top: 0.65rem; }
  .home-theme-label { font-size: clamp(0.6875rem, 1.8vw, 0.72rem); }
  .home-theme-item { width: clamp(46px, 11vw, 68px); }
  .home-theme-upload-label,
  .home-theme-reset-btn { width: 44px; height: 44px; }
}

@media (max-width: 620px) {
  .home-header { gap: 0.25rem; }
  .home-brand-logo { width: clamp(118px, 34vw, 148px); }
  .home-nav { flex: 1 1 auto; justify-content: space-between; }
  .home-nav a { min-width: 44px; padding-inline: 0.1rem; font-size: 0.68rem; letter-spacing: 0.045em; }
  .home-portal-stack { bottom: clamp(2rem, 4.4dvh, 2.5rem); }
  .home-hero-lockup { width: min(70vw, 290px); margin-bottom: 0.35rem; }
  .home-statement { font-size: clamp(1.2rem, 5.8vw, 1.55rem); line-height: 1.18; }
  .home-portal { min-height: clamp(98px, 11.8dvh, 118px); }
  .home-portal-desc { max-width: 11rem; font-size: 0.72rem; line-height: 1.3; }
  .home-portal-arrow { margin-top: 0.1rem; }
  .home-theme-strip { gap: 0.25rem; padding-inline: 0.3rem; }
  .home-theme-label { gap: 0.25rem; padding-inline: 0.15rem; letter-spacing: 0.065em; }
  .home-theme-label svg { width: 20px; height: 20px; }
  .home-theme-item { width: 48px; height: 40px; }
  .home-theme-upload-label,
  .home-theme-reset-btn { width: 44px; height: 44px; }
  .home-theme-privacy { font-size: 0.68rem; }
}

@media (max-width: 430px) {
  .home-brand-logo { width: 104px; }
  .home-nav a { min-width: 44px; min-height: 44px; padding-inline: 0.1rem; font-size: 0.64rem; letter-spacing: 0; }
}

@media (max-height: 760px) and (min-width: 700px) {
  .home-portal-stack { bottom: 2.25rem; }
  .home-statement { margin-bottom: 0.5rem; font-size: clamp(1.3rem, 2vw, 1.9rem); }
  .home-hero-lockup { width: min(38vw, 360px); margin-bottom: 0.3rem; }
  .home-portal { min-height: 90px; }
  .home-portal-icon { width: 29px; height: 29px; margin-bottom: 0; }
  .home-theme-strip { min-height: 44px; margin-top: 0.5rem; }
}

@media (min-aspect-ratio: 21/9) {
  .home-portal-stack { bottom: 2.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* Night V6 uses the approved composition with a restrained operational tone map. */
[data-theme="night"] .home-shell,
[data-theme="night"] .home-bg { background: #020b14; }

[data-theme="night"] .home-bg-img {
  filter: saturate(0.72) brightness(0.72) contrast(1.12);
}

[data-theme="night"] .home-bg::before {
  background:
    linear-gradient(90deg, rgba(0, 7, 18, 0.99) 0%, rgba(3, 28, 51, 0.92) 32%, rgba(5, 63, 105, 0.26) 58%, transparent 80%),
    linear-gradient(180deg, rgba(0, 9, 27, 0.72), transparent 30%);
}

[data-theme="night"] .home-bg::after {
  background: linear-gradient(180deg, transparent 0%, rgba(4, 31, 54, 0.22) 20%, rgba(2, 18, 34, 0.84) 62%, rgba(0, 7, 18, 0.99) 100%);
}

[data-theme="night"] .home-portal-dashboard {
  border-color: rgba(117, 190, 239, 0.42);
  background: linear-gradient(145deg, rgba(5, 63, 113, 0.9), rgba(3, 27, 53, 0.96));
}

[data-theme="night"] .home-portal-pro {
  border-color: rgba(161, 170, 188, 0.34);
  background: linear-gradient(145deg, rgba(13, 45, 72, 0.94), rgba(0, 9, 27, 0.98));
}

[data-theme="night"] .home-theme-strip {
  border-color: rgba(139, 210, 255, 0.32);
  background: linear-gradient(135deg, rgba(5, 35, 59, 0.9), rgba(2, 20, 37, 0.94));
}
