/*
  Add new components by creating matching markup in /templates and styling the section--{name} modifier.
  Extend logo shapes by declaring additional .logo-shape--{variant} classes and updating the options in js/library.js.
  Add new section or navbar styles by composing new classes under .memecoin-page and wiring templates in js/library.js.
*/

:root {
  --page-font: "Space Grotesk", "Inter", system-ui, sans-serif;
  --page-radius: 18px;
  --page-radius-soft: 30px;
  --page-radius-pill: 50px;
  --page-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  --page-max-width: 1120px;
}

.memecoin-page {
  margin: 0;
  color: var(--color-text);
  background: var(--color-background);
  font-family: var(--page-font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: clamp(3rem, 5vw, 4.5rem);
  padding: clamp(1.5rem, 4vw, 3rem);
}

.page-main {
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 5vw, 4rem);
}

.memecoin-page .inner {
  width: min(var(--page-max-width), 100%);
  margin: 0 auto;
}

.memecoin-page p {
  color: var(--color-text-muted);
  line-height: 1.6;
}

.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.page-nav__links {
  display: inline-flex;
  gap: 1rem;
  align-items: center;
}

.page-nav__links a {
  text-decoration: none;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 0.45rem 0.75rem;
  border-radius: var(--page-radius);
  transition: background 0.2s ease, color 0.2s ease;
}

.page-nav__links a:hover {
  background: var(--color-surface-soft);
  color: var(--color-text);
}

.page-nav__cta {
  display: inline-flex;
  gap: 0.5rem;
}

.mem-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.4rem;
  border-radius: var(--page-radius);
  background: var(--color-accent);
  color: var(--color-text-inverse);
  text-decoration: none;
  font-weight: 700;
  box-shadow: var(--page-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.mem-btn--ghost {
  background: transparent;
  border: 2px solid var(--color-accent);
  color: var(--color-accent);
  box-shadow: none;
}

.mem-btn--pill {
  border-radius: var(--page-radius-pill);
}

.mem-btn:hover {
  transform: translateY(-2px) scale(1.01);
  filter: brightness(1.02);
}

.mem-btn:active {
  transform: translateY(1px);
  filter: brightness(0.98);
}

.logo-shape {
  width: clamp(64px, 10vw, 96px);
  aspect-ratio: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  color: var(--color-accent);
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  border-radius: var(--page-radius);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.05), var(--page-shadow);
  position: relative;
  overflow: hidden;
}

.logo-shape img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.logo-shape span {
  position: relative;
  z-index: 1;
}

.logo-shape img + span {
  display: none;
}

.inline-edit {
  position: relative;
  outline: 2px dashed rgba(94, 252, 232, 0.6);
  outline-offset: 2px;
  cursor: text;
}

.inline-edit:focus {
  outline: 2px solid rgba(94, 252, 232, 0.9);
  background: rgba(94, 252, 232, 0.08);
}

.logo-shape--hex {
  clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
}

.logo-shape--circle {
  border-radius: 999px;
}

.logo-shape--square {
  border-radius: 16px;
}

.logo-shape--rect {
  width: clamp(120px, 16vw, 180px);
  aspect-ratio: 2.3 / 1;
}

.section {
  display: flex;
  justify-content: center;
}

.section__shell {
  width: min(var(--page-max-width), 100%);
}

.section__header {
  display: grid;
  gap: 0.5rem;
  margin-bottom: clamp(1.5rem, 3vw, 2rem);
  text-align: center;
}

.section__header h2 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  margin: 0;
}

.section__header p {
  margin: 0 auto;
  max-width: 60ch;
}

.section--hero {
  position: relative;
}

.section--hero .section__shell {
  display: grid;
  gap: 2rem;
  align-items: center;
  text-align: left;
}

.hero-grid {
  display: grid;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: center;
}

.hero-grid .hero-copy h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  margin: 0 0 0.5rem 0;
  color: var(--color-text);
}

.hero-grid .hero-copy p {
  font-size: clamp(1rem, 3vw, 1.2rem);
}

.hero-grid .hero-actions {
  display: inline-flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-grid .hero-art {
  position: relative;
  border-radius: var(--page-radius-soft);
  overflow: hidden;
  box-shadow: var(--page-shadow);
}

.hero-grid .hero-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.section--about .section__shell {
  background: var(--color-surface);
  border-radius: var(--page-radius-soft);
  padding: clamp(1.5rem, 4vw, 3rem);
  box-shadow: var(--page-shadow);
}

.section--tokenomics .token-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.token-card {
  background: var(--color-surface);
  padding: 1.25rem;
  border-radius: var(--page-radius);
  border: 1px solid var(--color-border);
  display: grid;
  gap: 0.35rem;
  box-shadow: var(--page-shadow);
}

.token-card strong {
  font-size: 1.4rem;
  color: var(--color-text);
}

.section--roadmap .roadmap {
  display: grid;
  gap: 1.5rem;
  position: relative;
}

.roadmap__item {
  display: grid;
  gap: 0.35rem;
  padding-left: 1.5rem;
  border-left: 3px solid var(--color-accent);
}

.roadmap__item strong {
  font-size: 1.1rem;
  color: var(--color-text);
}

.section--team .team-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.team-card {
  background: var(--color-surface);
  border-radius: var(--page-radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--page-shadow);
}

.team-card img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 24px;
  margin-bottom: 0.75rem;
  box-shadow: var(--page-shadow);
}

