/*
  CORSAIR Pages — portal UI.
  Corporate palette (Brand Book v15): dark-first, Pitch Black dominant,
  Bright Yellow as accent only (never a background surface).
  Saira for copy; Saira Expanded (wdth 125) for headlines and labels.
*/

:root {
  --pitch-black: #000000;
  --anthracite: #191919;
  --dark-grey: #373638;
  --vivid-grey: #5f626b;
  --mid-grey: #8c8c8e;
  --light-grey: #c1c6c8;
  --bright-grey: #d4d8da;
  --white: #ffffff;
  --yellow: #ece81a;
  --danger: #ff6b66;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--pitch-black);
  color: var(--white);
  font-family: "Saira", Arial, sans-serif;
  font-optical-sizing: auto;
  line-height: 1.5;
}

a { color: inherit; }
button, input { font: inherit; }
button, .button { touch-action: manipulation; }

::selection { background: var(--yellow); color: var(--pitch-black); }

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 72px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  background: var(--pitch-black);
  border-bottom: 2px solid var(--yellow);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--mid-grey);
  font-size: .875rem;
  font-weight: 500;
}

.site-header nav a {
  color: var(--white);
  font-stretch: 125%;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration-color: transparent;
  text-underline-offset: 6px;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 128px;
  height: auto;
}

.brand-divider {
  width: 1px;
  height: 24px;
  background: var(--dark-grey);
}

.brand-product {
  color: var(--yellow);
  font-stretch: 125%;
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}

/* ---------- Layout ---------- */

.shell {
  width: min(1180px, calc(100% - 48px));
  margin: 52px auto 90px;
}

.narrow {
  width: min(700px, 100%);
  margin: auto;
}

.site-footer {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 24px 0 40px;
  border-top: 1px solid var(--dark-grey);
  color: var(--mid-grey);
  font-size: .8125rem;
  font-weight: 300;
}

/* ---------- Type ---------- */

h1, h2, h3, p { text-wrap: pretty; }

h1, h2 {
  font-stretch: 125%;
  font-weight: 400;
  letter-spacing: .015em;
  line-height: 1.06;
}

h1 strong, h2 strong { font-weight: 700; }

h1 {
  margin: 6px 0 12px;
  font-size: clamp(2rem, 4.5vw, 3.25rem);
}

h2 {
  margin: 4px 0 8px;
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
}

/* Page titles are user data — no caps treatment. */
.page-title {
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--yellow);
  font-stretch: 125%;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.eyebrow::before { content: "// " / ""; }

.lede,
:where(.login-card, .login-intro, .card, .empty-state) p {
  color: var(--light-grey);
  line-height: 1.65;
}

/* ---------- Shared rows ---------- */

.page-heading,
.toolbar,
.row-title,
.copy-row,
.actions,
.upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-heading {
  justify-content: space-between;
  margin-bottom: 32px;
}

.toolbar {
  justify-content: space-between;
  margin-bottom: 20px;
}

.ghost-link {
  color: var(--mid-grey);
  font-stretch: 125%;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration-color: transparent;
  text-underline-offset: 6px;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--mid-grey);
  font-weight: 600;
  text-decoration-color: transparent;
  text-underline-offset: 5px;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

/* ---------- Inputs ---------- */

.search {
  display: flex;
  gap: 10px;
  flex: 1;
  max-width: 600px;
}

input[type="text"],
input[type="search"] {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--dark-grey);
  border-radius: 0;
  background: var(--pitch-black);
  color: var(--white);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input::placeholder { color: var(--mid-grey); }

input[type="text"]:focus-visible,
input[type="search"]:focus-visible {
  border-color: var(--yellow);
  box-shadow: 0 0 0 1px var(--yellow);
  outline: none;
}

/* ---------- Buttons ---------- */

.button {
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid var(--light-grey);
  border-radius: 0;
  background: transparent;
  color: var(--white);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-stretch: 110%;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 120ms var(--ease-out);
}

.button:active { transform: scale(.97); }

.button.primary {
  padding: 11px 22px;
  border: 0;
  background: var(--yellow);
  color: var(--pitch-black);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
}

.button.danger { color: var(--danger); border-color: var(--danger); }

.button.small { min-height: 36px; padding: 7px 12px; font-size: .75rem; }

.button:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px var(--yellow);
}

.button.primary:focus-visible { box-shadow: inset 0 0 0 3px var(--pitch-black); }

/* ---------- Lists ---------- */

.page-list,
.revision-list {
  overflow: hidden;
  border: 1px solid var(--dark-grey);
  background: var(--anthracite);
}

.page-row,
.revision-row {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding: 24px 26px;
  border-bottom: 1px solid var(--dark-grey);
}

.page-row:last-child,
.revision-row:last-child { border-bottom: 0; }

.page-row h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0;
}

.page-row h2 a {
  text-decoration-color: transparent;
  text-underline-offset: 5px;
  transition: text-decoration-color 160ms ease;
}

.public-url {
  color: var(--light-grey);
  font-weight: 400;
  overflow-wrap: anywhere;
  text-underline-offset: 4px;
  transition: color 160ms ease;
}

.row-meta,
.revision-row > div:first-child {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  color: var(--mid-grey);
  font-size: .8125rem;
}

.revision-row > div:first-child { align-items: flex-start; }
.revision-row strong { color: var(--bright-grey); }

