/*
  ═══════════════════════════════════════════════════════════
  FILE: style.css
  PURPOSE: The ONE shared stylesheet for every page on LinuxTrix.

  Every HTML page loads this file in its <head>:
    - Pages in the site root (index.html, tutorials.html …) use:
        <link rel="stylesheet" href="style.css" />
    - Pages inside /tutorials/ go up one folder first:
        <link rel="stylesheet" href="../style.css" />

  Change something here and it changes on EVERY page.

  HOW THIS FILE IS ORGANISED (top to bottom):
    1.  Colour variables (the site's dark theme + orange accent)
    2.  Page base (body font, background, sticky-footer layout)
    3.  Header & navigation bar
    4.  Main content area, headings, links
    5.  Code blocks (<code> and <pre>)
    6.  Tutorial lists (the clickable "cards" on listing pages)
    7.  Command search page
    8.  Tutorial page sections (grey boxes around intro / steps …)
    9.  Footer
    10. Highlight utility
    11. Topic grid (home page + photography hub tiles)
    12. Results count (command search)
    13. Tables (app comparison tables, cheat sheets)
    14. Callout boxes (tips, warnings, notes)
    15. Difficulty tags (Easy / Medium / Hard pills)
    16. Responsive rules for small screens (phones)
    17. Screenshots in guides (figure.shot)
    18. Security tracker (stat cards, progress bars)
    19. Tools page buttons
    20. Live TryHackMe panel (activity squares, skill bars, chips)
    21. Tool inputs (subnet calculator)
    22. Contact form

  HOW CSS WORKS (quick refresher):
    selector { property: value; }
      - "body"      targets every <body> tag
      - ".desc"     targets anything with class="desc"
      - "#intro"    targets the one element with id="intro"
      - "var(--x)"  reads a colour variable defined in :root below
  ═══════════════════════════════════════════════════════════
*/


/* ─────────────────────────────────────────────────────────
   1. COLOUR VARIABLES
   Change a colour here once and the whole site updates.
   ───────────────────────────────────────────────────────── */
:root {
  --bg-color: #121212;      /* page background (near-black)          */
  --text-color: #ffffff;    /* main text colour (white)              */
  --accent-color: #ff6600;  /* LinuxTrix orange — links, borders     */
  --card-bg: #1e1e1e;       /* background of cards, header, footer   */
  --code-bg: #2a2a2a;       /* background of code blocks             */
  --muted-text: #bbbbbb;    /* grey text for descriptions            */
  --border-color: #333333;  /* thin dividing lines                   */
  --tip-color: #3fb96b;     /* green  — "tip" callouts / Easy tag    */
  --warn-color: #e6b422;    /* yellow — "warning" callouts / Medium  */
  --danger-color: #e5484d;  /* red    — "danger" callouts / Hard tag */
  --info-color: #4aa3ff;    /* blue   — "note" callouts              */
}


/* ─────────────────────────────────────────────────────────
   2. PAGE BASE
   The body is a vertical flexbox so the footer is always
   pushed to the bottom, even on short pages.
   ───────────────────────────────────────────────────────── */
body {
  margin: 0;
  min-height: 100vh;               /* at least the full window height */
  display: flex;
  flex-direction: column;          /* header → main → footer, stacked */
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}


/* ─────────────────────────────────────────────────────────
   3. HEADER & NAVIGATION
   The bar at the top of every page. "sticky" keeps it
   visible while the reader scrolls.
   ───────────────────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 1000;                   /* sit above all other content */
  display: flex;
  align-items: center;
  flex-wrap: wrap;                 /* nav links wrap instead of overflowing */
  gap: 0.5rem;
  padding: 1rem 2rem;
  background-color: var(--card-bg);
  border-bottom: 2px solid var(--accent-color);
}

/* The round orange logo (logo.svg) */
.logo {
  width: 40px;
  height: 40px;
  margin-right: 1rem;
}

/* Page title next to the logo — grows to push the nav to the right */
header h1 {
  flex-grow: 1;
  font-size: 1.5rem;
  margin: 0;
}

/* Each navigation link */
nav a {
  color: var(--text-color);
  text-decoration: none;
  margin-right: 1.5rem;
  font-weight: 500;
  transition: color 0.2s;
}

/* Hovered link, and the link for the page you're on (class="highlight") */
nav a:hover,
nav a.highlight {
  color: var(--accent-color);
}


/* ─────────────────────────────────────────────────────────
   4. MAIN CONTENT, HEADINGS, LINKS
   ───────────────────────────────────────────────────────── */
