/* === Main === */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #f7f3e8;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  color: #2c241a;
  line-height: 1.45;
  padding: 1.5rem 1rem;
}

.container {
  max-width: 880px;
  margin: 0 auto;
}

/* Header */
.site-header {
  border-bottom: 3px solid #e67e22;
  margin-bottom: 1.8rem;
  padding-bottom: 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.logo h1 {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #bf5e00, #e67e22);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  transition: background-position 0.3s ease;
}

.logo h1:hover {
  background-position: 100% 0;
}

.logo h1 a {
  color: inherit;
  text-decoration: inherit;
}

.logo .tagline {
  font-size: 0.75rem;
  color: #a5673f;
  font-weight: 500;
}

/* Auth */
.auth-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.signin-link, .newpost-link {
  background: #e67e22;
  color: white;
  padding: 6px 16px;
  border-radius: 30px;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background 0.2s;
}

.signin-link:hover, .newpost-link:hover {
  background: #c2410c;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffedd5;
  padding: 4px 12px 4px 16px;
  border-radius: 40px;
  border: 1px solid #fed7aa;
}

.user-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.user-name {
  font-weight: 700;
  color: #b45309;
  font-size: 0.85rem;
}

.user-karma {
  background: #fde68a;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 30px;
  color: #92400e;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

dt.karma {
  float: right;
}

dt.karma + dd {
  float: left;
}

dt.karma + dd::before {
  content: "⭐\00A0";
}

dt.karma + dd::after {
  content: "\00A0";
}

.logout-form {
  margin: 0;
  padding: 0;
}

.logout-button {
  background: none;
  border: none;
  color: #b45309;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}

.logout-button:hover {
  background: #fed7aa;
}

/* Article Post */
article {
  background: white;
  margin-bottom: 1.2rem;
  padding: 1rem;
  border: 1px solid #e1cbb5;
  overflow: hidden;
}

/* Voting Column */
article > aside {
  float: left;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

article > aside form {
  display: contents;
  margin: 0;
  padding: 0;
}

article > aside button {
  background: #f2ece4;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  min-width: 32px;
  min-height: 32px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b4c2c;
  cursor: pointer;
  padding: 0;
}

article > aside button:last-child {
  margin-bottom: 8px;
}

aside button:not(:disabled):hover {
  background-color: #ffc18c;
}

aside button:disabled {
  opacity: 0.5;
  cursor: default;
}

aside button[aria-label="Vote up"] {
  background-image: url("/up.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 50%;
}

aside button[aria-label="Vote down"] {
  background-image: url("/down.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 50%;
}

/*
aside button[aria-label="Vote up"]::before {
  content: "+";
}

aside button[aria-label="Vote down"]::before {
  content: "-";
}
*/

aside output {
  font-weight: 700;
  font-size: 1rem;
  color: #c2410c;
  text-align: center;
  display: block;
  user-select: none;
}

article > aside a.source {
  background: transparent url("/external.svg") center / 50% no-repeat;
  display: flex;
  min-width: 32px;
  min-height: 32px;
  border-radius: 30px;
  opacity: 0.5;
}

article > aside a.source:hover {
  opacity: initial;
}

article > aside a.source > span {
  display: none;
}

/* Content Area */
article > aside ~ * {
  margin-left: 48px;
}

article > header h2 {
  display: inline-block;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 5px;
}

article > header a {
  text-decoration: none;
  color: #1f2937;
}

article > header a:hover {
  color: #e67e22;
  text-decoration: underline;
}

/* Blockquote */
article > blockquote {
  background: #fefaf5;
  border-left: 2px solid #e6d8cc;
  padding: 0.5rem 0.75rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: #8f6e4e;
  font-style: italic;
}

article > blockquote a {
  color: inherit;
  text-decoration: inherit;
}

article > blockquote a:hover {
  text-decoration: underline;
}

article > blockquote p {
  margin: 0;
}

/* 7 */
article figure {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  overflow: hidden;
  background: #fefaf5;
  border: 1px solid #efe2d2;
}

article figure img {
  width: 100%;
  max-height: 448px;
  object-fit: contain;
  display: block;
}

/* Footer */
footer {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #8f6e4e;
}

footer .author {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

footer address {
  display: inline;
  font-style: normal;
}

footer address a {
  font-weight: 600;
  color: #b45309;
  text-decoration: none;
}

footer address a:hover {
  text-decoration: underline;
}

footer time {
  color: #aa8562;
}

footer dl {
  display: flex;
  flex-direction: row-reverse;
  margin: 0;
  background: #fde68a;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 30px;
  color: #92400e;
  user-select: none;
}

footer dt {
  font-weight: normal;
}

footer dd {
  font-weight: 600;
  color: #92400e;
}

footer nav {
  background: #f0e7de;
  padding: 2px 8px;
  border-radius: 20px;
}

/* Karma Card */
.karma-card {
  background: white;
  border-radius: 20px;
  margin: 1.5rem 0 1.2rem;
  padding: 1rem 1.2rem;
  border: 1px solid #efe2d2;
}

.karma-header {
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  border-left: 4px solid #e67e22;
  padding-left: 10px;
}

.user-karma-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.karma-stats {
  display: flex;
  align-items: baseline;
  gap: 12px;
  background: #fef7ef;
  padding: 6px 16px;
  border-radius: 40px;
}

.karma-number {
  font-size: 1.6rem;
  font-weight: 800;
  color: #c2410c;
}

.rating-buttons {
  display: flex;
  gap: 12px;
}

.rating-btn {
  background: #f2e8de;
  border: none;
  padding: 6px 18px;
  border-radius: 40px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #5c3e24;
  cursor: default;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.rating-btn.disabled {
  opacity: 0.45;
  background: #e6dbcf;
}

hr {
  margin: 0.8rem 0;
  border: none;
  border-top: 1px solid #f0e2d2;
}

.info-note {
  background: #fef5ea;
  border-radius: 18px;
  padding: 0.7rem 1rem;
  font-size: 0.7rem;
  color: #9b6a42;
  text-align: center;
  margin-top: 1.8rem;
}

/* Responsive */
@media (max-width: 580px) {
  body {
    padding: 1rem;
  }
  
  article > aside {
    float: right;
    flex-direction: row;
    justify-content: flex-start;
    margin-right: 0;
    margin-bottom: 0.5rem;
    gap: 0;
    background-color: #f2ece4;
    border-radius: 8px;
    margin-left: 4px;
    margin-top: 3px;
  }

  article > aside output {
    font-size: 0.8rem;
    min-width: 12px;
    line-height: 24px;
  }

  article > aside a.source {
    min-width: 24px;
    min-height: 24px;
    background-size: 46%;
    padding-left: 2px;
    padding-right: 2px;
  }

  article > aside ~ * {
    margin-left: 0;
  }

  article > aside button {
    background: #f2ece4;
    border: none;
    min-width: 24px;
    min-height: 24px;
    padding-left: 2px;
    padding-right: 2px;
  }

  article > aside button:last-child {
    margin-bottom: 0;
  }

  article > aside button:first-of-type {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }

  article > aside button:last-of-type {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  article > aside output {
    padding-left: 2px;
    padding-right: 2px;
  }

  article > header h2 {
    display: block;
  }

  .user-karma-row {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .user-menu {
    padding: 4px 8px 4px 12px;
  }
  
  .user-info {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }
}

/* === Sign In === */

/* Login/Signup container */
.login-container,
.signup-container {
  max-width: 380px;
  width: 100%;
  margin: 0 auto;
}

/* Brand header */
.brand {
  text-align: center;
  margin-bottom: 2rem;
}

.brand h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #bf5e00, #e67e22);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  margin-bottom: 0.25rem;
}

.brand .tagline {
  font-size: 0.75rem;
  color: #a5673f;
  font-weight: 500;
}

/* Login/Signup card */
.login-card,
.signup-card {
  background: white;
  border-radius: 24px;
  padding: 2rem 1.8rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  border: 1px solid #efe2d2;
}

/* Form groups */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #b87a4a;
  margin-bottom: 0.5rem;
}

.form-group input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: #fefaf5;
  border: 1px solid #e6d8cc;
  border-radius: 14px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #2c241a;
  transition: all 0.2s ease;
  outline: none;
}

.form-group input:focus {
  border-color: #e67e22;
  box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.1);
  background: white;
}

.form-group input::placeholder {
  color: #cbb99f;
  font-weight: 400;
}

/* Submit button */
.submit-btn {
  width: 100%;
  background: linear-gradient(135deg, #e67e22, #c2410c);
  color: white;
  border: none;
  padding: 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 40px;
  cursor: pointer;
  font-family: inherit;
  margin-top: 0.5rem;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.submit-btn:hover {
  background: linear-gradient(135deg, #d9731a, #b03a0a);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
}

.submit-btn:active {
  transform: translateY(0);
}

/* Helper links */
.helper {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: #a7896b;
}

.helper a {
  color: #e67e22;
  text-decoration: none;
  font-weight: 500;
}

.helper a:hover {
  text-decoration: underline;
}

/* Divider */
.divider {
  margin: 1.5rem 0 1rem;
  text-align: center;
  font-size: 0.7rem;
  color: #d4bea4;
  position: relative;
}

.divider::before,
.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: #ecdbba;
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

/* Karma note */
.karma-note {
  text-align: center;
  font-size: 0.65rem;
  color: #bf8f60;
  margin-top: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid #f0e2d2;
}

/* Body override for auth pages */
body:has(.login-container, .signup-container) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}