/* ==========================================================================
   DESIGN TOKENS — same palette and fonts as my portfolio (adi-burgic.github.io)
   ========================================================================== */
:root {
  --bg-base: #0b1526;       /* page background */
  --bg-elevated: #10203a;   /* form panel */
  --bg-floating: #16284a;   /* department cards */

  --text: #edf1f8;
  --text-muted: #91a4c4;
  --text-faint: #5f7295;

  --accent: #f2a33c;
  --accent-soft: rgba(242, 163, 60, 0.14);

  --error: #ff8a7a;
  --error-soft: rgba(255, 138, 122, 0.1);

  --border: rgba(237, 241, 248, 0.09);
  --border-strong: rgba(237, 241, 248, 0.16);

  /* The report is a light "paper" page, so it looks the same on screen,
     in the PDF and when pasted into an email */
  --paper: #fbfaf7;
  --ink: #14213a;
  --ink-muted: #5a6a85;
  --rule: #e6e2d9;
  --accent-ink: #c47a17;    /* darker orange, readable on white */

  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;

  --radius: 14px;
}

/* ==========================================================================
   BASE
   ========================================================================== */
* {
  box-sizing: border-box;
}

/* The hero glow reaches past the screen edges. Clip it so the page
   can't scroll sideways ("clip" doesn't create a scroll container). */
html,
body {
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
}

p {
  margin: 0;
}

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

[hidden] {
  display: none !important;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.chip input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.hero {
  position: relative;
  padding: clamp(3rem, 8vw, 5rem) 0 2rem;
}

/* Soft orange/blue glow, like the portfolio hero */
.hero__glow {
  position: absolute;
  inset: -2rem -50vw 0;
  z-index: -1;
  background:
    radial-gradient(40% 60% at 25% 20%, rgba(242, 163, 60, 0.14), transparent 70%),
    radial-gradient(30% 50% at 80% 30%, rgba(90, 130, 200, 0.12), transparent 70%);
  pointer-events: none;
}

.hero__title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hero__tagline {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
  max-width: 56ch;
}

/* ==========================================================================
   FORM PANEL
   ========================================================================== */
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.75rem);
}

.label {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding: 0;
}

.input,
textarea {
  width: 100%;
  background: var(--bg-base);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font: inherit;
}

textarea {
  resize: vertical;
  line-height: 1.55;
  font-size: 0.92rem;
}

.input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

/* Red outline on the field that failed validation */
[aria-invalid="true"] {
  border-color: var(--error);
}

.counter {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-top: 0.3rem;
}

.counter.is-near-limit {
  color: var(--accent);
}

/* Period + language row */
.settings {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.25rem 2.5rem;
  margin-bottom: 1.75rem;
}

/* Period: "From" and "To" date pickers side by side */
.period {
  flex-wrap: nowrap;
  gap: 0.75rem;
}

.period__field {
  flex: 1 1 0;
  min-width: 0;
  max-width: 190px;
}

.period__hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-bottom: 0.2rem;
}

/* Native date pickers: dark calendar popup and a light calendar icon */
input[type="date"] {
  color-scheme: dark;
}

/* Highlight label, e.g. "Production:" in front of a key highlight */
.report__dept {
  font-weight: 600;
  color: var(--ink);
}

.option-group {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.option-group legend {
  width: 100%;
}

/* Radio buttons styled as pill "chips" */
.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip span {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.chip span:hover {
  border-color: var(--accent);
  color: var(--text);
}

.chip input:checked + span {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

/* "Department updates" heading + Load example button */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.section-head__title {
  margin: 0;
}

.section-head__count {
  margin-left: 0.4rem;
  color: var(--text-faint);
  font-weight: 400;
}

/* ==========================================================================
   DEPARTMENT CARDS — two columns on wide screens
   ========================================================================== */
.depts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  gap: 1rem;
}

.dept {
  background: var(--bg-floating);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
}

.dept__head {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.dept__name {
  font-family: var(--font-display);
  font-weight: 500;
}

.dept__remove {
  flex: none;
  width: 2.6rem;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.dept__remove:hover:not(:disabled) {
  color: var(--error);
  border-color: var(--error);
}

.dept__remove:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ==========================================================================
   BUTTONS (same pill buttons as the portfolio)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.8rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.btn--primary {
  background: var(--accent);
  color: #1a1206;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 24px -10px rgba(242, 163, 60, 0.55);
}

.btn--primary:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn--primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn--secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn--secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.btn--small {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
}

/* Full-width dashed "+ Add department" button */
.btn--dashed {
  width: 100%;
  margin-top: 1rem;
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-muted);
}

.btn--dashed:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
}

.btn--dashed:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.actions {
  margin-top: 1.5rem;
}

/* Little spinner shown inside the Generate button while waiting */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(26, 18, 6, 0.3);
  border-top-color: #1a1206;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   ERROR MESSAGE
   ========================================================================== */
.error {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: var(--error-soft);
  border: 1px solid rgba(255, 138, 122, 0.35);
  color: var(--error);
  font-size: 0.95rem;
}

/* ==========================================================================
   RESULT — toolbar + the report "paper"
   ========================================================================== */
.result {
  margin-top: 2.5rem;
  scroll-margin-top: 1.5rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.report {
  max-width: 780px;
  margin: 0 auto;
  background: var(--paper);
  color: var(--ink);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 5vw, 3rem);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
  overflow-wrap: anywhere; /* long words/URLs wrap instead of overflowing */
}

.report__kicker {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.report__title {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
}

.report__period {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--accent-ink);
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.report__section {
  margin-top: 1.5rem;
  break-inside: avoid; /* don't split a section across PDF pages */
}

.report__section h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.report__section ul {
  margin: 0;
  padding-left: 1.2rem;
}

.report__section li {
  margin-bottom: 0.3rem;
  font-size: 0.97rem;
}

.report__section li::marker {
  color: var(--accent-ink);
}

/* Key highlights stand out in a soft orange box */
.report__section--highlights {
  background: rgba(242, 163, 60, 0.1);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}

/* Action items get an orange bar on the left */
.report__section--actions {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer {
  margin-top: 3rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-faint);
}

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

/* ==========================================================================
   PRINT = "Download PDF": show ONLY the report, on plain white paper
   ========================================================================== */
@media print {
  @page {
    margin: 18mm;
  }

  body {
    background: #fff;
  }

  .hero,
  .panel,
  .toolbar,
  .footer {
    display: none !important;
  }

  .container,
  .result {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .report {
    max-width: none;
    padding: 0;
    border-top: none;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
  }

  /* Keep the orange highlight box and bars when printing */
  .report * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