.status {
  padding: 3px 10px;
  border: 1px solid var(--vivid-grey);
  background: transparent;
  color: var(--light-grey);
  font-stretch: 125%;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status.published {
  border-color: var(--yellow);
  background: var(--yellow);
  color: var(--pitch-black);
}

.status.archived { border-color: var(--dark-grey); color: var(--mid-grey); }

/* ---------- Cards and forms ---------- */

.card,
.empty-state,
.login-card {
  padding: 32px;
  border: 1px solid var(--dark-grey);
  background: var(--anthracite);
}

.empty-state { text-align: center; padding-block: 64px; }
.empty-state h1, .empty-state h2 { margin: 0 0 8px; }
.empty-state form { margin-top: 16px; }

.form-stack {
  display: grid;
  gap: 22px;
  margin-top: 30px;
}

.form-stack label:not(.dropzone) {
  display: grid;
  gap: 8px;
  font-stretch: 125%;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.form-stack label:not(.dropzone) input {
  font-stretch: normal;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

.errorlist {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  color: var(--danger);
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
}

.dropzone {
  min-height: 170px;
  padding: 26px;
  border: 2px dashed var(--vivid-grey);
  background: var(--pitch-black);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms var(--ease-out);
}

.dropzone span { font-weight: 600; }
.dropzone small { color: var(--mid-grey); }
.dropzone.compact { min-height: 96px; flex: 1; gap: 14px; }
.dropzone.dragging { border-color: var(--yellow); background: var(--anthracite); transform: scale(.995); }
.dropzone input { max-width: 100%; color: var(--light-grey); }
.dropzone input::file-selector-button { margin-right: 12px; }

/* ---------- Messages ---------- */

.messages { display: grid; gap: 8px; margin-bottom: 22px; }

.message {
  padding: 13px 15px;
  border-left: 3px solid var(--mid-grey);
  background: var(--anthracite);
  color: var(--bright-grey);
}

.message.success { border-color: var(--yellow); }
.message.error { border-color: var(--danger); }

.revision-section { margin-top: 48px; }

/* ---------- Login ---------- */

.auth-page { min-height: 100vh; }

.auth-page .shell {
  width: min(1180px, calc(100% - 48px));
  margin-block: 0;
}

.login-layout {
  min-height: calc(100vh - 74px);
  padding: clamp(40px, 8vh, 92px) 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  align-items: center;
  gap: clamp(48px, 8vw, 120px);
}

.login-intro h1 {
  max-width: 760px;
  margin: 18px 0 24px;
  font-size: clamp(2.25rem, 4.2vw, 3.75rem);
  line-height: 1.02;
}

.login-intro > p:not(.eyebrow) {
  max-width: 590px;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
}

.login-card {
  padding: clamp(30px, 4vw, 48px);
  border-top: 4px solid var(--yellow);
}

.login-card h2 {
  margin: 12px 0 8px;
  font-size: clamp(1.6rem, 2.8vw, 2.1rem);
}

.login-card > p:not(.eyebrow) { font-size: 1rem; }
.login-button { width: 100%; margin-top: 18px; }

.microsoft-mark {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  padding: 3px;
  background: var(--white);
  box-sizing: content-box;
}

.login-card .login-note {
  margin: 18px 0 0;
  color: var(--mid-grey);
  font-size: .8125rem;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ---------- States ---------- */

@media (hover: hover) and (pointer: fine) {
  .site-header nav a:hover { color: var(--yellow); text-decoration-color: var(--yellow); }
  .ghost-link:hover { color: var(--yellow); text-decoration-color: var(--yellow); }
  .back-link:hover { color: var(--yellow); text-decoration-color: var(--yellow); }
  .button:hover { background: var(--white); border-color: var(--white); color: var(--pitch-black); }
  .button.primary:hover { background: var(--white); color: var(--pitch-black); }
  .button.danger:hover { background: var(--danger); border-color: var(--danger); color: var(--pitch-black); }
  .page-row h2 a:hover { text-decoration-color: var(--yellow); }
  .public-url:hover { color: var(--yellow); }
  .dropzone:hover { border-color: var(--yellow); background: var(--anthracite); }
}

@media (max-width: 820px) {
  .login-layout { grid-template-columns: 1fr; gap: 34px; }
  .login-intro > p:not(.eyebrow) { max-width: 100%; }
}

@media (max-width: 720px) {
  .site-header { min-height: 66px; padding: 0 18px; }
  .brand-logo { width: 104px; }
  .brand-product { font-size: .75rem; }
  .site-header nav { gap: 14px; }
  .site-header nav span { display: none; }
  .shell, .auth-page .shell { width: min(100% - 28px, 1180px); margin-top: 32px; }
  .auth-page .shell { margin-top: 0; }
  .site-footer { width: min(100% - 28px, 1180px); }
  .page-heading, .toolbar, .page-row, .revision-row, .upload-row { align-items: stretch; flex-direction: column; }
  .page-row, .revision-row { padding: 20px; }
  .row-meta, .revision-row > div:first-child { align-items: flex-start; }
  .actions, .row-title, .copy-row { flex-wrap: wrap; }
  .login-layout { min-height: calc(100vh - 68px); padding: 46px 0 64px; }
  .login-intro h1 { font-size: clamp(2.25rem, 9vw, 3.5rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

@media (prefers-contrast: more) {
  body { color: var(--white); }
  .card, .empty-state, .login-card, .page-list, .revision-list, .message { border-color: var(--white); }
  .site-footer { color: var(--light-grey); }
}
