/* CSS Variables */
:root {
  --primary-text: #0c1821;
  --background: #ccc9dc;
  --border-color: #0c1821;
  --link-color: #0c1821;
  --visited-link-color: #475869;
  --toggle-bg: #0c1821;
  --toggle-handle: #ccc9dc;
}

/* Dark Mode Variables */
body:has(#darkmode-toggle:checked) {
  --primary-text: #ccc9dc;
  --background: #0c1821;
  --border-color: #ccc9dc;
  --link-color: #ccc9dc;
  --visited-link-color: #687a8b;
  --toggle-bg: #ccc9dc;
  --toggle-handle: #0c1821;
}

/* Reset & Base Styles */
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--background);
  transition: background-color 0.3s ease;
}

/* Link styles - Updated with better specificity */
.articles-container a {
  color: var(--link-color);
  text-decoration: none;
}

.articles-container a:visited {
  color: var(--visited-link-color);
}

/* Layout */
.page-wrapper {
  background-color: var(--background);
  color: var(--primary-text);
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  padding: 15px;
  max-width: 800px;
  margin: 0 auto;
}

/* Header */
.site-header h1 {
  font-family: "Bebas Neue", cursive;
  font-style: italic;
  font-size: 2.5rem;
  text-align: center;
  border-bottom: 3px double var(--border-color);
  margin: 0 0 20px;
  padding: 10px 0;
  color: var(--primary-text);
}

/* Articles Container */
.articles-container {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

/* Article Styles */
article {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
}

.article-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 12px 0;
  display: block;
  object-fit: cover;
}

h2,
h3 {
  margin: 8px 0;
  font-weight: normal;
}

h2 a {
  font-size: 1.4rem;
}

h3 a {
  font-size: 1.2rem;
}

.source-time {
  color: color-mix(in srgb, var(--primary-text) 60%, transparent);
  font-size: 0.7rem;
  margin-top: 5px;
  display: block;
}

/* Add share button styles */
.source-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
}

.share-button {
  color: var(--primary-text);
  font-size: 0.7rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}

.share-button:hover {
  color: var(--link-color);
}

/* Theme Toggle */
#darkmode-toggle {
  position: absolute;
  left: -9999px;
}

.theme-toggle {
  position: fixed;
  top: 15px;
  right: 15px;
  width: 50px;
  height: 26px;
  background: var(--toggle-bg);
  border-radius: 13px;
  cursor: pointer;
  z-index: 100;
  transition: background 0.3s ease;
}

.toggle-handle {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--toggle-handle);
  border-radius: 50%;
  transition: transform 0.3s ease;
}

#darkmode-toggle:checked ~ .page-wrapper .theme-toggle .toggle-handle {
  transform: translateX(24px);
}

/* Footer */
.footer {
  margin-top: 40px;
  padding: 20px 0;
  border-top: 1px solid var(--border-color);
}

.copyright {
  text-align: center;
  margin-top: 20px;
  color: var(--primary-text);
}

/* Contact Form */
.tips-box {
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}

.tips-box h3 {
  font-family: "Bebas Neue", cursive;
  font-size: 1.5rem;
  margin: 0 0 10px;
}

.contact-form {
  max-width: 400px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 15px;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 4px;
  border: 1px solid var(--border-color);
  background: var(--background);
  color: var(--primary-text);
  font-family: inherit;
}

.form-textarea {
  height: 3rem;
  resize: vertical;
}

.form-submit {
  background: var(--primary-text);
  color: var(--background);
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  width: 100%;
  font-family: "Bebas Neue", cursive;
  font-size: 1.2rem;
}

.form-submit:hover {
  opacity: 0.9;
}

/* Media Queries */
@media (min-width: 768px) {
  body {
    padding: 0;
  }

  .page-wrapper {
    padding: 25px 40px;
  }

  .site-header h1 {
    font-size: 3.5rem;
    margin-bottom: 30px;
  }

  .article-image {
    width: 100%;
    margin: 15px 0;
    max-width: 100%;
  }

  h2 a {
    font-size: 1.8rem;
  }

  h3 a {
    font-size: 1.4rem;
  }

  .source-time {
    font-size: 0.8rem;
  }

  .tips-box h3 {
    font-size: 1.8rem;
  }
}

/* Add highlight animation for linked articles */
article:target {
  animation: highlight 1.5s ease-out;
  background-color: color-mix(in srgb, var(--primary-text) 10%, transparent);
  scroll-margin-top: 80px;
}

@keyframes highlight {
  from {
    background-color: color-mix(in srgb, var(--primary-text) 30%, transparent);
  }
  to {
    background-color: color-mix(in srgb, var(--primary-text) 10%, transparent);
  }
}
