:root {
  --error: #9b2f27;
}

/* Each label's glass is tinted with a dark color from its own case-study page, and
   its primary action uses that page's accent (ivory text clears 5:1 on each).
   --object-width is the width at which each magnet covers roughly the same area. */
body[data-project="bpm"] {
  --deep: 36 50 62;
  --button-bg: #4c667a;
  --object-width: 300px;
}

body[data-project="scenario-map"] {
  --deep: 14 52 70;
  --button-bg: #0f6687;
  --object-width: 340px;
}

body[data-project="jp-points"] {
  --deep: 31 46 32;
  --button-bg: #2f5931;
  --object-width: 340px;
}

body[data-project="tax-vat"] {
  --deep: 58 36 26;
  --button-bg: #a34e2a;
  --object-width: 240px;
}

/* Homepage directory glass, tinted with the project color. */
body {
  --surface: rgb(var(--deep) / 58%);
  --text: #f4f0e8;
  --text-muted: rgb(244 240 232 / 72%);
  --rule: rgb(255 255 255 / 20%);
  --field-bg: rgb(255 255 255 / 94%);
  --field-line: transparent;
  --button-text: #f4f0e8;
  --stamp: #f4f0e8;
  --focus: #f4f0e8;
  --error-text: #ffb8ac;
}

* { box-sizing: border-box; }

/* Grid and flex blocks below would otherwise override the hidden attribute. */
[hidden] { display: none !important; }

