/* ---- type and colour, matched to graftonarchitects.ie ----
   Colours were sampled from a screenshot; sizes are relative to a 16px body text.
   Change a value here to adjust it everywhere. */
:root {
    --color-nav: #333;         /* menu links */
  --color-title: #7a7a7a;       /* project titles */
  --color-meta: #bbb;        /* small secondary line under card titles */
  --size-logo: 1.65rem;
  --size-nav: clamp(1.15rem, 3vw, 1.6rem);
  --size-card-title: .82rem;
  /* Image columns shared by the grid, the top menu and the side menu.
     Same as the original site: 160px thumbnails, about 35px apart. */
  --columns: repeat(auto-fill, 10rem);
  --column-gap: 2.2rem;
  --font-family-sans: Helvetica, Arial, sans-serif;   /* as on the original site */
}

[hidden] {
  display: none !important;
}

/* The page spans the full width of the window (the starterkit stopped at 70rem), so the
   number of image columns grows with the screen, as on the original site. */
body {
  max-width: none;
  padding-top: 1.5rem;       /* a little less space above the name (was 3rem on wide screens) */
}

.logo {
  color: #ff0000;            /* red name, as on the original site */
  font-size: var(--size-logo);
  font-weight: 400;
  line-height: 1.1;
  text-transform: uppercase;
}
.logo .color-grey {
  margin-left: .25rem;
  color: #666;               /* grey "| Design", same size as the name */
  font-size: inherit;
  font-weight: 400;
}

/* ---- header: menu sits below the name ---- */
.header {
  /* A plain block, not flex: Safari stretches a grid that sits inside a column flexbox. */
  display: block;
  height: auto;
  margin-bottom: 3.2rem !important;   /* gap between the menu and the images */
}
.header .menu {
  /* Same columns as the project grid, so Portfolio / About / Contact sit over
     the left edge of the first, second and third column of images. */
  display: grid;
  grid-template-columns: var(--columns);
  grid-gap: var(--column-gap);
  grid-auto-rows: min-content;      /* rows are one line high, never stretched */
  align-content: start;
  align-items: start;
  height: auto;
  margin-top: .7rem;               /* space under the name */
  padding: 0 1rem;
}
/* Small screens: there is no room for the column alignment, so the three links
   sit in one row, spread equally across the full width. */
@media (max-width: 44rem) {
  /* Phones and small tablets: columns stretch to fill the width, as before. */
  :root {
    --columns: repeat(auto-fill, minmax(11rem, 1fr));
    --column-gap: 1.5rem;
    --size-logo: 1.1rem;      /* the name keeps its original size on phones */
  }
  .header .menu {
    display: flex;
    justify-content: space-between;
  }
  /* The text under each thumbnail is larger on phones; the title stays above the description. */
  :root {
    --size-card-title: 1.05rem;
  }
  .project-grid .project-card .card-desc {   /* extra specificity: the base rule comes later in the file */
    font-size: .9rem;
  }
}

.logo {
  padding-bottom: .25rem;
}
.menu a {
  padding: .25rem 0;
}

/* ---- menu ---- */
.menu a {
  color: #666;               /* same grey and size as "Design" beside the name */
  font-size: .88rem;         /* 20% smaller than the name (--size-logo) */
  line-height: 1.1;
}

