/* Colors */
@import "./variables.css";

:root {
  /* Mapping legacy variables to new design tokens for backward compatibility */
  --brand-primary: var(--color-primary);
  --brand-primary-soft: var(--color-primary-soft);

  --white: var(--color-surface-50);
  --gray: var(--color-surface-400);
  --lightgray: var(--color-surface-200);

  --blue: var(--color-primary);
  --lightblue: var(--color-primary-soft);
  --red: var(--color-error);
  --darkgray: var(--color-surface-900);
}

/* Global stylesheet */
* {
  box-sizing: border-box;
}

/* Utility Classes */
.hidden {
  display: none !important;
  visibility: hidden !important;
}

.skip-link {
  position: absolute;
  top: -9999px;
  left: 0;
  background: var(--color-background);
  color: var(--color-primary);
  padding: 1rem;
  z-index: 9999;
  text-decoration: none;
  border: 1px solid var(--color-primary);
}

.skip-link:focus {
  top: 0;
}

html,
body {
  padding: 0;
  margin: 0;
  font-family: var(--font-base);
  color: var(--color-foreground);
  background-color: var(--color-background);
  line-height: 1.6;
  font-size: 18px;
}

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

h2,
h3,
h4,
h5 {
  margin: 1.5rem 0 0.75rem 0;
  padding: 0;
  color: var(--color-surface-900);
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

li {
  padding: 0.25rem 0;
  margin: 0 0 0 1.5rem;
}

p {
  margin: 0 0 1rem 0;
  padding: 0;
}

button {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.5rem;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  background-color: var(--color-surface-100);
  color: var(--color-foreground);
}

button:hover {
  background-color: var(--color-surface-200);
}

form {
  width: 80%;
}

input,
textarea {
  display: block;
  width: 100%;
  border: 0;
  padding: 10px 5px;
  background: var(--color-input) no-repeat;
  color: var(--color-foreground);

  /* Modern underline effect using gradients */
  background-image:
    linear-gradient(var(--color-primary), var(--color-primary-soft)),
    linear-gradient(to bottom, var(--color-border), var(--color-border));

  background-size:
    0 2px,
    100% 1px;

  background-position:
    50% 100%,
    50% 100%;

  transition: background-size 0.3s cubic-bezier(0.64, 0.09, 0.08, 1);
}

input:focus,
textarea:focus {
  background-size:
    100% 2px,
    100% 1px;
  outline: none;
}

input[type="number"],
input[type="text"] {
  width: 50%;
}

img {
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
  border-radius: var(--radius-sm);
}

.cover {
  display: block;
  width: min(100%, 980px);
  max-height: 420px;
  object-fit: cover;
  border-radius: 4px;
  margin: 1.5rem auto 0.75rem auto;
}

.feature-image {
  display: block;
  width: min(100%, 980px);
  max-height: 440px;
  object-fit: cover;
  border-radius: 4px;
  margin: 1.25rem auto;
}

p,
.tmpl-post li {
  line-height: 1.6;
}

.tmpl-post main p,
.tmpl-post main li {
  max-width: 65ch;
}

a[href] {
  color: var(--color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a[href]:visited {
  opacity: 0.9;
}

blockquote {
  font-size: 1.25em;
  width: 100%;
  margin: 2rem 0;
  font-style: italic;
  padding: 1rem 2rem;
  color: var(--color-surface-700);
  border-left: 4px solid var(--color-primary);
  background: var(--color-surface-50);
  border-radius: var(--radius-sm);
}

@media only screen and (min-width: 800px) {
  blockquote {
    margin: 3rem auto;
    padding: 2rem 3rem;
  }
}

blockquote::before {
  content: none;
}

blockquote::after {
  content: "";
}

blockquote span {
  display: block;
  color: #333333;
  font-style: normal;
  font-weight: bold;
  margin-top: 1em;
}

main {
  padding: 2rem 1rem;
  margin: 0 auto;
  max-width: 72ch;
}

main time {
  font-size: smaller;
  margin-left: 2rem;
}

main:first-child {
  margin-top: 0;
}

header {
  border-bottom: 1px dashed var(--lightgray);
}

header:after {
  content: "";
  display: table;
  clear: both;
}

table {
  margin: 1em 0;
}

table td,
table th {
  padding-right: 1em;
}

pre,
code {
  font-family:
    Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono",
    "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono",
    "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L",
    "Courier New", Courier, monospace;
  line-height: 1.5;
}

pre {
  font-size: 14px;
  line-height: 1.375;
  direction: ltr;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  -moz-tab-size: 2;
  -o-tab-size: 2;
  tab-size: 2;
  -webkit-hyphens: none;
  -moz-hyphens: none;
  -ms-hyphens: none;
  hyphens: none;
  padding: 1em;
  margin: 0.5em 0;
  background-color: var(--lightgray);
}

code {
  word-break: break-all;
}

.highlight-line {
  display: block;
  padding: 0.125em 1em;
  text-decoration: none;
  /* override del, ins, mark defaults */
  color: inherit;
  /* override del, ins, mark defaults */
}

/* allow highlighting empty lines */
.highlight-line:empty:before {
  content: " ";
}

/* avoid double line breaks when using display: block; */
.highlight-line + br {
  display: none;
}

.highlight-line-isdir {
  color: #b0b0b0;
  background-color: #222;
}

.highlight-line-active {
  background-color: #444;
  background-color: hsla(0, 0%, 27%, 0.8);
}

.highlight-line-add {
  background-color: #45844b;
}

.highlight-line-remove {
  background-color: #902f2f;
}

/* Header */
.home {
  padding: 0 1rem;
  float: left;
  margin: 1rem 0;
  /* 16px /16 */
  font-size: 1.5em;
  /* 16px /16 */
}

.home :link:not(:hover) {
  text-decoration: none;
}

/* Nav */
.nav {
  padding: 0;
  list-style: none;
  float: left;
  margin-left: 1em;
}

.nav-item {
  display: inline-block;
  margin-right: 1em;
}

.nav-item a[href]:not(:hover) {
  text-decoration: none;
}

.nav-item-active {
  font-weight: 700;
  text-decoration: underline;
}

/* Posts list */
.postlist {
  list-style: none;
  padding: 0;
}

.postlist-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  counter-increment: start-from -1;
  line-height: 1.8;
}

.postlist-item:before {
  display: inline-block;
  pointer-events: none;
  content: "" counter(start-from, decimal-leading-zero) ". ";
  line-height: 100%;
  text-align: right;
}

.postlist-date,
.postlist-item:before {
  font-size: 0.8125em;
  /* 13px /16 */
  color: var(--darkgray);
}

.postlist-date {
  word-spacing: -0.5px;
}

.postlist-link {
  padding-left: 0.25em;
  padding-right: 0.25em;
  text-underline-position: from-font;
  text-underline-offset: 0;
  text-decoration-thickness: 1px;
}

.postlist-item-active .postlist-link {
  font-weight: bold;
}

.tmpl-home .postlist-link {
  font-size: 1.1875em;
  /* 19px /16 */
  font-weight: 700;
}

/* Tags */
.post-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  font-size: 0.75em;
  /* 12px /16 */
  padding: 0.08333333333333em 0.3333333333333em;
  /* 1px 4px /12 */
  margin-left: 0.6666666666667em;
  /* 8px /12 */
  margin-top: 0.5em;
  /* 6px /12 */
  margin-bottom: 0.5em;
  /* 6px /12 */
  color: var(--darkgray);
  border: 1px solid var(--gray);
  border-radius: 0.25em;
  /* 3px /12 */
  text-decoration: none;
  line-height: 1.8;
}

a[href].post-tag,
a[href].post-tag:visited {
  color: inherit;
}

a[href].post-tag:hover,
a[href].post-tag:focus {
  background-color: var(--lightgray);
}

.postlist-item > .post-tag {
  align-self: center;
}

.tag-list {
  margin: 2rem;
  text-align: center;
}

/* Warning */
.warning {
  background-color: var(--red);
  padding: 1em 0.625em;
  /* 16px 10px /16 */
}

.warning ol:only-child {
  margin: 0;
}

/* Direct Links / Markdown Headers */
.direct-link {
  font-family: sans-serif;
  text-decoration: none;
  font-style: normal;
  margin-left: 0.1em;
}

a[href].direct-link,
a[href].direct-link:visited {
  color: transparent;
}

a[href].direct-link:focus,
a[href].direct-link:focus:visited,
:hover > a[href].direct-link,
:hover > a[href].direct-link:visited {
  color: var(--gray);
}

.site-footer {
  background-color: var(--color-surface-50);
  padding: 3rem 1rem 1.5rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-muted-foreground);
  border-top: 1px solid var(--color-border);
}

