/* StorageMath - Clean Professional Theme */
/* Optimized for executive and CIO readability */

:root {
  --bg: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --text: #1f2937;
  --text-bright: #111827;
  --text-muted: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-dim: rgba(37, 99, 235, 0.08);
  --border: #e5e7eb;
  --success: #059669;
  --warning: #d97706;
  --error: #dc2626;
  --code-bg: #f8f9fa;
  --code-border: #e5e7eb;
  --max-width: 820px;
  --max-width-wide: 1100px;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0.875rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo img {
  height: 32px;
  width: auto;
  transition: opacity 0.15s;
}

.logo:hover img {
  opacity: 0.8;
}

nav {
  display: flex;
  gap: 1.75rem;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}

nav a:hover {
  color: var(--text-bright);
}

/* Main content */
main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 2rem;
  width: 100%;
}

main.wide {
  max-width: var(--max-width-wide);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-bright);
  font-weight: 600;
  line-height: 1.3;
  margin: 2.5rem 0 1rem;
}

h1 {
  font-size: 2rem;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-top: 3rem;
}

h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p {
  margin: 1.25rem 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

strong {
  color: var(--text-bright);
  font-weight: 600;
}

/* Article styling */
article h1 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

article .tagline {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 2rem;
  line-height: 1.5;
}

article img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 2.5rem 0;
  border: 1px solid var(--border);
  background: var(--bg);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

article img:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

article img + em,
article p > em:only-child {
  display: block;
  text-align: center;
  margin-top: -1rem;
  margin-bottom: 2rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Code - Enhanced for readability */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  color: #1f2937;
  padding: 0.2em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--code-border);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.75rem 0;
  line-height: 1.5;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.9rem;
}