/* ---- side navigation (the original accordion) ---- */
.layout {
  margin: 0;
  padding: 0;
  /* The accordion is column 1 of the same grid the project cards and the top menu use,
     so Portfolio / About / Contact always sit over the columns of images. */
  display: grid;
  grid-template-columns: var(--columns);
  grid-gap: var(--column-gap);
  align-items: start;
}
.layout .main {
  grid-column: 1 / -1;
  min-width: 0;
}
.has-side-nav .layout .main {
  grid-column: 2 / -1;       /* the images start in column 2, beside the accordion */
}
.side-nav {
  grid-column: 1;
  font-size: .86rem;
  line-height: 1.72;
}
.side-nav ul {
  margin: 0;
  padding: 0;
}
.side-nav .side-nav-list .side-nav-list {
  display: none;
}
.side-nav li.is-open > .side-nav-list {
  display: block;
}
.side-nav a {
  display: block;
  color: #464646;
}
.side-nav .level-3 a { color: #3f3f3f; }
.side-nav .level-4 a { color: #131313; }
.side-nav .level-5 a { color: #131313; }
.side-nav a.trigger.open { color: #ff0000; }
.side-nav a[aria-current="page"] { color: #ef4135; }
.side-nav li.last-child > a { color: #878788; font-style: italic; font-size: .75rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }   /* the end items, usually project titles */
.side-nav li.last-child > a[aria-current="page"],
.side-nav li.last-child > a:hover,
.side-nav a:hover { color: #f00; }

@media (max-width: 40rem) {
  .layout { display: block; }
  .has-side-nav .layout .main { grid-column: auto; }
  .side-nav { margin-bottom: 1rem; }
}

/* ---- project cards ---- */
.project-grid {
  display: grid;
  grid-gap: var(--column-gap);
  row-gap: 1.1rem;           /* space below each card: half the column gap */
  grid-template-columns: var(--columns);
  margin: 0 0 3rem;
  padding: 0;
}
.project-card a {
  display: block;
}
/* thumbnails keep the proportions and size of the originals */
.project-card .project-thumb {
  display: block;
  max-width: 100%;
  height: auto;
  margin-bottom: .15rem;
}
.project-card .img-caption {
  padding-top: .2rem;     /* gap under the thumbnail is half what it was (.6rem + .75rem) */
  color: var(--color-title);
  font-size: var(--size-card-title);
  font-weight: 700;
  line-height: 1.3;
}
.project-card .card-title {
  display: block;
  overflow: hidden;
  white-space: nowrap;       /* one line, cut off with an ellipsis */
  text-overflow: ellipsis;
}
/* description: first lines of the project text, cut off after two lines */
.project-card .card-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  margin-top: .1rem;
  color: var(--color-text-grey);
  font-size: .62rem;
  font-weight: 400;
  line-height: 1.45;
}
.project-card .img-caption .color-grey {
  display: block;
  margin-top: .35rem;
  color: var(--color-meta);
  font-size: .62rem;
  font-weight: 400;
}

/* ---- category pages ---- */
.category-text {
  margin-bottom: 3rem;
  max-width: 40rem;
}
.category-section {
  margin-top: 4rem;
}
.category-section > h2 {
  margin-bottom: 1.5rem;
}
.category-section > h2 a:hover {
  text-decoration: underline;
}

/* ---- previous / next project ---- */
.project-nav {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 3rem;
}
.project-nav a:hover {
  text-decoration: underline;
}

/* ---- home page: title and description appear when the thumbnail is hovered ---- */
.template-home .project-card .img-caption {
  opacity: 0;
  transition: opacity .2s ease;
}
.template-home .project-card:hover .img-caption,
.template-home .project-card:focus-within .img-caption {
  opacity: 1;
}
/* Touch screens have no hover, so keep the text visible there. */
@media (hover: none) {
  .template-home .project-card .img-caption {
    opacity: 1;
  }
}

/* ---- masonry: cards are placed by assets/js/masonry.js ---- */
.project-grid.is-masonry {
  display: block;
  position: relative;
}
.project-grid.is-masonry > .project-card {
  position: absolute;
  margin: 0;
}

/* ---- short summary of the practice: phones only, under the menu on the home page ---- */
.home-summary,
.home-recent {
  display: none;
}
@media (max-width: 44rem) {
  .home-summary {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
    margin: 0 0 4.5rem;
    color: #666;
    font-size: .9rem;
    line-height: 1.5;
  }
  .home-recent {
    display: block;
    margin: 0 0 1rem;
    color: var(--color-title);   /* same grey as the project titles */
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.3;
  }
}

/* ---- project titles are grey, not black, on the project page too ---- */
.template-project h1,
.template-project .h1 {
  color: var(--color-title);
}

/* ---- phones: the home page shows only the projects marked "Show on the phone home page" ---- */
@media (max-width: 44rem) {
  .template-home .project-card:not(.is-phone) {
    display: none;
  }
}

/* ---- project page ----
   Phones: the title heads the page, then the text and the images, as before.
   Desktop: the left column holds the image carousel, then the title, then the text;
   the gallery column is not used. */
.project-carousel,
.project-title {
  display: none;
}
@media (min-width: 44.01rem) {
  .project > .h1 {
    display: none;
  }
  .project .grid > .column:first-child {
    --columns: 12 !important;
    /* three image columns wide (3 x 10rem + 2 gaps of 2.2rem), left aligned */
    max-width: calc(3 * 10rem + 2 * 2.2rem);
  }
  .project .grid > .column:last-child {
    display: none;
  }
  .project-carousel {
    display: block;
    margin-bottom: 1rem;
  }
  .carousel-viewport {
    height: 420px;           /* fixed height; each image fits inside it */
    overflow: hidden;
  }
  .carousel-track {
    display: flex;
    margin: 0;
    padding: 0;
    transition: transform .4s ease;
  }
  .carousel-slide {
    flex: 0 0 100%;
    line-height: 0;
  }
  .carousel-slide {
    height: 420px;
  }
  .carousel-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;     /* the whole image shows, never cropped */
    object-position: left top;
  }
  .carousel-track {
    cursor: pointer;
  }
  .carousel-nav {
    display: flex;
    gap: 1.5rem;
    align-items: baseline;
    margin-top: .6rem;
    color: #666;
    font-size: .8rem;
    line-height: 1.4;
  }
  .carousel-nav button {
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
  }
  .carousel-nav button:hover {
    color: #f00;
  }
  .carousel-count {
    margin-left: auto;
  }
  /* the project description: justified, light grey, smaller */
  .project .text {
    color: var(--color-text-grey);
    font-size: .85rem;
    line-height: 1.55;
    text-align: justify;
    hyphens: auto;
  }
  .project .text p,
  .project .text p.color-grey {
    color: inherit;
  }
  .project-title {
    display: block;
    margin-bottom: .6rem;
    color: var(--color-title);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
  }
}

/* Desktop: the previous / next project links keep to the width of the carousel and text. */
@media (min-width: 44.01rem) {
  .project-nav {
    max-width: calc(3 * 10rem + 2 * 2.2rem);
  }
  /* same style as "Previous image / Next image" in the carousel */
  .project-nav {
    color: #666;
    font-size: .8rem;
    line-height: 1.4;
  }
  .project-nav a:hover {
    color: #f00;
    text-decoration: none;
  }
}

/* Phones: the first image sits under the title, so the gallery below skips it. */
.project-first {
  display: block;
  margin-bottom: 1.5rem;
  line-height: 0;
}
.project-first img {
  display: block;
  width: 100%;
  height: auto;
}
.album-gallery li.is-first {
  display: none;
}
@media (min-width: 44.01rem) {
  .project-first {
    display: none;
  }
  .album-gallery li.is-first {
    display: list-item;
  }
}

/* Desktop: the end items of the accordion (project titles) are a little smaller still. */
@media (min-width: 44.01rem) {
  .side-nav li.last-child > a {
    font-size: .68rem;
  }
}

/* ---- phone home page, version B: the desktop grid in five columns ----
   Chosen on the Home page in the Panel, or with ?mobile=b in the address. */
@media (max-width: 44rem) {
  .mobile-b {
    --columns: repeat(5, 1fr);
    --column-gap: .5rem;
  }
  .mobile-b .home-summary,
  .mobile-b .home-recent {
    display: none;
  }
  .template-home.mobile-b .project-card:not(.is-phone) {
    display: block;          /* all projects, not just the six */
  }
  .mobile-b .project-grid {
    row-gap: .5rem;
  }
  .mobile-b .project-card .img-caption {
    display: none;           /* too narrow for text; tap a thumbnail to open the project */
  }
  .mobile-b .project-card .project-thumb {
    margin-bottom: 0;
  }
}

/* the short label of a section (first word of its title) is only used on phones */
.side-nav .label-short {
  display: none;
}

/* ---- phone accordion ----
   No "Portfolio" line. The sections (Architecture, Art Projects, Theatre, Furniture Design)
   sit in one row; clicking one opens its accordion in full width beneath the row. */
@media (max-width: 44rem) {
  .side-nav .level-1 > li > a {
    display: none;
  }
  .side-nav .level-1 > li > .level-2 {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    column-gap: 1rem;
  }
  .side-nav .level-2 > li {
    display: contents;       /* the link and its list become items of the row */
  }
  .side-nav .level-2 > li > a {
    flex: 0 1 auto;
    padding: .35rem 0;
    font-size: .9rem;
    line-height: 1.2;
  }
  /* short labels so all four fit on one line: the first word of the title (Art, Furniture) */
  .side-nav .level-2 > li > a .label-full {
    display: none;
  }
  .side-nav .level-2 > li > a .label-short {
    display: inline;
  }
  .side-nav .level-2 > li > .side-nav-list {
    flex: 0 0 100%;          /* the opened section drops down under the row */
    order: 1;
    padding-top: .5rem;
  }
}

/* Phones, project pages: the menu sits at the bottom, just below the previous / next links. */
@media (max-width: 44rem) {
  .template-project .layout {
    display: flex;
    flex-direction: column;
  }
  .template-project .layout .main {
    order: 1;
  }
  .template-project .side-nav {
    order: 2;
    margin-top: 2rem;
  }
}

/* Desktop: the end items of the accordion (project titles) are cut to 15 characters. */
.side-nav .leaf-short,
.side-nav .leaf-mid {
  display: none;
}
@media (min-width: 44.01rem) {
  .side-nav .leaf-full {
    display: none;
  }
  .side-nav .leaf-short {
    display: inline;
  }
}

/* Phones, project pages: the project title is the same size as the name in the header. */
@media (max-width: 44rem) {
  .template-project .project > .h1,
  .template-project .project > .h1 h1 {
    font-size: var(--size-logo);
    font-weight: 700;
    line-height: 1.3;
  }
  .template-project .project > .h1 {
    margin-bottom: 1rem;     /* was 3rem: the image sits closer under the title */
  }
}

/* Previous / next project links: phones say "Previous project" / "Next project" with the arrows;
   desktop shows the project's title. */
.project-nav .nav-title {
  display: none;
}
.project-nav .nav-label {
  display: inline;
}
@media (min-width: 44.01rem) {
  .project-nav .nav-title {
    display: inline;
  }
  .project-nav .nav-label {
    display: none;
  }
}


/* Phones: long project names must never make the page wider than the screen. When they did,
   iOS Safari inflated the text of the whole menu (seen after opening Art > Curated Projects). */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (max-width: 44rem) {
  .layout, .side-nav, .side-nav ul, .side-nav li, .side-nav a {
    min-width: 0;
    max-width: 100%;
  }
  .side-nav { grid-column: 1 / -1; }
  .side-nav li.last-child > a {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}

/* Phones: end items use the 30-character version. */
@media (max-width: 44rem) {
  .side-nav .leaf-full { display: none; }
  .side-nav .leaf-mid { display: inline; }
}

/* Phones, category pages: the heading matches the project title (size and grey), not big and black. */
@media (max-width: 44rem) {
  .template-category .h1,
  .template-category .h1 h1 {
    font-size: var(--size-logo);
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-title);
  }
  .template-category .h1 {
    margin-bottom: 1rem;
  }
}
