/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Fonts */
@font-face {
  font-family: "Noto Serif";
  src: url("/assets/NotoSerif-VariableFont_wdth,wght-2fbee482.ttf") format("truetype");
  font-weight: 100 900;
  font-stretch: 62.5% 100%;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Serif";
  src: url("/assets/NotoSerif-Italic-VariableFont_wdth,wght-dadb798e.ttf") format("truetype");
  font-weight: 100 900;
  font-stretch: 62.5% 100%;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Cal Sans";
  src: url("/assets/CalSans-Regular-8205a53d.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Layout */
h1, h2, h3, h4, h5, h6 {
  font-family: "Cal Sans", sans-serif;
  letter-spacing: 0.09rem;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  margin: 0;
  color: #1a1a1a;
  background: #f8f9fa;
}

a {
  color: #0066cc;
  text-decoration: none;
}

a:visited {
  color: #0066cc;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 75ch;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Navbar */
.navbar {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 0.75rem 1rem;
}

.navbar-content {
  max-width: 75ch;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  font-family: "Cal Sans", sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.09rem;
  color: #1a1a1a;
  text-decoration: none;
}

.navbar-links {
  font-family: "Cal Sans", sans-serif;
  letter-spacing: 0.09rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.navbar-user {
  font-size: 0.875rem;
  color: #666;
}

/* User Bar */
.user-bar {
  background: #f8f8f8;
  border-bottom: 1px solid #e0e0e0;
  padding: 0.4rem 1rem;
}

.user-bar-content {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  font-size: 0.85rem;
}

/* Buttons & Links */
.btn {
  display: inline-block;
  cursor: pointer;
  font-size: 0.875rem;
}

.btn-link {
  background: none;
  border: none;
  color: #0066cc;
  padding: 0;
  text-decoration: none;
}

.btn-link:hover {
  text-decoration: underline;
}

/* Flash messages */
.notice {
  background: #d4edda;
  color: #155724;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.alert {
  background: #f8d7da;
  color: #721c24;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* Auth */
.auth-container {
  max-width: 360px;
  margin: 3rem auto;
}

.auth-container h1 {
  margin-bottom: 1.5rem;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

.field input[type="email"]:focus,
.field input[type="password"]:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}

.field.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.field.checkbox label {
  display: inline;
  margin-bottom: 0;
}

.actions input[type="submit"] {
  width: 100%;
  padding: 0.625rem;
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  background: #0066cc;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 0.5rem;
}

.actions input[type="submit"]:hover {
  background: #0052a3;
}

/* Forms */
.post-form {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #333;
  margin-bottom: 0.375rem;
}

.form-input {
  display: block;
  width: 100%;
  padding: 0.5rem 0.625rem;
  font-family: inherit;
  font-size: 1rem;
  color: #1a1a1a;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}

.form-textarea.drag-over {
  border-color: #0066cc;
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
  background: #f0f7ff;
}

.form-textarea {
  resize: vertical;
  min-height: 300px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

.form-actions {
  margin-top: 1.5rem;
}

.btn-primary {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  background: #0066cc;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: #0052a3;
}

.form-errors {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.form-errors h2 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #991b1b;
  margin: 0 0 0.5rem;
}

.form-errors ul {
  margin: 0;
  padding-left: 1.25rem;
}

.form-errors li {
  font-size: 0.875rem;
  color: #b91c1c;
}

.back-link {
  font-size: 0.875rem;
  color: #666;
}

.back-link:hover {
  color: #0066cc;
}

/* Article list */
/*.article-list-item h2 {*/
/*  font-family: "Noto Serif", "Palatino", "Garamond", serif;*/
/*  letter-spacing: 0;*/
/*}*/

/* Article show page */
.article {
  margin-bottom: 2rem;
}

.article-header {
  margin-bottom: 2rem;
}

.article-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  margin: 0 0 0.75rem;
  text-wrap: balance;
}

.article-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e0e0e0;
}

.article-footer-author {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  letter-spacing: 0.01em;
}

.article-footer-date {
  display: block;
  font-size: 0.85rem;
  color: #888;
  margin-top: 0.25rem;
  letter-spacing: 0.02em;
}

.article-body {
  font-size: clamp(1.05rem, 1.6vw, 1.195rem);
  font-family: "Noto Serif", "Palatino", "Garamond", serif;
  line-height: 1.58;
  letter-spacing: -0.003em;
  word-spacing: 0.01em;
  color: #2a2a2a;
}

.article-body p {
  margin: 0 0 1.5em;
}

.article-body h2 {
  font-size: clamp(1.3rem, 2.8vw, 1.75rem);
  font-weight: 600;
  line-height: 1.3;
  margin: 2em 0 0.75em;
}

.article-body h3 {
  font-size: clamp(1.1rem, 2.2vw, 1.35rem);
  font-weight: 600;
  line-height: 1.35;
  margin: 1.75em 0 0.5em;
}

.article-body a {
  color: #0066cc;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.article-body a:hover {
  color: #0052a3;
}

.article-body blockquote {
  margin: 1.5em 0;
  padding: 0.25em 0 0.25em 1.25em;
  border-left: 3px solid #d0d0d0;
  color: #555;
  font-style: italic;
}

.article-body blockquote p:last-child {
  margin-bottom: 0;
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.5em;
  padding-left: 1.5em;
}

.article-body li {
  margin-bottom: 0.35em;
}

.article-body li::marker {
  color: #999;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1.5em 0;
}

.article-body hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 2.5em 0;
}

.article-body pre {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1.5em 0;
  font-size: 0.875em;
  line-height: 1.55;
  -webkit-overflow-scrolling: touch;
}

.article-body code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.875em;
}

.article-body pre code.hljs {
  background: transparent;
  padding: 0;
}

.article-body :not(pre) > code {
  background: #f0f0f0;
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95em;
}

.article-body th,
.article-body td {
  padding: 0.5em 0.75em;
  border: 1px solid #e0e0e0;
  text-align: left;
}

.article-body th {
  background: #f8f8f8;
  font-weight: 600;
}

.article-body strong {
  font-weight: 600;
}

.article-admin {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 1rem;
}

.article-admin a {
  color: #666;
}

.article-admin a:hover {
  color: #0066cc;
}

/* Dashboard */
.dashboard {
  max-width: 900px;
  margin: 0 auto;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.dashboard-header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.dashboard-period {
  display: flex;
  gap: 0.25rem;
}

.period-link {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 4px;
  text-decoration: none;
  color: #555;
  background: #eee;
}

.period-link:hover {
  background: #ddd;
}

.period-link--active {
  background: #0066cc;
  color: #fff;
}

.period-link--active:hover {
  background: #0052a3;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1.25rem;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dashboard-section {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.dashboard-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.dashboard-columns .dashboard-section {
  margin-bottom: 0;
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.dashboard-table th,
.dashboard-table td {
  text-align: left;
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.dashboard-table th {
  font-weight: 500;
  color: #888;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dashboard-table a {
  color: #0066cc;
  text-decoration: none;
}

.dashboard-table a:hover {
  text-decoration: underline;
}

.truncate {
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-bar {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 120px;
}

.chart-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar-fill {
  width: 100%;
  background: #0066cc;
  border-radius: 2px 2px 0 0;
  min-height: 1px;
}

.chart-bar-label {
  font-size: 0.6rem;
  color: #999;
  margin-top: 4px;
}

.empty-state {
  color: #999;
  font-size: 0.875rem;
  text-align: center;
  padding: 1rem 0;
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-columns {
    grid-template-columns: 1fr;
  }
}
