/* ZeroDayOutlaw — link-hub / mascot-brand theme */
:root {
  --bg:        #000000;
  --bg-alt:    #08080a;
  --panel:     #0e0f13;
  --ink:       #e9e3d6;
  --ink-dim:   #9a9384;
  --steel:     #7fb2d6;
  --steel-lt:  #a9d0ea;
  --copper:    #c8863f;
  --copper-lt: #e3a862;
  --htb:       #9fef00;
  --htb-dim:   #7ab800;
  --h1:        #ff3350;      /* HackerOne red */
  --line:      #1c1c1c;
  --maxw:      1080px;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 1.5rem; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--sans); line-height: 1.65; font-size: 17px; overflow-x: hidden;
}
/* Ambient backdrop: faint top glow + dot grid (shows through transparent sections).
   Height is pinned to the *large* viewport (lvh) rather than inset:0 so iOS
   Safari's address-bar collapse doesn't resize this fixed layer and visibly
   stretch the gradient as you scroll past the top. */
body::before {
  content: ""; position: fixed; top: 0; left: 0; right: 0; z-index: -1; pointer-events: none;
  height: 100vh;   /* fallback for browsers without large-viewport units */
  height: 100lvh;
  background:
    radial-gradient(ellipse 90% 55% at 50% -12%, rgba(159,239,0,.06), transparent 60%),
    radial-gradient(rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: auto, 24px 24px;
}
a { color: var(--steel-lt); text-decoration: none; }
em { color: var(--htb); font-style: normal; }

.wrap { width: min(var(--maxw), 92vw); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--htb); color: #000; padding: .6rem 1rem; }
.skip:focus { left: 0; }

/* ---------- SITE BAR (shared header: home topbar + writeup nav) ---------- */
.bar { background: rgba(6,7,9,.96); border-bottom: 1px solid var(--line); }
.bar__inner { width: min(var(--maxw), 92vw); margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; }
.bar__brand { display: flex; align-items: center; }
.bar__wm { height: 28px; width: auto; display: block; }
.bar__right { display: flex; align-items: center; gap: 1.35rem; }
.bar__link { font-family: var(--mono); font-size: .9rem; letter-spacing: .03em; color: var(--ink-dim); text-decoration: none; white-space: nowrap; transition: color .2s; }
.bar__link:hover { color: var(--htb); }

/* Home topbar: fixed, fades in once scrolled past the hero */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  transform: translateY(-100%); opacity: 0; visibility: hidden;
  transition: transform .25s ease, opacity .25s ease, visibility .25s;
}
.topbar--visible { transform: none; opacity: 1; visibility: visible; }

/* ---------- LANGUAGE TOGGLE ---------- */
.lang { display: inline-flex; align-items: center; gap: .38rem; font-family: var(--mono); font-size: .84rem; letter-spacing: .06em; }
.lang__opt { color: var(--ink-dim); text-decoration: none; padding: .1rem .1rem; transition: color .2s; }
.lang__opt:hover { color: var(--ink); }
.lang__opt.is-active { color: var(--htb); font-weight: 700; }
.lang__sep { color: var(--line); }
.lang__glob { width: 17px; height: 17px; color: var(--ink-dim); flex: none; }

/* Fixed globe pill in the top-right corner (home hero); hands off to the
   topbar toggle once scrolled so only one control shows at a time. */
.lang-fab {
  position: fixed; top: clamp(.9rem, 2.5vw, 1.4rem); right: clamp(.9rem, 3vw, 1.7rem); z-index: 55;
  padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(10,11,14,.82);
  transition: opacity .25s ease, transform .25s ease, visibility .25s, border-color .2s;
}
.lang-fab:hover { border-color: rgba(159,239,0,.35); }
.lang-fab--hidden { opacity: 0; visibility: hidden; transform: translateY(-6px); pointer-events: none; }

