/* ---------------------------------- tokens -------------------------------- */
/* Brand palette: gold, near-black, white.
   Gold is a FILL colour only — #EDC142 on white is 1.71:1, far below the 4.5:1
   needed for text, so gold panels always carry ink-coloured text, and anywhere
   gold has to BE the text on a light surface it uses --gold-deep instead. */
:root {
  --gold:      #EDC142;  /* brand gold — fills, never small text on white     */
  --gold-deep: #8A6700;  /* gold that is legible as text (>=4.5:1 on light)   */
  --gold-soft: #F5EFDC;  /* tinted surface for tags and avatars              */
  --ink:       #1F1E1C;  /* brand near-black                                 */
  --ink-soft:  #3A3733;
  --bg:        #F7F5ED;
  --surface:   #FFFFFF;
  --border:    #E8E2D1;
  --text:      #1F1E1C;
  --muted:     #6B675E;
  --danger:    #B3261E;
  --ok:        #0F6B45;
  --ok-sft:    #E4F2EA;
  --err-sft:   #FBEAE8;
  --radius:    14px;
  --shadow:    0 1px 2px rgba(31, 30, 28, .05), 0 8px 24px rgba(31, 30, 28, .07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--gold-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 2rem; }
.wrap { width: min(1080px, 100% - 2.5rem); margin-inline: auto; }
.muted { color: var(--muted); }
.center { text-align: center; }
.inline { display: inline; }

/* ---------------------------------- topbar -------------------------------- */
.topbar {
  background: var(--ink);
  border-bottom: 1px solid #000;
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-size: 1.15rem; }
.brand:hover { text-decoration: none; }
.brand strong { color: var(--gold); }
.brand-mark { width: 34px; height: 34px; display: block; }
.nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.nav > a { color: #C9C4B8; font-size: .94rem; font-weight: 500; }
.nav > a:hover { color: #fff; text-decoration: none; }
.nav > a.active { color: var(--gold); }
.nav .btn-primary { color: var(--ink); }
/* "Sign out" is a submit button styled as a nav link, so it needs the same
   light treatment as the anchors now that the bar is dark. */
.nav .linkish { color: #C9C4B8; }
.nav .linkish:hover { color: #fff; }

/* --------------------------------- buttons -------------------------------- */
.btn {
  display: inline-block; padding: .6rem 1.1rem; border-radius: 10px;
  border: 1px solid transparent; font-size: .95rem; font-weight: 600;
  cursor: pointer; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: .42rem .8rem; font-size: .88rem; }
.btn-primary { background: var(--gold); color: var(--ink); }
.btn-primary:hover { background: #E0AF24; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-danger { background: var(--err-sft); color: var(--danger); border-color: #f5c6cb; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--muted); font: inherit; font-size: .94rem;
}
.linkish:hover { color: var(--text); text-decoration: underline; }
.linkish.danger { font-size: .8rem; }
.linkish.danger:hover { color: var(--danger); }

/* ---------------------------------- cards --------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem;
}
.page { padding: 2.2rem 0 3rem; flex: 1; }
.narrow { width: min(760px, 100% - 2.5rem); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-head h1, .page-head h2 { margin: 0; }
.back { display: inline-block; margin-bottom: 1rem; color: var(--muted); font-size: .92rem; }
.empty { text-align: center; color: var(--muted); padding: 3rem 1.5rem; }
.pad { padding: 1rem 0; }

/* ----------------------------------- hero --------------------------------- */
.hero { background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%); border-bottom: 1px solid var(--border); }
.hero-inner { display: grid; grid-template-columns: 1.5fr 1fr; gap: 3rem; align-items: center; padding: 4rem 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--gold-deep); margin: 0 0 .6rem; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.1rem); }
.hero h1 em {
  font-style: normal; color: var(--ink);
  background: var(--gold); padding: 0 .18em; border-radius: 6px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.lede { font-size: 1.08rem; color: var(--muted); max-width: 52ch; }
.hero-actions { display: flex; gap: .75rem; margin-top: 1.6rem; flex-wrap: wrap; }
.stats { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.stats li {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.2rem; display: flex; align-items: baseline; gap: .6rem;
}
.stats strong { font-size: 1.7rem; color: var(--gold-deep); }
.stats span { color: var(--muted); font-size: .9rem; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; padding: 3rem 0; }
.step-n {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--gold); color: var(--ink); font-weight: 700; margin-bottom: .7rem;
}
.step h3 { font-size: 1.05rem; }
.step p { margin: 0; color: var(--muted); font-size: .94rem; }

/* --------------------------------- filters -------------------------------- */
.filters { display: flex; gap: .7rem; margin-bottom: 1.4rem; padding: .9rem; flex-wrap: wrap; }
.filters input[type="search"] { flex: 1 1 240px; width: auto; }
.filters select { flex: 0 1 190px; width: auto; }
.filters .btn { flex: none; }
input, select, textarea {
  font: inherit; color: var(--text); background: #fff;
  padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
textarea { resize: vertical; }

/* ---------------------------------- grid ---------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.1rem; }

.skill-card { display: flex; flex-direction: column; gap: .7rem; }
.skill-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tag {
  background: var(--gold-soft); color: var(--gold-deep);
  padding: .2rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 700;
}
.level { color: var(--muted); font-size: .78rem; }
.skill-title { margin: 0; font-size: 1.15rem; }
.skill-title a { color: var(--text); }
.skill-title a:hover { color: var(--gold-deep); text-decoration: none; }
.skill-desc {
  margin: 0; color: var(--muted); font-size: .94rem; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.skill-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border); padding-top: .8rem; margin-top: .2rem;
}
.comment-count { color: var(--muted); font-size: .86rem; }

/* --------------------------------- avatars -------------------------------- */
.avatar {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold-deep);
  font-weight: 700; font-size: .9rem; text-decoration: none;
}
.avatar-sm { width: 30px; height: 30px; font-size: .74rem; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.5rem; }
.who { display: flex; align-items: center; gap: .6rem; color: var(--text); }
.who:hover { text-decoration: none; }
.who strong { display: block; font-size: .9rem; font-weight: 600; }
.who small { color: var(--muted); font-size: .78rem; }

/* ------------------------------ skill detail ------------------------------ */
.skill-detail h1 { margin-top: .6rem; font-size: 1.8rem; }
.skill-body { white-space: pre-wrap; color: #3a4055; }
.author-box {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  border-top: 1px solid var(--border); margin-top: 1.4rem; padding-top: 1.1rem; font-size: .9rem;
}
.owner-actions { display: flex; gap: .5rem; margin-top: 1rem; }

/* -------------------------------- comments -------------------------------- */
.comments { margin-top: 2rem; scroll-margin-top: 84px; }
.comments h2 { font-size: 1.2rem; margin-bottom: .9rem; }
.comment-form { display: flex; gap: .8rem; align-items: flex-start; }
.comment-form > div { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; }
.signin-nudge { text-align: center; color: var(--muted); }
.comment-list { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; gap: .3rem; }
.comment { display: flex; gap: .8rem; padding: .9rem 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-body p { margin: 0; overflow-wrap: anywhere; }
.comment-meta { display: flex; align-items: baseline; gap: .55rem; margin-bottom: .2rem; }
.comment-meta a { color: var(--text); }
.comment-meta small { color: var(--muted); font-size: .78rem; }

/* --------------------------------- profile -------------------------------- */
.profile-head { display: flex; gap: 1.4rem; align-items: flex-start; margin-bottom: 2rem; }
.profile-meta { flex: 1; }
.profile-meta h1 { margin-bottom: .15rem; }
.headline { color: var(--gold-deep); font-weight: 600; margin: 0 0 .3rem; }
.bio { margin: .8rem 0 0; white-space: pre-wrap; }
.contact { margin: .6rem 0 0; font-size: .92rem; }
.member { display: flex; gap: .9rem; align-items: center; color: var(--text); }
.member:hover { text-decoration: none; border-color: var(--gold); }
.member small { display: block; color: var(--muted); font-size: .84rem; }
.pill {
  display: inline-block; margin-top: .4rem; background: var(--gold-soft); color: var(--gold-deep);
  padding: .1rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 600;
}

/* ---------------------------------- forms --------------------------------- */
.form { display: flex; flex-direction: column; gap: 1rem; }
.form form { display: flex; flex-direction: column; gap: 1rem; }
.form label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; font-weight: 600; color: #39405a; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: .6rem; }
.auth { max-width: 460px; margin-inline: auto; }
.errors {
  background: var(--err-sft); border: 1px solid #f5c6cb; color: #8f1f2b;
  border-radius: 10px; margin: 0 0 1.1rem; padding: .8rem 1rem .8rem 2.2rem; font-size: .92rem;
}
.flash { border-radius: 10px; padding: .75rem 1rem; margin: 1rem 0 0; font-size: .93rem; }
.flash-success { background: var(--ok-sft); color: var(--ok); border: 1px solid #b7e4cd; }
.flash-error { background: var(--err-sft); color: var(--danger); border: 1px solid #f5c6cb; }

/* --------------------------------- misc ----------------------------------- */
.center-page { text-align: center; padding-top: 5rem; }
.big-code { font-size: 4.5rem; color: var(--gold-deep); margin: 0; }
.footer { border-top: 1px solid var(--border); background: var(--surface); padding: 1.6rem 0; margin-top: auto; }
.footer p { color: var(--muted); }
.footer p { margin: 0; color: var(--muted); font-size: .88rem; text-align: center; }

@media (max-width: 800px) {
  .hero-inner, .steps, .row { grid-template-columns: 1fr; }
  .hero-inner { gap: 2rem; padding: 2.5rem 0; }
  .profile-head { flex-direction: column; }
  .topbar-inner { height: auto; padding: .7rem 0; flex-direction: column; align-items: stretch; }
  .nav { justify-content: center; }
}
