/* MaxedUp — interactive particle M section.
   Every rule is scoped to .particle-section. The stage stays dark charcoal in both
   site themes so the luminous particles keep their contrast. */

.particle-section{
  --p-bg:#111214;
  --p-text:#efeee9;
  --p-muted:#b4b5b9;
  --p-accent:#f07848;
  --p-accent-soft:#ffa780;
  --p-line:rgba(239,238,233,.14);
  --p-control-line:rgba(239,238,233,.26);
  --p-track:rgba(239,238,233,.22);
  --p-pad-x:max(56px,calc((100% - 1440px) / 2));
  /* World units read by particles.js */
  --particle-center-x:.7;
  /* Mirrors the JS camera so the static SVG lines up with the WebGL M */
  --p-cam-h:6.6;
  --p-m-y:0;

  position:relative;
  isolation:isolate;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  gap:48px;
  width:100%;
  height:min(900px,max(100svh,680px));
  min-height:640px;
  padding:clamp(72px,10vh,120px) var(--p-pad-x) 32px;
  background:
    radial-gradient(ellipse 48% 58% at 63% 50%,rgba(240,120,72,.075),rgba(240,120,72,0) 72%),
    radial-gradient(ellipse 90% 70% at 50% 110%,rgba(0,0,0,.45),rgba(0,0,0,0) 70%),
    var(--p-bg);
  color:var(--p-text);
  color-scheme:dark;
  scroll-margin-top:-40px;
}
.particle-section ::selection{background:var(--p-accent);color:var(--p-bg)}

/* Full-section render layer */
.particle-section .particle-stage{
  position:absolute;
  inset:0;
  z-index:0;
  container-type:size;
  overflow:hidden;
}
.particle-section .particle-canvas{
  position:absolute;
  inset:0;
  display:block;
  width:100%;
  height:100%;
  touch-action:pan-y;
  outline:none;
}

/* Static M while loading, on error, or without WebGL */
.particle-section .particle-fallback{
  --p-unit:calc(100cqh / var(--p-cam-h));
  position:absolute;
  left:calc(50% + var(--particle-center-x) * 13.6%);
  top:50%;
  width:min(56vh,60vw);
  height:min(56vh,60vw);
  left:calc(50% + var(--particle-center-x) * var(--p-unit));
  top:calc(50% - var(--p-m-y) * var(--p-unit));
  width:calc(6 * var(--p-unit));
  height:calc(6 * var(--p-unit));
  translate:-50% -50%;
  color:var(--p-accent);
  opacity:.88;
  filter:drop-shadow(0 0 48px rgba(240,120,72,.32));
  pointer-events:none;
}
.particle-section.is-ready .particle-fallback{
  visibility:hidden;
  opacity:0;
}

/* Copy: upper left, above the canvas, lets pointer reach the particles */
.particle-section .particle-copy{
  position:relative;
  z-index:1;
  pointer-events:none;
}
.particle-section .particle-copy h2{
  margin:0;
  max-width:12ch;
  font-size:clamp(2.75rem,1.1rem + 5.6vw,6rem);
  font-weight:500;
  line-height:.98;
  letter-spacing:-.045em;
  color:var(--p-text);
  text-shadow:0 2px 32px rgba(17,18,20,.55);
}
.particle-section .particle-copy h2 span{color:var(--p-accent)}
.particle-section .particle-copy p{
  max-width:32ch;
  margin-top:32px;
  font-size:16px;
  line-height:1.75;
  color:var(--p-muted);
  text-shadow:0 1px 18px rgba(17,18,20,.7);
}

/* Footer: quiet hint left, controls right */
.particle-section .particle-footer{
  position:relative;
  z-index:1;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px 32px;
  flex-wrap:wrap;
  padding-top:20px;
  border-top:1px solid var(--p-line);
  pointer-events:none;
}
.particle-section .particle-hint{
  font-size:13px;
  line-height:1.6;
  color:var(--p-muted);
}
.particle-section .particle-controls{
  display:flex;
  align-items:center;
  gap:8px 12px;
  flex-wrap:wrap;
  pointer-events:auto;
}
.particle-section .particle-controls[hidden]{display:none}

.particle-section .particle-controls label{
  display:inline-flex;
  align-items:center;
  gap:14px;
  min-height:44px;
  padding-right:12px;
  font-size:13px;
  font-weight:500;
  color:var(--p-text);
  cursor:pointer;
}