/* ---------- HERO ---------- */
.hero {
  position: relative; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 1.05rem;
  padding: clamp(3rem, 7vw, 5.5rem) 1.2rem clamp(2.5rem, 6vw, 4rem);
  /* Use svh (small viewport height), which is stable, rather than dvh. dvh is
     the *dynamic* viewport and shrinks/grows as iOS Safari's address bar
     shows/hides on scroll, resizing the hero and reflowing its centered
     content -- the "stretch" seen when scrolling past the top. svh never
     changes, so the hero stays put. */
  min-height: 100vh; min-height: 100svh; justify-content: center;
}
.hero > * { position: relative; z-index: 1; }
/* translateX offsets the hat's right-heavy brim so the head reads as centered over the wordmark */
.hero__mascot { width: min(380px, 70vw); height: auto; transform: translateX(-1%); filter: drop-shadow(0 14px 40px rgba(0,0,0,.7)); }
.hero__wordmark { width: min(440px, 84vw); height: auto; margin-top: -.2rem; }
.hero__tag {
  display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; align-items: center;
  font-family: var(--mono); letter-spacing: .26em; text-transform: uppercase;
  font-size: clamp(.68rem, 2.2vw, .82rem); color: var(--ink-dim);
}
.hero__tag i { color: var(--htb); font-style: normal; }
.hero__tag span:nth-child(1) { color: var(--copper-lt); }
.hero__tag span:nth-child(5) { color: var(--steel); }
.hero__scroll {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-dim); margin-top: .6rem; text-decoration: none;
  display: inline-flex; align-items: center; gap: .45rem; transition: color .2s;
}
.hero__scroll:hover { color: var(--htb); }
.hero__scroll-arrow { display: inline-block; animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

/* ---------- GRANDMASTER RANK FLEX ---------- */
.rank {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: .9rem;
  padding: .5rem 1.6rem .5rem .55rem; margin-top: .4rem;
  border: 1px solid rgba(186,217,253,.32); border-radius: 999px;
  background: linear-gradient(135deg, rgba(186,217,253,.12), rgba(178,167,220,.03));
  box-shadow: inset 0 0 30px rgba(186,217,253,.06), 0 8px 30px rgba(0,0,0,.55);
  transition: transform .18s, border-color .2s, box-shadow .2s;
}
.rank::after {
  content: ""; position: absolute; top: 0; left: 0; width: 55%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.16), transparent);
  transform: translateX(-200%); pointer-events: none;
  animation: rankSheen 6.5s ease-in-out 2s infinite;
}
@keyframes rankSheen { 0% { transform: translateX(-200%); } 18%, 100% { transform: translateX(360%); } }
.rank:hover { transform: translateY(-2px); border-color: rgba(186,217,253,.6); box-shadow: inset 0 0 36px rgba(186,217,253,.12), 0 10px 40px rgba(138,154,208,.22); }
.rank__crest { position: relative; flex: 0 0 auto; display: grid; place-items: center; width: 64px; height: 64px; }
.rank__crest::before {
  content: ""; position: absolute; inset: 4px; border-radius: 50%;
  background: radial-gradient(circle, rgba(186,217,253,.45), transparent 68%);
  filter: blur(5px); animation: rankPulse 4.5s ease-in-out infinite;
}
.rank__badge { position: relative; width: 58px; height: 58px; filter: drop-shadow(0 0 8px rgba(186,217,253,.55)); }
.rank__text { display: flex; flex-direction: column; text-align: left; line-height: 1.1; }
.rank__label {
  font-weight: 800; font-size: 1.3rem; letter-spacing: .05em; text-transform: uppercase;
  color: #d3def6; /* fallback where background-clip:text is unsupported */
  background: linear-gradient(180deg, #eef4ff, #bad9fd 55%, #8a9ad0);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 14px rgba(186,217,253,.4));
}
.rank__sub { font-family: var(--mono); font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-dim); margin-top: .35rem; }
@keyframes rankPulse { 0%,100% { opacity: .5; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.08); } }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-block; font-weight: 700; letter-spacing: .05em; font-size: .9rem;
  padding: .8rem 1.6rem; border-radius: 6px; border: 1px solid var(--copper);
  color: var(--copper-lt); text-decoration: none;
  transition: transform .15s, box-shadow .2s, color .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(200,134,63,.18); color: var(--ink); }
.btn--htb { background: linear-gradient(135deg, var(--htb-dim), var(--htb)); color: #0c1400; border-color: transparent; }
.btn--htb:hover { color: #000; box-shadow: 0 8px 22px rgba(159,239,0,.25); }

/* ---------- SECTIONS ---------- */
.sec { padding: clamp(3rem, 8vw, 5.5rem) 0; border-top: 1px solid var(--line); position: relative; }
.sec::before {
  content: ""; position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  width: 110px; height: 1px; background: linear-gradient(90deg, transparent, var(--htb), transparent); opacity: .6;
}
.sec--alt { background: var(--bg-alt); }
.kicker { font-family: var(--mono); color: var(--copper); letter-spacing: .18em; text-transform: uppercase; font-size: .76rem; margin-bottom: .7rem; display: inline-flex; align-items: center; gap: .5rem; }
.kicker .ico { width: 15px; height: 15px; color: var(--htb); flex: none; }
.sec h2 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); line-height: 1.15; letter-spacing: -.01em; margin-bottom: 1.4rem; }
.sec p { color: var(--ink-dim); max-width: 62ch; }
.sec__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.sec__head h2 { margin-bottom: 0; }
.sec__more { color: var(--copper-lt); font-weight: 700; font-size: .9rem; white-space: nowrap; }
.sec__more:hover { color: var(--htb); }

