/* ============================================================
   Carbon Crimes — Main Stylesheet
   Ported from Next.js globals.css + Tailwind utility classes
   ============================================================ */

/* --- Reset & base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --red: #ee1e3a;
    --black: #171717;
    --white: #ffffff;
    --gray-light: #ededed;
    --gray-mid: #cccccc;
    --gray-text: #6b7280;
}

body {
    color: var(--black);
    background: var(--white);
    font-family: 'Karla', Helvetica, sans-serif;
    font-size: 18px;
    font-weight: 300;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
strong { font-weight: 700; }
sub { font-size: 0.6em; }

h1 { letter-spacing: -0.04em; }

img { max-width: 100%; height: auto; display: block; }

/* --- Layout helpers --------------------------------------- */
.container    { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.mt-10        { margin-top: 2.5rem; }
.py-10        { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.px-4         { padding-left: 1rem; padding-right: 1rem; }
.px-10        { padding-left: 2.5rem; padding-right: 2.5rem; }
.text-center  { text-align: center; }
.text-left    { text-align: left; }

/* --- Header ----------------------------------------------- */
.site-header {
    background: var(--white);
    padding: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.header-logo img { height: 60px; width: auto; }

.header-nav { display: flex; gap: 1.5rem; }
.header-nav a { font-size: 1rem; font-weight: 500; }
.header-nav a:hover { text-decoration: underline; }

.header-search { display: flex; gap: 0.5rem; align-items: center; }
.header-search input {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}
.header-search input:focus { border-color: var(--red); box-shadow: 0 0 0 2px rgba(238,30,58,0.2); }
.header-search button, .mobile-search button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--red);
    color: var(--red);
    background: transparent;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: background 0.2s, color 0.2s;
}
.header-search button:hover, .mobile-search button:hover {
    background: var(--red);
    color: var(--white);
}

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid #d1d5db;
    padding: 0.4rem;
    cursor: pointer;
    border-radius: 4px;
}

.header-spacer { height: 80px; }

/* Mobile menu */
.mobile-menu {
    display: none;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    border-top: 1px solid var(--gray-light);
}
.mobile-menu.open { display: flex; }
.mobile-menu nav { display: flex; flex-direction: column; gap: 1rem; }
.mobile-menu nav a { font-size: 1.1rem; font-weight: 500; }
.mobile-search { display: flex; gap: 0.5rem; }
.mobile-search input {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    font-family: inherit;
    font-size: 1rem;
}

@media (max-width: 768px) {
    .header-nav, .header-search { display: none; }
    .menu-toggle { display: block; }
    .header-spacer { height: 64px; }
}

/* --- Footer ----------------------------------------------- */
.site-footer {
    background: var(--black);
    color: var(--white);
    padding: 1.5rem 1rem;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}
.footer-logo img { height: 50px; width: auto; }
.footer-text { font-size: 0.875rem; }
.footer-text p { margin-top: 0.5rem; }
.footer-text a { color: var(--red); text-decoration: underline; }

/* --- Typography ------------------------------------------- */
.text-4xl  { font-size: 2.25rem; }
.text-5xl  { font-size: 3rem; }
.text-3xl  { font-size: 1.875rem; }
.text-2xl  { font-size: 1.5rem; }
.text-xl   { font-size: 1.25rem; }
.text-lg   { font-size: 1.125rem; }
.font-bold { font-weight: 700; }
.leading-tight { line-height: 1.25; }
.uppercase { text-transform: uppercase; }

@media (min-width: 768px) {
    .text-5xl { font-size: 4rem; }
    .md\:text-5xl { font-size: 4em; }
    .md\:text-7xl { font-size: 4.5rem; }
}

/* --- Brand colours ---------------------------------------- */
.text-red, .text-red-500 { color: var(--red); }
.bg-red, .bg-red-500 { background-color: var(--red); }
.text-gray { color: var(--gray-text); }

