/* =========================================================
   DownloadHub - stylesheet (public + admin)
   Direction: "release manifest" - quiet paper UI, monospace
   metadata, pine-green access stamp as the signature element.
   ========================================================= */

:root {
    --ink:        #14181d;
    --ink-soft:   #5a6672;
    --line:       #dfe4e8;
    --paper:      #f4f6f7;
    --card:       #ffffff;

    --pine:       #24594a;
    --pine-soft:  #e3efe9;
    --amber:      #a86a12;
    --amber-soft: #fbf0dc;
    --rust:       #a63d2c;
    --rust-soft:  #fbe6e2;

    --radius:     4px;
    --shadow:     0 1px 2px rgba(20, 24, 29, .06), 0 8px 24px rgba(20, 24, 29, .05);

    --display: "Space Grotesk", "Segoe UI", Helvetica, Arial, sans-serif;
    --body:    "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
    --mono:    ui-monospace, "JetBrains Mono", "Cascadia Mono", "Consolas", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--body);
    font-size: 15px;
    line-height: 1.6;
}

a { color: var(--pine); }

h1, h2, h3, h4 {
    font-family: var(--display);
    letter-spacing: -.02em;
    margin: 0 0 .4em;
    line-height: 1.2;
}

h1 { font-size: 2rem; font-weight: 600; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* ---------------- Public header ---------------- */
.site-head {
    background: var(--ink);
    color: #fff;
    padding: 18px 0;
}
.site-head .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.brand {
    font-family: var(--display);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -.02em;
    color: #fff;
    text-decoration: none;
}
.brand span { color: #7fb5a2; }
.site-head nav a {
    color: #b9c3cc;
    text-decoration: none;
    font-size: .85rem;
    font-family: var(--mono);
}
.site-head nav a:hover { color: #fff; }

/* ---------------- Hero ---------------- */
.hero {
    background: var(--ink);
    color: #fff;
    padding: 46px 0 64px;
}
.hero .eyebrow {
    font-family: var(--mono);
    font-size: .72rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #7fb5a2;
    margin-bottom: 12px;
}
.hero h1 { font-size: 2.4rem; max-width: 22ch; color: #fff; }
.hero p { color: #b9c3cc; max-width: 56ch; margin: 0; }

.pull-up { margin-top: -34px; }

/* ---------------- Cards / release rows ---------------- */
.release {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    margin-bottom: 14px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
}
.release-main { flex: 1 1 380px; min-width: 260px; }
.release h3 { margin-bottom: 6px; }
.release p { margin: 0 0 10px; color: var(--ink-soft); }

.meta {
    font-family: var(--mono);
    font-size: .74rem;
    color: var(--ink-soft);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    letter-spacing: .02em;
}
.meta b { color: var(--ink); font-weight: 600; }

.release-action { flex: 0 0 auto; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-block;
    font-family: var(--body);
    font-size: .9rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--pine);
    background: var(--pine);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}
.btn:hover { background: #1c4739; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid #7fb5a2; outline-offset: 2px; }

.btn-ghost { background: transparent; color: var(--pine); }
.btn-ghost:hover { background: var(--pine-soft); }

.btn-dark { background: var(--ink); border-color: var(--ink); }
.btn-dark:hover { background: #000; }

.btn-danger { background: var(--rust); border-color: var(--rust); }
.btn-danger:hover { background: #8a3123; }

.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-block { display: block; width: 100%; text-align: center; }

/* ---------------- Forms ---------------- */
.field { margin-bottom: 16px; }
label {
    display: block;
    font-size: .78rem;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--ink-soft);
    margin-bottom: 6px;
}
input[type=text], input[type=email], input[type=password],
input[type=file], textarea, select {
    width: 100%;
    padding: 10px 12px;
    font-family: var(--body);
    font-size: .95rem;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--pine);
    box-shadow: 0 0 0 3px var(--pine-soft);
}
textarea { min-height: 92px; resize: vertical; }
.hint { font-size: .78rem; color: var(--ink-soft); margin-top: 6px; }

/* ---------------- Panels ---------------- */
.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}
.panel-title {
    font-family: var(--mono);
    font-size: .74rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 14px;
}

/* ---------------- Access stamp (signature element) ---------------- */
.stamp {
    border: 1.5px solid currentColor;
    border-radius: var(--radius);
    padding: 14px 18px;
    font-family: var(--mono);
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.stamp .code {
    font-size: .72rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    white-space: nowrap;
    padding-top: 2px;
}
.stamp .msg { font-family: var(--body); color: var(--ink); }
.stamp.pending  { color: var(--amber); background: var(--amber-soft); }
.stamp.approved { color: var(--pine);  background: var(--pine-soft); }
.stamp.blocked  { color: var(--rust);  background: var(--rust-soft); }

/* ---------------- Badges ---------------- */
.badge {
    display: inline-block;
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 2px;
    border: 1px solid currentColor;
}
.badge.pending  { color: var(--amber); background: var(--amber-soft); }
.badge.approved { color: var(--pine);  background: var(--pine-soft); }
.badge.blocked  { color: var(--rust);  background: var(--rust-soft); }
.badge.off      { color: var(--ink-soft); background: #eef1f3; }

/* ---------------- Alerts ---------------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    border-left: 3px solid;
    margin-bottom: 18px;
    font-size: .92rem;
}
.alert.success { background: var(--pine-soft);  border-color: var(--pine);  color: #1c4739; }
.alert.error   { background: var(--rust-soft);  border-color: var(--rust);  color: #8a3123; }
.alert.info    { background: var(--amber-soft); border-color: var(--amber); color: #7d4f0c; }

/* ---------------- Tables ---------------- */
.table-scroll { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
table.data th {
    text-align: left;
    font-family: var(--mono);
    font-size: .7rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    white-space: nowrap;
}
table.data td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fafbfc; }
.mono { font-family: var(--mono); font-size: .82rem; }
.muted { color: var(--ink-soft); }
.nowrap { white-space: nowrap; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------- Stats ---------------- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 3px solid var(--pine);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.stat .n {
    font-family: var(--display);
    font-size: 1.9rem;
    font-weight: 600;
    line-height: 1;
}
.stat .l {
    font-family: var(--mono);
    font-size: .7rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-top: 8px;
}
.stat.warn { border-left-color: var(--amber); }
.stat.warn .n { color: var(--amber); }

/* ---------------- Admin shell ---------------- */
.admin-body { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: var(--ink);
    color: #b9c3cc;
    padding: 22px 0;
}
.sidebar .brand { display: block; padding: 0 22px 20px; }
.sidebar a.nav-link {
    display: block;
    padding: 10px 22px;
    color: #b9c3cc;
    text-decoration: none;
    font-size: .92rem;
    border-left: 3px solid transparent;
}
.sidebar a.nav-link:hover { background: #1c2129; color: #fff; }
.sidebar a.nav-link.active {
    background: #1c2129;
    color: #fff;
    border-left-color: #7fb5a2;
}
.sidebar .nav-tag {
    font-family: var(--mono);
    font-size: .68rem;
    background: var(--amber);
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    margin-left: 6px;
}
.sidebar-foot {
    margin-top: 24px;
    padding: 16px 22px 0;
    border-top: 1px solid #262c35;
    font-family: var(--mono);
    font-size: .72rem;
}

.admin-main { flex: 1 1 auto; padding: 26px 30px 60px; min-width: 0; }
.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

/* ---------------- Auth screen ---------------- */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--ink);
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--card);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

/* ---------------- Footer ---------------- */
.site-foot {
    padding: 30px 0;
    color: var(--ink-soft);
    font-family: var(--mono);
    font-size: .76rem;
    text-align: center;
}

/* ---------------- Empty state ---------------- */
.empty {
    text-align: center;
    padding: 44px 20px;
    color: var(--ink-soft);
}
.empty .mark {
    font-family: var(--mono);
    font-size: .74rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--pine);
    margin-bottom: 8px;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
    .admin-body { flex-direction: column; }
    .sidebar { width: 100%; flex: none; padding: 14px 0; }
    .sidebar .brand { padding-bottom: 12px; }
    .sidebar a.nav-link { padding: 9px 18px; }
    .admin-main { padding: 20px 16px 50px; }
    .hero h1 { font-size: 1.8rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ---------------- Public header nav ---------------- */
.head-nav { display: flex; gap: 18px; align-items: center; }
.head-nav a {
    color: #b9c3cc;
    text-decoration: none;
    font-size: .85rem;
    font-family: var(--mono);
}
.head-nav a:hover { color: #fff; }
.head-nav a.on { color: #7fb5a2; }

/* ---------------- Admin message card (user dashboard) ---------------- */
.note {
    border: 1px solid var(--line);
    border-left: 3px solid var(--pine);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 12px;
    background: #fbfcfc;
}
.note:last-child { margin-bottom: 0; }
.note-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}
.note-head h3 { margin: 0 0 4px; }
.note-subject {
    font-family: var(--mono);
    font-size: .76rem;
    letter-spacing: .04em;
    color: var(--ink-soft);
    margin-bottom: 10px;
}
.note p { margin: 0; }

/* ---------------- Certificate card ---------------- */
.cert {
    display: flex;
    gap: 20px;
    justify-content: space-between;
    flex-wrap: wrap;
    border: 1px solid var(--line);
    border-left: 3px solid var(--ink-soft);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 12px;
    background: #fbfcfc;
}
.cert:last-child { margin-bottom: 0; }
.cert-main { flex: 1 1 380px; min-width: 250px; }
.cert-main h3 { margin-bottom: 6px; }
.cert-main p { margin: 0 0 10px; color: var(--ink-soft); }
.cert-side { flex: 0 0 auto; text-align: right; max-width: 240px; }
.cert-side .hint { text-align: right; }
.cert-issued    { border-left-color: var(--pine); }
.cert-requested,
.cert-paid      { border-left-color: var(--amber); }

/* ---------------- Two column form row ---------------- */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 560px) {
    .two-col { grid-template-columns: 1fr; }
    .cert-side { text-align: left; }
    .cert-side .hint { text-align: left; }
}

/* ---------------- Section heading ---------------- */
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 34px 0 16px;
}
.section-head h2 { margin: 0; }

/* =========================================================
   Certificate catalogue
   ========================================================= */

.cert-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    align-items: stretch;
}

.cert-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.cert-card:hover {
    transform: translateY(-3px);
    border-color: #c6d3cd;
    box-shadow: 0 2px 4px rgba(20,24,29,.06), 0 16px 34px rgba(20,24,29,.10);
}

/* ---- Media: any image size is cropped to a fixed ratio ---- */
.cert-card-media {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--ink);
    overflow: hidden;
}
.cert-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform .5s ease;
}
.cert-card:hover .cert-card-media img { transform: scale(1.045); }

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 16 / 10) {
    .cert-card-media { height: 0; padding-bottom: 62.5%; }
    .cert-card-media img { position: absolute; inset: 0; }
}

.cert-card-media.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        repeating-linear-gradient(135deg, #1b222b 0 14px, #171e26 14px 28px);
}
.cert-card-media.placeholder span {
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .26em;
    text-transform: uppercase;
    color: #7fb5a2;
    border: 1px solid #33463f;
    padding: 8px 14px;
    border-radius: 2px;
}

/* Validity chip sitting on the image */
.cert-chip {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    font-family: var(--mono);
    font-size: .64rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .94);
    color: var(--pine);
    box-shadow: 0 1px 3px rgba(20,24,29,.18);
}

/* ---- Body ---- */
.cert-card-body {
    padding: 20px 20px 4px;
    flex: 1 1 auto;
    min-width: 0;
}
.cert-card-body h3 {
    margin: 0 0 10px;
    font-size: 1.06rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.cert-card-body p {
    margin: 0;
    color: var(--ink-soft);
    font-size: .9rem;
    line-height: 1.55;
}

.ticks {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    font-size: .86rem;
    color: var(--ink-soft);
}
.ticks li {
    padding-left: 20px;
    position: relative;
    margin-bottom: 6px;
    line-height: 1.45;
}
.ticks li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: .5em;
    width: 8px;
    height: 4px;
    border-left: 1.6px solid var(--pine);
    border-bottom: 1.6px solid var(--pine);
    transform: rotate(-45deg);
}

/* ---- Footer pinned to the bottom of every card ---- */
.cert-card-foot {
    margin-top: auto;
    padding: 18px 20px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
}
.cert-card-foot .price {
    font-family: var(--display);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1;
}
.cert-card-foot .price small {
    display: block;
    font-family: var(--mono);
    font-size: .62rem;
    font-weight: 400;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-top: 6px;
}

/* ---- "How it works" strip ---- */
.steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 34px;
}
.step {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
}
.step .num {
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .18em;
    color: var(--pine);
    margin-bottom: 10px;
}
.step h4 { margin: 0 0 6px; font-size: .98rem; }
.step p { margin: 0; color: var(--ink-soft); font-size: .88rem; line-height: 1.55; }

/* ---- Responsive ---- */
@media (max-width: 980px) {
    .cert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .steps     { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .cert-grid { grid-template-columns: 1fr; gap: 16px; }
    .steps     { grid-template-columns: 1fr; }
    .cert-card:hover { transform: none; }
    .cert-card-foot { padding: 16px; }
    .cert-card-body { padding: 18px 16px 4px; }
    .cert-card-foot .btn { width: 100%; text-align: center; }
}

/* Certificate order states on the user dashboard */
.cert-pending { border-left-color: var(--amber); }
.cert-failed  { border-left-color: var(--rust); }

/* ---------------- Promo strip (home page) ---------------- */
.promo {
    margin-top: 30px;
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 3px solid var(--pine);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    flex-wrap: wrap;
}
.promo-text { flex: 1 1 340px; min-width: 0; }
.promo-eyebrow {
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--pine);
    margin-bottom: 8px;
}
.promo h2 { margin: 0 0 6px; font-size: 1.3rem; }
.promo p { margin: 0; color: var(--ink-soft); font-size: .93rem; }

@media (max-width: 560px) {
    .promo { padding: 20px; }
    .promo .btn { width: 100%; text-align: center; }
}
