/* Blueberry PSIRT — security site
 *
 * Brand palette sampled from blueberry.bg theme app.css:
 *   --bb-purple-primary  #8147bb   (advisory headers, links, accents)
 *   --bb-purple-deep     #490c85   (hovers, pressed states)
 *   --bb-purple-light    #cb97ff   (light-mode accents)
 *   --bb-cyan            #5cffe2   (highlights, "current" indicators)
 *   --bb-pink            #ff5ca8   (severity-critical contrast color)
 *   --bb-navy            #060a26   (dark bg)
 *   --bb-deep-violet     #190e3a   (dark mid-tone)
 *   --bb-text-dark       #162f4e   (light-mode body text)
 *   Light-mode neutrals: #fff bg, #f1f1f1 soft, #676a7f muted text
 *
 * Typography mirrors blueberry.bg: Open Sans for UI, JetBrains Mono for IDs/code.
 */

:root {
  --c-text: #162f4e;
  --c-text-soft: #30353a;
  --c-muted: #676a7f;
  --c-line: #d5e8fe;
  --c-bg: #ffffff;
  --c-bg-soft: #f6f7f8;
  --c-bg-card: #edf5ff;
  --c-link: #8147bb;            /* Blueberry purple */
  --c-link-hover: #490c85;      /* Blueberry deep purple */
  --c-accent: #8147bb;
  --c-accent-bright: #5cffe2;   /* Blueberry mint cyan */

  --c-critical: #6e0a0a;
  --c-high: #b3261e;
  --c-medium: #c46c0d;
  --c-low: #2e7d32;

  --w-content: 920px;
  --fs-base: 16px;
  --fs-small: 14px;
  --fs-meta: 13px;
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.25rem;
  --radius: 4px;
  --shadow-card: 0 1px 3px rgba(6, 10, 38, 0.08), 0 1px 2px rgba(6, 10, 38, 0.04);

  --font-sans: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-text: #e8eaf3;
    --c-text-soft: #b6bbc4;
    --c-muted: #95a0b8;
    --c-line: #2a2f4d;
    --c-bg: #060a26;          /* Blueberry deep navy */
    --c-bg-soft: #190e3a;     /* Blueberry dark purple */
    --c-bg-card: #1c1740;
    --c-link: #cb97ff;        /* Blueberry light purple */
    --c-link-hover: #5cffe2;  /* Blueberry mint cyan on hover for delight */
    --c-accent: #995cd6;
    --c-accent-bright: #5cffe2;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

/* ====== Reset & base ====== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ====== Layout ====== */

.site-header,
main.content,
footer.site-footer {
  max-width: var(--w-content);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.site-header {
  padding-top: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--c-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.site-title {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--c-text);
  text-decoration: none;
  letter-spacing: -.01em;
  position: relative;
}
.site-title::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: var(--space-2);
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent-bright));
  border-radius: 2px;
  vertical-align: 1px;
}
.site-title:hover { color: var(--c-accent); }

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--fs-small);
}
.site-header nav a {
  color: var(--c-muted);
  text-decoration: none;
  padding-bottom: var(--space-1);
  border-bottom: 2px solid transparent;
  transition: color .12s ease, border-color .12s ease;
}
.site-header nav a:hover {
  color: var(--c-link);
  border-bottom-color: var(--c-accent-bright);
}

main.content {
  padding-top: var(--space-5);
  padding-bottom: var(--space-5);
  min-height: 60vh;
}

footer.site-footer {
  border-top: 1px solid var(--c-line);
  padding-top: var(--space-3);
  padding-bottom: var(--space-4);
  color: var(--c-muted);
  font-size: var(--fs-meta);
  text-align: center;
}
footer.site-footer p { margin: var(--space-1) 0; }
footer.site-footer a { color: var(--c-muted); }
footer.site-footer a:hover { color: var(--c-link); }

/* ====== Typography ====== */

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.01em;
  color: var(--c-text);
  margin-top: var(--space-5);
  margin-bottom: var(--space-3);
}
h1 { font-size: 2.0rem; margin-top: 0; }
h2 {
  font-size: 1.4rem;
  padding-top: var(--space-3);
  border-top: 1px solid var(--c-line);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1em;
  background: var(--c-accent);
  border-radius: 2px;
}
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 var(--space-3); }
ul, ol { margin: 0 0 var(--space-3); padding-left: 1.5rem; }
li { margin-bottom: var(--space-1); }

a {
  color: var(--c-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(129, 71, 187, 0.4);
  transition: color .12s, text-decoration-color .12s;
}
a:hover {
  color: var(--c-link-hover);
  text-decoration-color: currentColor;
}

.lead {
  font-size: 1.15rem;
  color: var(--c-muted);
  margin-top: calc(-1 * var(--space-2));
  margin-bottom: var(--space-4);
  line-height: 1.5;
}

.meta {
  color: var(--c-muted);
  font-size: var(--fs-meta);
}

code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--c-bg-soft);
  color: var(--c-link-hover);
  padding: 0.1em 0.4em;
  border-radius: var(--radius);
  border: 1px solid var(--c-line);
}
pre {
  font-family: var(--font-mono);
  background: var(--c-bg-soft);
  padding: var(--space-3);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: var(--fs-small);
  border: 1px solid var(--c-line);
}
pre code { background: none; padding: 0; border: none; color: inherit; }

