/* ============================================================================
   style.css: the look of the site (colors, fonts, spacing, layout)
   ============================================================================
   How CSS works, in short:
     .name { property: value; }   applies to every element with class="name"
     #name { ... }                applies to the element with id="name"
     var(--x)                     uses the value defined as --x below
     comments                     start with slash-star and end with star-slash,
                                  like this block; the browser ignores them

   EASIEST EDITS are all in the first block (:root): change a color or size
   there once and it updates everywhere on the page.
   ============================================================================ */


/* ---------------------------------------------------------------------------
   1. DESIGN SETTINGS (light mode)
   Colors are hex codes: #RRGGBB. Pick new ones with any color picker.
   --------------------------------------------------------------------------- */
:root {
  --bg: #edf1f5;          /* page background (light steel grey) */
  --surface: #ffffff;     /* cards, the map panel, the counter box */
  --ink: #172133;         /* main text color (navy) */
  --muted: #566274;       /* secondary text: intros, captions, tool lists */
  --rule: #cfd7e1;        /* thin divider lines and borders */
  --accent: #1f5bd6;      /* the one highlight color: buttons, links, tunnel line */
  --accent-soft: #dfe8fb; /* pale version of the accent (hover, highlighted box) */
  --wip: #a86a08;         /* amber text for "work in progress" badges */
  --wip-soft: #f8ecd6;    /* amber badge background */
  --live: #1d7a4a;        /* green text for "Running" badges */
  --live-soft: #dcefe4;   /* green badge background */

  /* Fonts. The first name is used if it loads; the rest are fallbacks. */
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  /* Text sizes, smallest to largest. 1rem = 16px.
     --step-3 is the big headline; clamp() makes it grow with screen width
     between 2.25rem (phones) and 3.5rem (desktop). */
  --step--1: 0.875rem;    /* small text: menu, buttons, captions */
  --step-0: 1.0625rem;    /* normal body text */
  --step-1: 1.25rem;      /* intro paragraph, project titles */
  --step-2: 1.625rem;     /* section titles */
  --step-3: clamp(2.25rem, 1.5rem + 3vw, 3.5rem);

  --wrap: 1180px;         /* maximum content width on wide screens */
  --radius-lg: 14px;      /* rounded corners: big panels */
  --radius-sm: 6px;       /* rounded corners: buttons, small boxes */
  color-scheme: light;
}

/* ---------------------------------------------------------------------------
   2. DARK MODE
   Used automatically when the visitor's device is set to dark mode.
   Same names as above, darker values. Change these to adjust dark mode only.
   --------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1826;
    --surface: #162235;
    --ink: #e6ecf3;
    --muted: #9aa8bb;
    --rule: #2a3a52;
    --accent: #79a2ff;
    --accent-soft: #1e3157;
    --wip: #f0b44c;
    --wip-soft: #3a2c12;
    --live: #5fcf93;
    --live-soft: #15392a;
    color-scheme: dark;
  }
}


/* ---------------------------------------------------------------------------
   3. BASICS (apply to the whole page)
   --------------------------------------------------------------------------- */

/* Width/height include padding and border: makes sizes predictable */
*, *::before, *::after { box-sizing: border-box; }

/* Menu links scroll smoothly to their section... */
html { scroll-behavior: smooth; }
/* ...unless the visitor has asked their device to reduce motion */
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.6;                 /* space between lines of text */
  -webkit-font-smoothing: antialiased;
}

/* Centers content and keeps 16px of space on each side on phones */
.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }

/* Links */
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

/* Visible outline when moving through the page with the Tab key (accessibility) */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* "Skip to content" link: off-screen until a keyboard user tabs to it */
.skip { position: absolute; left: -9999px; top: 8px; }
.skip:focus { left: 16px; z-index: 10; background: var(--surface); padding: 8px 12px; }


/* ---------------------------------------------------------------------------
   4. TOP BAR (logo + menu). "sticky" keeps it at the top while scrolling.
   --------------------------------------------------------------------------- */
