/* EMRSphere Gold Production Portal v2
   Fix: width-only breakpoints, no orientation queries
*/

:root{
  --navy:#071D2E;
  --navy2:#10283B;
  --gold:#D4AF37;
  --max-card:180px;
  --cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Ctext y='22' font-size='22'%3E%F0%9F%91%86%3C/text%3E%3C/svg%3E") 11 2, pointer;
}

*{
  box-sizing:border-box;
}

html,
body{
  margin:0;
  min-height:100%;
  font-family:"Segoe UI", Arial, sans-serif;
  background:linear-gradient(160deg, #f5f0e8 0%, #ede8dc 60%, #e8e0d0 100%);
  color:#071D2E;
}

body{
  padding-bottom:env(safe-area-inset-bottom);
}

a{
  color:inherit;
  text-decoration:none;
}

.hidden{
  display:none !important;
}

.portal-header{
  width:100%;
  padding:10px 18px 8px;
  text-align:center;
  background:transparent;
}

.header-logo-wrap{
  display:inline-block;
  background:#ffffff;
  border-top:3px solid var(--gold);
  border-bottom:3px solid var(--gold);
  border-left:none;
  border-right:none;
  border-radius:0;
  padding:14px 28px;
}

.header-logo{
  display:block;
  width:min(380px, 42vw);
  height:auto;
  filter:drop-shadow(0 4px 5px rgba(0,0,0,.18));
}

.portal-main{
  width:100%;
  padding:6px 18px 18px;
  background:transparent;
}

.portal-grid{
  width:100%;
  max-width:780px;
  margin:0 auto;
  display:grid;
  grid-template-columns:repeat(4, minmax(0, var(--max-card)));
  justify-content:center;
  gap:12px;
}

.portal-button{
  display:block;
  width:100%;
  max-width:100%;
  height:160px !important;
  max-height:160px !important;
  border-radius:10px;
  overflow:hidden;
  background:transparent;
  box-shadow:none;
  border:none;
  transition:transform .16s ease, filter .16s ease;
  touch-action:manipulation;
  padding:0;
  cursor:var(--cursor);
}

.portal-button:hover,
.portal-button:focus{
  transform:translateY(-5px);
  filter:drop-shadow(0 8px 16px rgba(212,175,55,.35));
  outline:none;
  cursor:var(--cursor);
}

.portal-button:hover img,
.portal-button:focus img{
  border-color:var(--gold);
}

.portal-button img{
  display:block;
  width:100%;
  height:100%;
  object-fit:fill;
  object-position:center center;
  border-radius:10px;
  border:3px solid var(--navy);
  transition:border-color .16s ease;
}

.motto{
  width:100%;
  max-width:780px;
  margin:12px auto 0;
  text-align:center;
}

.motto img{
  display:block;
  width:min(560px, 70vw);
  height:auto;
  margin:0 auto;
}

.portal-footer{
  min-height:44px;
  border-top:2px solid var(--gold);
  background:linear-gradient(135deg, var(--navy), var(--navy2));
  color:#ffffff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:0 24px;
  font-size:13px;
}

/* iPad landscape (1024px+) — 4 columns */
@media(min-width:1024px) and (max-width:1366px){
  .portal-grid{
    grid-template-columns:repeat(4, minmax(0, 200px));
    gap:6px;
    max-width:860px;
  }

  .portal-button{
    height:155px !important;
    max-height:155px !important;
    max-width:100%;
    cursor:var(--cursor);
  }

  .header-logo{
    width:min(340px, 42vw);
  }

  .motto img{
    width:min(460px, 60vw);
  }
}

/* iPad portrait: 721px–1023px — 3 columns */
@media(min-width:721px) and (max-width:1023px){
  .portal-grid{
    grid-template-columns:repeat(3, minmax(0, 200px));
    gap:6px;
    max-width:640px;
  }

  .portal-button{
    height:155px !important;
    max-height:155px !important;
    max-width:100%;
    cursor:var(--cursor);
  }

  .header-logo{
    width:min(300px, 55vw);
  }

  .motto img{
    width:min(420px, 70vw);
  }
}

/* Phone: up to 720px — 2 columns */
@media(max-width:720px){
  .portal-header{
    padding:8px 10px 6px;
  }

  .header-logo-wrap{
    padding:10px 18px;
  }

  .header-logo{
    width:min(240px, 62vw);
  }

  .portal-main{
    padding:6px 12px 14px;
  }

  .portal-grid{
    grid-template-columns:repeat(2, 1fr);
    gap:12px;
  }

  .portal-button{
    width:100%;
    max-width:100%;
    height:190px !important;
    max-height:190px !important;
    margin:0;
    border-radius:10px;
    padding:0;
    cursor:var(--cursor);
  }

  .motto{
    margin-top:10px;
  }

  .motto img{
    width:min(320px, 82vw);
  }

  .portal-footer{
    min-height:auto;
    flex-direction:column;
    align-items:flex-start;
    gap:4px;
    padding:10px 14px;
    font-size:12px;
  }
}

/* Small phones */
@media(max-width:380px){
  .header-logo-wrap{
    padding:8px 14px;
  }

  .header-logo{
    width:58vw;
  }

  .portal-grid{
    gap:10px;
  }

  .portal-button{
    height:160px !important;
    max-height:160px !important;
    max-width:100%;
    cursor:var(--cursor);
  }

  .motto img{
    width:76vw;
  }
}