/* Syntax highlighting - GitHub inspired light theme */
.highlight { background: var(--code-bg); border-radius: 8px; }
.highlight pre { margin: 0; padding: 1.25rem; }
.highlight .hll { background-color: #fff3cd; }
.highlight .c { color: #6a737d; font-style: italic; } /* Comment */
.highlight .k { color: #d73a49; } /* Keyword */
.highlight .kd { color: #d73a49; } /* Keyword.Declaration */
.highlight .kn { color: #d73a49; } /* Keyword.Namespace */
.highlight .kp { color: #d73a49; } /* Keyword.Pseudo */
.highlight .kr { color: #d73a49; } /* Keyword.Reserved */
.highlight .kt { color: #005cc5; } /* Keyword.Type */
.highlight .n { color: #24292e; } /* Name */
.highlight .na { color: #6f42c1; } /* Name.Attribute */
.highlight .nb { color: #005cc5; } /* Name.Builtin */
.highlight .nc { color: #6f42c1; } /* Name.Class */
.highlight .nf { color: #6f42c1; } /* Name.Function */
.highlight .no { color: #005cc5; } /* Name.Constant */
.highlight .nd { color: #6f42c1; } /* Name.Decorator */
.highlight .ni { color: #24292e; } /* Name.Entity */
.highlight .ne { color: #005cc5; } /* Name.Exception */
.highlight .nv { color: #e36209; } /* Name.Variable */
.highlight .o { color: #d73a49; } /* Operator */
.highlight .ow { color: #d73a49; } /* Operator.Word */
.highlight .p { color: #24292e; } /* Punctuation */
.highlight .s { color: #032f62; } /* String */
.highlight .s1 { color: #032f62; } /* String.Single */
.highlight .s2 { color: #032f62; } /* String.Double */
.highlight .se { color: #032f62; } /* String.Escape */
.highlight .si { color: #032f62; } /* String.Interpol */
.highlight .m { color: #005cc5; } /* Number */
.highlight .mi { color: #005cc5; } /* Number.Integer */
.highlight .mf { color: #005cc5; } /* Number.Float */
.highlight .mh { color: #005cc5; } /* Number.Hex */

/* Math blocks */
.math, .katex-display {
  overflow-x: auto;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 6px;
  margin: 1.5rem 0;
}

/* Blockquotes */
blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.75rem 0;
  padding: 0.75rem 1.25rem;
  background: var(--bg-secondary);
  border-radius: 0 6px 6px 0;
}

blockquote p {
  margin: 0.5rem 0;
}

blockquote p:first-child { margin-top: 0; }
blockquote p:last-child { margin-bottom: 0; }

/* Lists */
ul, ol {
  margin: 1.25rem 0;
  padding-left: 1.5rem;
}

li {
  margin: 0.5rem 0;
}

li > ul, li > ol {
  margin: 0.25rem 0;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75rem 0;
  font-size: 0.95rem;
}

th, td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  text-align: left;
}

th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-bright);
}

tr:nth-child(even) {
  background: var(--bg-secondary);
}

/* Hero section */
.hero {
  text-align: center;
  padding: 3rem 0;
  margin-bottom: 2.5rem;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
}

.hero .tagline {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 550px;
  margin: 0 auto 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  color: var(--text-bright);
  text-decoration: none;
}

/* Article list */
.article-list {
  list-style: none;
  padding: 0;
}

.article-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.article-item:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  transform: translateY(-2px);
}

.article-item h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.article-item h3 a {
  color: var(--text-bright);
}

.article-item h3 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.article-item p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Features grid */
.features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin: 2rem 0;
}

.feature {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.feature:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  transform: translateY(-2px);
}

.feature h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--text-bright);
}

.feature p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Calculator */
.calculator {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 0;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

.calc-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-group label {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.input-group input {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text-bright);
  font-size: 1rem;
  font-family: var(--font-mono);
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.calc-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

.result-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.875rem;
}

.result-card.highlight {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.result-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.result-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-bright);
  font-family: var(--font-mono);
}

.config-name {
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mds-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mds-yes {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.mds-no {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

/* Code Analysis Section */
.code-analysis {
  margin-top: 1.25rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.analysis-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.analysis-item {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text);
}

.analysis-item strong {
  color: var(--text-bright);
  font-weight: 600;
}

.analysis-good {
  color: var(--success);
  font-weight: 600;
}

.analysis-warn {
  color: var(--warning);
  font-weight: 600;
}

.analysis-bad {
  color: var(--error);
  font-weight: 600;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.preset-btn {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}

.preset-btn:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text-bright);
}

.locality-toggle {
  margin-top: 1rem;
  padding: 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.locality-toggle label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
}

.locality-toggle input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.locality-info {
  margin-top: 0.4rem;
  margin-left: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
}

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1rem;
}

.footer-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.footer-nav a:hover {
  color: var(--accent);
}

/* Image Modal */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, background 0.25s ease, visibility 0.25s;
}

.modal.active {
  opacity: 1;
  visibility: visible;
  background: rgba(0, 0, 0, 0.92);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 2rem;
  color: var(--text-muted);
  font-size: 2.5rem;
  font-weight: 300;
  cursor: pointer;
  transition: color 0.15s, transform 0.15s;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-bright);
  transform: scale(1.1);
}

.modal-content {
  max-width: 90%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal.active .modal-content {
  transform: scale(1);
  opacity: 1;
}

#modal-caption {
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
  max-width: 700px;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
}

.modal.active #modal-caption {
  opacity: 1;
  transform: translateY(0);
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* References section */
.references, article > p:last-of-type {
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
  html { font-size: 16px; }

  .header-inner {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }

  nav { gap: 1.25rem; }

  .hero h1 { font-size: 1.75rem; }
  .hero { padding: 2rem 0; }

  main { padding: 1.5rem 1rem; }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }

  .features {
    grid-template-columns: 1fr;
  }

  .calc-inputs {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .calc-inputs {
    grid-template-columns: 1fr;
  }
}

/* Social Share Buttons */
.share-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.share-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}

.share-btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.share-btn.share-twitter:hover {
  background: #000;
  border-color: #000;
  color: #fff;
}

.share-btn.share-linkedin:hover {
  background: #0a66c2;
  border-color: #0a66c2;
  color: #fff;
}

.share-btn.share-hn:hover {
  background: #ff6600;
  border-color: #ff6600;
  color: #fff;
}

.share-btn.share-email:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