.section--gallery .gallery-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.gallery-grid img {
  width: 100%;
  border-radius: var(--page-radius);
  object-fit: cover;
  box-shadow: var(--page-shadow);
}

.gallery-item {
  margin: 0;
}

.section--widgets .section__shell {
  background: linear-gradient(135deg, rgba(115, 110, 254, 0.18), rgba(94, 252, 232, 0.12));
  border-radius: var(--page-radius-soft);
  padding: clamp(1.75rem, 5vw, 3rem);
  border: 1px solid rgba(115, 110, 254, 0.25);
  box-shadow: 0 25px 70px rgba(64, 78, 255, 0.2);
}

.widgets-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.widget-card {
  position: relative;
  padding: 1.5rem;
  border-radius: 28px;
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.12), transparent 55%),
    rgba(9, 13, 24, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 40px rgba(8, 15, 30, 0.35);
  overflow: hidden;
}

.widget-card::before {
  content: "";
  position: absolute;
  inset: -60% 50% auto -30%;
  background: radial-gradient(circle, rgba(var(--accent-rgb, 255, 209, 102), 0.45), transparent 70%);
  transform: rotate(15deg);
}

.widget-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.widget-card__tag {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(115, 110, 254, 0.2));
  color: var(--color-text);
  position: relative;
  z-index: 1;
}

.widget-card__stat {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 700;
  color: var(--color-accent-text, #ffffff);
  position: relative;
  z-index: 1;
}

.widget-card__body {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
  line-height: 1.6;
}

.widget-card__accent {
  position: absolute;
  inset: auto -20% -30% auto;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(var(--accent-rgb, 94, 252, 232), 0.55), transparent 70%);
  filter: blur(0px);
}

.widget-card[data-accent="sol"] {
  --accent-rgb: 255, 111, 97;
  --color-accent-text: #ffe9e4;
  border-color: rgba(255, 155, 140, 0.35);
}

.widget-card[data-accent="aqua"] {
  --accent-rgb: 94, 252, 232;
  --color-accent-text: #e5fffc;
  border-color: rgba(94, 252, 232, 0.28);
}

.widget-card[data-accent="violet"] {
  --accent-rgb: 163, 125, 255;
  --color-accent-text: #f4ebff;
  border-color: rgba(163, 125, 255, 0.33);
}

.widget-card[data-accent="sun"] {
  --accent-rgb: 255, 209, 102;
  --color-accent-text: #fff6de;
  border-color: rgba(255, 209, 102, 0.3);
}

.section--ui-elements .section__shell {
  display: grid;
  gap: clamp(1.5rem, 4vw, 2.5rem);
}

.ui-elements {
  display: grid;
  gap: 1.75rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
}

.ui-elements__group {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.35rem;
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 45px rgba(6, 10, 22, 0.32);
}

