/* =========================
   VARIABLES
   ========================= */
:root {
  --primary: #FFD400;
  --secondary: #FF6A00;
  --bg: #020813;
  --surface: #0A1220;
  --surface-alt: #060D1A;
  --text: #E0E6ED;
  --grid: #081424;

  --user-primary: #FFD400;
  --user-glow-primary: #FFD400B3;
  --user-glow-message: #FFD4001A;
  --remote-secondary: #FF6A00;
  --remote-glow-secondary: #FF6A00B3;
  --remote-glow-message: #FF6A001A;

  --glow-primary: rgba(255,212,0,0.7);
  --glow-secondary: rgba(255,106,0,0.6);

  --font: 'Rajdhani', sans-serif;
  --font-title: 'Orbitron', sans-serif;

  --sidebar-width: 240px;
  --header-height: 80px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: var(--header-height);
}

/* =========================
   BASE
   ========================= */
body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

/* Grid overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* =========================
   GRID LAYOUT
   ========================= */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;

  height: 100vh;
}

/* =========================
   SIDEBAR (fixe)
   ========================= */
.sidebar {
  grid-row: 1 / span 2;
  grid-column: 1;

  background: rgba(10,18,36,0.95);
  border-right: 1px solid rgba(255,212,0,0.2);

  padding: 1rem;

  overflow-y: auto;

  box-shadow:
    0 0 20px rgba(0,0,0,0.8);
}

.sidebar-info-title {  
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  margin-bottom: 0.8rem;

  color: var(--primary);

  text-transform: uppercase;
  letter-spacing: 0.1em;

  text-shadow:
    0 0 8px var(--glow-primary);
}

.sidebar-info-area {
  margin-left: 0.1rem;
  margin-right: 0.1rem;
  margin-bottom: 1.2rem;
  padding: 0.8rem;

  background: rgba(255, 0, 0, 0.05);
  border: 1px solid rgba(255, 0, 0, 0.2);

  box-shadow:
    0 0 8px rgba(255, 0, 0, 0.1),
    inset 0 0 10px rgba(0, 0, 0, 0.6);
}

.sidebar-info-error-title {
  color: #FF2A2A;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;

  margin-bottom: 0.4rem;

  text-shadow:
    0 0 5px rgba(255, 0, 0, 0.6),
    0 0 10px rgba(255, 0, 0, 0.4);
}

.sidebar-info-content {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
  opacity: 0.85;
}

.sidebar-info-content::before {
  content: ">";
  color: var(--primary);
}

/* =========================
   HEADER (fixe)
   ========================= */
.header {
  grid-column: 2;
  grid-row: 1;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 1rem;

  background: rgba(10,18,36,0.95);
  border-bottom: 1px solid rgba(255,212,0,0.2);

  backdrop-filter: blur(6px);

  box-shadow:
    0 5px 15px rgba(0,0,0,0.6);
}

/* =========================
   CONTENT (scrollable)
   ========================= */
.content {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;

  overflow-y: auto;
  padding: 2rem;

  background: var(--bg);
}

/* =========================
   OPTIONAL: CYBER GRID BG
   ========================= */
.content::before {
  content: "";
  position: fixed;
  inset: 0;

  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);

  background-size: 40px 40px;
  pointer-events: none;
}

/* =========================
   SIDEBAR MENU
   ========================= */
.menu-item {
  padding: 0.6rem;
  margin: 0.4rem 0;
  cursor: pointer;

  border-left: 2px solid transparent;
  transition: 0.2s;
}

.menu-item:hover {
  border-left: 2px solid var(--secondary);
  background: rgba(255,106,0,0.1);
}

/* =========================
   LAYOUT GLOBAL (2 COLONNES)
   ========================= */
.content-layout {
  display: grid;
  grid-template-columns: 1fr 310px;
  grid-template-rows: 0;
}

.content-main {
  grid-column: 1 / 2;
  grid-row: 1 / span 60000;
}

.content-cover {
  margin-bottom: 2rem;
  margin-left: 2rem;
  grid-column: 2 / 2;
  grid-row: 2;
}

.content-toc {
  margin-bottom: 2rem;
  margin-left: 2rem;
  grid-column: 2 / 2;
  grid-row: 3;
}

.content-child-pages {
  margin-bottom: 2rem;
  margin-left: 2rem;
  grid-column: 2 / 2;
  grid-row: 4;
}

/* =========================
   CATEGORY (colonne gauche)
   ========================= */
