/* ***********************************************************************
 *
 *  File:   index.css
 *
 *  Brief:  Styles for the landing page of my personal website.
 *
 *  Author: Jomar Hønsi, 2009-2026
 *
 * ************************************************************************/

:root {
  --hf-text: #f4f1e8;
  --hf-bgcolor: #30383d;
  --hf-container-bg: #e9e5d8;
  --hf-accent: #a8b88a;
  --hf-subtle-border: #c9c2ae;
  --hf-link: #315c52;
  --hf-link-hover: #203d37;
  --hf-image-border: #c9c2ae;
  --hf-nav: #e9e5d8;
  --hf-border: #c9c2ae;
  --hf-subtitle: #315c52;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
}

div#container {
  position: relative;
  display: flex;
  flex-flow: column;
  text-align: center;
  border-radius: 8px;
  max-width: 720px;
  padding: 10px;
  margin: 0 auto;
  border: 1px solid var(--hf-accent);
  background-color: var(--hf-container-bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.cell {
  text-align: left;
}

.page-header {
  display: grid;
  grid-template-columns: 48px 48px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  margin: -10px -10px 0;
  padding: 20px 12px;
  border: 1px solid var(--hf-subtle-border);
  border-radius: 8px 8px 0 0;
  color: var(--hf-text);
  background: linear-gradient(110deg, #00205b 0%, #12334d 52%, #7d1734 100%);
}

.header-home {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 48px;
  height: 48px;
}

.header-home img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  object-fit: contain;
}

.header-nav {
  position: relative;
  margin-left: 12px;
}

.header-title {
  min-width: 0;
  text-align: center;
}

.header-title h1 {
  margin: 0;
  color: var(--hf-text);
  font-size: clamp(1rem, 4vw, 2rem);
  letter-spacing: clamp(0px, 0.7vw, 3px);
  overflow-wrap: anywhere;
  text-shadow: 3px 3px 5px var(--hf-bgcolor);
}

.header-tools {
  justify-self: end;
}

.header-button {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: 1px solid rgba(201, 194, 174, 0.38);
  border-radius: 5px;
  color: var(--hf-text);
  background: transparent;
  cursor: pointer;
}

.header-button:hover,
#language-menu[open] > .header-button {
  background: rgba(244, 241, 232, 0.12);
}

.header-button:focus-visible,
.header-home:focus-visible {
  outline: 2px solid var(--hf-accent);
  outline-offset: 2px;
}

#menu-toggle {
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

#menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--hf-text);
  transition: transform 0.2s, opacity 0.2s;
}

.menu-open #menu-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-open #menu-toggle span:nth-child(2) {
  opacity: 0;
}

.menu-open #menu-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

#language-menu {
  position: relative;
}

#language-menu > summary {
  list-style: none;
}

#language-menu > summary::-webkit-details-marker {
  display: none;
}

.settings-dots {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.settings-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

div#content {
  display: grid;
  grid-template-columns: 1fr 40%;
  align-items: start;
  margin: 0 -10px -10px;
  background-color: #f4f1e8;
}

#photo {
  grid-column: 2;
  grid-row: 1;
}

#intro {
  grid-column: 1;
  grid-row: 1;
  padding: 20px 16px 20px 24px;
}

#intro p {
  margin: 0 0 16px;
  padding: 0;
}

#intro p:last-child {
  margin-bottom: 0;
}

.intro-links {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0 24px 20px;
}

.intro-links a,
.intro-links a:visited {
  padding: 8px 12px;
  border: 1px solid var(--hf-link);
  border-radius: 5px;
  color: var(--hf-link);
  font-size: 14px;
  font-weight: bold;
  text-align: center;
}

.intro-links a:hover,
.intro-links a:focus-visible {
  color: var(--hf-text);
  background: var(--hf-link);
  text-decoration: none;
}

.intro-links a:focus-visible {
  outline: 2px solid var(--hf-link);
  outline-offset: 2px;
}

#links {
  display: none;
  position: absolute;
  top: 82px;
  left: 10px;
  z-index: 10;
  max-width: calc(100% - 20px);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  box-sizing: border-box;
  width: max-content;
  margin: 0;
  padding: 0.3em 0;
  border: 0;
  border-radius: 5px;
  background: var(--hf-container-bg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  font-size: 1rem;
  line-height: 1.3;
}

.menu-open #links {
  display: block;
}

#language-menu .header-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: max-content;
  min-width: 150px;
  padding: 4px;
  border: 0;
  border-radius: 5px;
  background: var(--hf-container-bg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  font-size: 1rem;
  line-height: 1.3;
}

#language-menu .header-panel a {
  display: flex;
  align-items: center;
  padding: 0.55em 0.75em;
  color: var(--hf-link);
}