main {
  max-width: 960px;                /* keep lines readable on wide screens */
  width: 100%;
  margin: 2rem auto;               /* centre the column */
  padding: 0 1.5rem;
  box-sizing: border-box;
  flex: 1 0 auto;                  /* pushes footer to bottom when content is short */
}

section {
  margin-bottom: 3rem;
}

/* When a link jumps to #some-id, leave room so the sticky header
   doesn't cover the heading you jumped to */
[id] {
  scroll-margin-top: 90px;
}

h1, h2, h3 {
  color: var(--text-color);
}

a {
  color: var(--accent-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}


/* ─────────────────────────────────────────────────────────
   5. CODE BLOCKS
   <code> = small inline code, <pre> = multi-line block.
   ───────────────────────────────────────────────────────── */
code, pre {
  background: var(--code-bg);
  border-radius: 4px;
  font-family: "Fira Code", "Cascadia Code", Consolas, monospace;
}

code {
  padding: 0.15em 0.4em;
  font-size: 0.9em;
  overflow-wrap: anywhere;         /* long URLs/paths wrap instead of widening the page on phones */
}

pre {
  padding: 1rem;
  overflow-x: auto;                /* long lines scroll sideways instead of breaking the layout */
  margin: 0.75rem 0;
}

/* A <code> inside a <pre> shouldn't get its own padding */
pre code {
  padding: 0;
  font-size: 0.9em;
  overflow-wrap: normal;           /* code blocks scroll sideways instead of wrapping */
}


/* ─────────────────────────────────────────────────────────
   6. TUTORIAL LISTS
   <ul class="tutorial-list"> — each <li> becomes a card
   that slides right slightly when hovered.
   ───────────────────────────────────────────────────────── */
.tutorial-category h2 {
  margin-top: 2rem;
}

.tutorial-list {
  list-style: none;                /* remove bullet points */
  padding: 0;
}

.tutorial-list li {
  background: var(--card-bg);
  margin-bottom: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 6px;
  display: flex;
  flex-direction: column;          /* title on top, description below */
  gap: 0.25rem;
  transition: transform 0.15s, box-shadow 0.15s;
}

.tutorial-list li:hover {
  transform: translateX(4px);
  box-shadow: 0 0 0 1px var(--accent-color);
}

/* The card's title link */
.tutorial-list a {
  font-weight: 600;
  font-size: 1.1rem;
}

/* The grey description line under the title */
.tutorial-list .desc {
  color: var(--muted-text);
  font-size: 0.95rem;
}


/* ─────────────────────────────────────────────────────────
   7. COMMAND SEARCH PAGE (search.html)
   ───────────────────────────────────────────────────────── */
/* The big search box */
#search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background: var(--card-bg);
  color: var(--text-color);
  border: 2px solid #444;
  border-radius: 6px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s;
}

#search-input:focus {
  border-color: var(--accent-color);
}

/* One command result card */
.command {
  background: var(--card-bg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  border-radius: 6px;
  border-left: 4px solid var(--accent-color);
}

.command h3 {
  margin-top: 0;
  color: var(--accent-color);
}

.command pre code {
  background: var(--code-bg);
}

.command ul {
  padding-left: 1.5rem;
}

.command li {
  margin-bottom: 0.3rem;
}


/* ─────────────────────────────────────────────────────────
   8. TUTORIAL PAGE SECTIONS
   Sections with these ids get a grey box so the key parts
   of a tutorial stand out.
   ───────────────────────────────────────────────────────── */
#intro, #prerequisites, #steps, #troubleshooting, #next-steps {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

ol li, ul li {
  margin-bottom: 0.4rem;
}


/* ─────────────────────────────────────────────────────────
   9. FOOTER
   ───────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem;
  background-color: var(--card-bg);
  border-top: 1px solid var(--border-color);
  margin-top: 3rem;
}


/* ─────────────────────────────────────────────────────────
   10. HIGHLIGHT UTILITY
   Add class="highlight" to anything to make it orange.
   ───────────────────────────────────────────────────────── */
.highlight {
  color: var(--accent-color);
}


/* ─────────────────────────────────────────────────────────
   11. TOPIC GRID
   <div class="topic-grid"> holds <a class="topic-card">
   tiles. The grid automatically fits as many 250px-wide
   columns as the screen allows.
   ───────────────────────────────────────────────────────── */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.topic-card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 6px;
  border-left: 4px solid var(--accent-color);
  transition: transform 0.15s, box-shadow 0.15s;
}