/* Range slider */
.particle-section .particle-controls input[type="range"]{
  -webkit-appearance:none;
  appearance:none;
  width:clamp(128px,14vw,200px);
  height:44px;
  margin:0;
  padding:0;
  background:transparent;
  accent-color:var(--p-accent);
  cursor:pointer;
  border-radius:2px;
}
.particle-section .particle-controls input[type="range"]::-webkit-slider-runnable-track{
  height:2px;
  border-radius:2px;
  background:linear-gradient(to right,var(--p-accent) 0 var(--particle-form-progress,100%),var(--p-track) var(--particle-form-progress,100%) 100%);
}
.particle-section .particle-controls input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none;
  appearance:none;
  width:18px;
  height:18px;
  margin-top:-8px;
  border:3px solid var(--p-bg);
  border-radius:50%;
  background:var(--p-accent);
  box-shadow:0 0 0 1px var(--p-accent);
  transition:background .2s,box-shadow .2s;
}
.particle-section .particle-controls input[type="range"]:hover::-webkit-slider-thumb{
  background:var(--p-accent-soft);
  box-shadow:0 0 0 1px var(--p-accent-soft),0 0 0 7px rgba(240,120,72,.16);
}
.particle-section .particle-controls input[type="range"]::-moz-range-track{
  height:2px;
  border:0;
  border-radius:2px;
  background:var(--p-track);
}
.particle-section .particle-controls input[type="range"]::-moz-range-progress{
  height:2px;
  border-radius:2px;
  background:var(--p-accent);
}
.particle-section .particle-controls input[type="range"]::-moz-range-thumb{
  width:12px;
  height:12px;
  border:3px solid var(--p-bg);
  border-radius:50%;
  background:var(--p-accent);
  box-shadow:0 0 0 1px var(--p-accent);
  transition:background .2s,box-shadow .2s;
}
.particle-section .particle-controls input[type="range"]:hover::-moz-range-thumb{
  background:var(--p-accent-soft);
  box-shadow:0 0 0 1px var(--p-accent-soft),0 0 0 7px rgba(240,120,72,.16);
}
.particle-section .particle-controls input[type="range"]:focus-visible{
  outline:2px solid var(--p-accent-soft);
  outline-offset:2px;
}

/* Buttons */
.particle-section .particle-replay,
.particle-section .particle-pause{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-width:44px;
  min-height:44px;
  margin:0;
  padding:0 20px;
  border:1px solid var(--p-control-line);
  border-radius:999px;
  background:transparent;
  color:var(--p-text);
  font-size:13px;
  font-weight:500;
  line-height:1;
  white-space:nowrap;
  cursor:pointer;
  transition:background .2s,border-color .2s,color .2s;
}
.particle-section .particle-replay .icon{
  width:16px;
  height:16px;
  transition:transform .4s cubic-bezier(.16,1,.3,1);
}
.particle-section .particle-replay:hover,
.particle-section .particle-pause:hover{
  border-color:var(--p-accent);
  color:var(--p-accent-soft);
}
.particle-section .particle-replay:hover .icon{transform:translate(2px,-2px)}
.particle-section .particle-pause[aria-pressed="true"]{
  border-color:var(--p-accent);
  background:var(--p-accent);
  color:var(--p-bg);
}
.particle-section .particle-pause[aria-pressed="true"]:hover{
  border-color:var(--p-accent-soft);
  background:var(--p-accent-soft);
  color:var(--p-bg);
}
.particle-section .particle-replay:focus-visible,
.particle-section .particle-pause:focus-visible{
  outline:2px solid var(--p-accent-soft);
  outline-offset:3px;
}
.particle-section .particle-replay:disabled,
.particle-section .particle-pause:disabled{
  opacity:.45;
  cursor:default;
}

/* Paused: the hint steps back so the frozen scene reads as intentional */
.particle-section.is-paused .particle-hint{color:rgba(180,181,185,.7)}

/* Tablet */
@media (max-width:1100px){
  .particle-section{--p-pad-x:40px}
}
@media (max-width:900px){
  .particle-section{--p-pad-x:28px}
  .particle-section .particle-copy p{margin-top:24px}
}

/* Mobile: centred M, JS camera height 8.2, M at y=-.25 */
@media (max-width:700px){
  .particle-section{
    --particle-center-x:0;
    --p-cam-h:8.2;
    --p-m-y:-.25;
    --p-pad-x:20px;
    gap:24px;
    height:min(760px,max(100svh,680px));
    min-height:680px;
    padding-top:56px;
    padding-bottom:24px;
    background:
      radial-gradient(ellipse 80% 42% at 50% 54%,rgba(240,120,72,.08),rgba(240,120,72,0) 72%),
      var(--p-bg);
  }
  .particle-section .particle-copy h2{line-height:1}
  .particle-section .particle-copy p{
    margin-top:16px;
    font-size:15px;
    line-height:1.65;
  }
  .particle-section .particle-footer{
    flex-direction:column;
    align-items:stretch;
    gap:8px;
    padding-top:16px;
  }
  .particle-section .particle-hint{font-size:12px}
  .particle-section .particle-controls{gap:8px}
  .particle-section .particle-controls label{
    flex:1 1 100%;
    padding-right:0;
  }
  .particle-section .particle-controls input[type="range"]{
    flex:1 1 auto;
    width:auto;
    min-width:0;
  }
  .particle-section .particle-replay,
  .particle-section .particle-pause{flex:1 1 0}
}
@media (max-width:360px){
  .particle-section .particle-copy h2{font-size:2.5rem}
}

@media (prefers-reduced-motion:reduce){
  .particle-section *,
  .particle-section *::before,
  .particle-section *::after{transition:none!important}
  .particle-section .particle-controls input[type="range"]::-webkit-slider-thumb{transition:none}
  .particle-section .particle-controls input[type="range"]::-moz-range-thumb{transition:none}
  .particle-section .particle-replay:hover .icon{transform:none}
}