#language-menu .language-flag {
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 14px;
  margin-right: 8px;
}

#language-menu .header-panel a[aria-current="page"] {
  font-weight: bold;
}

#language-menu .header-panel a:hover,
#language-menu .header-panel a:focus-visible {
  background: var(--hf-nav);
  color: var(--hf-link-hover);
  text-decoration: none;
}

#photo {
  box-sizing: border-box;
  padding: 10px;
}

#photo figure {
  margin: 10px 0;
}

#photo img {
  box-sizing: border-box;
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--hf-image-border);
  border-radius: 10px;
}

/* Menu items styled */
#links h2 {
  margin: 0;
  padding: 0.3em 0.9em 0.1em;
  font-size: 0.8em;
  font-weight: bold;
  text-align: left;
  color: var(--hf-subtitle);
}

#links ul+h2 {
  margin-top: 0.3em;
  padding-top: 0.6em;
  border-top: 1px solid var(--hf-border);
}

a, a:visited {
  color: var(--hf-link);
  text-decoration: none;
}

a:hover, a:focus-visible {
  color: var(--hf-link-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

#links ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

#links a,
#links a:visited {
  display: block;
  padding: 0.45em 0.9em;
  color: var(--hf-link);
}

#links a:hover,
#links a:focus-visible {
  background: var(--hf-nav);
  color: var(--hf-link-hover);
  text-decoration: none;
}

p {
  padding: 10px;
  font-size: 18px;
  line-height: 1.6;
  text-align: justify;
}

/* Site map: same dark panel style as the header */
nav#sitemap {
  box-sizing: border-box;
  margin: 10px -10px -10px;
  padding: 16px 24px 8px;
  text-align: left;
  color: var(--hf-text);
  border: 1px solid var(--hf-subtle-border);
  border-radius: 0 0 8px 8px;
  background: var(--hf-bgcolor);
}

.sitemap-details>summary {
  display: block;
  margin: 0 0 12px;
  padding-bottom: 8px;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 6px;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 3px 3px 5px #000;
  border-bottom: 1px solid var(--hf-subtle-border);
  cursor: pointer;
  list-style: none;
}

.sitemap-details:not([open])>summary {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.sitemap-details>summary::-webkit-details-marker {
  display: none;
}

.sitemap-details>summary::after {
  content: " +";
  letter-spacing: 0;
}

.sitemap-details[open]>summary::after {
  content: " −";
}

.sitemap-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 24px;
}

nav#sitemap h3 {
  margin: 0 0 6px;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--hf-accent);
}

nav#sitemap h3.sitemap-contact {
  margin-top: 12px;
}

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

nav#sitemap ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

nav#sitemap li {
  margin: 0;
  padding: 3px 0;
  font-size: 14px;
  line-height: 1.4;
}

nav#sitemap a,
nav#sitemap a:visited {
  color: var(--hf-text);
}

nav#sitemap a:hover,
nav#sitemap a:focus-visible {
  color: var(--hf-text);
  text-decoration: underline;
}

.sitemap-info {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  gap: 4px 24px;
  margin-top: 16px;
  padding: 10px 0 0 0;
  font-size: 12px;
  letter-spacing: 0.5px;
  border-top: 1px solid rgba(201, 194, 174, 0.35);
  color: var(--hf-accent);
}

.sitemap-details:not([open])+.sitemap-info {
  margin-top: 6px;
  padding-top: 6px;
}

#links #contact {
  display: flex;
  align-items: center;
  gap: 0.9em;
  margin-top: 0.3em;
  padding: 0.6em 0.9em 0.3em;
  border-top: 1px solid var(--hf-border);
}

#links #contact h2 {
  padding: 0;
}

#contact img {
  display: block;
}

@media (max-width: 576px) {
  .page-header {
    grid-template-columns: 40px 40px minmax(0, 1fr) 40px;
    gap: 8px;
  }

  .header-home {
    width: 40px;
    height: 40px;
  }

  .header-nav {
    margin-left: 8px;
  }

  /* Photo floats right so the intro text wraps around and below it */
  div#content {
    display: flow-root;
  }

  #photo {
    float: right;
    width: 40%;
  }

  #photo figure {
    margin: 0;
  }

  #intro {
    padding: 14px 16px;
  }

  .intro-links {
    clear: both;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 16px 14px;
  }

  .sitemap-cols {
    grid-template-columns: 1fr;
  }

  nav#sitemap {
    padding: 14px 16px 8px;
  }

  #links {
    top: 72px;
    max-height: calc(100vh - 110px);
  }

  p {
    font-size: 14px;
    text-align: left;
  }
}