/* Horeca Advies Bureau — brand tokens taken from horecaadviesbureau.nl */
:root {
  --petrol: #003e53;
  --petrol-dark: #002c3b;
  --cyan: #68ccd1;
  --offwhite: #faf9f9;
  /* Relief tile lifted from the Forfacts banner, 91x92 and seamless. The tile is drawn
     smaller than its native size; --relief-size is the dial for how fine the texture is. */
  --relief: url("/assets/pattern.png");
  --relief-size: 46px;
  /* How far the logo and user button sit inside the petrol band. */
  --bar-inset: 1.25rem;
  /* Shadow beside the column, running its full height. No negative spread: that would
     pull the blur back in at the top and bottom and leave the corners bare. */
  --shadow-reach: 26px;
  --shadow-blur: 44px;
  --shadow-tighten: 0;
  --shadow-ink: rgba(0, 40, 54, .3);
  --ink: #1d2b31;
  --muted: #5c6f77;
  --line: #dfe6e9;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Open Sans", -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--offwhite);
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: "Roboto Slab", Georgia, serif;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 .5rem;
}

a { color: var(--petrol); }

/* --- sign-in screen ------------------------------------------------------- */

.signin {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background: linear-gradient(160deg, var(--petrol) 0%, var(--petrol-dark) 100%);
}

.signin-card {
  width: 100%;
  max-width: 27rem;
  text-align: center;
}

/* Direct children only: Clerk mounts its own h1, p and img inside this card, and
   these rules would otherwise repaint its header white-on-white. */
.signin-card > img { height: 68px; margin-bottom: 2rem; }

.signin-card > h1 { color: #fff; font-size: 1.6rem; }

.signin-card > p { color: rgba(255, 255, 255, .78); margin: 0 0 2rem; }

.signin-card .mount { display: flex; justify-content: center; }

/* --- portal chrome -------------------------------------------------------- */

.topbar {
  /* The bar lives inside the column, so it is already exactly the report's width and
     needs no tricks to line up. --bar-inset keeps the logo and user button off the edge.
     position:relative so .menu-panel, once it becomes a dropdown, anchors to the bar
     instead of the page. #panel is a flex sibling painted after it in DOM order, and a
     flex item with z-index:auto still takes part in z-index ordering -- without this,
     .menu-panel's dropdown would render underneath the report instead of over it.
     z-index alone (without position) does nothing, hence both live on this rule. */
  position: relative;
  z-index: 20;
  background: var(--petrol);
  color: #fff;
  padding: .9rem var(--bar-inset);
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Direct child again: the Clerk user button mounts its avatar inside this bar. */
.topbar > img { height: 40px; }

.topbar .spacer { flex: 1; }

/* Always pinned to the far right, with or without the .spacer beside it -- the
   dropdown below hides the spacer, and #user needs to stay put without it. */
#user { margin-left: auto; }

/* Collapsed into .menu-panel below the breakpoint in the media query further down;
   until then this has no visual effect at all. */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 2.25rem;
  height: 2.25rem;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.menu-toggle span { display: block; height: 2px; background: #fff; border-radius: 1px; }

.menu-toggle:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* On a wide screen this wrapper is invisible to layout -- its children sit directly
   in .topbar's flex row, exactly as if there were no wrapper at all. The media query
   further down is what turns it into an actual dropdown. */
.menu-panel { display: contents; }

/* The report's page tabs, restyled to live in the petrol bar. */
.pages { display: flex; flex-wrap: wrap; gap: .25rem; margin-left: 1rem; }

.page {
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
  color: rgba(255, 255, 255, .72);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: .35rem .7rem;
}

.page:hover { color: #fff; }

.page[aria-current="true"] { color: #fff; border-bottom-color: var(--cyan); }

.page:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* One viewport of relief, with the column centred on it. */
.app {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  height: 100dvh;
  overflow: hidden;
  background: var(--relief) repeat;
  /* Height derived from the tile's own 91:92 ratio so the diamonds stay undistorted. */
  background-size: var(--relief-size) calc(var(--relief-size) * 92 / 91);
}

/* Bar plus report. fitFrame() gives it a width and height in pixels.
   Two mirrored shadows rather than one blur all round: this way left and right are
   identical by construction, and nothing spills above or below the block. */
.column {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  max-height: 100%;
  box-shadow:
    calc(var(--shadow-reach) * -1) 0 var(--shadow-blur) var(--shadow-tighten) var(--shadow-ink),
    var(--shadow-reach) 0 var(--shadow-blur) var(--shadow-tighten) var(--shadow-ink);
}

.picker {
  font: inherit;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 6px;
  padding: .35rem .6rem;
}

.picker option { color: var(--ink); background: #fff; }

/* Below this width the bar itself is too narrow for tabs, both pickers and the avatar
   side by side -- .menu-panel becomes an actual dropdown instead of the inline group
   it is above the breakpoint, opened by .menu-toggle and closed again by portal.js
   once something inside it is chosen. */
@media (max-width: 720px) {
  .menu-toggle { display: flex; }

  .menu-panel {
    display: none;
    position: absolute;
    inset-inline: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: .6rem;
    background: var(--petrol);
    padding: 1rem var(--bar-inset) 1.25rem;
    box-shadow: 0 16px 28px rgba(0, 40, 54, .35);
  }

  .menu-panel.open { display: flex; }

  /* Only does anything inline, pushing the pickers away from the tabs -- in a
     column it would just eat vertical space between them for nothing. */
  .menu-panel .spacer { display: none; }

  .pages { flex-direction: column; margin-left: 0; }

  .picker { width: 100%; }
}

#panel {
  position: relative;
  flex: 1;
  min-height: 0;      /* lets the iframe shrink inside the flex column */
  overflow: hidden;
  background: #fff;
  /* Grid so a message can centre itself with margin:auto. The tracks are pinned to
     minmax(0,1fr): an auto track would grow to the iframe's intrinsic width and push
     the report off-screen. */
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

/* The column is already the report's exact ratio, so the frame simply fills it and
   Power BI has nothing left to letterbox. */
#frame {
  position: relative;
  width: 100%;
  height: 100%;
}

#frame iframe { border: 0; width: 100%; height: 100%; display: block; }

.report-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1rem;
  background: var(--petrol);
  color: rgba(255, 255, 255, .8);
}

.report-loading p { margin: 0; }

/* Messages take the place of the report, so they centre in the same space. */
.notice {
  max-width: 34rem;
  margin: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--cyan);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  color: var(--muted);
}

.notice.error { border-left-color: #b3261e; }

/* Shown while clerk-js is still coming down the wire. */
.spinner {
  width: 1.75rem;
  height: 1.75rem;
  border: 3px solid rgba(255, 255, 255, .25);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
}

.signin-error { color: #fff; background: rgba(0, 0, 0, .25); border-radius: var(--radius); padding: 1rem; }