blockquote {
  margin: var(--space-3) 0;
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--c-accent);
  background: var(--c-bg-soft);
  color: var(--c-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
}
blockquote p:last-child { margin-bottom: 0; }

/* ====== Tables ====== */

table {
  border-collapse: collapse;
  width: 100%;
  margin: var(--space-3) 0 var(--space-4);
  font-size: var(--fs-small);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  overflow: hidden;
}
th, td {
  border-bottom: 1px solid var(--c-line);
  padding: var(--space-2) var(--space-3);
  text-align: left;
  vertical-align: top;
}
th {
  background: var(--c-bg-soft);
  font-weight: 600;
  color: var(--c-text);
  border-bottom: 2px solid var(--c-accent);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: rgba(129, 71, 187, .03); }
@media (prefers-color-scheme: dark) {
  tbody tr:nth-child(even) { background: rgba(204, 151, 255, .04); }
}

/* ====== Severity pills ====== */

.sev {
  display: inline-block;
  padding: .18rem .6rem;
  border-radius: 999px;
  font-size: var(--fs-meta);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #fff;
  line-height: 1.3;
}
.sev-critical { background: var(--c-critical); }
.sev-high     { background: var(--c-high); }
.sev-medium   { background: var(--c-medium); }
.sev-low      { background: var(--c-low); }

/* ====== Advisory page ====== */

.advisory-header {
  background: linear-gradient(135deg, var(--c-bg-card) 0%, var(--c-bg-soft) 100%);
  padding: var(--space-4);
  border-left: 4px solid var(--c-accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-4);
}
.advisory-header .ids {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  color: var(--c-muted);
  margin: 0 0 var(--space-1);
  letter-spacing: .04em;
}
.advisory-header .ids strong {
  color: var(--c-link);
  font-weight: 700;
  font-size: 1.05em;
}
.advisory-header .ids a {
  margin-left: var(--space-2);
  color: var(--c-muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--c-muted);
}
.advisory-header .ids a:hover {
  color: var(--c-link);
  border-bottom-color: var(--c-link);
}
.advisory-header h1 {
  margin: 0 0 var(--space-3);
  font-size: 1.6rem;
  line-height: 1.3;
}
.advisory-header dl.meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-1) var(--space-3);
  margin: 0;
  font-size: var(--fs-small);
}
.advisory-header dl.meta dt {
  color: var(--c-muted);
  font-weight: 500;
}
.advisory-header dl.meta dd { margin: 0; color: var(--c-text); }

article.advisory section {
  margin-bottom: var(--space-4);
}
article.advisory section h2:first-child {
  border-top: none;
  padding-top: 0;
}

.advisory-footer {
  margin-top: var(--space-5);
  padding: var(--space-3);
  background: var(--c-bg-soft);
  border-radius: var(--radius);
  border: 1px dashed var(--c-line);
  color: var(--c-muted);
  font-size: var(--fs-small);
}
.advisory-footer p { margin: var(--space-1) 0; }
.advisory-footer a {
  font-family: var(--font-mono);
  font-size: .92em;
}

/* ====== Landing & list ====== */

.landing .hero h1 {
  font-size: 2.4rem;
  margin-bottom: var(--space-2);
  background: linear-gradient(120deg, var(--c-link) 0%, var(--c-accent-bright) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  display: inline-block;
}
.landing .recent ul {
  list-style: none;
  padding-left: 0;
}
.landing .recent li {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--c-line);
  display: flex;
  gap: var(--space-3);
  align-items: baseline;
  flex-wrap: wrap;
}
.landing .recent li:last-child { border-bottom: none; }
.landing .recent li a {
  flex: 1 1 auto;
  min-width: 0;
  text-decoration: none;
  color: var(--c-text);
  font-weight: 500;
}
.landing .recent li a:hover { color: var(--c-link); }
.landing .recent li time {
  color: var(--c-muted);
  font-size: var(--fs-meta);
  white-space: nowrap;
  font-family: var(--font-mono);
}

.entries table th:nth-child(1),
.entries table td:nth-child(1) {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
}

/* ====== Responsive ====== */

@media (max-width: 600px) {
  body { font-size: 15px; }
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.25rem; }
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .advisory-header { padding: var(--space-3); }
  .advisory-header dl.meta {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .advisory-header dl.meta dt { margin-top: var(--space-2); }
  .landing .hero h1 { font-size: 1.8rem; }
}

/* ====== Print ====== */
@media print {
  body { background: #fff; color: #000; max-width: none; }
  .site-header nav, .advisory-footer, footer.site-footer { display: none; }
  .advisory-header {
    background: #f5f5f5;
    border-left-color: #000;
    box-shadow: none;
  }
  a { color: #000; text-decoration: underline; }
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: .85em;
    color: #555;
  }
}