.topic-card:hover {
  transform: translateY(-2px);     /* lift slightly */
  box-shadow: 0 4px 12px rgba(255, 102, 0, 0.2);
  text-decoration: none;
}

.topic-card h3 {
  margin-top: 0;
  color: var(--accent-color);
}

.topic-card p {
  color: var(--muted-text);
  font-size: 0.95rem;
}


/* ─────────────────────────────────────────────────────────
   12. RESULTS COUNT (search.html — "12 commands found")
   ───────────────────────────────────────────────────────── */
#results-count {
  color: #888;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}


/* ─────────────────────────────────────────────────────────
   13. TABLES
   Wrap any table in <div class="table-wrap"> so it scrolls
   sideways on phones instead of squashing.
     <div class="table-wrap">
       <table class="data-table"> … </table>
     </div>
   ───────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;       /* no double borders between cells */
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

/* Header row */
.data-table th {
  background: var(--card-bg);
  color: var(--accent-color);
  font-weight: 600;
  white-space: nowrap;
}

/* Light stripe on hover so the eye can follow a row */
.data-table tbody tr:hover {
  background: rgba(255, 102, 0, 0.06);
}

/* Section divider row inside a table: <tr class="group-row"><td colspan="…"> */
.data-table .group-row td {
  background: #181818;
  color: var(--muted-text);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}


/* ─────────────────────────────────────────────────────────
   14. CALLOUT BOXES
   Coloured boxes for tips and warnings:
     <div class="callout tip">     … </div>  green
     <div class="callout warning"> … </div>  yellow
     <div class="callout danger">  … </div>  red
     <div class="callout note">    … </div>  blue
   ───────────────────────────────────────────────────────── */
.callout {
  background: var(--card-bg);
  border-left: 4px solid var(--info-color);
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  margin: 1rem 0;
}

.callout p:first-child { margin-top: 0; }
.callout p:last-child  { margin-bottom: 0; }

.callout.tip     { border-left-color: var(--tip-color); }
.callout.warning { border-left-color: var(--warn-color); }
.callout.danger  { border-left-color: var(--danger-color); }
.callout.note    { border-left-color: var(--info-color); }


/* ─────────────────────────────────────────────────────────
   15. DIFFICULTY TAGS
   Small rounded labels:
     <span class="tag easy">Easy</span>
     <span class="tag medium">Medium</span>
     <span class="tag hard">Hard</span>
   ───────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 0.1em 0.6em;
  border-radius: 999px;            /* pill shape */
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  background: #333;
  color: #ddd;
}

.tag.easy   { background: rgba(63, 185, 107, 0.15); color: var(--tip-color); }
.tag.medium { background: rgba(230, 180, 34, 0.15); color: var(--warn-color); }
.tag.hard   { background: rgba(229, 72, 77, 0.15);  color: var(--danger-color); }


/* ─────────────────────────────────────────────────────────
   16. RESPONSIVE (phones and narrow windows)
   Everything inside this block only applies when the
   screen is 600px wide or less.
   ───────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* Stack logo/title above the nav links. The header stops being
     "sticky" on phones so it doesn't cover a quarter of the screen. */
  header {
    position: static;
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
  }

  nav a {
    margin-right: 1rem;
    display: inline-block;
    margin-bottom: 0.25rem;
  }

  main {
    padding: 0 1rem;
  }

  #intro, #prerequisites, #steps, #troubleshooting, #next-steps {
    padding: 1rem;
  }
}


/* ─────────────────────────────────────────────────────────
   17. SCREENSHOTS IN GUIDES
   Add a screenshot to any guide with:
     <figure class="shot">
       <img src="../images/<guide-name>/01-name.png" alt="What it shows" loading="lazy" />
       <figcaption>Short caption</figcaption>
     </figure>
   The shot lists in youtube/scripts/ say which picture goes
   in which section of each guide.
   ───────────────────────────────────────────────────────── */
figure.shot {
  margin: 1.25rem 0;
}

figure.shot img {
  max-width: 100%;                 /* never wider than the page */
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  display: block;
}

figure.shot figcaption {
  color: var(--muted-text);
  font-size: 0.9rem;
  margin-top: 0.4rem;
}


/* ─────────────────────────────────────────────────────────
   18. SECURITY TRACKER (security.html)
   Stat cards, progress bars for learning paths, and the
   grey "nothing here yet" row in empty tables.
   ───────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.stat-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-color, #f97316);   /* site orange */
}

