/* NIVHA Internal Operations Portal — landing styles
   Brand palette (NIVHA 2018 Style Guide):
     Hawaiian Blue   #2a8ba3   primary
     Forest Grey     #6d6e71   text / secondary
     Clouded Pearl   #e5e8ea   surface / border
     Green Parrot    #77b85e   success / accent
   Typography: Open Sans (web standard per brand guide)
*/

:root {
  --blue: #2a8ba3;
  --blue-700: #1f6e83;
  --blue-50: #eaf4f7;
  --grey: #6d6e71;
  --grey-900: #2c2d2f;
  --grey-700: #4a4b4d;
  --grey-300: #b8babc;
  --pearl: #e5e8ea;
  --pearl-soft: #f3f5f6;
  --green: #77b85e;
  --bg: #fbfcfc;
  --card: #ffffff;
  --shadow-sm: 0 1px 2px rgba(20, 30, 40, 0.04);
  --shadow-md: 0 6px 24px rgba(20, 30, 40, 0.06), 0 2px 6px rgba(20, 30, 40, 0.04);
  --shadow-lg: 0 14px 40px rgba(20, 30, 40, 0.10), 0 4px 12px rgba(20, 30, 40, 0.05);
  --radius: 14px;
  --radius-lg: 20px;
  --container: 1180px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 400;
  color: var(--grey-900);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Decorative background ----------------------------------------- */
.bg-poly {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.bg-poly svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Top bar ------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2rem);
  background: rgba(251, 252, 252, 0.85);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: inherit;
}
.brand-logo {
  height: 34px;
  width: auto;
  display: block;
}
.brand-divider {
  width: 1px;
  height: 24px;
  background: var(--pearl);
}
.brand-suffix {
  font-family: "Open Sans", sans-serif;
  font-weight: 300;
  font-size: 1.05rem;
  color: var(--grey);
  letter-spacing: 0.04em;
}

.topnav { display: flex; align-items: center; gap: 0.75rem; }
.env-pill {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue-700);
  background: var(--blue-50);
  border: 1px solid rgba(42, 139, 163, 0.15);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
}

/* Main layout --------------------------------------------------- */
main {
  flex: 1;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 4vw, 2rem) 4rem;
}

/* Hero ---------------------------------------------------------- */
.hero {
  padding: clamp(2rem, 6vw, 4.5rem) 0 clamp(2rem, 5vw, 3.5rem);
  max-width: 760px;
}
.eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue);
  margin: 0 0 1rem;
}
.hero h1 {
  font-size: clamp(2.1rem, 5.2vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  font-weight: 300;
  color: var(--grey-900);
  margin: 0 0 1.1rem;
}
.hero h1::first-line { font-weight: 400; }
.hero .lede {
  font-size: clamp(1.05rem, 1.8vw, 1.2rem);
  line-height: 1.55;
  color: var(--grey-700);
  margin: 0 0 1.8rem;
  max-width: 60ch;
  font-weight: 400;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }

/* Buttons ------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: transform 180ms var(--ease), background 180ms var(--ease),
              box-shadow 180ms var(--ease), color 180ms var(--ease);
  cursor: pointer;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--blue-700); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost {
  background: transparent;
  color: var(--grey-700);
  border-color: var(--pearl);
}
.btn-ghost:hover { color: var(--blue-700); border-color: rgba(42,139,163,0.4); background: var(--blue-50); }

/* Section heading ---------------------------------------------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1.5rem;
  flex-wrap: wrap;
}
.section-head h2 {
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--grey-900);
  margin: 0;
}
.section-head p {
  font-size: 0.95rem;
  color: var(--grey-700);
  margin: 0;
}

/* App grid ------------------------------------------------------ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.4rem 1.4rem 1.1rem;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--pearl);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease),
              border-color 220ms var(--ease);
  overflow: hidden;
  isolation: isolate;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(42,139,163,0.05), transparent 55%);
  opacity: 0;
  transition: opacity 220ms var(--ease);
  z-index: -1;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(42,139,163,0.35);
}
.card:hover::before { opacity: 1; }
.card:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.card-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--blue-50);
  color: var(--blue);
  transition: background 220ms var(--ease), color 220ms var(--ease);
}
.card-icon svg { width: 22px; height: 22px; }
.card:hover .card-icon { background: var(--blue); color: #fff; }

.card-body h3 {
  font-size: 1.12rem;
  font-weight: 600;
  margin: 0 0 0.3rem;
  color: var(--grey-900);
}
.card-body p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--grey-700);
}

.card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--pearl);
  font-size: 0.82rem;
  color: var(--grey-700);
}
.card-host {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-feature-settings: "tnum";
}
.card-arrow {
  width: 16px;
  height: 16px;
  color: var(--grey-300);
  transition: color 220ms var(--ease), transform 220ms var(--ease);
}
.card:hover .card-arrow { color: var(--blue); transform: translateX(3px); }

/* Status dot ---------------------------------------------------- */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--grey-300);
  display: inline-block;
  flex-shrink: 0;
}
.dot-live {
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(119, 184, 94, 0.55);
  animation: pulse 2.6s var(--ease) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(119,184,94,0.45); }
  70%  { box-shadow: 0 0 0 8px rgba(119,184,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(119,184,94,0); }
}

