/* The Profile Hub.
 *
 * Loads after /styles.css, which supplies the palette, the top bar and every
 * control on the page. Everything here is the hub's own layout.
 *
 * Lives in /assets/ rather than /profile/ because /profile/<address> is
 * rewritten to the page itself -- a stylesheet sitting under that path would
 * be one rewrite rule away from being served as HTML. */

.profile-main {
    max-width: 1020px;
    margin: 0 auto;
    padding: clamp(12px, 3vw, 28px) 24px 80px;
}

/* ----- Who this is --------------------------------------------------------- */

.hub-head {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 20px 24px;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: rgba(34, 39, 50, 0.92);
    margin-bottom: 18px;
}

.hub-avatar {
    border-radius: 50%;
    border: 2px solid var(--accent);
    flex-shrink: 0;
}

/* Grows to take the room the figures do not, so a bio has somewhere to wrap
   rather than pushing the numbers off the end of the row. */
.hub-who { min-width: 0; flex: 1 1 240px; }
.hub-who h1 { margin: 0 0 6px; font-size: clamp(1.4rem, 4vw, 1.9rem); letter-spacing: -0.02em; }

/* pre-wrap: the line breaks somebody typed are part of what they wrote.
   Capped at a readable measure -- a bio is a couple of lines, not a column. */
