/* Fairdoc landing + sign-in prototype.
   Static HTML/CSS/JS: no frameworks, web fonts, CDNs, or network calls. */

:root {
  --ink: #1a1a18;          /* strip, primary text, dark button */
  --ink-hover: #3c3c38;
  --paper: #f8f7f4;        /* login page, inverse text */
  --chip: #efece5;         /* home Sign in control */
  --muted: #696762;        /* field labels */
  --hairline: rgba(84, 64, 16, 0.14);
  --hairline-hover: rgba(84, 64, 16, 0.24);
  --scrim: 26, 26, 24;

  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --w-label: 450;          /* closest system weight to the reference's 432 */

  --rise: 350ms cubic-bezier(0.215, 0.61, 0.355, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 20px;
  color: #000;
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
p, h1 { margin: 0; }
img, svg { display: block; }
[hidden] { display: none !important; }

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

:focus { outline: none; }
[tabindex="-1"]:focus { box-shadow: none; }

.skip-link {
  position: absolute; z-index: 20; left: 16px; top: -80px;
  padding: 8px 12px; border-radius: 4px;
  background: var(--paper); color: var(--ink);
  font-weight: var(--w-label); text-decoration: none;
}
.skip-link:focus-visible { top: 36px; box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--paper); }

/* ---------- Shell: thin dark strip + rounded page ---------- */

.shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--ink);
}

.strip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  min-height: 28px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  padding-top: env(safe-area-inset-top);
  background: var(--ink);
  color: var(--paper);
}
.strip-text {
  font-size: 13px;
  line-height: 16px;
  font-style: italic;
}

.strip-link {
  position: relative;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(248, 247, 244, 0.6);
  white-space: nowrap;
  border-radius: 2px;
}
.strip-link:hover { text-decoration-color: currentColor; }
.strip-link::after { content: ""; position: absolute; inset: -6px -4px; } /* larger touch target */
.strip-link:focus-visible { box-shadow: 0 0 0 2px var(--paper); }
.strip-link[aria-current="page"] { text-decoration-color: currentColor; }

/* ---------- Home ---------- */

.home {
  position: relative;
  isolation: isolate;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  overflow: hidden;
  border-radius: 6px 6px 0 0;
}

.home-bg {
  position: absolute;
  inset: 0;
  z-index: -10;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 100%;
  pointer-events: none;
}

.home-scrim {
  position: absolute;
  inset: 0;
  z-index: -10;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(var(--scrim), 0.24) 0%,
    rgba(var(--scrim), 0.176) 8%,
    rgba(var(--scrim), 0.096) 16%,
    rgba(var(--scrim), 0.04) 23%,
    rgba(var(--scrim), 0) 30%,
    rgba(var(--scrim), 0) 55%,
    rgba(var(--scrim), 0.04) 70%,
    rgba(var(--scrim), 0.096) 80%,
    rgba(var(--scrim), 0.176) 88%,
    rgba(var(--scrim), 0.248) 94%,
    rgba(var(--scrim), 0.32) 100%);
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 24px max(32px, env(safe-area-inset-right)) 32px max(32px, env(safe-area-inset-left));
}
.home-brand { position: relative; z-index: 2; display: flex; align-items: center; width: 156px; height: 48px; flex: 0 0 156px; opacity: 1; visibility: visible; overflow: visible; }
.home-logo { display: block; width: 156px; height: 40px; object-fit: contain; max-width: none; flex: none; opacity: 1; visibility: visible; }

.btn-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 8px 12px;
  border-radius: 4px;
  background: var(--chip);
  color: var(--ink);
  font-size: 14px;
  line-height: 20px;
  font-weight: var(--w-label);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 150ms, opacity 150ms;
}
.btn-signin:hover { background: var(--paper); }
.btn-signin:active { opacity: 0.6; }
.btn-signin:focus-visible { box-shadow: 0 0 0 1px rgba(26, 26, 24, 0.6), 0 0 0 3px var(--paper); }