.footer-grid {
  max-width: 72ch;
  margin: 0 auto;
  display: grid;
  gap: 2rem;
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
  }
}

.footer-disclaimer {
  max-width: 50ch;
}

.disclaimer-text {
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  color: var(--color-surface-500);
}

.footer-nav {
  display: flex;
  gap: 2rem;
}

.footer-col h6 {
  margin: 0 0 0.5rem 0;
  padding: 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-surface-700);
}

.site-footer a {
  color: var(--color-surface-600);
}

.site-footer a:hover {
  color: var(--color-primary);
}

.footer-bottom {
  max-width: 72ch;
  margin: 2rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.copyright-text {
  margin: 0;
  padding: 0;
  font-size: 0.75rem;
  color: var(--color-surface-400);
}

.footer-links {
  padding-left: 0;
  margin: 0;
  list-style: none;
}

.footer-links li {
  display: block;
  margin: 0;
  padding: 0.2rem 0;
}

.hero {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.99), rgba(255, 255, 255, 0.25)),
    url("https://images.unsplash.com/photo-1491183672482-d0af0e44929d?crop=entropy&cs=tinysrgb&fm=jpg&ixlib=rb-1.2.1&q=60&raw_url=true&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTZ8fHRleHR1cmUlMjBiYWNrZ3JvdW5kfGVufDB8MHwwfHdoaXRlfA%3D%3D&auto=format&fit=crop&w=900");
  /* Set a specific height */
  height: 50%;

  /* Position and center the image to scale nicely on all screens */
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  position: relative;
  background-color: var(--white);
  color: var(--darkgray);
  padding: 2rem;
  width: 120%;
  margin-left: -2rem;
  box-shadow: none;
}

h1.home,
h1.home a {
  color: var(--darkgray) !important;
}

/* Hero CTA button */
.hero-cta .btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  background-color: var(--color-primary);
  color: var(--color-primary-content);
  border: none;
}

.hero-cta .btn:hover {
  background-color: var(--color-primary-soft);
}

.hero-cta {
  text-decoration: none;
}

.cover {
  max-width: 66%;
}

.description {
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  box-sizing: border-box;
  margin-bottom: 1rem;
  margin-left: auto;
  margin-right: auto;
  margin-top: 1rem;
  max-width: 36rem;
  text-align: center;
  font-size: 1.125rem;
  line-height: 1.625;
  color: var(--blue);
}