/* ---------- PLATFORM CARDS ---------- */
.platforms { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.1rem; }
.pcard {
  display: flex; align-items: center; gap: 1.1rem;
  padding: 1.3rem 1.4rem; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line);
  position: relative; overflow: hidden;
  transition: transform .18s, border-color .2s, box-shadow .2s;
}
.pcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line); transition: background .25s; z-index: 2; }
.pcard__wm { position: absolute; right: -18px; top: 50%; transform: translateY(-50%); width: 148px; height: auto; opacity: .05; z-index: 0; pointer-events: none; transition: opacity .2s; }
.pcard--htb:hover .pcard__wm { opacity: .1; }
.pcard__mark, .pcard__body, .pcard__go { position: relative; z-index: 1; }
.pcard:hover { transform: translateY(-4px); }
.pcard--htb:hover { border-color: rgba(159,239,0,.45); box-shadow: 0 12px 30px rgba(159,239,0,.10); }
.pcard--htb:hover::before { background: var(--htb); }
.pcard--h1:hover { border-color: rgba(255,51,80,.5); box-shadow: 0 12px 30px rgba(255,51,80,.10); }
.pcard--h1:hover::before { background: var(--h1); }

.pcard__mark { flex: 0 0 auto; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 14px; }
.pcard__logo { width: 32px; height: 32px; }
.pcard__mark--htb { color: var(--htb); background: radial-gradient(circle at 50% 40%, rgba(159,239,0,.14), rgba(159,239,0,.03)); border: 1px solid rgba(159,239,0,.28); }
.pcard__mark--htb .pcard__logo { filter: drop-shadow(0 0 6px rgba(159,239,0,.4)); }
.pcard__mark--h1 { color: #ece6da; background: linear-gradient(135deg, #14161b, #0a0b0e); border: 1px solid rgba(255,255,255,.14); }

.pcard__body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; flex: 1; }
.pcard__name { font-weight: 800; font-size: 1.1rem; color: var(--ink); letter-spacing: .01em; }
.pcard__handle { font-family: var(--mono); font-size: .82rem; color: var(--steel-lt); }
.pcard__note { font-size: .82rem; color: var(--ink-dim); margin-top: .2rem; }
.pcard__note--rank { font-family: var(--mono); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .74rem; color: var(--htb); }
.pcard__go { flex: 0 0 auto; align-self: flex-start; color: var(--ink-dim); font-size: 1.1rem; transition: color .2s, transform .2s; }
.pcard:hover .pcard__go { color: var(--ink); transform: translate(2px,-2px); }

/* ---------- CERTIFICATIONS (compact strip in About) ---------- */
.certstrip { margin-top: 2rem; display: flex; flex-direction: column; align-items: flex-start; gap: .9rem; }
.certstrip__label { display: inline-flex; align-items: center; gap: .45rem; font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); }
.certstrip__ico { width: 15px; height: 15px; color: var(--htb); flex: none; }
.certstrip__list { list-style: none; display: flex; flex-wrap: wrap; gap: .7rem; }
.certbadge {
  display: inline-flex; text-decoration: none; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line);
  transition: transform .16s, border-color .2s, box-shadow .2s;
}
.certbadge:hover { transform: translateY(-3px); border-color: rgba(159,239,0,.4); box-shadow: 0 10px 24px rgba(159,239,0,.1); }
.certbadge__img { width: 76px; height: 76px; display: block; }

/* ---------- ABOUT (lite) ---------- */
.about-lite__lead { font-size: 1.05rem; color: var(--ink-dim); max-width: 60ch; }