.home-lower {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.home-foot {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 16px;
  padding: 0 max(32px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(32px, env(safe-area-inset-left));
  color: var(--paper);
  font-size: 13px;
  line-height: 16px;
}
.home-foot p { color: #fff; opacity: 1; }
.home-foot a, .home-foot a:link, .home-foot a:visited { color: #fff; text-decoration: none; }
.home-foot a, .home-foot span { white-space: nowrap; }
.home-foot a:hover, .home-foot a:focus-visible { text-decoration: underline; }

/* Entrance, matching the reference's short rise */
.rise { animation: rise var(--rise) both; will-change: transform, opacity; }
.rise-1 { animation-delay: 90ms; }
.rise-2 { animation-delay: 180ms; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Sign in ---------- */

.login {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  border-radius: 6px 6px 0 0;
  background: var(--paper);
}

.login-center {
  flex: 1;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.login-col {
  position: relative;
  margin: auto 0; /* safe vertical centering: never clips when the viewport is short */
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 384px;
  max-width: 100%;
}

.login-head { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }
.login-logo { display: block; border-radius: 4px; }
.login-logo img { width: 36px; height: 36px; }
.login-title {
  font-size: 24px;
  line-height: 32px;
  font-weight: var(--w-label);
  letter-spacing: -0.1px;
  color: var(--ink);
}

.login-form { display: flex; flex-direction: column; gap: 8px; }

.field {
  position: relative;
  display: flex;
  align-items: center;
  height: 64px;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: transparent;
}
.field:hover { border-color: var(--hairline-hover); }
.field:focus-within { border-color: var(--ink); }

.field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 12px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
}
.field input::placeholder { opacity: 0; }
.field input:not(:placeholder-shown) { padding-top: 20px; }

.field label {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  transform-origin: left;
  pointer-events: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
  transition: top 150ms ease-in-out, font-size 150ms ease-in-out, line-height 150ms ease-in-out;
}
.field input:not(:placeholder-shown) + label {
  top: calc(50% - 10px);
  font-size: 13px;
  line-height: 16px;
}

.field-password input { padding-right: 4px; }
.eye-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 12px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.eye-btn .eye-hide { display: none; }
.eye-btn[data-visible="true"] .eye-show { display: none; }
.eye-btn[data-visible="true"] .eye-hide { display: block; }
/* larger invisible hit area for touch */
.eye-btn { position: relative; }
.eye-btn::after { content: ""; position: absolute; inset: -10px; }

.login-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  margin-top: 12px; /* 8px form gap + 12px = reference 20px */
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: 16px;
  line-height: 24px;
  font-weight: var(--w-label);
  cursor: pointer;
  transition: background-color 150ms, opacity 150ms;
}
.btn-submit:hover { background: var(--ink-hover); }
.btn-submit:active { opacity: 0.6; }

.btn-forgot {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 16px;
  font-weight: var(--w-label);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.btn-forgot::after { content: ""; position: absolute; inset: -12px -6px; }
.btn-forgot:hover { color: var(--ink-hover); }

.btn-submit:focus-visible,
.btn-forgot:focus-visible,
.eye-btn:focus-visible,
.login-logo:focus-visible { box-shadow: 0 0 0 1px var(--paper), 0 0 0 3px var(--ink); }

.login-aside {
  position: absolute;
  top: calc(100% + 20px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 16px;
}

.form-status:empty { display: none; }
.form-status {
  font-size: 13px;
  line-height: 16px;
  font-weight: var(--w-label);
  color: var(--ink);
}

/* ---------- Mission (same warm-white page as sign in) ---------- */

.page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  border-radius: 6px 6px 0 0;
  background: var(--paper);
}
.page-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.mission-col {
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  width: 480px;
  max-width: 100%;
  padding: 24px 0;
}
.page-head { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }
.mission-body { display: flex; flex-direction: column; gap: 16px; }
.mission-body p {
  font-size: 16px;
  line-height: 24px;
  color: var(--ink);
}
.page-back { display: inline-block; margin-top: 4px; text-decoration: underline; }
.page-back:focus-visible { box-shadow: 0 0 0 1px var(--paper), 0 0 0 3px var(--ink); }

/* ---------- Responsive ---------- */

@media (max-width: 767px) {
  .strip { align-items: flex-start; padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: 8px; }
  .home-header { gap: 8px; }
  .home-brand { width: 140px; flex-basis: 140px; }
  .home-logo { width: 140px; height: 36px; }
  .home-foot { flex-direction: column; }
}

@media (max-width: 359px) {
  .home-header { padding-left: 12px; padding-right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; }
  *, *::before, *::after { transition-duration: 0.001ms !important; }
}

@media (forced-colors: active) {
  .btn-signin, .btn-submit, .field { border: 1px solid ButtonText; }
  :focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
}