.ui-elements__title {
  margin: 0 0 1rem 0;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.element-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.85rem 1.15rem;
  border-radius: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
  color: #10131a;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.element-button--glow {
  background: linear-gradient(135deg, #76ebff, #8c7eff);
  box-shadow: 0 15px 40px rgba(118, 235, 255, 0.35);
}

.element-button--sunset {
  background: linear-gradient(135deg, #ff9966, #ff5e62);
  box-shadow: 0 18px 42px rgba(255, 105, 97, 0.42);
}

.element-button--matrix {
  background: radial-gradient(circle at top left, #62fce8, #0b1e2d 70%);
  color: #dffefa;
  box-shadow: 0 20px 42px rgba(98, 252, 232, 0.3);
}

.element-button--glass {
  background: rgba(255, 255, 255, 0.12);
  color: #f4f6ff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(18px);
}

.element-button:hover {
  transform: translateY(-3px) scale(1.01);
  filter: brightness(1.05);
}

.element-button:active {
  transform: translateY(1px);
}

.element-toggle {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 20px;
  background: rgba(9, 13, 24, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.element-toggle::before {
  content: "";
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(117, 238, 255, 0.25), rgba(163, 125, 255, 0.25));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  position: relative;
  transition: background 0.2s ease;
}

.element-toggle::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff, rgba(163, 125, 255, 0.65));
  box-shadow: 0 6px 14px rgba(10, 16, 35, 0.45);
  transform: translateY(-50%);
  transition: transform 0.25s ease;
}

.element-toggle--active {
  border-color: rgba(118, 235, 255, 0.45);
  box-shadow: 0 18px 34px rgba(118, 235, 255, 0.25);
}

.element-toggle--active::before {
  background: linear-gradient(135deg, rgba(118, 235, 255, 0.45), rgba(94, 252, 232, 0.55));
}

.element-toggle--active::after {
  transform: translate(20px, -50%);
}

.element-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.element-badge--glow {
  background: rgba(115, 110, 254, 0.2);
  border-color: rgba(115, 110, 254, 0.4);
  color: #dcd9ff;
}

.element-badge--mint {
  background: rgba(98, 252, 232, 0.2);
  border-color: rgba(98, 252, 232, 0.4);
  color: #dbfff9;
}

.element-badge--sunrise {
  background: rgba(255, 155, 140, 0.2);
  border-color: rgba(255, 155, 140, 0.38);
  color: #ffe4de;
}

.element-badge--gold {
  background: rgba(255, 209, 102, 0.18);
  border-color: rgba(255, 209, 102, 0.32);
  color: #fff6de;
}

.ui-elements__buttons,
.ui-elements__toggles,
.ui-elements__badges {
  display: grid;
  gap: 0.75rem;
}

.section--footer {
  margin-top: auto;
}

.page-footer {
  display: grid;
  gap: 0.75rem;
  text-align: center;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  border-radius: var(--page-radius-soft);
  background: var(--color-surface);
  box-shadow: var(--page-shadow);
}

.page-footer .page-nav__links {
  justify-content: center;
  flex-wrap: wrap;
}

.page-footer small {
  color: var(--color-text-muted);
}

.navbar--centered {
  flex-direction: column;
  text-align: center;
  gap: 1rem;
}

.navbar--vertical {
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.navbar--minimal {
  justify-content: space-between;
}

.navbar--minimal .page-nav__links {
  display: none;
}

.navbar--minimal .page-nav__links.is-open {
  display: flex;
}

.navbar--mobile-toggle {
  display: none;
  background: transparent;
  border: 2px solid var(--color-border);
  color: var(--color-text);
  padding: 0.45rem 0.8rem;
  border-radius: var(--page-radius);
}

.chart-embed {
  width: 100%;
  min-height: 260px;
  border-radius: var(--page-radius-soft);
  border: none;
  box-shadow: var(--page-shadow);
}

/* Layout modifiers */
.layout--single .memecoin-page {
  gap: clamp(2.5rem, 4vw, 3.5rem);
}

.layout--split .section--hero .section__shell {
  grid-template-columns: 1.2fr 1fr;
}

.layout--card .section--about .section__shell,
.layout--card .section--tokenomics .token-card,
.layout--card .section--roadmap .roadmap__item,
.layout--card .section--team .team-card,
.layout--card .section--gallery .gallery-grid img {
  border-radius: var(--page-radius);
}

.layout--multi .memecoin-page {
  gap: clamp(3rem, 6vw, 5rem);
}

/* Themes */
.theme-light {
  --color-background: #fdfdfd;
  --color-surface: #ffffff;
  --color-surface-soft: #f2f6ff;
  --color-text: #12131a;
  --color-text-muted: #4a4d57;
  --color-text-inverse: #0b0c10;
  --color-border: rgba(12, 20, 34, 0.12);
  --color-accent: linear-gradient(135deg, #736efe, #5efce8);
}

.theme-dark {
  --color-background: #05070f;
  --color-surface: rgba(15, 18, 28, 0.9);
  --color-surface-soft: rgba(43, 47, 65, 0.55);
  --color-text: #f8f9ff;
  --color-text-muted: rgba(224, 226, 255, 0.72);
  --color-text-inverse: #05070f;
  --color-border: rgba(132, 142, 255, 0.24);
  --color-accent: linear-gradient(135deg, #8c7eff, #ff6a88);
}

.theme-degen {
  --color-background: #07010d;
  --color-surface: rgba(22, 5, 42, 0.92);
  --color-surface-soft: rgba(98, 10, 144, 0.35);
  --color-text: #fde5ff;
  --color-text-muted: rgba(255, 227, 255, 0.7);
  --color-text-inverse: #1d022c;
  --color-border: rgba(255, 78, 217, 0.35);
  --color-accent: linear-gradient(135deg, #ff4ed9, #ffc701);
}

.theme-meme {
  --color-background: #fff9e9;
  --color-surface: #ffffff;
  --color-surface-soft: #fef1bd;
  --color-text: #231e12;
  --color-text-muted: rgba(35, 30, 18, 0.75);
  --color-text-inverse: #231e12;
  --color-border: rgba(255, 188, 66, 0.35);
  --color-accent: linear-gradient(135deg, #ffb944, #ff5b79);
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .page-nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .navbar--minimal .page-nav__links {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .layout--split .section--hero .section__shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .memecoin-page {
    padding: clamp(1.25rem, 4vw, 2rem);
  }

  .page-nav {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .page-nav__links {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-grid .hero-actions {
    justify-content: center;
  }

  .navbar--minimal .page-nav__links {
    display: none;
  }

  .navbar--mobile-toggle {
    display: inline-flex;
  }
}

@media (min-width: 721px) {
  .navbar--minimal .page-nav__links {
    display: inline-flex;
  }

  .navbar--mobile-toggle {
    display: none;
  }
}