.category {
  min-width: 0;
  height: fit-content;
  background: var(--surface);
  border: 1px solid rgba(255,106,0,0.2);
}

.category-header {
  padding: 0.8rem;
  background: rgba(255,106,0,0.1);
  color: var(--primary);
  font-family: var(--font-title);
}

.category-header .bookmark {
  opacity: 0;
  transform: scale(0.8);

  transition: all 0.2s ease;
  cursor: pointer;
}

.category-header::before {
  content: ">";
  color: var(--primary);
  margin-right: 5px;
}

.category-header:hover .bookmark {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  pointer-events: auto;
}

/* =========================
   HEADER TITLE
   ========================= */
.header-title {
  color: var(--primary);
  font-family: 'Orbitron', sans-serif;

  text-shadow: 0 0 10px rgba(255,212,0,0.6);
}

/* =========================
   TABLE OF CONTENTS
   ========================= */
.table-of-contents {
  position: initial;

  height: fit-content;

  background: rgba(10, 18, 36, 0.85);
  border: 1px solid rgba(255, 212, 0, 0.2);

  padding: 1rem;

  box-shadow:
    0 0 15px rgba(0,0,0,0.8),
    0 0 10px rgba(255, 212, 0, 0.1);

  backdrop-filter: blur(6px);
}

/* =========================
   TITLE
   ========================= */
.table-of-contents-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  margin-bottom: 0.8rem;

  color: var(--primary);

  text-transform: uppercase;
  letter-spacing: 0.1em;

  text-shadow:
    0 0 8px var(--glow-primary);
}

/* =========================
   LIST
   ========================= */
.table-of-contents ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.table-of-contents li {
  margin: 0.4rem 0;
}

/* =========================
   LINKS STYLE
   ========================= */
.table-of-contents a {
  display: block;
  font-size: 0.85rem;

  color: var(--text);
  text-decoration: none;

  padding: 0.3rem 0.5rem;

  border-left: 2px solid transparent;

  transition: all 0.2s ease;
}

.table-of-contents a:hover {
  color: var(--secondary);
  border-left: 2px solid var(--secondary);

  background: rgba(255,106,0,0.08);

  text-shadow:
    0 0 6px var(--glow-secondary);
}

.table-of-contents a.active {
  color: var(--primary);
  border-left: 2px solid var(--primary);

  text-shadow:
    0 0 6px var(--glow-primary);
}

/* =========================
   MOBILE SIDEBAR (HIDDEN)
   ========================= */

.menu-toggle {
  display: none;
  vertical-align: middle;
}

@media (max-width: 900px) {
  /* layout devient 1 colonne */
  .app {
    grid-template-columns: 1fr;
  }

  .menu-toggle {
    display: inline;
  }

  /* sidebar en overlay */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;

    width: var(--sidebar-width);
    height: 100vh;

    transform: translateX(-100%);
    transition: transform 0.3s ease;

    z-index: 1000;
  }

  /* affichée quand active */
  .app.sidebar-open .sidebar {
    transform: translateX(0);
  }

  /* overlay sombre */
  .overlay {
    position: fixed;
    inset: 0;

    background: rgba(0,0,0,0.6);
    opacity: 0;
    pointer-events: none;

    transition: opacity 0.3s ease;
    z-index: 900;
  }

  .app.sidebar-open .overlay {
    opacity: 1;
    pointer-events: auto;
  }

  /* header sur toute la largeur */
  .header {
    grid-column: 1;
  }

  /* content plein écran */
  .content {
    grid-column: 1;
  }

  .content-layout {
    grid-template-columns: 1fr;
  }

  .content-main {
    grid-column: 1;
    grid-row: 4;
    margin-bottom: 2rem;
  }

  .content-cover {
    margin-left: 0rem;
    grid-column: 1;
    grid-row: 2;
  }

  .content-toc {
    margin-left: 0rem;
    grid-column: 1;
    grid-row: 3;
  }

  .content-child-pages {
    margin-left: 0rem;
    grid-column: 1;
    grid-row: 5;
  }

  .table-of-contents {
    position: unset;
  }
}

/* =========================
   TERMINAL MINI (CHAT)
   ========================= */
.terminal {
  background: black;
  padding: 1rem;
  font-family: monospace;
  color: #00FF9C;

  border: 1px solid rgba(0,255,150,0.3);
  box-shadow: inset 0 0 20px rgba(0,255,150,0.2);
}

.terminal-line::before {
  content: ">";
  color: var(--primary);
  margin-right: 5px;
}

