/* ==========================================================================
   John P. Freeman Portfolio — stylesheet
   Sections:  1. Design tokens   2. Base   3. Header & navigation
              4. Page layout (sections / grid)   5. Content blocks
              6. Embeds   7. Mobile drawer
   ========================================================================== */

/* 1. Design tokens — change colours / sizes here ------------------------- */
:root {
  --bg: #f1ece4;          /* page background */
  --text: #212121;        /* body text */
  --accent: #ffaa00;      /* orange: active-tab underline, download button */
  --link: #4a86e8;        /* blue headings / links */
  --nav-bg: #4f474e;      /* scrolled header, "More" menu, mobile drawer */
  --card-bg: #ffffff;     /* white text boxes */
  --header-h: 56px;
  --font: Roboto, Arial, sans-serif;
}

/* 2. Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

main { flex: 1 0 auto; }

img { max-width: none; }

/* "Skip to main content" link: hidden until it receives keyboard focus */
.skip-link {
  position: absolute;
  top: 5px;
  left: 50%;
  z-index: 90;
  transform: translate(-50%, -200%);
  padding: 20px 28px;
  border-radius: 32px;
  background: rgba(32, 33, 36, .75);
  color: #fff;
  font-size: 14px;
  text-decoration: none;
}
.skip-link:focus { transform: translate(-50%, 0); }

/* 3. Header & navigation -------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: stretch;
  padding: 0 16px;
  color: #fff;                       /* pages with a banner: white text... */
  transition: background-color .3s;
}
.site-header--plain {                /* ...pages without a banner: dark text */
  color: var(--text);
  background: var(--bg);
}
.site-header.is-solid {              /* banner pages, after scrolling past it */
  background: var(--nav-bg);
  color: #fff;
}

