summaryrefslogtreecommitdiffstats
path: root/assets/css/components/_page.scss
blob: 435d6967bcba72a38201cdcf906f4fbfd90fedc6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
.c-page {
    &__prefixed {
        position: relative;
        margin-left: -1 * $page--item-prefix--width;
        padding-left: $page--item-prefix--width;

        &::before {
            display: inline-block;
            position: absolute;
            box-sizing: border-box;
            width: $page--item-prefix--width;
            margin-left: -1 * $page--item-prefix--width;
            padding-right: $page--item-prefix--pad;
            color: var(--page--item-prefix--fg);
            font-weight: normal;
            text-align: right;
        }

        $h1-unscale-factor: px-to-em($font-size, $content--h1--font-size);

        &--h1 {
            margin-top: $line-height * $h1-unscale-factor;
            font-size: px-to-em($content--h1--font-size);

            &::before {
                content: '#';
                font-size: $h1-unscale-factor;
            }
        }
        
        &--h1 + &--h1 {
            margin-top: $line-height * $h1-unscale-factor;
        }

        &--h2::before {
            content: '##';
        }

        &--h3::before {
            content: '###';
        }

        &--pre {
            $scale-factor: $font-size / $code-block--font-size;

            margin-left: calc(#{-1 * $page--item-prefix--width} * #{$scale-factor});
            padding-left: calc(#{$page--item-prefix--width} * #{$scale-factor});
            border-left: 0;
            color: var(--code-block--fg);
            font-size: $code-block--font-size;
            line-height: $code-block--line-height;
            text-overflow: '';
    
            &::before {
                content: str-repeat('``\A', 40);
                height: 100%;
                overflow: hidden;
                color: var(--page--item-prefix--fg);
                font-size: px-to-em($font-size, $code-block--font-size);
                line-height: $code-block--line-height / $scale-factor;
            }
        }

        &--ref::before {
            content: '|>';
        }

        &--backref::before {
            content: '<|';
        }
    }

    &__header {
        margin-bottom: $line-height * 1em;

        &__title {
            margin-top: 0;
        }

        &__backlink__link {
            &:link,
            &:visited {
                color: var(--fg-hi);

                &:hover {
                    color: var(--link--hover--fg);
                }
            }
        }

        &__backlink + &__title {
            margin-top: $line-height * 1em;
        }

        &__meta {
            margin-top: 0;
            color: var(--fg-hi);
            font-weight: normal;
        }
    }

    &__content {
        padding-left: $page--item-prefix--width;

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

    @media (max-width: map-get($breakpoints, 'sm')) {
        &__prefixed {
            margin-left: 0;
            padding-left: $page--item-prefix--width--sm;

            &::before {
                width: $page--item-prefix--width--sm;
                margin-left: -1 * $page--item-prefix--width--sm;
            }

            &--h1,
            &--h2,
            &--h3,
            &--pre {
                padding-left: 0;

                &::before {
                    display: none;
                }
            }
        }

        &__content {
            padding-left: 0;
        }
    }
}