/* Aside cards --------------------------------------------------- */
.aside {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.1rem;
  margin-top: 3rem;
}
.aside-card {
  padding: 1.25rem 1.4rem;
  background: var(--pearl-soft);
  border: 1px solid var(--pearl);
  border-radius: var(--radius);
}
.aside-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 0.4rem;
  color: var(--grey-900);
}
.aside-card p {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--grey-700);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.status-card .dot { margin-right: 0.1rem; }

/* Footer -------------------------------------------------------- */
footer {
  margin-top: auto;
  padding: 1.5rem clamp(1rem, 4vw, 2rem);
  border-top: 1px solid var(--pearl);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
}
.foot-row {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--grey-700);
}
.foot-meta { color: var(--grey-300); }

/* Apps section spacing ------------------------------------------ */
.apps { margin-top: 1rem; }

/* Mobile tweaks ------------------------------------------------- */
@media (max-width: 540px) {
  .topbar { padding: 0.85rem 1rem; }
  .brand-logo { height: 28px; }
  .brand-suffix { font-size: 0.95rem; }
  .env-pill { font-size: 0.7rem; padding: 0.3rem 0.6rem; }
  .hero { padding-top: 2rem; }
}

/* iPad single-screen layout ------------------------------------
   Goal: every link visible without scrolling, both orientations.
   Targets touch devices between 700px and 1366px wide.
   Uses 100svh so it accounts for Safari's dynamic toolbar.
*/
@media (min-width: 700px) and (max-width: 1366px) and (pointer: coarse),
       (min-width: 700px) and (max-width: 1366px) and (hover: none) {

  html, body { height: 100%; }
  body {
    min-height: 100svh;
    height: 100svh;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr auto;
  }

  .topbar {
    padding: 0.55rem clamp(1rem, 3vw, 1.5rem);
    position: relative; /* no need to be sticky on a no-scroll page */
  }
  .brand-logo { height: 30px; }
  .brand-suffix { font-size: 0.95rem; }
  .env-pill { font-size: 0.72rem; padding: 0.3rem 0.7rem; }

  /* Main becomes a vertical flex container that fills remaining height */
  main {
    padding: clamp(0.75rem, 2.2vh, 1.4rem) clamp(1rem, 3vw, 1.75rem);
    display: flex;
    flex-direction: column;
    gap: clamp(0.6rem, 1.6vh, 1rem);
    min-height: 0;
    overflow: hidden;
  }

  /* Hero shrinks to its content; no fat vertical padding */
  .hero {
    padding: 0;
    max-width: none;
    flex: 0 0 auto;
  }
  .eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.7rem;
  }
  .hero h1 {
    font-size: clamp(1.5rem, 3.6vh, 2.1rem);
    line-height: 1.1;
    margin: 0 0 0.55rem;
  }
  .hero .lede {
    font-size: clamp(0.9rem, 1.7vh, 1.02rem);
    line-height: 1.45;
    margin: 0 0 0.85rem;
    max-width: 70ch;
  }
  .hero-actions { gap: 0.5rem; }
  .btn { padding: 0.6rem 1rem; font-size: 0.9rem; }

  /* Apps section grows to fill what's left */
  .apps {
    margin-top: 0;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .section-head {
    margin: 0 0 clamp(0.5rem, 1.2vh, 0.85rem);
  }
  .section-head h2 { font-size: 1.1rem; }
  .section-head p { font-size: 0.85rem; }

  /* The 4 app tiles in a 2x2 (portrait) or 4x1 (landscape wide) grid */
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(0.55rem, 1.4vh, 0.9rem);
    flex: 1 1 auto;
    min-height: 0;
  }
  .card {
    padding: clamp(0.75rem, 1.8vh, 1.1rem) clamp(0.9rem, 2vw, 1.2rem);
    gap: clamp(0.45rem, 1vh, 0.75rem);
    min-height: 0;
  }
  .card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }
  .card-icon svg { width: 19px; height: 19px; }
  .card-body h3 {
    font-size: 1rem;
    margin: 0 0 0.2rem;
  }
  .card-body p {
    font-size: 0.85rem;
    line-height: 1.42;
  }
  .card-foot {
    padding-top: clamp(0.45rem, 1vh, 0.7rem);
    font-size: 0.78rem;
    gap: 0.5rem;
  }

  /* Aside cards: 3 columns, single line each */
  .aside {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 0;
    flex: 0 0 auto;
  }
  .aside-card {
    padding: 0.7rem 0.95rem;
  }
  .aside-card h3 {
    font-size: 0.82rem;
    margin: 0 0 0.2rem;
  }
  .aside-card p {
    font-size: 0.8rem;
    line-height: 1.35;
  }

  /* Footer slim */
  footer {
    padding: 0.55rem clamp(1rem, 3vw, 1.5rem);
  }
  .foot-row { font-size: 0.75rem; }

  /* Tap targets: cards already big; keep buttons comfortable */
  .btn { min-height: 44px; }
}

/* iPad landscape: more horizontal room — switch tiles to 4-up
   so each card is wider and the description has air. */
@media (min-width: 1000px) and (max-width: 1366px) and (orientation: landscape) and (pointer: coarse),
       (min-width: 1000px) and (max-width: 1366px) and (orientation: landscape) and (hover: none) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}

/* Very short viewports (iPad landscape with split-view, etc.):
   trim the lede out of the way to guarantee fit. */
@media (max-height: 720px) and (pointer: coarse),
       (max-height: 720px) and (hover: none) {
  .hero .lede { display: none; }
}

/* Reduced motion ------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
  }
}
