/* vv styles — Newcomer Exploration */

/* =============================================================================
   DESIGN TOKENS
   ============================================================================= */
:root {
  --color-primary: #1D42C3;      /* Deep blue */
  --color-accent: #E7FF47;       /* Chartreuse yellow */
  --color-white: #FFFFFF;
  --color-black: #1a1a1a;
  --color-gray-light: #f5f5f5;
  --color-gray-medium: #808080;  /* Medium gray for recent section */

  --font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-family-serif: var(--font-family);  /* Keeping variable for easy switching */
}

/* =============================================================================
   BASE STYLES
   ============================================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  line-height: 1.5;
  color: var(--color-black);
  background: var(--color-white);
}

/* No max-width container for full-bleed sections */
main {
  margin: 0;
  padding: 0;
}

/* =============================================================================
   LOGO HEADER
   ============================================================================= */
.logo-header {
  padding: 1.5rem 2rem;
  background: var(--color-white);
}

.logo-header a {
  display: inline-block;
}

.site-logo {
  height: 28px;
  width: auto;
  display: block;
}

.site-logo:hover {
  opacity: 0.8;
}

/* =============================================================================
   PROFILE HEADER — Blue background, white text
   ============================================================================= */
.profile-header {
  background: var(--color-primary);
  color: var(--color-white);
  text-align: center;
  padding: 3rem 2rem;
  margin-bottom: 0;
  border-bottom: none;
}

.profile-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  text-transform: lowercase;
  letter-spacing: -0.05em;
  margin-bottom: 0.5rem;
  color: var(--color-white);
}

.profile-header .stats {
  color: rgba(255, 255, 255, 0.5);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.05em;
}

/* =============================================================================
   SECTIONS — Base styles
   ============================================================================= */
section {
  margin-bottom: 0;
}

section h2 {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: -0.05em;
  text-transform: lowercase;
  margin-bottom: 1.5rem;
}

/* =============================================================================
   VV TOP SECTION — White background
   ============================================================================= */
.vv-top {
  background: var(--color-white);
  padding: 3rem 2rem;
  margin-bottom: 0;
}

.vv-top h2 {
  color: var(--color-black);
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
  max-width: 800px;
  margin: 0 auto;
}

/* =============================================================================
   LINK CARD — Grid layout (VV Top)
   ============================================================================= */
.link-card {
  display: block;
  background: var(--color-white);
  border: none;
  border-radius: 0;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s, box-shadow 0.2s;
}

.link-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.link-image {
  width: 100%;
  height: 120px;
  background-size: cover;
  background-position: center;
  background-color: var(--color-primary);
  border-radius: 0;
}

.links-grid .link-image {
  height: 100px;
}

.link-content {
  padding: 0.875rem;
}

.link-title {
  display: block;
  font-family: var(--font-family-serif);
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.4;
  letter-spacing: -0.05em;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.link-domain {
  display: inline;
  font-family: var(--font-family-serif);
  font-size: 0.75rem;
  letter-spacing: -0.05em;
  color: rgba(0, 0, 0, 0.5);
}

/* Link Description */
.link-description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: var(--font-family-serif);
  font-size: 0.8rem;
  line-height: 1.4;
  letter-spacing: -0.05em;
  color: rgba(0, 0, 0, 0.5);
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

/* =============================================================================
   LINK BADGE — Chartreuse accent
   ============================================================================= */
.link-badge {
  display: inline-block;
  font-family: var(--font-family-serif);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.05em;
  color: var(--color-black);
  background: var(--color-accent);
  padding: 3px 8px;
  border-radius: 0;
  margin-left: 0;
  margin-top: 4px;
}

/* =============================================================================
   RECENT SECTION — Gray background block
   ============================================================================= */
.recent {
  background: var(--color-primary);
  padding: 2rem 2rem 3rem 2rem; /* top right bottom left - reduced top to compensate for sticky h2 padding */
}

.recent h2 {
  color: var(--color-white);
}

@media (min-width: 600px) {
  .recent h2 {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--color-primary);
    /* Extend to full bleed while maintaining text position */
    margin-left: -2rem;
    margin-right: -2rem;
    padding-left: 2rem;
    padding-right: 2rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem; /* reduced from inherited 1.5rem */
  }
}