/* --- Highlight (red + understroke) ------------------------ */
.highlight {
    color: var(--red);
    font-weight: 700;
    background: url("/public/assets/understroke.png") bottom left no-repeat;
    background-size: 100%;
    padding-bottom: 10px;
}

/* --- Criminal card grid ----------------------------------- */
.criminals-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
    padding: 0 1rem;
    max-width: 1200px;
    margin: 0 auto;
}
@media (min-width: 640px)  { .criminals-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .criminals-grid { grid-template-columns: repeat(4, 1fr); } }

.criminal-card { text-align: center; }
.criminal-card a { display: block; }

.criminal-card-image {
    position: relative;
    display: inline-block;
}

/* --- Criminal photo --------------------------------------- */
.criminal-image {
    width: 192px;
    height: 192px;
    border-radius: 50%;
    object-fit: cover;
    filter: contrast(1.2) saturate(0);
    border: 2px solid transparent;
    transition: filter 0.2s, border 0.2s;
    display: block;
    margin: 0 auto;
}
.criminal-image:hover {
    filter: saturate(1.5);
    border: 6px solid var(--red);
}
.criminal-profile .criminal-image {
    width: 200px; height: 200px;
    max-width: 600px; max-height: 600px;
}

/* --- Starburst badge -------------------------------------- */
.starburst {
    position: absolute;
    top: -8px; right: -12px;
    width: 100px;
    height: 100px;
    background: var(--red);
    color: var(--white);
    font-weight: 700;
    font-size: 0.65rem;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transform: rotate(15deg);
    padding: 10px;
    clip-path: polygon(99.18% 59.03%,87.49% 63.94%,93.13% 75.3%,80.46% 75.92%,81.87% 88.53%,69.76% 84.78%,66.77% 97.1%,56.67% 89.44%,49.65% 100%,42.78% 89.34%,32.57% 96.86%,29.76% 84.5%,17.59% 88.08%,19.18% 75.5%,6.53% 74.7%,12.32% 63.42%,0.7% 58.34%,10% 49.72%,0.82% 40.97%,12.51% 36.06%,6.87% 24.7%,19.54% 24.08%,18.13% 11.47%,30.24% 15.22%,33.23% 2.9%,43.33% 10.56%,50.35% 0%,57.22% 10.66%,67.43% 3.14%,70.24% 15.5%,82.41% 11.92%,80.82% 24.5%,93.47% 25.3%,87.68% 36.58%,99.3% 41.66%,90% 50.28%);
}

/* --- Criminal card details -------------------------------- */
.criminal-card-details { margin-top: 1rem; }
.criminal-card-details h3 { font-size: 1.125rem; font-weight: 700; text-transform: uppercase; }
.criminal-card-details .profession { color: #374151; font-weight: 500; }
.criminal-card-details .stats { color: var(--gray-text); font-size: 0.875rem; margin-top: 0.25rem; }

/* --- Profile page ----------------------------------------- */
.criminal-profile { min-height: 100vh; }
.profile-hero { text-align: center; padding: 2.5rem 1rem; }
.profile-hero h1 { font-size: 2rem; font-weight: 700; margin: 2rem 0 3rem; line-height: 1.15; }
@media (min-width: 768px) { .profile-hero h1 { font-size: 4.5rem; } }

.profile-body {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
    align-items: flex-start;
}
@media (min-width: 1024px) { .profile-body { flex-direction: row; } }

.profile-left  { flex: 1; }
.profile-right { flex: 2; max-width: 100%; }

/* emoji stats */
.hint        { font-size: 0.7em; }
.emoji-header { font-size: 1.4em; line-height: 1.1; margin-bottom: 0.25rem; }
.emoji-row   { word-break: break-all; margin: 0.4rem 0; }

/* criminal detail stats */
.criminal-details { padding: 1em 0; }
.stat { font-size: 1.5em; font-weight: 700; }
.label-style { text-transform: uppercase; font-weight: 700; color: #aaa; font-size: 14px; display: block; margin-top: 7px; }

/* --- Buttons ---------------------------------------------- */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}
.btn-red { background: var(--red); color: var(--white); border-radius: 4px; }
.btn-red:hover { background: #c8172e; }
.btn-red:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Offset modal ----------------------------------------- */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 100;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--white);
    max-width: 640px;
    width: 100%;
    padding: 2.5rem;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-close {
    position: absolute; top: 1rem; right: 1rem;
    font-size: 1.5rem; background: none; border: none; cursor: pointer;
}
.modal-box h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; line-height: 1.2; }
.modal-box p  { margin-bottom: 1rem; }