/* ---------- WRITEUPS LIST (shared with /writeups page) ---------- */
.wp-list { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.wp-item a { display: block; padding: 1.2rem 1.4rem; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; transition: transform .15s, border-color .2s; }
.wp-item a:hover { transform: translateY(-3px); border-color: rgba(159,239,0,.4); }
.wp-item__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.wp-item__head h2, .wp-item__head h3 { font-size: 1.15rem; color: var(--ink); display: flex; align-items: center; gap: .5rem; }
.wp-ico { width: 17px; height: 17px; color: var(--htb); flex: none; }
.wp-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.wp-tag { font-family: var(--mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; padding: .2rem .5rem; border-radius: 5px; color: var(--copper-lt); border: 1px solid rgba(200,134,63,.28); background: rgba(200,134,63,.05); }
.wp-date { font-family: var(--mono); font-size: .75rem; color: var(--ink-dim); white-space: nowrap; }
.wp-summary { color: var(--ink-dim); font-size: .9rem; margin-top: .5rem; }
.wp-empty {
  color: var(--ink-dim); text-align: center;
  border: 1px dashed var(--line); border-radius: 12px;
  padding: 2.2rem 1.5rem; background: rgba(255,255,255,.012);
}
.wp-empty p { margin-inline: auto; }
.wp-empty__k { font-family: var(--mono); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--copper); margin-bottom: .6rem; }
.wp-badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; align-items: center; }
.wp-badge { font-family: var(--mono); font-size: .72rem; padding: .25rem .6rem; border-radius: 999px; border: 1px solid var(--line); color: var(--steel-lt); background: rgba(127,178,214,.05); }
.wp-badge--plat { color: var(--htb); border-color: rgba(159,239,0,.35); background: rgba(159,239,0,.06); }
/* Difficulty colour-coding (Easy stays neutral to avoid clashing with the green platform badge). */
.wp-badge--diff { font-weight: 700; }
.wp-badge--medium { color: var(--copper-lt); border-color: rgba(200,134,63,.4); background: rgba(200,134,63,.07); }
.wp-badge--hard   { color: var(--h1); border-color: rgba(255,51,80,.4); background: rgba(255,51,80,.07); }
.wp-badge--insane { color: #d4b1e6; border-color: rgba(212,177,230,.42); background: rgba(212,177,230,.08); }

/* ---------- FOOTER ---------- */
.foot { border-top: 1px solid var(--line); padding: 2.75rem 0 1.6rem; }
.foot__grid { display: flex; flex-wrap: wrap; gap: 1.75rem 3.5rem; }
.foot__col { display: flex; flex-direction: column; gap: .55rem; min-width: 8rem; }
.foot__h {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink-dim); margin-bottom: .35rem;
}
.foot__col a { color: var(--copper-lt); font-size: .86rem; text-decoration: none; width: max-content; }
.foot__col a:hover { color: var(--htb); }
.foot__bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: .9rem 1.5rem; margin-top: 2.4rem; padding-top: 1.3rem; border-top: 1px solid var(--line);
  color: var(--ink-dim); font-size: .82rem;
}

/* ---------- SCROLL PROGRESS + BACK-TO-TOP ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 60;
  transform: scaleX(0); transform-origin: left; will-change: transform;
  background: linear-gradient(90deg, var(--copper), var(--htb));
  box-shadow: 0 0 10px rgba(159,239,0,.5);
}
.to-top {
  position: fixed; right: clamp(1rem,3vw,2rem); bottom: clamp(1rem,3vw,2rem); z-index: 60;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(159,239,0,.4); background: rgba(14,15,19,.97); color: var(--htb);
  font-size: 1.2rem; line-height: 1; display: grid; place-items: center;
  transition: transform .15s, box-shadow .2s;
}
.to-top:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(159,239,0,.25); }
.to-top[hidden] { display: none; }

/* ---------- FOCUS VISIBILITY (a11y) ---------- */
:focus-visible { outline: 2px solid var(--htb); outline-offset: 3px; border-radius: 4px; }
.pcard:focus-visible, .rank:focus-visible { outline-offset: 4px; }

/* Reveal on scroll (progressive enhancement) — children stagger in */
.reveal-ready .reveal > * { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal-ready .reveal.is-visible > * { opacity: 1; transform: none; }
.reveal-ready .reveal.is-visible > *:nth-child(2) { transition-delay: .08s; }
.reveal-ready .reveal.is-visible > *:nth-child(3) { transition-delay: .16s; }
.reveal-ready .reveal.is-visible > *:nth-child(4) { transition-delay: .24s; }
.reveal-ready .reveal.is-visible > *:nth-child(n+5) { transition-delay: .3s; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 560px) {
  .pcard { gap: .9rem; padding: 1.1rem; }
  .rank { padding-right: 1.1rem; }
  /* Keep the top menu compact on phones so it doesn't overflow; the larger
     sizing above is for wider screens where the words looked too small. */
  .bar__inner { padding: .55rem 0; }
  .bar__wm { height: 20px; }
  .bar__right { gap: .6rem; }
  .bar__link { font-size: .78rem; letter-spacing: 0; }
  /* The logo already links home, so drop the redundant Home link on phones to
     make room for Writeups + Tactics + Tutorials without crowding. */
  .bar__link--home { display: none; }
  .lang { font-size: .76rem; gap: .3rem; }
  .lang__glob { width: 15px; height: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rank, .pcard, .pcard__go, .wp-item a { transition: none; }
  .rank__crest::before, .rank::after, .hero__scroll-arrow { animation: none; }
  .reveal-ready .reveal > * { opacity: 1; transform: none; transition: none; }
}