/* Hide date indicator by default */
.sticky-date-indicator {
  display: none;
}

@media (min-width: 1150px) {
  .sticky-date-indicator {
    display: inline;
    /* Match .links-list centering: max-width 600px centered */
    position: absolute;
    /* Calculate: 50% of viewport, minus half of 600px, equals left edge of cards */
    left: calc(50%);
    transform: translateX(-300px);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.05em;
    text-transform: lowercase;
    color: rgba(255, 255, 255, 0.5);
    opacity: 0;
    transition: opacity 0.15s ease;
  }

  .sticky-date-indicator.visible {
    opacity: 1;
  }
}

/* =============================================================================
   SECTION SUBHEADERS
   ============================================================================= */
.section-subheader {
  font-weight: 500;
  margin-left: 1rem;
}

.vv-top .section-subheader {
  color: rgba(26, 26, 26, 0.5);
}

.recent .section-subheader {
  color: rgba(255, 255, 255, 0.5);
}

.recent .link-card-inline {
  border: 2px solid var(--color-accent);
}

.recent .link-card-inline .link-thumbnail {
  filter: grayscale(100%);
  transition: filter 0.3s ease;
}

.recent .link-card-inline:hover .link-thumbnail {
  filter: grayscale(0%);
}

/* Favicon grayscale treatment in Recent section — matches thumbnail behavior */
.recent .link-card-inline .link-thumbnail-favicon img {
  filter: grayscale(100%);
  transition: filter 0.3s ease;
}

.recent .link-card-inline:hover .link-thumbnail-favicon img {
  filter: grayscale(0%);
}

.links-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* =============================================================================
   INLINE LINK CARD — Used in Recent section
   ============================================================================= */
.link-card-inline {
  display: flex;
  align-items: stretch;
  height: 140px;
  background: var(--color-white);
  border: none;
  border-radius: 0;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s, box-shadow 0.2s;
}

.link-card-inline:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* Inline thumbnail */
.link-thumbnail {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  background-color: var(--color-primary);
}

/* Favicon thumbnail — neutral background with centered icon */
.link-thumbnail-favicon {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-gray-light);
}

.link-thumbnail-favicon img {
  width: 48px;
  height: 48px;
}

/* Inline card content — Grid layout */
.link-card-inline .link-content {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  row-gap: 4px;
  flex: 1;
  min-width: 0;
  padding: 0.75rem 1rem;
  height: 100%;
}

.link-card-inline .link-title {
  grid-row: 1;
  -webkit-line-clamp: 1;
  font-weight: 600;
}

.link-card-inline .link-badge {
  grid-row: 2;
  justify-self: start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 0;
}

.link-card-inline .link-description {
  grid-row: 3;
  align-self: start;
}

.link-card-inline .link-meta {
  grid-row: 4;
  align-self: end;
}

/* =============================================================================
   DATE HEADERS
   ============================================================================= */
.date-header {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.05em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0;
}

.date-header:first-child,
.date-group:first-child .date-header {
  margin-top: 0;
}

.link-date {
  font-family: var(--font-family-serif);
  font-size: 0.75rem;
  letter-spacing: -0.05em;
  color: rgba(0, 0, 0, 0.35);
}

.link-date:not(:empty)::before {
  content: ' · ';
  color: #ccc;
}

.link-meta {
  display: block;
  font-family: var(--font-family-serif);
  font-size: 0.75rem;
  letter-spacing: -0.05em;
  color: rgba(0, 0, 0, 0.4);
}

/* =============================================================================
   EMPTY STATES
   ============================================================================= */
.empty-state,
.empty-section {
  text-align: center;
  padding: 2rem 1rem;
  color: rgba(255, 255, 255, 0.7);
}

.empty-section {
  padding: 1rem;
}

