/* ==========================================================================
   Left Sidebar & App Layout — Neo-Brutalist Production Design
   ========================================================================== */

@font-face {
  font-family: "Nevis";
  src: url("../fonts/Nevis-Bold.woff") format("woff");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Woliu Maners Demo";
  src: url("../fonts/Woliu-Maners-Demo.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

.site-shell {
  --burst-origin-x: max(155px, calc((100% - 1720px) / 2 + 155px));
  --burst-origin-y: 30px;
  position: relative;
  isolation: isolate;
  min-height: calc(100vh - 32px);
}

.site-shell::before,
.site-shell::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
}

/* Long rays */
.site-shell::before {
  background: repeating-conic-gradient(
    from -0.06deg at var(--burst-origin-x) var(--burst-origin-y),
    var(--burst-ray-1) 0deg 0.12deg,
    transparent 0.12deg 3.6deg
  );
  -webkit-mask-image: radial-gradient(circle at var(--burst-origin-x) var(--burst-origin-y), transparent 0 145px, #000 148px 72%, transparent 94%);
  mask-image: radial-gradient(circle at var(--burst-origin-x) var(--burst-origin-y), transparent 0 145px, #000 148px 72%, transparent 94%);
}

/* Short rays, offset between each long ray */
.site-shell::after {
  background: repeating-conic-gradient(
    from 1.74deg at var(--burst-origin-x) var(--burst-origin-y),
    var(--burst-ray-2) 0deg 0.12deg,
    transparent 0.12deg 3.6deg
  );
  -webkit-mask-image: radial-gradient(circle at var(--burst-origin-x) var(--burst-origin-y), transparent 0 145px, #000 148px 43%, transparent 58%);
  mask-image: radial-gradient(circle at var(--burst-origin-x) var(--burst-origin-y), transparent 0 145px, #000 148px 43%, transparent 58%);
}

.sidebar-brand {
  min-height: 60px;
  padding: 1px 8px;
  display: flex;
  align-items: center;
}

.app-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 20px;
  max-width: 1720px;
  margin: 0 auto;
  align-items: start;
}

/* Sidebar Container */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 16px;
}

.brand-identity {
  display: flex;
  align-items: center;
  gap: 9px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-identity:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
  border-radius: 4px;
}

.brand-mark {
  display: block;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
}

.brand-wordmark {
  color: var(--brand-wordmark-color);
  font-family: "Nevis", "Trebuchet MS", Arial, sans-serif;
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1.4px;
  white-space: nowrap;
}

.brand-country {
  display: inline-block;
  margin-left: 0.1em;
  color: #1f6f2c;
  font-family: "Woliu Maners Demo", Arial, Helvetica, sans-serif;
  font-size: 0.52em;
  font-weight: 400;
  letter-spacing: 0;
  transform: translateY(-0.75em);
}

/* Upcoming Events Section */
.upcoming-section {
  background: var(--paper);
  border: var(--border-width) solid var(--line);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-radius: 8px;
}

.upcoming-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: var(--border-width) solid var(--line);
}

.upcoming-title {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink);
}

.upcoming-count:empty {
  display: none;
}

.upcoming-count {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  padding: 2px 8px;
  background: var(--bg-muted);
  border: var(--border-thin) solid var(--line);
  border-radius: 12px;
  letter-spacing: 0.04em;
}

.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Upcoming Event Card */
.upcoming-card {
  padding: 12px 14px;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: var(--ink);
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
  background: var(--paper);
}

/* Category Full-Fill Backgrounds (matching flush day card event pills) */
.upcoming-card.ctf { background: var(--ctf); }
.upcoming-card.hackathon { background: var(--hackathon); }
.upcoming-card.datathon { background: var(--datathon); }
.upcoming-card.cp { background: var(--cp); }
.upcoming-card.business-case { background: var(--business-case); }
.upcoming-card.fest { background: var(--fest); }
.upcoming-card.other { background: var(--other); }

.upcoming-card:hover {
  transform: translateY(-1px);
  box-shadow: 2.5px 2.5px 0 var(--line);
  filter: brightness(0.97);
}

.upcoming-card:active {
  transform: translateY(1px);
  box-shadow: none;
}

.upcoming-card::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  pointer-events: none;
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 3px,
    var(--texture-line) 3px 4px
  );
}

.upcoming-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.upcoming-category-tag {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  background: var(--paper);
  border: var(--border-thin) solid var(--line);
  border-radius: 9999px;
  color: var(--ink);
}

.upcoming-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  color: #444;
  white-space: nowrap;
}

.upcoming-event-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 900;
  line-height: 1.25;
  position: relative;
  z-index: 1;
}

.upcoming-organizer {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #666;
  position: relative;
  z-index: 1;
}

.upcoming-empty {
  padding: 20px 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #888;
}