.site-header { border-bottom: 1px solid var(--rule); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.header-row { display: flex; align-items: center; justify-content: space-between; height: 64px; }

/* The "./tag" logo text */
.wordmark { font-family: var(--mono); font-weight: 500; font-size: 1.25rem; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
/* The blinking "_" cursor after the logo. Delete the "animation: ..." part to stop the blink. */
.wordmark::after { content: "_"; color: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Menu items laid out in a row */
nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
nav a { display: block; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-weight: 500; font-size: var(--step--1); }
nav a:hover { background: var(--surface); }


/* ---------------------------------------------------------------------------
   5. HERO (headline, intro, counter, buttons, and the map beside them)
   --------------------------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); /* text 5 parts : map 7 parts */
  gap: 56px;                    /* space between text and map */
  align-items: center;
  padding-block: 72px 88px;     /* space above and below the hero */
}
.hero h1 {
  font-size: var(--step-3);
  line-height: 1.05;
  letter-spacing: -0.03em;      /* slightly tighter letters for big text */
  font-weight: 700;
  margin: 0 0 24px;
  max-width: 15ch;              /* "ch" = width of one character: limits line length */
  text-wrap: balance;           /* evens out line lengths, avoids a lone last word */
}
.lede { font-size: var(--step-1); line-height: 1.55; color: var(--muted); margin: 0 0 24px; max-width: 34em; }
.lede strong { color: var(--ink); font-weight: 600; }

/* Visitor counter box (blue bar on the left) */
.visit {
  margin: 0 0 32px;
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--step--1);
  color: var(--muted);
  max-width: 34em;
}
/* tabular-nums = every digit the same width, so the number doesn't jitter */
.visit strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.visit span { font-variant-numeric: tabular-nums; color: var(--ink); }

/* Buttons */
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-block;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--step--1);
  text-decoration: none;
  border: 1.5px solid var(--accent);
}
.btn-primary { background: var(--accent); color: var(--surface); }  /* filled button */
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { color: var(--accent); }                                /* outline button */
.btn-ghost:hover { background: var(--accent-soft); }


/* ---------------------------------------------------------------------------
   6. LAB MAP (the SVG drawing in the hero)
   The class names here match the class="..." names in the SVG in index.html.
   --------------------------------------------------------------------------- */
.topology {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 20px 20px 16px;
}
.topology svg { width: 100%; height: auto; display: block; font-family: var(--font); }
.topology figcaption { margin-top: 12px; font-size: var(--step--1); color: var(--muted); }

/* In SVG, "fill" = inside color, "stroke" = outline color */
.node rect { fill: var(--surface); stroke: var(--ink); stroke-width: 1.25; }       /* Internet, Cloudflare */
.node-fw rect { fill: var(--bg); }                                                  /* firewall bar */
.lane rect { fill: none; stroke: var(--rule); stroke-width: 1.25; stroke-dasharray: 5 4; } /* dashed VLAN columns */
.lane-dmz rect { stroke: var(--accent); }                                           /* DMZ column in the accent color */
.lane-dmz .t-lane { fill: var(--accent); }
.dev rect { fill: var(--bg); stroke: var(--rule); stroke-width: 1; }               /* device boxes */
.dev text { font-size: 12px; fill: var(--ink); }
.dev-hot rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.75; } /* highlighted device */
.dev-hot text { font-weight: 600; }

/* Text styles inside the map */
.t-name { font-size: 14px; font-weight: 600; fill: var(--ink); }   /* box titles */
.t-sub { font-size: 12px; fill: var(--muted); }                    /* second line under a title */
.t-lane { font-size: 12.5px; font-weight: 600; fill: var(--muted); } /* LAN / IoT / Servers */
.t-note { font-size: 11.5px; fill: var(--muted); }                 /* small labels on lines */
.t-accent { fill: var(--accent); font-weight: 500; }               /* the tunnel label */