.site-title {
  flex: none;
  align-self: center;
  max-width: 380px;
  padding: 16px 12px;
  overflow: hidden;
  color: inherit;
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-nav { margin: 0 -2px 0 auto; }
.js .site-nav { visibility: hidden; }          /* revealed once site.js has laid it out */
.js .site-nav.is-ready { visibility: visible; }

.site-nav__list {
  display: flex;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav__item { position: relative; flex: none; padding: 0 11px; }

.site-nav__link {
  display: block;
  height: var(--header-h);
  padding: 14px 2px 0;
  border: 0;
  border-bottom: 8px solid transparent;
  background: none;
  color: inherit;
  font: 700 16px/28px var(--font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.site-nav__link:hover { opacity: .6; }
.site-nav__link[aria-current="page"] { border-bottom-color: var(--accent); }

/* "More" drop-down (built by site.js from links that don't fit) */
.nav-more[hidden] { display: none; }
.nav-more__toggle { display: flex; align-items: flex-start; }
.nav-more__toggle svg { width: 24px; height: 24px; margin: 2px -2px 0 0; fill: currentColor; transition: transform .2s; }
.nav-more.is-open .nav-more__toggle svg { transform: rotate(180deg); }

.nav-more__menu {
  position: absolute;
  top: 100%;
  z-index: 200;
  display: none;
  min-width: 240px;
  margin: 0;
  padding: 8px 0;
  background: var(--nav-bg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
  color: #fff;
  list-style: none;
}
.nav-more.is-open .nav-more__menu { display: block; }
.nav-more__menu .site-nav__item { padding: 0; }
.nav-more__menu .site-nav__link {
  height: 40px;
  padding: 6px 24px 0 44px;
  border-bottom: 0;
}
.nav-more__menu .site-nav__link[aria-current="page"] { color: var(--accent); }

/* Hamburger button (phones/tablets only) */
.nav-toggle {
  display: none;
  position: fixed;
  top: 0; left: 0;
  z-index: 90;
  width: 48px;
  height: 55px;
  padding: 16px 12px;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
.nav-toggle svg { display: block; width: 24px; height: 24px; fill: currentColor; }
.nav-toggle .icon-close { display: none; }
.nav-open .nav-toggle { color: #fff; }
.nav-open .nav-toggle .icon-menu { display: none; }
.nav-open .nav-toggle .icon-close { display: block; }

.nav-scrim { display: none; }

/* 4. Page layout: sections and the 12-column grid ------------------------- */
.section {
  position: relative;
  padding: 24px 0;
}
main > .section:first-child { padding-top: calc(var(--header-h) + 24px); }

/* Banner at the top of the home page */
.section--banner {
  background: url("../Home/dc73dd8b74ea366ca617d74a073460e3.jpg") center center / cover;
}
.section--banner::before {          /* darkens the pattern so the white header text stays readable */
  content: "";
  position: absolute;
  inset: 0;
  background: rgb(33, 33, 33);
  opacity: .4;                      /* raise for a darker banner, lower for a lighter one */
}
.section--banner > .row { position: relative; }

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 5px;
}

/* A column spans N of 12 units on desktop:  <div class="col" style="--span: 8">
   On phones the grid has 4 units and on tablets 6 (default: full width), so a column
   can also set  --phone: 3  (75% wide) or  --tablet: 4  (two-thirds wide), centred. */
.col {
  --span: 12;
  width: calc(var(--phone, 4) / 4 * 100%);
}
.col__inner {                        /* side padding = 15% / units, so gutters stay constant */
  padding-left: calc(15% / var(--phone, 4));
  padding-right: calc(15% / var(--phone, 4));
}

.spacer { width: 100%; }

/* Phones and small tablets: columns stack, and each one gets 24px above and below
   (instead of padding on the section), so stacked columns end up 48px apart. */
@media (max-width: 767px) {
  .row { justify-content: center; }
  .section { padding: 0; }
  main > .section:first-child { padding-top: var(--header-h); }
  .col__inner { padding-top: 24px; padding-bottom: 24px; }
}
@media (min-width: 480px) and (max-width: 767px) {
  .row { max-width: 544px; }
  .col { width: calc(var(--tablet, 6) / 6 * 100%); }
  .col__inner {
    padding-left: calc(15% / var(--tablet, 6));
    padding-right: calc(15% / var(--tablet, 6));
  }
}
@media (min-width: 768px) {
  .row { padding: 0 48px; }
  .col { width: calc(var(--span) / 12 * 100%); }
  .col__inner { padding: 0 calc(15% / var(--span)); }   /* no vertical padding on desktop */
  .col--offset-1 { margin-left: calc(1 / 12 * 100%); }
  .col--offset-2 { margin-left: calc(2 / 12 * 100%); }
  .col--offset-3 { margin-left: calc(3 / 12 * 100%); }
}

/* 5. Content blocks ------------------------------------------------------- */
/* White text box. The title and paragraph sit in one box. */
.card {
  padding: 8px;
  background: var(--card-bg);
}
.card--padded { padding: 14px 8px; }   /* the project cards on the home page */
.card__title {
  margin: 0 0 28px;
  color: var(--link);
  font: 700 37pt/1.25 var(--font);
  text-align: center;
}
.card__title a { color: inherit; text-decoration: underline; }
.card__title--plain { color: var(--text); text-decoration: underline; }   /* dark, underlined, not a link */
.font-open-sans { font-family: "Open Sans", Arial, sans-serif; }
.card__title--no-margin { margin-bottom: 0; }

.card p {
  margin: 0;
  color: var(--text);
  font: 400 13pt/1.55 var(--font);
}
.card p + p { margin-top: 14px; }
.card p, .card__title { font-variant: none; }   /* no ligatures, as on the original site... */
.card .ligatures { font-variant: normal; }       /* ...except where the original had them on */
.text-center { text-align: center; }

/* Larger text inside a paragraph (used on the Mob Boss Maids page) */
.size-lg { font-size: 23pt; }
.size-xl { font-size: 33pt; }
@media (min-width: 480px) and (max-width: 767px) { .size-lg { font-size: 27pt; } .size-xl { font-size: 41pt; } }
@media (min-width: 768px) { .size-lg { font-size: 30pt; } .size-xl { font-size: 48pt; } }

/* Links inside paragraphs */
.link-plain  { color: inherit; text-decoration: none; }          /* whole paragraph is a link, looks like text */
.link-accent { color: var(--link); font-weight: 700; text-decoration: underline; }
.link-blue   { color: var(--link); text-decoration: underline; }
.link-underline { color: inherit; text-decoration: none; }
.underline { text-decoration: underline; }      /* drawn on the inner span so it scales with the text size */

/* Image, optionally cropped: the inline width/margin on <img> do the cropping */
.media {
  display: block;
  overflow: hidden;
  background: var(--card-bg);
}
.media img { display: block; width: 100%; }
.media--clear { background: transparent; }   /* banner image: no white behind it */

/* Orange button */
.button {
  display: inline-flex;
  padding: 6px 6px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: var(--text);
  font: 400 13pt/22px var(--font);
  text-decoration: none;
}
@media (min-width: 768px) { .button { padding: 6px 12px; } }

/* Headings shrink on smaller screens */
@media (min-width: 480px) and (max-width: 767px) { .card__title { font-size: 32pt; } }
@media (max-width: 479px) { .card__title { font-size: 26pt; } }

/* 6. Embeds (games and videos) -------------------------------------------- */
/* --ratio is height ÷ width, e.g. 56.25% for 16:9 */
.embed {
  position: relative;
  width: 100%;
  overflow: hidden;
  line-height: 0;
}
.embed::before {
  content: "";
  display: block;
  padding-top: var(--ratio, 56.25%);
}
.embed iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
}

/* Game pages: the game fills the whole window under the header
   (full width, window height minus the 56px header and a 1px bottom line) */
.main--game { padding-top: var(--header-h); }
.embed--fill {
  box-sizing: content-box;                        /* the 1px line sits below the game, not inside it */
  height: calc(100vh - var(--header-h) - 1px);
  height: calc(100dvh - var(--header-h) - 1px);   /* phones: ignores the collapsing address bar */
  border-bottom: 1px solid #e3e3e3;
}
.embed--fill::before { display: none; }

/* 7. Mobile drawer (below 768px the top bar becomes a slide-in menu) ------ */
@media (max-width: 767px) {
  .site-header { padding-left: 36px; }

  .nav-toggle { display: block; }

  .js .site-nav { visibility: visible; }
  .site-nav {
    position: fixed;
    top: 0; left: 0;
    z-index: 70;
    width: 250px;
    max-width: 80%;
    height: 100%;
    margin: 0;
    padding-top: var(--header-h);
    overflow-y: auto;
    background: var(--nav-bg);
    color: #fff;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .5s cubic-bezier(.4, 0, .2, 1), visibility 0s .5s;
  }
  .js .site-nav.is-ready { visibility: hidden; }
  .nav-open .site-nav,
  .js .nav-open .site-nav.is-ready {
    transform: none;
    visibility: visible;
    transition: transform .5s cubic-bezier(.4, 0, .2, 1);
  }

  .site-nav__list { display: block; height: auto; }
  .site-nav__item { margin-top: 20px; padding: 0 10px 0 36px; line-height: 20.27px; }
  .site-nav__link {
    display: inline-block;
    vertical-align: top;
    height: auto;
    margin: 1px 0 0 4px;
    padding: 0;
    border-bottom: 0 solid var(--accent);
    line-height: 19px;
  }
  .site-nav__link[aria-current="page"] { border-bottom-width: 7px; }

  .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 60;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .5s;
  }
  .nav-open .nav-scrim { opacity: .5; pointer-events: auto; }
}

@media (max-width: 479px) {
  .site-title { max-width: calc(100vw - 56px); font-size: 18.6667px; }
}
