/* ============================================================
   NOVA TECH — CAMPUS PORTAL SIGN IN
   Design language: the school records office. Ledger paper,
   ruled lines, index-card tabs, and an ink stamp of authority.
   ============================================================ */

:root {
  --ink: #1c2b3a;
  --ink-2: #142130;
  --parchment: #f3ecdc;
  --parchment-dark: #e9ddc3;
  --paper: #fbf7ee;
  --brass: #a9803f;
  --brass-dark: #8a6a34;
  --maroon: #7a2e2e;
  --maroon-dark: #611f1f;
  --forest: #3f5d4f;
  --forest-dark: #304a3e;
  --text: #262019;
  --text-soft: #5a5142;
  --line: rgba(38, 32, 25, 0.14);
  --error: #a13636;

  --accent: var(--maroon);
  --accent-dark: var(--maroon-dark);

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "IBM Plex Sans", -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --radius: 4px;
  --shadow-card: 0 24px 48px -20px rgba(28, 43, 58, 0.35);
}

body[data-role="admin"]     { --accent: var(--maroon);  --accent-dark: var(--maroon-dark); }
body[data-role="principal"] { --accent: var(--brass);   --accent-dark: var(--brass-dark); }
body[data-role="teacher"]   { --accent: var(--forest);  --accent-dark: var(--forest-dark); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--parchment);
}

@media (prefers-reduced-motion: no-preference) {
  .card, .tab, .submit, .field__control input { transition: all 0.18s ease; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

button, input {
  font-family: inherit;
}

a {
  color: var(--accent-dark);
}

.page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 38%) 1fr;
}

/* ---------------- LEDGER PANEL (left) ---------------- */

.ledger {
  position: relative;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  color: var(--parchment);
  overflow: hidden;
  padding: clamp(2rem, 5vw, 4rem);
  display: flex;
  align-items: center;
}

.ledger__lines {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 43px,
    rgba(243, 236, 220, 0.06) 44px
  );
  pointer-events: none;
}

.ledger__margin {
  position: absolute;
  top: 0; bottom: 0;
  left: clamp(3.2rem, 9vw, 6.5rem);
  width: 1px;
  background: rgba(122, 46, 46, 0.35);
  pointer-events: none;
}

.ledger__content {
  position: relative;
  z-index: 1;
  max-width: 30rem;
}

.seal {
  position: relative;
  width: 84px;
  height: 84px;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.seal__ring {
  position: absolute;
  inset: 0;
  fill: none;
  stroke: var(--brass);
  stroke-width: 1.4;
}

.seal__initials {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.6rem;
  color: var(--brass);
  letter-spacing: 0.04em;
}

.ledger__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 0.6rem;
}

.ledger__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 1.08;
  margin: 0 0 1.6rem;
  color: var(--paper);
}

.ledger__quote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.05rem;
  line-height: 1.55;
  color: rgba(243, 236, 220, 0.78);
  margin: 0 0 2.4rem;
  padding-left: 1rem;
  border-left: 2px solid rgba(169, 128, 63, 0.5);
}

.ledger__meta {
  display: flex;
  gap: 2rem;
  margin: 0;
  padding-top: 1.6rem;
  border-top: 1px solid rgba(243, 236, 220, 0.16);
}

.ledger__meta > div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ledger__meta dt {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(243, 236, 220, 0.5);
}

.ledger__meta dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--parchment);
}

/* ---------------- AUTH PANEL (right) ---------------- */

.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem);
}

.auth__inner {
  width: 100%;
  max-width: 26rem;
}

/* Folder tabs */
.tabs {
  display: flex;
  padding-left: 0.75rem;
}

.tab {
  appearance: none;
  border: none;
  cursor: pointer;
  background: var(--parchment-dark);
  color: var(--text-soft);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.82rem;
  padding: 0.7rem 1.1rem 0.6rem;
  margin-right: -0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
  position: relative;
  z-index: 1;
  transform: translateY(4px);
}