html { background: #3c3f42; }

body {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* The homepage fridge, blurred and dimmed, as if the object was just lifted off it. */
body::before {
  content: "";
  position: fixed;
  inset: -40px;
  z-index: -1;
  background:
    linear-gradient(rgb(28 30 33 / 42%), rgb(28 30 33 / 58%)),
    url("/assets/homepage/login/fridge-blur.webp") center / cover no-repeat;
  filter: blur(14px) saturate(.85);
}

.login-header {
  width: min(1240px, calc(100% - 80px));
  margin: 0 auto;
  padding: 24px 0 0;
}

.wordmark {
  display: block;
  width: 120px;
  height: 44px;
  background: url("/assets/homepage/name-hand-written-transparent.png") -10px -32px / 200px 200px no-repeat;
  /* The signature is dark ink; invert it to sit on the dimmed fridge. */
  filter: invert(1) brightness(1.1);
}

.inspect {
  flex: 1;
  /* The magnet and label together take about half of a 1440px page. */
  width: min(760px, calc(100% - 80px));
  margin: 0 auto;
  padding: 24px 0 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  align-items: center;
  gap: 40px;
}

.inspect-object {
  margin: 0;
  display: flex;
  justify-content: center;
  animation: lift 560ms cubic-bezier(.2, .8, .2, 1) both;
}

.inspect-object img {
  display: block;
  width: min(100%, var(--object-width));
  height: auto;
  transform: rotate(-3deg);
  filter: drop-shadow(0 28px 40px rgb(0 0 0 / 34%)) drop-shadow(0 6px 10px rgb(0 0 0 / 18%));
}

.tag {
  position: relative;
  padding: 28px 32px 26px;
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(.95);
  animation: slide-in 520ms 120ms cubic-bezier(.2, .8, .2, 1) both;
}

/* Reflected light and grain, matching the homepage directory panel. */
.tag::before,
.tag::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tag::before {
  background:
    radial-gradient(ellipse 105% 18% at 4% 14%, rgb(255 247 228 / 17%) 0%, rgb(255 244 220 / 7%) 42%, transparent 74%),
    linear-gradient(118deg, transparent 0%, rgb(255 244 220 / 9%) 12%, rgb(255 244 220 / 4%) 23%, transparent 38%),
    linear-gradient(105deg, transparent 58%, rgb(255 245 224 / 3.5%) 68%, transparent 79%);
}

.tag::after {
  opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.tag > * {
  position: relative;
  z-index: 1;
}

.tag-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px dashed var(--rule);
}

.tag-number {
  color: var(--text-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.tag-barcode {
  width: 96px;
  height: 24px;
  fill: currentColor;
  opacity: .78;
}

h1 {
  margin: 20px 0 0;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -.02em;
}

.tag-lede {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.5;
}

.tag-summary {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.5;
}

.tag-fields {
  margin: 22px 0 0;
  border-top: 1px solid var(--rule);
}

.tag-fields div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}

.tag-fields dt,
.tag-form label {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.tag-fields dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.tag-form {
  margin-top: 24px;
  display: grid;
  gap: 8px;
}

input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--field-line);
  border-radius: 6px;
  background: var(--field-bg);
  color: rgb(var(--deep));
  font: inherit;
  font-size: 16px;
}

input[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }

.tag-error {
  margin: 0;
  color: var(--error-text);
  font-size: 13px;
  line-height: 1.5;
}

button {
  min-height: 50px;
  margin-top: 6px;
  padding: 12px 18px;
  border: 0;
  border-radius: 6px;
  background: var(--button-bg);
  color: var(--button-text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

button:hover { filter: brightness(1.08); }
button:disabled { cursor: progress; filter: none; opacity: .82; }

input:focus-visible,
button:focus-visible,
.tag-back:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.wordmark:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 5px;
}

/* Projects outside the first release replace the password field with a production stamp. */
.tag-wip {
  margin-top: 24px;
  display: grid;
  justify-items: start;
  gap: 14px;
}

.tag-stamp {
  margin: 0;
  padding: 6px 12px;
  border: 2px solid var(--stamp);
  border-radius: 4px;
  color: var(--stamp);
  font-size: 13px;
  font-weight: 500;
  transform: rotate(-2deg);
}

.tag-wip-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

.tag-cta {
  width: 100%;
  min-height: 50px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--button-bg);
  color: var(--button-text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.tag-cta:hover { filter: brightness(1.08); }

.tag-cta:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.tag-note {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.tag-back {
  display: inline-block;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 13px;
  text-underline-offset: 4px;
}

@keyframes lift {
  from { opacity: 0; transform: translateY(28px) scale(.92); }
}

@keyframes slide-in {
  from { opacity: 0; transform: translateX(28px); }
}

/* Laptop windows lose height to browser chrome and the dock. Float the signature
   and tighten the label's spacing so the whole label fits without scrolling. */
@media (min-width: 900px) and (max-height: 820px) {
  .login-header {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
  }

  .inspect { padding: 24px 0; }

  .tag { padding: 22px 28px 20px; }

  .tag-head { padding-bottom: 14px; }

  h1 { margin-top: 14px; }

  .tag-lede { margin-top: 6px; }

  .tag-summary { margin-top: 8px; }

  .tag-fields { margin-top: 16px; }

  .tag-fields div { padding: 6px 0; }

  .tag-form,
  .tag-wip { margin-top: 18px; }

  input,
  button,
  .tag-cta { min-height: 44px; }

  .tag-note,
  .tag-back { margin-top: 10px; }
}

@media (max-width: 899px) {
  .login-header,
  .inspect { width: min(560px, calc(100% - 48px)); }

  .inspect {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 28px;
    padding-top: 12px;
  }

  .inspect-object img {
    width: min(78%, var(--object-width));
    max-height: 30vh;
    object-fit: contain;
  }

  @keyframes slide-in {
    from { opacity: 0; transform: translateY(24px); }
  }
}

@media (max-width: 639px) {
  .login-header,
  .inspect { width: calc(100% - 32px); }

  .login-header { padding-top: 16px; }

  .wordmark {
    width: 104px;
    height: 40px;
    background-position: -8px -27px;
    background-size: 170px 170px;
  }

  /* Keep the password field inside the first screen on a 375×812 phone. */
  .inspect { gap: 14px; padding-top: 4px; padding-bottom: 32px; }

  .inspect-object img { max-height: 15vh; }

  .tag { padding: 22px 20px 22px; }

  .tag-head { padding-bottom: 14px; }

  h1 { margin-top: 14px; font-size: 28px; }

  .tag-summary { margin-top: 10px; }

  .tag-fields { margin-top: 16px; }

  .tag-fields div { padding: 7px 0; }

  .tag-form { margin-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .inspect-object,
  .tag { animation: none; }
}