.terminal-line-blinking-cursor:last-child::after {
  content: "_";
  margin-left: 5px;
  color: var(--primary);

  animation: blink 1s step-start infinite;
}

/* Animation */
@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* =========================
   USER PROFILE
   ========================= */

.profile {
  text-align: center;
  margin: 1rem;
}

.profile .avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 2px solid var(--user-primary);
  box-shadow: 0 0 10px var(--user-glow-primary);
}

.profile .username {
  margin-top: 10px;
  color: var(--user-primary);
}

.user-profile {
  text-align: center;
  margin-bottom: 2rem;
  margin-top: 2rem;
  padding-top: 0.6rem;
}

.user-profile .username {
  margin-top: 10px;
  color: var(--remote-secondary);
}

.user-profile .avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 2px solid var(--remote-secondary);
  box-shadow: 0 0 10px var(--remote-glow-secondary);
}

/* =========================
   LIENS CYBERPUNK (FORUM)
   ========================= */
a {
  color: var(--primary);
  text-decoration: none;
}

a.invalid {
  color: var(--secondary);
}

a.invalid:hover {
  color: red;
  text-decoration-line: line-through;
}

a.invalid:active {
  color: red;
}

.not-colored {
  color: var(--color-text);
}

/* =========================
   BUTTON
   ========================= */
.button {
  padding: 0.5rem 1rem;
  background: var(--primary);
  border: none;
  cursor: pointer;
  text-transform: uppercase;
}

.button:hover {
  background: var(--secondary);
  box-shadow: 0 0 10px var(--glow-secondary);
}

/* =========================
   INPUTS
   ========================= */
textarea {
  max-width: 100%;
}

input, textarea {
  background: transparent;
  border: 1px solid rgba(255, 212, 0, 0.3);
  color: var(--color-text);
  padding: 0.6rem;
  outline: none;

  box-shadow:
    inset 0 0 8px rgba(255, 212, 0, 0.1);
}

input:hover, textarea:hover {
  border-color: var(--secondary);
  box-shadow:
    0 0 10px var(--glow-secondary),
    inset 0 0 10px rgba(255, 106, 0, 0.1);
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow:
    0 0 12px var(--glow-primary),
    inset 0 0 10px rgba(255, 212, 0, 0.15);
}

/* =========================
   BUTTON CUT CORNERS
   ========================= */
.button-cut {
  --cut: 10px;

  position: relative;
  display: inline-block;
  padding: 0.7rem 1.5rem;

  color: var(--bg);
  background: var(--primary);
  border: none;
  cursor: pointer;

  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;

  clip-path: polygon(
    var(--cut) 0,
    100% 0,
    100% calc(100% - var(--cut)),
    calc(100% - var(--cut)) 100%,
    0 100%,
    0 var(--cut)
  );

  box-shadow:
    0 0 10px var(--glow-primary),
    inset 0 0 5px rgba(0,0,0,0.6);

  transition: all 0.2s ease;
}

.button-cut:hover {
  background: var(--secondary);
  box-shadow:
    0 0 15px var(--glow-secondary),
    0 0 30px var(--glow-secondary);
  transform: translateY(-2px);
}

.button-cut:active {
  transform: translateY(0);
  box-shadow:
    0 0 5px var(--glow-primary),
    inset 0 0 10px rgba(0,0,0,0.8);
}

.button-cut::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(255,255,255,0.2),
    transparent
  );
  opacity: 0;
}

.button-cut:hover::before {
  opacity: 1;
  animation: scan 1s linear infinite;
}

.button-cut-centered {
  display: block;
  margin: 0 auto;
}

@keyframes scan {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* =========================
   CYBERPUNK SELECT
   ========================= */
select {
  background: rgba(10, 18, 36, 0.9);
  color: var(--primary);

  border: 1px solid rgba(255, 212, 0, 0.3);
  padding: 0.6rem 2.5rem 0.6rem 0.8rem;

  font-family: var(--font);
  letter-spacing: 0.05em;

  cursor: pointer;
  position: relative;

  box-shadow:
    0 0 8px rgba(255, 212, 0, 0.1),
    inset 0 0 10px rgba(0, 0, 0, 0.8);

  transition: all 0.2s ease;
}

select:hover {
  border-color: var(--secondary);
  box-shadow:
    0 0 10px var(--glow-secondary),
    inset 0 0 10px rgba(255, 106, 0, 0.1);
}

select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow:
    0 0 12px var(--glow-primary),
    inset 0 0 10px rgba(255, 212, 0, 0.15);
}