/* =============================================================================
   SITE FOOTER — Minimal, white background
   ============================================================================= */
.site-footer {
  background: var(--color-white);
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 0;
  border-top: none;
  color: rgba(0, 0, 0, 0.4);
  font-size: 0.8rem;
  letter-spacing: -0.05em;
}

.site-footer a {
  color: rgba(0, 0, 0, 0.5);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--color-primary);
}

.footer-divider {
  margin: 0 0.75rem;
  color: #ccc;
}

/* =============================================================================
   ERROR PAGES
   ============================================================================= */
.error-page {
  display: flex;
  flex-direction: column;
  min-height: 80vh;
}

.error-header {
  text-align: center;
  padding: 1.5rem 2rem;
  background: var(--color-white);
}

.error-header .logo-link {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-black);
  text-decoration: none;
}

.not-found {
  text-align: center;
  padding: 4rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--color-primary);
  color: var(--color-white);
}

.not-found h1 {
  font-size: 6rem;
  font-weight: 800;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}

.not-found p {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.not-found a {
  color: var(--color-white);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* =============================================================================
   HOMEPAGE
   ============================================================================= */
.home {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--color-primary);
}

.home-content {
  text-align: center;
  padding: 2rem 1rem;
}

.home-logo {
  font-size: 6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-white);
  margin-bottom: 0.5rem;
}

.home-tagline {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.home-logo-img {
  height: 100px;
  width: auto;
  margin-bottom: 1rem;
  filter: brightness(0) invert(1);
}

/* =============================================================================
   LOGIN PAGE
   ============================================================================= */
.login-container {
  width: 100%;
  max-width: 360px;
  padding: 0 1.5rem;
}

.login-container h1 {
  margin-bottom: 1.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  word-wrap: break-word;
}

.login-container form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-container input {
  padding: 0.875rem 1rem;
  border: 2px solid var(--color-black);
  border-radius: 8px;
  font-size: 1rem;
  min-height: 48px;
}

.login-container input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.login-container button {
  padding: 0.875rem 1rem;
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  min-height: 48px;
  transition: background 0.2s;
}

.login-container button:hover {
  background: #15329a;
}

.error {
  color: #d32f2f;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* =============================================================================
   EDIT PAGE
   ============================================================================= */
.edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1.5rem 2rem;
  background: var(--color-primary);
  color: var(--color-white);
  flex-wrap: wrap;
  gap: 1rem;
}

.edit-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0;
}

.edit-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* =============================================================================
   BUTTONS
   ============================================================================= */
.btn {
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  min-height: 44px;
  transition: all 0.2s;
}

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

.btn-primary:hover:not(:disabled) {
  background: #d4f52e;
}

.btn-primary:disabled {
  background: #999;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--color-white);
  color: var(--color-black);
  border: 2px solid var(--color-black);
}

.btn-secondary:hover {
  background: var(--color-gray-light);
}

.btn-text {
  background: none;
  color: rgba(255, 255, 255, 0.8);
  padding: 0.5rem;
}

.btn-text:hover {
  color: var(--color-white);
}

.btn-icon {
  background: var(--color-white);
  border: 2px solid var(--color-black);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--color-black);
  transition: all 0.15s;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--color-gray-light);
}

.btn-icon.featured {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: rgba(29, 66, 195, 0.1);
}

.btn-icon.btn-delete:hover:not(:disabled) {
  border-color: #d32f2f;
  color: #d32f2f;
  background: #fef2f2;
}

.btn-icon:disabled,
.visibility-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =============================================================================
   ADD LINK SECTION
   ============================================================================= */
.add-link-section {
  margin: 0;
  padding: 2rem;
  background: var(--color-white);
}

.add-link-section h2 {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-black);
  margin-bottom: 1rem;
}

.add-link-form {
  display: flex;
  gap: 0.75rem;
  max-width: 600px;
}

.add-link-form input {
  flex: 1;
  padding: 0.875rem 1rem;
  border: 2px solid var(--color-black);
  border-radius: 8px;
  font-size: 1rem;
}