/* --- Tables ----------------------------------------------- */
table { width: 100%; border-collapse: collapse; }
thead { background: #f3f4f6; }
th, td { padding: 0.5rem 1rem; text-align: left; }
tbody tr { border-top: 1px solid #e5e7eb; }
tbody tr:nth-child(even) { background: #fafafa; }

.table-scroll { overflow-x: auto; }
.table-scroll-limited { overflow-x: auto; max-height: 16rem; border: 1px solid #e5e7eb; border-radius: 4px; }

/* Flight table responsive */
@media screen and (max-width: 600px) {
    table.flights { border: 0; }
    table.flights thead {
        border: none; clip: rect(0 0 0 0);
        height: 1px; margin: -1px;
        overflow: hidden; padding: 0;
        position: absolute; width: 1px;
    }
    table.flights tr {
        border-top: 3px solid #ddd;
        display: block; margin-bottom: .625em; padding-top: .625em;
    }
    table.flights td {
        display: block; font-size: .9em; text-align: right;
        padding: .1em 1rem;
    }
    table.flights td::before { float: left; font-weight: bold; text-transform: uppercase; }
    table.flights td:last-child { border-bottom: 0; }
    table.flights td:nth-child(1)::before { content: "from:\00a0"; }
    table.flights td:nth-child(2)::before { content: "to:\00a0"; }
    table.flights td:nth-child(3)::before { content: "Miles:\00a0"; }
    table.flights td:nth-child(4)::before { content: "Time:\00a0"; }
    table.flights td:nth-child(5)::before { content: "CO2:\00a0"; }
}

/* --- Pagination ------------------------------------------- */
.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin: 1.5rem 0; }
.pagination button {
    padding: 0.5rem 1rem;
    background: #e5e7eb;
    border: none; cursor: pointer;
    font-family: inherit; font-size: 1rem;
}
.pagination button:hover:not(:disabled) { background: #d1d5db; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .page-info { font-size: 1.1rem; font-weight: 500; }

/* --- Share buttons ---------------------------------------- */
.sharing-widget { padding: 1.25rem; background: var(--gray-light); margin-top: 1rem; }
.share-button {
    display: inline-block;
    font-weight: bold;
    padding: 0.3em 0.8em;
    margin: 0 0.25rem 0.5rem 0;
    border-radius: 20px;
    font-size: 0.9em;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.share-x    { color: rgb(29,155,240); border: 1px solid rgb(29,155,240); }
.share-x:hover { background: rgb(29,155,240); color: white; }
.share-bsky { color: rgb(16,131,254); border: 1px solid rgb(16,131,254); }
.share-bsky:hover { background: rgb(16,131,254); color: white; }
.share-thrd { border: 1px solid black; }
.share-thrd:hover { background: black; color: white; }
.share-face { color: rgb(8,102,255); border: 1px solid rgb(8,102,255); }
.share-face:hover { background: rgb(8,102,255); color: white; }
.share-email { border: 1px solid #333; color: #333; }
.share-email:hover { background: #333; color: white; }

/* --- Home about section ----------------------------------- */
.home-about {
    max-width: 800px;
    margin: 2rem auto;
    border-top: 1px solid var(--gray-light);
    padding: 2.5rem 2.5rem;
}
.home-about p { margin-bottom: 1rem; }
.home-about a, .faq a { color: var(--red); text-decoration: underline; }

/* --- FAQ -------------------------------------------------- */
.faq ul { list-style-type: disc; margin-left: 2rem; }
.faq li { margin-top: 1em; }
.faq p  { margin-bottom: 1rem; }

/* --- Hero section ----------------------------------------- */
.hero { padding: 2.5rem; }
.hero h1 { font-size: 2.25rem; font-weight: 700; line-height: 1.25; margin-bottom: 1rem; }
.hero h2 { font-size: 1.25rem; font-weight: 500; }
@media (min-width: 768px) {
    .hero h1 { font-size: 4rem; }
    .hero h2 { font-size: 1.5rem; }
}

/* --- Static content pages --------------------------------- */
.content-page { max-width: 800px; margin: 2.5rem auto; padding: 2rem; background: white; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.content-page h1 { font-size: 1.875rem; font-weight: 700; margin-bottom: 1rem; }
.content-page h2 { font-size: 1.5rem; font-weight: 700; margin: 1.5rem 0 0.75rem; }
.content-page p  { margin-bottom: 1rem; line-height: 1.6; }
.content-page a  { color: var(--red); text-decoration: underline; }

/* --- Success / cancel pages ------------------------------- */
.result-page { text-align: center; padding: 4rem 1rem; }
.result-page h1 { font-size: 2rem; font-weight: 700; margin-bottom: 1rem; }
.result-page p  { font-size: 1.1rem; margin-bottom: 1.5rem; }

/* --- Admin (functional, not fancy) ------------------------ */
.admin-body { font-family: system-ui, sans-serif; font-size: 15px; background: #f5f5f5; color: #333; }
.admin-header { background: #1a1a1a; color: white; padding: 0.75rem 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.admin-header a { color: #ccc; text-decoration: none; margin-left: 1rem; }
.admin-header a:hover { color: white; }
.admin-container { max-width: 1100px; margin: 2rem auto; padding: 0 1rem; }
.admin-card { background: white; border-radius: 6px; padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.admin-card h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; border-bottom: 1px solid #eee; padding-bottom: 0.5rem; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th { text-align: left; padding: 0.4rem 0.75rem; background: #f0f0f0; }
.admin-table td { padding: 0.4rem 0.75rem; border-bottom: 1px solid #eee; }
.admin-table tr:hover td { background: #fafafa; }
.admin-form label { display: block; font-weight: 600; margin: 0.75rem 0 0.25rem; font-size: 0.875rem; }
.admin-form input[type=text],
.admin-form input[type=number],
.admin-form textarea,
.admin-form select {
    width: 100%; padding: 0.4rem 0.6rem; border: 1px solid #ccc;
    border-radius: 3px; font-family: inherit; font-size: 0.9rem;
}
.admin-form textarea { min-height: 80px; resize: vertical; }
.admin-form input[type=checkbox] { width: auto; margin-right: 0.4rem; }
.admin-btn { display: inline-block; padding: 0.4rem 1rem; border: none; border-radius: 3px; font-size: 0.875rem; cursor: pointer; font-family: inherit; }
.admin-btn-primary { background: #2563eb; color: white; }
.admin-btn-primary:hover { background: #1d4ed8; }
.admin-btn-danger  { background: #dc2626; color: white; }
.admin-btn-danger:hover { background: #b91c1c; }
.admin-btn-secondary { background: #e5e7eb; color: #333; }
.admin-btn-secondary:hover { background: #d1d5db; }
.admin-msg { padding: 0.6rem 1rem; border-radius: 4px; margin-bottom: 1rem; }
.admin-msg-success { background: #dcfce7; color: #166534; }
.admin-msg-error   { background: #fee2e2; color: #991b1b; }