/* Lines and arrowheads */
.link { fill: none; stroke: var(--muted); stroke-width: 1.25; }
.arrowhead { fill: var(--muted); }
.arrowhead-accent { fill: var(--accent); }
/* stroke-dasharray "6 5" = 6px dash, 5px gap */
.tunnel { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 5; }

/* The moving dot: invisible until the animation starts */
.packet { fill: var(--accent); opacity: 0; }

/* THE ANIMATION
   main.js adds the class "is-live" to the map when it scrolls into view.
   Then the dot travels along the tunnel (offset-path) and the cloudflared box pulses.
   offset-path MUST match the tunnel's d="..." in index.html.
   Timing: "2.4s" = travel time, ".6s" = wait before starting. */
.topology.is-live .packet { opacity: 1; offset-path: path("M580 42H614V253H572"); animation: travel 2.4s cubic-bezier(.5,0,.3,1) .6s forwards; }
@keyframes travel {
  0% { offset-distance: 0%; opacity: 1; }
  92% { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }   /* fades out on arrival */
}
/* cloudflared box pulses at 2.9s (0.6s wait + 2.4s travel, minus a little) */
.topology.is-live #edge-node rect { animation: arrive .5s ease-out 2.9s both; }
@keyframes arrive { 0% { stroke-width: 1.75; } 50% { stroke-width: 4; } 100% { stroke-width: 1.75; } }

/* No animations for visitors who've turned on "reduce motion" */
@media (prefers-reduced-motion: reduce) {
  .wordmark::after { animation: none; }
  .topology.is-live .packet, .topology.is-live #edge-node rect { animation: none; }
}


/* ---------------------------------------------------------------------------
   7. SECTIONS (Projects, Skills, Contact share these)
   --------------------------------------------------------------------------- */
.section { padding-block: 72px; border-top: 1px solid var(--rule); }  /* space + line between sections */
.section h2 { font-size: var(--step-2); letter-spacing: -0.02em; margin: 0 0 8px; }
.section-lede { color: var(--muted); margin: 0 0 40px; max-width: 40em; }


/* ---------------------------------------------------------------------------
   8. PROJECTS: one wide featured card, then a two-column list
   --------------------------------------------------------------------------- */
.projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; } /* 2 columns */
.project { padding: 28px 0; border-bottom: 1px solid var(--rule); }
/* Title on the left, status badge on the right */
.project header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.project h3 { font-size: var(--step-1); letter-spacing: -0.01em; margin: 0; line-height: 1.3; }
.project p { margin: 0 0 12px; max-width: 62ch; }
/* The "Tool, Tool, Tool" line in code font */
.project .tools { font-family: var(--mono); font-size: 0.8125rem; color: var(--muted); margin: 0; }

/* Featured project: spans both columns, white card with a blue left edge */
.project-feature {
  grid-column: 1 / -1;            /* from the first column line to the last = full width */
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 8px;
}
.project-feature h3 { font-size: var(--step-2); }

/* Status badges (pill shape). Add a new color: copy .status-live, rename it,
   change the two colors, and use that class name in index.html. */
.status { flex: none; margin: 0 !important; font-size: 0.8125rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.status-live { color: var(--live); background: var(--live-soft); }
.status-wip { color: var(--wip); background: var(--wip-soft); }
.status-idea { color: var(--muted); background: var(--bg); border: 1px solid var(--rule); }  /* planned / considering */


/* "Secured by: ..." line under each project description */
.project .secured { color: var(--ink); font-size: var(--step--1); }
.project .secured strong { color: var(--live); font-weight: 600; }   /* green label */


/* Device list inside "The hardware" project card */
.hw-list { margin: 0 0 4px; padding: 0; list-style: none; font-size: var(--step--1); }
.hw-list li { padding: 6px 0; border-top: 1px solid var(--rule); }
.hw-list strong { font-weight: 600; }


/* The three production rules (Secure / Up to date / Always online), shown in a row */
.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
}
.principles li {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--live);     /* green top edge = "production" */
  border-radius: var(--radius-sm);
}
.principles h3 { font-size: var(--step-0); margin: 0 0 6px; }
.principles p { margin: 0; color: var(--muted); font-size: var(--step--1); }