.tab__icon {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.tab[aria-selected="true"] {
  background: var(--paper);
  color: var(--accent-dark);
  transform: translateY(0);
  z-index: 3;
  font-weight: 600;
}

.tab:hover:not([aria-selected="true"]) {
  color: var(--text);
}

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

/* Card */
.card {
  position: relative;
  background: var(--paper);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  box-shadow: var(--shadow-card);
  padding: 2.4rem 2.2rem 2rem;
  z-index: 2;
}

.card__stamp {
  position: absolute;
  top: 1.4rem;
  right: 1.5rem;
  width: 58px;
  height: 58px;
  border: 1.5px dashed var(--accent);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  transform: rotate(-9deg);
  opacity: 0.9;
}

.card__stamp-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.card__stamp-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0.2rem;
}

.card__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 0.2rem;
}

.card__heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.7rem;
  color: var(--text);
  margin: 0 0 0.5rem;
  max-width: 85%;
}

.card__subtext {
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.5;
  margin: 0 0 1.8rem;
  max-width: 92%;
}

/* Form fields */
.field {
  margin-bottom: 1.15rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.field__control {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--parchment);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 0 0.75rem;
}

.field__control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.field__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: var(--text-soft);
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.field__control input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.68rem 0;
  font-size: 0.92rem;
  color: var(--text);
  outline: none;
  min-width: 0;
}

.field__control input::placeholder {
  color: #a59d8c;
}

.field__toggle {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0.3rem;
  display: flex;
  color: var(--text-soft);
}

.field__toggle-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.field__error {
  min-height: 1.1rem;
  margin: 0.35rem 0 0;
  font-size: 0.76rem;
  color: var(--error);
}

.field--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--text-soft);
  cursor: pointer;
}

.checkbox input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

.link {
  font-size: 0.82rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.link:hover {
  border-bottom-color: currentColor;
}

/* Submit */
.submit {
  width: 100%;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--paper);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.submit:hover {
  background: var(--accent-dark);
}

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

.submit__spinner {
  display: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 46;
  stroke-dashoffset: 0;
  animation: spin 0.8s linear infinite;
}

.submit.is-loading .submit__spinner {
  display: block;
}

.submit.is-loading .submit__label {
  opacity: 0.75;
}

.submit:disabled {
  cursor: progress;
}

@keyframes spin {
  0% { transform: rotate(0deg); stroke-dashoffset: 0; }
  100% { transform: rotate(360deg); stroke-dashoffset: 90; }
}

.form-status {
  min-height: 1.2rem;
  margin: 0.9rem 0 0;
  font-size: 0.82rem;
  text-align: center;
}

.form-status[data-state="success"] { color: var(--forest-dark); }
.form-status[data-state="error"] { color: var(--error); }

.card__footer {
  margin: 1.6rem 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--text-soft);
  text-align: center;
}

.card__footer a {
  color: var(--accent-dark);
}

.auth__fineprint {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-soft);
  margin-top: 1.3rem;
}

.auth__consent {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-soft);
  line-height: 1.5;
  margin: 1rem 0 0;
}

.auth__consent a {
  color: var(--accent-dark);
  text-decoration: underline;
}

.auth__consent a:hover {
  color: var(--accent);
}

.auth__copyright {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-soft);
  opacity: 0.75;
  margin-top: 0.5rem;
}

/* ---------------- RESPONSIVE ---------------- */

@media (max-width: 880px) {
  .page {
    grid-template-columns: 1fr;
  }

  .ledger {
    padding: 2rem 1.5rem;
  }

  .ledger__quote,
  .ledger__meta {
    display: none;
  }

  .ledger__title {
    font-size: 1.6rem;
    margin-bottom: 0;
  }

  .seal {
    width: 56px;
    height: 56px;
    margin-bottom: 1rem;
  }

  .seal__initials {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .tabs {
    padding-left: 0.3rem;
  }

  .tab {
    font-size: 0.72rem;
    padding: 0.6rem 0.7rem 0.55rem;
  }

  .tab__icon {
    width: 13px;
    height: 13px;
  }

  .card {
    padding: 1.8rem 1.3rem 1.6rem;
  }

  .card__stamp {
    width: 46px;
    height: 46px;
    top: 1rem;
    right: 1rem;
  }

  .card__heading {
    font-size: 1.4rem;
    max-width: 100%;
  }
}
