/* Safety.IO - Professional stylesheet with visual identity */

/* -------------------------------------------------------------------------
   Atkinson Hyperlegible Next (loaded from CSS so font works when only CSS is updated)
   ------------------------------------------------------------------------- */
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/atkinsonhyperlegiblenext/v7/NaPNcYPdHfdVxJw0IfIP0lvYFqijb-UxCtm5_wdGseiJn3o.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/atkinsonhyperlegiblenext/v7/NaPNcYPdHfdVxJw0IfIP0lvYFqijb-UxCtm5_wdGseiJn3o.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* -------------------------------------------------------------------------
   Design tokens
   ------------------------------------------------------------------------- */
:root {
  --color-primary: #0d47a1;
  --color-primary-hover: #0a3d87;
  --color-text: #2d3748;
  --color-text-heading: #1a202c;
  --color-text-muted: #4a5568;
  --color-border: #e2e8f0;
  --color-bg: #fafafa;
  --color-bg-elevated: #ffffff;
  --color-bg-footer: #f1f5f9;
  --font-sans: "Atkinson Hyperlegible Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* -------------------------------------------------------------------------
   Reset and base
   ------------------------------------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  line-height: 1.6;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-bg);
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  min-height: 100vh;
}

/* Subtle background: light gradient + very soft dot pattern */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(13, 71, 161, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(13, 71, 161, 0.02) 0%, transparent 40%),
    radial-gradient(circle 1px at 0 0, var(--color-border) 1px, transparent 0),
    radial-gradient(circle 1px at 24px 24px, var(--color-border) 1px, transparent 0);
  background-size: 100% 100%, 100% 100%, 24px 24px, 24px 24px;
  background-position: 0 0, 0 0, 0 0, 12px 12px;
  pointer-events: none;
  z-index: -1;
  opacity: 0.6;
}

/* -------------------------------------------------------------------------
   Typography
   ------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-top: 1.5em;
  margin-bottom: 0.75em;
  color: var(--color-text-heading);
}

h1 {
  font-size: 2rem;
  margin-top: 0;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

p {
  margin-bottom: 1em;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* -------------------------------------------------------------------------
   Skip link
   ------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-text-heading);
  color: var(--color-bg-elevated);
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* -------------------------------------------------------------------------
   Header
   ------------------------------------------------------------------------- */
header {
  background: var(--color-bg-elevated);
  border-bottom: 3px solid var(--color-primary);
  padding: 1.5rem 0;
  margin-bottom: 2rem;
}

.site-title {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0;
}

.site-title a {
  color: var(--color-text-heading);
  text-decoration: none;
}

.site-title a:hover,
.site-title a:focus {
  color: var(--color-primary);
  text-decoration: none;
}

/* -------------------------------------------------------------------------
   Main content
   ------------------------------------------------------------------------- */
main {
  min-height: 60vh;
}

/* -------------------------------------------------------------------------
   Post list (index)
   ------------------------------------------------------------------------- */
.post-list {
  list-style: none;
  padding: 0;
}

.post-item {
  background: var(--color-bg-elevated);
  border-left: 4px solid var(--color-primary);
  border-bottom: 1px solid var(--color-border);
  padding: 1.5rem 1.25rem;
  margin-bottom: 1rem;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.post-item:hover {
  background: var(--color-bg-elevated);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.post-item:last-child {
  margin-bottom: 0;
}

.post-title {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.post-title a {
  color: var(--color-text-heading);
}

.post-title a:hover,
.post-title a:focus {
  color: var(--color-primary);
}

.post-meta {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}

.post-description {
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* -------------------------------------------------------------------------
   Individual post page
   ------------------------------------------------------------------------- */
.post-header {
  margin-bottom: 2rem;
  padding: 1.5rem 0;
  border-bottom: 2px solid var(--color-border);
  background: var(--color-bg-elevated);
  padding-left: 1rem;
  padding-right: 1rem;
  margin-left: -1rem;
  margin-right: -1rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.post-header h1 {
  margin-bottom: 0.5rem;
}

.post-date {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.post-author {
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

.post-content {
  max-width: 800px;
  margin: 0 auto;
}

.post-content h2 {
  margin-top: 2em;
  margin-bottom: 1em;
}

.post-content h3 {
  margin-top: 1.5em;
  margin-bottom: 0.75em;
}

.post-content ul,
.post-content ol {
  margin-left: 1.5rem;
  margin-bottom: 1em;
}

.post-content li {
  margin-bottom: 0.5em;
}

.post-content code {
  background-color: var(--color-bg-footer);
  color: var(--color-text-heading);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.9em;
  border: 1px solid var(--color-border);
}

.post-content pre {
  background-color: var(--color-bg-footer);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1em;
  border: 1px solid var(--color-border);
}

.post-content pre code {
  background-color: transparent;
  padding: 0;
  border: none;
}

.post-content blockquote {
  border-left: 4px solid var(--color-primary);
  padding-left: 1rem;
  margin-left: 0;
  margin-bottom: 1em;
  color: var(--color-text-muted);
  font-style: italic;
  background: var(--color-bg-footer);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  padding-right: 1rem;
  border-radius: 0 4px 4px 0;
}

.post-content img {
  max-width: 100%;
  height: auto;
  margin: 1.5em 0;
  border-radius: 4px;
}

.post-content a {
  word-break: break-word;
}

/* -------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------- */
footer {
  background: var(--color-bg-footer);
  border-top: 1px solid var(--color-border);
  padding: 2rem 1rem;
  margin-top: 4rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* -------------------------------------------------------------------------
   Responsive - tablet
   ------------------------------------------------------------------------- */
@media (min-width: 768px) {
  body {
    padding: 0 2rem;
  }

  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  .site-title {
    font-size: 2rem;
  }

  .post-item {
    padding: 2rem 1.5rem;
  }

  .post-title {
    font-size: 1.75rem;
  }

  .post-header {
    margin-left: -2rem;
    margin-right: -2rem;
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* -------------------------------------------------------------------------
   Responsive - desktop
   ------------------------------------------------------------------------- */
@media (min-width: 1024px) {
  body {
    padding: 0 3rem;
  }

  h1 {
    font-size: 3rem;
  }

  .post-content {
    font-size: 1.1rem;
    line-height: 1.7;
  }

  .post-header {
    margin-left: -3rem;
    margin-right: -3rem;
    padding-left: 3rem;
    padding-right: 3rem;
  }
}

/* -------------------------------------------------------------------------
   Print
   ------------------------------------------------------------------------- */
@media print {
  body {
    max-width: 100%;
    padding: 0;
    background: #fff;
  }

  body::before {
    display: none;
  }

  header,
  footer {
    display: none;
  }

  a {
    color: #1a1a1a;
    text-decoration: underline;
  }

  .post-item {
    border-left: 1px solid #ccc;
    box-shadow: none;
  }

  .post-content {
    max-width: 100%;
  }
}