/* "The hardware" card: full width, device list in two columns (one on phones) */
.project-wide { grid-column: 1 / -1; }
.project-wide .hw-list { columns: 2; column-gap: 48px; }
.project-wide .hw-list li { break-inside: avoid; }

/* The lab card: amber edge instead of blue, to set it apart from production */
.project-lab { border-left-color: var(--wip); }
.lab-link { margin: 16px 0 0 !important; font-weight: 600; }


/* ---------------------------------------------------------------------------
   9. WORKBENCH: a list of in-progress items, text on the left, badge on the right
   --------------------------------------------------------------------------- */
.bench { margin: 0; padding: 0; list-style: none; max-width: 860px; }
.bench li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 20px 0;
  border-top: 1px solid var(--rule);
}
.bench li:last-child { border-bottom: 1px solid var(--rule); }
.bench h3 { font-size: var(--step-0); margin: 0 0 4px; }
.bench p { margin: 0; color: var(--muted); font-size: var(--step--1); max-width: 62ch; }


/* ---------------------------------------------------------------------------
   9b. GITHUB LINKS ("repos" = the row of link cards; "repo" = one card)
   --------------------------------------------------------------------------- */
.repos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.repo {
  display: block;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  color: var(--ink);
  text-decoration: none;
}
.repo:hover { border-color: var(--accent); }
.repo-name { display: block; font-size: var(--step-1); font-weight: 600; margin-bottom: 6px; }
.repo-desc { display: block; color: var(--muted); margin-bottom: 12px; }
.repo-url { display: block; font-family: var(--mono); font-size: 0.8125rem; color: var(--accent); }


/* ---------------------------------------------------------------------------
   10. CONTACT and FOOTER
   --------------------------------------------------------------------------- */
.contact p { max-width: 40em; margin: 0 0 20px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 12px; list-style: none; margin: 0; padding: 0; }
.contact-links a {
  display: inline-block; padding: 10px 18px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--rule); color: var(--ink);
  text-decoration: none; font-weight: 500;
}
.contact-links a:hover { border-color: var(--accent); color: var(--accent); }

.site-footer { border-top: 1px solid var(--rule); padding-block: 28px; color: var(--muted); font-size: var(--step--1); }
.site-footer p { margin: 0; max-width: 60em; }


/* ---------------------------------------------------------------------------
   11. SMALLER SCREENS
   "@media (max-width: 960px)" = only applies when the screen is 960px wide or less.
   --------------------------------------------------------------------------- */

/* Tablets: map moves under the text */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding-block: 48px 64px; }
  .hero h1 { max-width: 18ch; }
}

/* Phones: everything in one column, tighter spacing */
@media (max-width: 640px) {
  nav ul { gap: 0; }
  nav a { padding: 8px 7px; font-size: 0.8125rem; }
  .nav-wide { display: none; }   /* drop "The lab" from the menu; the map is right under the hero */
  .projects { grid-template-columns: 1fr; }
  .project-feature { padding: 22px 18px; }
  .project header { flex-direction: column; gap: 6px; }   /* badge goes under the title */
  .repos { grid-template-columns: 1fr; }

  .bench li { flex-direction: column; gap: 8px; }   /* badge goes under the text */
  .principles { grid-template-columns: 1fr; }        /* rules stack on phones */
  .project-wide .hw-list { columns: 1; }
  .topology { padding: 12px; }
  .section { padding-block: 56px; }

  /* Keep the map readable: it stays 560px wide and scrolls sideways inside its frame */
  .topology { overflow-x: auto; }
  .topology svg { min-width: 560px; }
}