.stat-label {
  display: block;
  color: var(--muted-text);
  font-size: 0.9rem;
}

.muted {
  color: var(--muted-text);
  font-size: 0.9rem;
}

/* Progress bar: grey track with an orange fill */
.progress {
  display: inline-block;
  width: 120px;
  height: 10px;
  border-radius: 5px;
  background: var(--border-color);
  overflow: hidden;
  vertical-align: middle;
}

.progress-fill {
  height: 100%;
  background: var(--accent-color, #f97316);
}

.progress-pct {
  margin-left: 0.5rem;
  font-size: 0.9rem;
}

.empty-row td {
  color: var(--muted-text);
  font-style: italic;
  text-align: center;
}


/* ─────────────────────────────────────────────────────────
   19. TOOLS PAGE BUTTONS (tools.html)
   Orange outline buttons for "Start test" and "Copy".
   The stat cards reuse section 18.
   ───────────────────────────────────────────────────────── */
.tool-btn {
  background: transparent;
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  font: inherit;
  cursor: pointer;
  margin-right: 0.75rem;
}

.tool-btn:hover:not(:disabled) {
  background: var(--accent-color);
  color: var(--bg-color);
}

.tool-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.tool-btn.small {
  padding: 0.15rem 0.6rem;
  font-size: 0.85rem;
  margin: 0 0 0 0.5rem;
}


/* ─────────────────────────────────────────────────────────
   20. LIVE TRYHACKME PANEL (security.html)
   The day-by-day activity squares, the skill bars and the
   rounded "chips" used for badges and completed rooms.
   The headline cards reuse section 18.
   ───────────────────────────────────────────────────────── */

/* "Top 4%" is wider than a plain number, so it gets a smaller size */
.stat-num.stat-text {
  font-size: 1.6rem;
  line-height: 3rem;
}

/* Activity squares: 7 rows (Sunday to Saturday), one column per week.
   On a phone the strip scrolls sideways inside its own box. */
.heatmap-wrap {
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.heatmap-months {
  position: relative;
  height: 1.2rem;
  font-size: 0.75rem;
  color: var(--muted-text);
}

.heatmap-months span {
  position: absolute;
  top: 0;
}

.heatmap {
  display: grid;
  grid-template-rows: repeat(7, 11px);
  grid-auto-flow: column;
  grid-auto-columns: 11px;
  gap: 3px;
  width: max-content;
}

.heatmap span,
.heatmap-legend span {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 2px;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Brighter orange = more done that day */
.hm0 { background: var(--border-color); }
.hm1 { background: rgba(255, 102, 0, 0.3); }
.hm2 { background: rgba(255, 102, 0, 0.5); }
.hm3 { background: rgba(255, 102, 0, 0.75); }
.hm4 { background: var(--accent-color); }
.heatmap .pad { background: transparent; }

/* Skill bars: name, bar, score */
.skill-row {
  display: grid;
  grid-template-columns: minmax(7rem, 12rem) 1fr 2.5rem;
  gap: 0.75rem;
  align-items: center;
  margin: 0.5rem 0;
}

.progress.wide {
  width: 100%;
}

/* Chips: badges and completed rooms */
.chip-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.9rem;
  background: var(--card-bg);
}

.chip .muted {
  font-size: 0.8rem;
}


/* ─────────────────────────────────────────────────────────
   21. TOOL INPUTS (tools.html subnet calculator)
   Text box and drop-down side by side; stacked on phones.
   ───────────────────────────────────────────────────────── */
.subnet-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0;
}

.subnet-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 240px;
  color: var(--muted-text);
  font-size: 0.9rem;
}

.tool-input {
  padding: 0.6rem 0.8rem;
  font: inherit;
  font-size: 1rem;
  background: var(--card-bg);
  color: var(--text-color);
  border: 2px solid #444;
  border-radius: 6px;
  outline: none;
  box-sizing: border-box;
  width: 100%;
}

.tool-input:focus {
  border-color: var(--accent-color);
}


/* ─────────────────────────────────────────────────────────
   22. CONTACT FORM (contact.html)
   Labels above their boxes; the spam-trap field is moved off
   screen so people never see it (bots still fill it in).
   ───────────────────────────────────────────────────────── */
.contact-form > label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 1rem 0;
  color: var(--muted-text);
  font-size: 0.9rem;
}

.contact-form textarea {
  resize: vertical;
  min-height: 10rem;
}

.contact-form .trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
