/* The order portal (order.yeklens.com): a stand-alone, mobile-first page. It deliberately shares nothing with the
   marketing site's navigation or footer, and loads none of its layout CSS. One font family (Manrope),
   YEKLENS navy and gold. */

:root {
  --navy: #1F3864;
  --navy-dark: #13233F;
  --gold: #B8860B;
  --gold-light: #F4E9CE;
  --grey: #595959;
  --cream: #FAF9F6;
  --border: #E7E2D6;
  --white: #fff;
  --error: #b03030;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

/* A class that sets display (like .p-form) must never defeat the hidden attribute. */
[hidden] { display: none !important; }

body {
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  color: var(--grey);
  background: var(--cream);
  line-height: 1.5;
  font-size: 16px;
  min-height: 100vh;
  min-height: 100dvh;
}

button, input { font-family: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.portal {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 28px 20px 24px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

/* ---- Top: small logo, centred; the school name appears once a card has been recognised ---- */
.portal-top { text-align: center; }
.portal-logo { height: 34px; width: auto; }
.portal-school { margin-top: 10px; font-weight: 700; color: var(--navy); font-size: 1rem; }

.portal-main { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 28px 0; }

.portal h1 { font-size: 1.5rem; font-weight: 700; color: var(--navy); line-height: 1.2; text-align: center; }

/* ---- The three entries: large, full width, differently coloured ---- */
.p-actions { display: flex; flex-direction: column; gap: 14px; }

.p-btn {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 76px; padding: 14px 18px;
  border: 2px solid transparent; border-radius: 10px;
  font-size: 1.15rem; font-weight: 700; text-align: left; line-height: 1.2;
  cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.p-btn:active { transform: scale(0.99); }
.p-btn:focus-visible, .p-link:focus-visible, .p-field input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.p-btn svg { flex: none; width: 30px; height: 30px; }
.p-btn .p-label { flex: 1; }

.p-btn--scan { background: var(--navy); color: var(--white); }
.p-btn--signin { background: var(--gold); color: var(--white); }
.p-btn--codes { background: var(--gold-light); color: var(--navy); border-color: var(--navy); }
.p-btn--scan:hover, .p-btn--signin:hover { filter: brightness(1.08); }
.p-btn--codes:hover { background: #efe0b8; }

.p-btn[aria-disabled='true'] { opacity: 0.92; }
.p-tag {
  flex: none; font-size: 0.6rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  background: rgba(255, 255, 255, 0.22); color: inherit; border-radius: 99px; padding: 3px 7px;
}

/* ---- Views inside the portal (home, codes, "coming soon") ---- */
.p-view[hidden] { display: none; }
/* No ring on a tap or a programmatic focus; keyboard users still get a clear one. */
.p-back:focus { outline: none; }
.p-back:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.p-back {
  background: none; border: none; color: var(--navy); font-weight: 700; font-size: 0.95rem;
  cursor: pointer; padding: 8px 0; margin-bottom: 8px; text-decoration: underline;
}
.p-lead { margin-top: 10px; text-align: center; font-size: 0.98rem; }

.p-form { margin-top: 22px; display: flex; flex-direction: column; gap: 16px; }
.p-field { display: flex; flex-direction: column; gap: 6px; }
.p-field label { font-size: 0.9rem; font-weight: 700; color: var(--navy); }
.p-field input {
  width: 100%; min-height: 56px; padding: 12px 14px; border: 2px solid var(--border); border-radius: 10px;
  background: var(--white); color: #1a1a1a; font-size: 1.35rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase;
}
.p-field input::placeholder { color: #b9b4a6; letter-spacing: 0.12em; font-weight: 700; }
.p-note { font-size: 0.9rem; text-align: center; }
.p-submit { background: var(--navy); color: var(--white); justify-content: center; text-align: center; min-height: 60px; }

.p-msg { padding: 12px 14px; border-radius: 10px; font-size: 0.95rem; font-weight: 600; text-align: center; }
.p-msg[hidden] { display: none; }
.p-msg--error { background: #fbecec; color: var(--error); border: 1px solid #ebb7b7; }
.p-msg--info { background: #eef3fb; color: var(--navy); border: 1px solid #c7d6ee; }

/* ---- Bottom: only a help link and a way back to the main site ---- */
.p-links { display: flex; justify-content: space-between; gap: 16px; font-size: 0.85rem; padding-top: 8px; }
.p-link { color: var(--grey); text-decoration: underline; background: none; border: none; font-size: inherit; cursor: pointer; padding: 6px 0; }
.p-link:hover { color: var(--navy); }

/* ---- Help panel (a sheet inside the portal, not a website page) ---- */
dialog.p-help {
  width: min(520px, 100vw); max-width: 100vw; max-height: 100dvh; height: auto;
  margin: auto; padding: 0; border: none; border-radius: 14px; background: var(--white); color: var(--grey);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
dialog.p-help::backdrop { background: rgba(19, 35, 63, 0.55); }
.p-help-head {
  position: sticky; top: 0; background: var(--white); display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.p-help-head h2 { font-size: 1.15rem; color: var(--navy); }
.p-help-close {
  background: var(--navy); color: var(--white); border: none; border-radius: 8px; padding: 8px 14px;
  font-weight: 700; font-size: 0.9rem; cursor: pointer;
}
.p-help-body { padding: 6px 18px 20px; overflow-y: auto; max-height: calc(100dvh - 70px); }
.p-help details { border-bottom: 1px solid var(--border); }
.p-help summary { cursor: pointer; padding: 14px 24px 14px 0; font-weight: 700; color: var(--navy); position: relative; list-style: none; }
.p-help summary::-webkit-details-marker { display: none; }
.p-help summary::after { content: '+'; position: absolute; right: 2px; top: 12px; font-size: 1.3rem; font-weight: 400; color: var(--gold); }
.p-help details[open] summary::after { content: '\2212'; }
.p-help details p { padding: 0 0 14px; font-size: 0.95rem; }
.p-help mark { background: var(--gold-light); color: var(--navy-dark); padding: 1px 4px; border-radius: 3px; font-weight: 700; }
.p-help a { color: var(--navy); font-weight: 700; }

/* On phones, Safari and Chrome float a toolbar over the bottom of the page. Leave room so the last
   button and the two small links are never hidden underneath it. */
@media (pointer: coarse) {
  .portal { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
}

@media (min-width: 520px) {
  .portal { padding-top: 48px; }
  dialog.p-help { max-height: 86vh; }
  .p-help-body { max-height: calc(86vh - 70px); }
}

@media (prefers-reduced-motion: reduce) {
  .p-btn { transition: none; }
}

/* ---- Scan your QR Code ---- */
.p-scan {
  position: relative; margin-top: 18px; border-radius: 14px; overflow: hidden; background: #0d1626;
  aspect-ratio: 1 / 1; width: 100%;
}
.p-scan video { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-scan-frame {
  position: absolute; inset: 14%; border: 3px solid rgba(255, 255, 255, 0.9); border-radius: 12px;
  box-shadow: 0 0 0 999px rgba(13, 22, 38, 0.35); pointer-events: none;
}
#scan-status { margin-top: 14px; }

/* ---- Sign In ---- */
.p-field input[type='email'], .p-field input[type='text'].p-plain { text-transform: none; letter-spacing: 0; font-size: 1.1rem; font-weight: 600; }
#signin-code { text-align: center; font-size: 1.8rem; letter-spacing: 0.35em; }
#signin-code::placeholder { letter-spacing: 0.35em; }
.p-split { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 0.9rem; }
.p-link[disabled] { opacity: 0.55; cursor: default; text-decoration: none; }
.p-children { list-style: none; margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.p-children li { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.p-children b { color: var(--navy); display: block; }
.p-children span { font-size: 0.9rem; }

/* ---- My Photos ---- */
.p-child { margin-top: 22px; }
.p-child h2 { font-size: 1.2rem; color: var(--navy); }
.p-meta { margin-top: 4px; font-size: 0.9rem; }
.p-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.p-cell { position: relative; }
.p-thumb { display: block; width: 100%; aspect-ratio: 4 / 5; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: #e9e5da; cursor: zoom-in; }
.p-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.p-thumb:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.p-heart {
  position: absolute; top: 6px; right: 6px; width: 38px; height: 38px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, 0.92); display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.p-heart svg { width: 22px; height: 22px; fill: none; stroke: var(--navy); stroke-width: 2; }
.p-heart.is-on svg { fill: #c0392b; stroke: #c0392b; }
.p-heart:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

dialog.p-zoom {
  width: min(560px, 100vw); max-width: 100vw; max-height: 100dvh; margin: auto; padding: 0; border: none;
  border-radius: 14px; background: #101826; color: #fff;
}
dialog.p-zoom::backdrop { background: rgba(13, 22, 38, 0.8); }
.p-zoom-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; }
.p-zoom-bar .p-heart { position: static; }
.p-zoom-stage { position: relative; display: flex; align-items: center; justify-content: center; padding: 0 0 14px; }
.p-zoom-stage img { display: block; max-width: 100%; max-height: calc(100dvh - 120px); width: auto; height: auto; }
.p-zoom-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 56px; border: 0; border-radius: 8px;
  background: rgba(255, 255, 255, 0.85); color: var(--navy); font-size: 2rem; line-height: 1; cursor: pointer;
}
#zoom-prev { left: 8px; }
#zoom-next { right: 8px; }