.hub-bio {
    margin: 8px 0 0;
    max-width: 52ch;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Only your own, and only while it is empty: how the field gets found. */
.hub-bio.is-prompt { color: var(--muted); font-style: italic; }

.hub-sub { display: flex; align-items: center; gap: 10px; margin: 0; flex-wrap: wrap; }
.hub-rsn { color: var(--muted); font-size: 0.92rem; }

/* The address other people reach this profile by. Shown as a link so it can
   be copied out of the page, since that is what it is for. */
.hub-handle {
    color: var(--accent);
    font-size: 0.85rem;
    text-decoration: none;
}
.hub-handle:hover { text-decoration: underline; }

/* The rank Jagex has for them, not a Discord role somebody forgot to update. */
.hub-rank {
    padding: 2px 10px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hub-figures { display: flex; gap: 26px; margin-left: auto; flex-wrap: wrap; }

.figure { text-align: right; }
.figure b {
    display: block;
    font-size: 1.45rem;
    line-height: 1.1;
    color: var(--accent-bright);
}
.figure span { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }

.stats-note {
    margin: 0 0 16px;
    padding: 10px 14px;
    border: 1px solid var(--panel-border);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    color: var(--muted);
    font-size: 0.85rem;
}
/* The note belongs to the skills tab. Hidden rather than removed so it does
   not shift the panel about as the tabs change. */
.stats-note.is-off { display: none; }

/* ----- Tabs ---------------------------------------------------------------
   The header carries the numbers people came for; only the panel under it
   changes, so nothing worth seeing is a scroll away. */

.tabs {
    display: flex;
    gap: 2px;
    margin: 0;
    border-bottom: 1px solid var(--panel-border);
    flex-wrap: wrap;
}

.tab {
    padding: 10px 16px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: none;
    color: var(--muted);
    font-size: 0.88rem;
    cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.is-here { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }

.hub-sub-head {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

/* ----- Skills -------------------------------------------------------------- */

.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 18px; }

.skill {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: baseline;
    padding: 7px 0 8px;
    border-bottom: 1px solid rgba(59, 66, 82, 0.5);
    font-size: 0.84rem;
}
.skill-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-level { font-weight: 700; }
.skill-xp { color: var(--muted); font-size: 0.75rem; min-width: 46px; text-align: right; }

/* ----- Goals --------------------------------------------------------------- */

.goals { display: grid; gap: 2px; }

.goal {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0 10px;
    border-bottom: 1px solid rgba(59, 66, 82, 0.5);
    font-size: 0.9rem;
    cursor: pointer;
}
.goal:last-child { border-bottom: 0; }
.goal.is-done span { color: var(--muted); text-decoration: line-through; }
.goal span { flex: 1; }

.goal-remove {
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.goal-remove:hover { color: var(--danger); }

.goal-add { display: flex; gap: 8px; margin-top: 14px; }
.goal-add input { flex: 1; }

/* ----- Events and activity ------------------------------------------------- */

/* Two columns side by side, which is what makes the tab fit a screen. */
.events-two {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 28px;
}

.event-list, .activity { display: grid; gap: 0; }

/* The line under a row is a separator, not an underline: it needs as much air
   beneath the text as above it, or every row reads as struck through. */
.event-row, .activity-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 9px 2px 11px;
    border-bottom: 1px solid rgba(59, 66, 82, 0.5);
    font-size: 0.88rem;
    line-height: 1.5;
}
.event-row:last-child, .activity-row:last-child { border-bottom: 0; }

.event-title, .activity-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.event-when, .activity-date {
    color: var(--muted);
    font-size: 0.76rem;
    flex-shrink: 0;
}

/* ----- Posts --------------------------------------------------------------- */

/* An Instagram-style grid of what they have put on Fury Social. The feed
   itself renders these full size; here they are thumbnails you click through. */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

.post-thumb {
    position: relative;
    display: block;
    aspect-ratio: 1;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--panel-2);
    color: inherit;
    text-decoration: none;
}
.post-thumb:hover { border-color: var(--accent); }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* A post with no picture is still a post, so it shows its words instead. */
.post-thumb-text {
    padding: 12px 14px;
    height: 100%;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.5;
    overflow: hidden;
}

.post-thumb-more {
    position: absolute;
    right: 6px;
    bottom: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(23, 25, 31, 0.82);
    color: var(--text);
    font-size: 0.7rem;
}

/* ----- Your details -------------------------------------------------------- */

[data-panel="settings"], [data-panel="admin"] { display: grid; gap: 16px; }
[data-panel="settings"] label, [data-panel="admin"] label {
    display: grid;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}
[data-panel="settings"] .hint, [data-panel="admin"] .hint { margin: -2px 0 2px; }

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

/* The address field, which reads as the URL it becomes. */
.handle-field {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: var(--panel-2);
    overflow: hidden;
}
.handle-field:focus-within { border-color: var(--accent); }
.handle-field span {
    display: flex;
    align-items: center;
    padding: 0 0 0 12px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 400;
    white-space: nowrap;
}
/* No left padding: the prefix and what gets typed are one address, and a gap
   between them reads as a space in the name. */
.handle-field input {
    border: 0;
    border-radius: 0;
    background: none;
    padding-left: 0;
}
.handle-field input:disabled { color: var(--muted); cursor: not-allowed; }

/* ----- Emoji and mentions in text written in Discord ----------------------- */

.event-title .emoji, .goal .emoji, .post-thumb-text .emoji {
    display: inline-block;
    width: 1.15em;
    height: 1.15em;
    vertical-align: -0.2em;
}
.event-title .mention, .goal .mention, .post-thumb-text .mention {
    padding: 0 3px;
    border-radius: 4px;
    background: rgba(217, 164, 65, 0.14);
    color: var(--accent-bright);
}
.event-title .mention-unknown, .goal .mention-unknown { background: none; color: var(--muted); }

@media (max-width: 620px) {
    .hub-figures { margin-left: 0; gap: 18px; }
    .figure { text-align: left; }
}

/* ----- Progress bars -------------------------------------------------------
   One shape for both the skills and the goals that carry a number: a track
   with a fill, and nothing else. A bar that is nearly always full or nearly
   always empty says nothing, which is why a skill measures against its next
   milestone rather than against 200M from level 1. */

.bar {
    display: block;
    height: 4px;
    border-radius: 999px;
    background: var(--panel-border);
    overflow: hidden;
}

.bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.3s ease;
}
.bar-fill.is-done { background: var(--success); }

@media (prefers-reduced-motion: reduce) {
    .bar-fill { transition: none; }
}

/* The skill row is a grid; the bar runs under all of it. */
.skill .bar { grid-column: 1 / -1; margin-top: 5px; }

/* ----- Goals with a number on them ----- */

.goal.has-bar { flex-wrap: wrap; align-items: center; }
.goal-text { flex: 1; }

.goal-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 6px;
    font-size: 0.8rem;
}
.goal-progress .bar { flex: 1; }

.goal-count {
    width: 74px;
    padding: 3px 7px;
    font-size: 0.8rem;
    text-align: right;
}

.goal-add { display: flex; gap: 8px; flex-wrap: wrap; }
.goal-add #goal-text { flex: 1; min-width: 180px; }
.goal-add #goal-target { width: 110px; flex: 0 0 auto; }