/* =========================
   OPTION (LIMITED STYLING)
   ========================= */
select option {
  background: #020813;
  color: var(--text);
}

/* =========================
   HEXAGONS
   ========================= */
.hexa {
  vertical-align: middle;
  display: inline-block;
  position: relative;
  width: 100px;
  height: 86.6px;
  background: var(--user-primary);
  box-sizing: border-box;
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

.hexa img {
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  position: absolute;
  object-fit: cover;
  object-position: top;
  top: 2px; /* equal to border thickness */
  left: 2px; /* equal to border thickness */
  width: 96px; /* container width - (border thickness * 2) */
  height: 82.6px; /* container height - (border thickness * 2) */
}

.hexa-icon {
  vertical-align: middle;
  display: inline-block;
  position: relative;
  width: 30px;
  height: 26px;
  background: var(--user-primary);
  box-sizing: border-box;
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

.hexa-icon img {
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  position: absolute;
  object-fit: cover;
  object-position: top;
  top: 1px; /* equal to border thickness */
  left: 1px; /* equal to border thickness */
  width: 28px; /* container width - (border thickness * 2) */
  height: 24px; /* container height - (border thickness * 2) */
}

.hexa-header {
  vertical-align: middle;
  display: inline-block;
  position: relative;
  width: 50px;
  height: 43.3px;
  background: var(--primary);
  box-sizing: border-box;
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

.hexa-header img {
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  position: absolute;
  object-fit: cover;
  object-position: top;
  top: 1px; /* equal to border thickness */
  left: 1px; /* equal to border thickness */
  width: 48px; /* container width - (border thickness * 2) */
  height: 41.3px; /* container height - (border thickness * 2) */
}

.hexa-large {
  vertical-align: middle;
  display: inline-block;
  position: relative;
  width: 200px;
  height: 173.2px;
  background: var(--user-primary);
  box-sizing: border-box;
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

.hexa-large img {
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  position: absolute;
  object-fit: cover;
  object-position: top;
  top: 3px; /* equal to border thickness */
  left: 3px; /* equal to border thickness */
  width: 194px; /* container width - (border thickness * 2) */
  height: 167.2px; /* container height - (border thickness * 2) */
}

/* Other */

.part {
  padding-left: 0.6rem;
  padding-right: 0.6rem;
  padding-top: 0.1rem;
}

.part-anchor .anchor {
  opacity: 0;
  transform: scale(0.8);

  transition: all 0.2s ease;
  cursor: pointer;
}

.part-anchor::before {
  content: ">";
  color: var(--primary);
  margin-right: 5px;
}

.part-anchor:hover .anchor {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  pointer-events: auto;
}

.add-part {
  display: none;
  padding-left: 0.6rem;
  padding-right: 0.6rem;
  padding-top: 0.1rem;
}

.delete-part {
  display: none;
}

.empty-part {
  padding-left: 1rem;
  padding-top: 1rem;
}

.anchor:hover {
  cursor: pointer;
}

.button-invisible {
    border:0;
    background:transparent;
}

.ph {
  color: var(--primary);
}

.post-comment {
  display: none;
  margin-left: 2rem;
}

.edit-part {
  display: none;
}

.chummer {
  text-decoration: none;
  position: relative;
  font-weight: 500;
  letter-spacing: 0.05em;

  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.pagination {
  padding: 0.6rem 0.6rem;
}

.meta {
  font-size: 0.8rem;
  opacity: 0.6;
  padding: 0.6rem 0.6rem;
}

.list-cell {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.list-cell:hover {
  background: rgba(255,212,0,0.05);
}

.list-cell-title {
  color: var(--text);
}

.form {
  padding: 0.6rem;
}

.pointer {
  cursor: pointer;
}

.animated {
  position: relative;
}

.animated::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background-color: var(--primary);
    bottom: 0;
    left: 0;
    transform-origin: right;
    transform: scaleX(0);
    transition: transform .3s ease-in-out;
  }

.animated:hover::before {
  transform-origin: left;
  transform: scaleX(1);
}

.spoiler{
  background-color: black;
  color: transparent;
  user-select: none;
}

.spoiler:hover{
  background-color: inherit;
  color: inherit;
}

.cover {
  width: 100%;
  height: auto;
  vertical-align: center;
}

.danger {
  color: red;
}

.vertical-center {
  vertical-align: center;
}