.upcoming-loading,
.upcoming-error {
  padding: 20px 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.upcoming-loading {
  color: #888;
}

.upcoming-error {
  color: #9a3412;
}

/* Category Legend Section in Sidebar */
.legend-section {
  background: var(--paper);
  border: var(--border-width) solid var(--line);
  padding: 14px 16px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: var(--border-width) solid var(--line);
}

.legend-title {
  margin: 0;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink);
}

.legend-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 11px;
  border: var(--border-thin) solid var(--line);
  border-radius: 9999px;
  color: var(--ink);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  background: var(--paper);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.legend-pill:hover {
  transform: translateY(-1px);
  box-shadow: 2px 2px 0 var(--line);
}

.legend-pill.active {
  border: var(--border-width) solid var(--line);
  box-shadow: 2.5px 2.5px 0 var(--line);
  transform: translateY(-1px);
}

.legend-pill.all-pill {
  background: var(--bg-muted);
}

.upcoming-card.dimmed {
  opacity: 0.15;
  filter: grayscale(0.85);
  pointer-events: none;
}

.legend-pill::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  pointer-events: none;
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 3px,
    var(--texture-line) 3px 4px
  );
}

/* Category Full-Fill Pills */
.legend-pill.ctf { background: var(--ctf); }
.legend-pill.hackathon { background: var(--hackathon); }
.legend-pill.datathon { background: var(--datathon); }
.legend-pill.cp { background: var(--cp); }
.legend-pill.business-case { background: var(--business-case); }
.legend-pill.fest { background: var(--fest); }
.legend-pill.other { background: var(--other); }

/* Minimal Sidebar Action Panel & Social Row */
.sidebar-actions-panel {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 4px 0 6px;
  width: 100%;
}

.sidebar-social-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.sidebar-social-link {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  box-shadow: none;
  background: transparent;
  color: #52525b;
  text-decoration: none;
  transition: transform 0.12s ease, color 0.15s ease;
}

.sidebar-social-link svg {
  width: 34px;
  height: 34px;
}

.sidebar-social-link.gmail svg {
  width: 24px;
  height: 24px;
}

.sidebar-social-link:hover,
.sidebar-social-link.linkedin:hover {
  color: #0077b5;
  transform: translateY(-1.5px) scale(1.08);
}

.sidebar-social-link.gmail:hover {
  color: #ea4335;
  transform: translateY(-1.5px) scale(1.08);
}

.sidebar-social-link:active {
  transform: translateY(1px);
}

.sidebar-actions-divider {
  width: 1.5px;
  height: 24px;
  background-color: var(--line);
  opacity: 0.18;
  flex-shrink: 0;
}

.sidebar-theme-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  background-color: var(--paper);
  color: var(--ink);
  border: var(--border-width) solid var(--line);
  border-radius: 9999px;
  box-shadow: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.1s ease;
}

.sidebar-theme-btn:hover {
  background-color: var(--hover-bar);
  transform: translateY(-1px);
  box-shadow: 2px 2px 0 var(--line);
}

.sidebar-theme-btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

.sidebar-submit-btn {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0 3px,
    var(--texture-line) 3px 4px
  );
  color: var(--ink);
  border: var(--border-width) solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  letter-spacing: 0.03em;
  box-shadow: none;
  position: relative;
  overflow: hidden;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.1s ease;
}

.sidebar-submit-btn:hover {
  background-color: var(--hover-bar);
  transform: translateY(-1px);
  box-shadow: 2px 2px 0 var(--line);
}

.sidebar-submit-btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

/* Responsive adjustments */
@media (max-width: 1080px) {
  .app-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .sidebar-panel {
    display: contents;
  }

  .sidebar-brand {
    order: 1;
  }

  .upcoming-section {
    order: 2;
  }

  .legend-section {
    order: 3;
  }

  .calendar {
    order: 4;
  }

  .sidebar-actions-panel {
    order: 5;
    padding: 6px 0 16px;
  }
}

@media (max-width: 768px) {
  .site-shell {
    --burst-origin-x: 50%;
    --burst-origin-y: 28px;
    min-height: calc(100vh - 12px);
  }

  .site-shell::before,
  .site-shell::after {
    display: block;
    opacity: 0.85;
  }

  .sidebar-brand {
    min-height: 52px;
    padding: 0 6px;
    justify-content: center;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .brand-wordmark {
    font-size: 38px;
  }

  .upcoming-section,
  .legend-section {
    padding: 12px;
    gap: 10px;
  }

  .upcoming-title,
  .legend-title {
    font-size: 13px;
  }

  .upcoming-card {
    padding: 8px 10px;
    gap: 4px;
  }

  /* Show only top 3 upcoming events on mobile to conserve screen space */
  .upcoming-list .upcoming-card:nth-child(n + 4) {
    display: none !important;
  }

  .upcoming-event-title {
    font-size: 12.5px;
  }

  .legend-pill {
    padding: 3px 9px;
    font-size: 10px;
  }
}
