/* ==========================================================================
   Phasic Labs — shared stylesheet
   Link from any page:  <link rel="stylesheet" href="{{ asset('css/phasic.css') }}">
   ========================================================================== */

/* ---- Fonts (Outfit, SIL Open Font License — see /fonts/OFL.txt) ---- */
@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-medium.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---- Brand tokens ---- */
:root {
  --pl-dusk: #3B3164;          /* Future Dusk: page background */
  --pl-dusk-deep: #2C2550;     /* panels, header and footer bands */
  --pl-dusk-raised: #463B74;   /* cards, inputs */
  --pl-line: rgba(240, 238, 233, 0.14);
  --pl-cloud: #F0EEE9;         /* Cloud Dancer: main text */
  --pl-cloud-muted: rgba(240, 238, 233, 0.72);
  --pl-aqua: #7FFFD4;          /* links, focus */
  --pl-yellow: #FFE600;        /* primary buttons */
  --pl-error: #FF8A80;

  --pl-font: "Outfit", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --pl-radius: 12px;
  --pl-radius-small: 8px;
  --pl-max: 1080px;
  --pl-space: clamp(16px, 4vw, 32px);
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--pl-dusk);
  color: var(--pl-cloud);
  font-family: var(--pl-font);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.6;
}

img, svg { max-width: 100%; height: auto; }

h1, h2, h3 {
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); }
h3 { font-size: 1.2rem; }
p  { margin: 0 0 1em; max-width: 68ch; }

a { color: var(--pl-aqua); text-underline-offset: 3px; }
a:hover { color: var(--pl-cloud); }

:focus-visible {
  outline: 2px solid var(--pl-aqua);
  outline-offset: 3px;
  border-radius: 4px;
}

code, pre {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--pl-dusk-deep);
  border-radius: var(--pl-radius-small);
}
code { padding: 0.15em 0.4em; }
pre  { padding: 1em; overflow-x: auto; }

/* ---- Layout ---- */
.pl-container {
  width: 100%;
  max-width: var(--pl-max);
  margin: 0 auto;
  padding: 0 var(--pl-space);
}

.pl-header {
  background: var(--pl-dusk-deep);
  border-bottom: 1px solid var(--pl-line);
}
.pl-header .pl-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  min-height: 76px;
}
.pl-header__logo { display: inline-flex; }
.pl-header__logo img { height: 40px; width: auto; }

.pl-nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.pl-nav a {
  color: var(--pl-cloud-muted);
  text-decoration: none;
  padding: 10px 0;
}
.pl-nav a:hover,
.pl-nav a[aria-current="page"] { color: var(--pl-cloud); }

.pl-main {
  flex: 1;
  padding: clamp(32px, 6vw, 64px) 0;
}

.pl-footer {
  border-top: 1px solid var(--pl-line);
  color: var(--pl-cloud-muted);
  font-size: 0.9rem;
  padding: 24px 0;
}
.pl-footer .pl-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}
.pl-footer a { color: var(--pl-cloud-muted); }

/* Centred pages: errors, login, maintenance */
.pl-centred {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(32px, 8vw, 80px) var(--pl-space);
}
.pl-centred p { margin-left: auto; margin-right: auto; }
.pl-centred__logo { width: min(320px, 80vw); margin-bottom: 40px; }

/* ---- Components ---- */
.pl-card {
  background: var(--pl-dusk-raised);
  border: 1px solid var(--pl-line);
  border-radius: var(--pl-radius);
  padding: clamp(20px, 4vw, 32px);
}
.pl-card--narrow { width: 100%; max-width: 440px; text-align: left; }

.pl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.pl-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--pl-yellow);
  color: var(--pl-dusk);
  font: 500 1rem/1 var(--pl-font);
  text-decoration: none;
  cursor: pointer;
}
.pl-button:hover { background: #FFF06B; color: var(--pl-dusk); }
.pl-button--ghost {
  background: transparent;
  color: var(--pl-cloud);
  box-shadow: inset 0 0 0 1.5px var(--pl-line);
}
.pl-button--ghost:hover { background: var(--pl-dusk-raised); color: var(--pl-cloud); }

/* Forms */
.pl-field { margin-bottom: 18px; }
.pl-label { display: block; margin-bottom: 6px; font-weight: 500; }
.pl-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--pl-line);
  border-radius: var(--pl-radius-small);
  background: var(--pl-dusk-deep);
  color: var(--pl-cloud);
  font: inherit;
}
.pl-input:focus { border-color: var(--pl-aqua); outline: none; box-shadow: 0 0 0 2px rgba(127, 255, 212, 0.35); }
.pl-error-text { color: var(--pl-error); font-size: 0.9rem; margin-top: 6px; }

.pl-alert {
  border-radius: var(--pl-radius-small);
  padding: 12px 16px;
  margin-bottom: 20px;
  background: var(--pl-dusk-deep);
  border: 1px solid var(--pl-line);
}
.pl-alert--success { border-color: rgba(127, 255, 212, 0.5); }
.pl-alert--error   { border-color: rgba(255, 138, 128, 0.6); }

/* Error pages */
.pl-error-code {
  font-size: clamp(3.5rem, 12vw, 6rem);
  font-weight: 500;
  line-height: 1;
  margin: 0 0 12px;
  color: var(--pl-aqua);
}

.pl-muted { color: var(--pl-cloud-muted); }

/* Screen-reader-only text */
.pl-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
