/* ===== Custom Properties ===== */
:root {
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --bg: #fafafa;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --error: #dc2626;
  --success: #16a34a;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --transition-speed: 0.2s;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== Layout ===== */
header,
main,
footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ===== Header ===== */
header {
  padding-top: 3rem;
  padding-bottom: 2rem;
  text-align: center;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.tagline {
  margin-top: 0.25rem;
  font-size: 1.1rem;
  color: var(--text-secondary);
}

/* ===== Input Section ===== */
.input-section {
  margin-bottom: 1.5rem;
}

#article-form {
  display: flex;
  gap: 0.5rem;
}

#article-form input[type="url"] {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  transition: border-color var(--transition-speed) ease;
}

#article-form input[type="url"]:focus {
  outline: none;
  border-color: var(--accent);
}

#article-form button {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-speed) ease,
              transform var(--transition-speed) ease;
}

#article-form button:hover {
  background: var(--accent-hover);
}

#article-form button:active {
  transform: scale(0.97);
}

#article-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== Error Message ===== */
.error-message {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--error);
}

.error-message[hidden] {
  display: none;
}

/* ===== Search Section ===== */
.search-section {
  margin-bottom: 2rem;
}

#search-input {
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  transition: border-color var(--transition-speed) ease;
}

#search-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===== Article Cards ===== */
#article-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.article-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition-speed) ease;
}

.article-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.article-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.article-card .summary {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.article-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.article-card .meta a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}

.article-card .meta a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ===== Loading Skeleton ===== */
#loading[hidden] {
  display: none;
}

.skeleton-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.skeleton-line {
  height: 1rem;
  background: var(--border);
  border-radius: 4px;
  margin-bottom: 0.75rem;
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-title {
  width: 70%;
  height: 1.25rem;
}

.skeleton-text {
  width: 100%;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-meta {
  width: 40%;
  height: 0.75rem;
  margin-bottom: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== Pagination ===== */
.pagination {
  text-align: center;
  margin: 2rem 0;
}

#load-more-btn {
  padding: 0.6rem 2rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition-speed) ease,
              color var(--transition-speed) ease;
}

#load-more-btn:hover {
  background: var(--accent);
  color: #ffffff;
}

#load-more-btn[hidden] {
  display: none;
}

/* ===== Footer ===== */
footer {
  padding: 2rem 1rem 3rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

footer p + p {
  margin-top: 0.25rem;
}

footer a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}

footer a:hover {
  text-decoration: underline;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  header {
    padding-top: 2rem;
    padding-bottom: 1.5rem;
  }

  header h1 {
    font-size: 2rem;
  }

  #article-form {
    flex-direction: column;
  }

  #article-form button {
    width: 100%;
  }

  .article-card {
    padding: 1rem 1.15rem;
  }

  .article-card .meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}