.add-link-form input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.add-link-form input:disabled {
  background: var(--color-gray-light);
}

/* =============================================================================
   LINKS SECTION (Edit page)
   ============================================================================= */
.links-section {
  padding: 2rem;
  background: var(--color-gray-light);
}

.links-section h2 {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-black);
  margin-bottom: 1rem;
}

.links-section h2 .count {
  font-weight: 400;
  text-transform: none;
}

.edit-links-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 700px;
}

.edit-link-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--color-white);
  border: none;
  border-radius: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  gap: 1rem;
}

.edit-link-card[data-visibility="private"] {
  background: var(--color-white);
  border: 2px dashed #ccc;
}

.edit-link-card[data-visibility="draft"] {
  background: #fffbf0;
  border: 2px solid #f5d89a;
}

.link-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.link-info .link-thumbnail,
.link-info .link-thumbnail-favicon {
  width: 48px;
  height: 48px;
  border-radius: 0;
  flex-shrink: 0;
}

.link-info .link-thumbnail-favicon {
  background-color: var(--color-primary);
}

.link-info .link-thumbnail-favicon img {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(1);
}

.link-info-text {
  flex: 1;
  min-width: 0;
}

.link-title-row {
  text-decoration: none;
  color: inherit;
}

.link-title-row:hover .link-title {
  text-decoration: underline;
}

.link-info .link-title {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-info .link-domain {
  font-size: 0.8rem;
  color: rgba(0, 0, 0, 0.4);
}

.link-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.visibility-select {
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--color-black);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--color-white);
  cursor: pointer;
  min-height: 44px;
}

.visibility-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* =============================================================================
   TOAST NOTIFICATIONS
   ============================================================================= */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.875rem 1.5rem;
  border-radius: 0;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-black);
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.toast-success {
  background: var(--color-accent);
}

.toast-error {
  background: #ff6b6b;
  color: var(--color-white);
}

/* =============================================================================
   LEGAL PAGES
   ============================================================================= */
.legal-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem;
}

.legal-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--color-black);
}

.legal-header .logo-link {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-black);
  text-decoration: none;
  text-transform: uppercase;
}

.legal-content h1 {
  font-size: 2.5rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.legal-content .effective-date {
  color: rgba(0, 0, 0, 0.5);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.legal-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.legal-content p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

.legal-content ul {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.legal-content li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.legal-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* =============================================================================
   MOBILE RESPONSIVENESS
   ============================================================================= */
@media (max-width: 600px) {
  .profile-header {
    padding: 2.5rem 1.5rem;
  }

  .profile-header h1 {
    font-size: 2rem;
  }

  .profile-header .stats {
    font-size: 0.9rem;
  }

  .vv-top,
  .recent {
    padding: 2rem 1rem;
  }

  .link-content {
    padding: 0.625rem;
  }

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

  .logo-header {
    padding: 1rem 1rem;
  }
}

@media (max-width: 500px) {
  .home-logo {
    font-size: 4rem;
  }

  .home-tagline {
    font-size: 1rem;
  }

  .home-logo-img {
    height: 72px;
  }

  .edit-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem 1rem;
  }

  .edit-link-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .link-controls {
    width: 100%;
    justify-content: flex-end;
  }

  .add-link-form {
    flex-direction: column;
  }

  .add-link-form button {
    width: 100%;
  }

  .not-found h1 {
    font-size: 4rem;
  }

  .not-found {
    padding: 2rem 1rem;
  }

  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    text-align: center;
  }

  .legal-content h1 {
    font-size: 1.75rem;
  }

  .legal-content h2 {
    font-size: 1.1rem;
  }
}

@media (max-width: 375px) {
  main {
    padding: 0;
  }

  .profile-header h1 {
    font-size: 1.75rem;
  }

  .links-grid .link-image {
    height: 80px;
  }

  .link-image {
    height: 90px;
  }

  .not-found h1 {
    font-size: 3rem;
  }

  .home-logo {
    font-size: 3rem;
  }

  .home-logo-img {
    height: 56px;
  }
}
